diff --git a/include/print_utils.h b/include/print_utils.h index 7e4c6cf9b..97d6ce653 100644 --- a/include/print_utils.h +++ b/include/print_utils.h @@ -51,9 +51,13 @@ struct fmt::formatter> : fmt::formatter -struct fmt::formatter> : fmt::formatter> { +struct fmt::formatter> : fmt::formatter> { format_context::iterator format(const celerity::subrange& sr, format_context& ctx) const { - return fmt::formatter>::format(celerity::detail::box(sr), ctx); + auto out = ctx.out(); + out = formatter>::format(sr.offset, ctx); + out = std::copy_n(" + ", 3, out); + out = formatter>::format(celerity::id(sr.range), ctx); // cast to id to avoid multiple inheritance + return out; } }; diff --git a/test/print_graph_tests.cc b/test/print_graph_tests.cc index 995fc6536..899b7f310 100644 --- a/test/print_graph_tests.cc +++ b/test/print_graph_tests.cc @@ -42,11 +42,11 @@ TEST_CASE("task-graph printing is unchanged", "[print_graph][task-graph]") { // replace the `expected` value with the new dot graph. const auto expected = "digraph G {label=\"Task Graph\" 0[shape=ellipse label=epoch>];1[shape=box style=rounded label=device-compute [0,0,0] - [64,1,1]
discard_write B1 {[0,0,0] - [1,1,1]}>];0->1[color=orchid];2[shape=box style=rounded " - "label=device-compute [0,0,0] - [64,1,1]
discard_write B0 {[0,0,0] - " - "[64,1,1]}>];0->2[color=orchid];3[shape=box style=rounded label=device-compute [0,0,0] - [64,1,1]
(R1) " + "
device-compute [0,0,0] + [64,1,1]
discard_write B1 {[0,0,0] - [1,1,1]}>];0->1[color=orchid];2[shape=box style=rounded " + "label=device-compute [0,0,0] + [64,1,1]
discard_write B0 {[0,0,0] - " + "[64,1,1]}>];0->2[color=orchid];3[shape=box style=rounded label=device-compute [0,0,0] + [64,1,1]
(R1) " "read_write B1 {[0,0,0] - [1,1,1]}
read B0 {[0,0,0] - [64,1,1]}>];1->3[];2->3[];4[shape=box style=rounded label=device-compute [0,0,0] - [64,1,1]
read B1 {[0,0,0] - [1,1,1]}>];3->4[];}"; + "\"task_consume_5\"
device-compute [0,0,0] + [64,1,1]
read B1 {[0,0,0] - [1,1,1]}>];3->4[];}"; const auto dot = tm.print_graph(std::numeric_limits::max()).value(); CHECK(dot == expected); @@ -66,9 +66,9 @@ TEST_CASE("command graph printing is unchanged", "[print_graph][command-graph]") const auto expected = "digraph G{label=\"Command Graph\" subgraph cluster_id_0_0{label=<T0 (epoch)>;color=darkgray;id_0_0[label=epoch> fontcolor=black shape=box];}subgraph cluster_id_0_1{label=<T1 \"reduce_8\" " - "(device-compute)>;color=darkgray;id_0_1[label=execution [0,0,0] - [1,1,1]
(R1) discard_write B0 {[0,0,0] - " + "(device-compute)>;color=darkgray;id_0_1[label=execution [0,0,0] + [1,1,1]
(R1) discard_write B0 {[0,0,0] - " "[1,1,1]}> fontcolor=black shape=box];}subgraph cluster_id_0_2{label=<T2 \"consume_9\" " - "(device-compute)>;color=darkgray;id_0_2[label=execution [0,0,0] - [1,1,1]
read B0 {[0,0,0] - " + "(device-compute)>;color=darkgray;id_0_2[label=execution [0,0,0] + [1,1,1]
read B0 {[0,0,0] - " "[1,1,1]}
read_write B0 {[0,0,0] - [1,1,1]}
write B0 {[0,0,0] - [1,1,1]}> fontcolor=black shape=box];}id_0_7[label=(R1) push transfer 8589934595 to N3
BB0 [0,0,0] - [1,1,1]> fontcolor=black shape=ellipse];id_0_1->id_0_7[];id_0_6[label=(R1) push transfer 8589934594 to N2
BB0 [0,0,0] - [1,1,1]> fontcolor=black shape=ellipse];id_0_1->id_0_6[];id_0_5[label=T0 (epoch)>;color=darkgray;id_0_0[label=epoch> fontcolor=black shape=box];}subgraph cluster_id_0_1{label=<T1 \"print_graph_buffer_name_12\" " - "(device-compute)>;color=darkgray;id_0_1[label=execution [0,0,0] - [16,1,1]
write B0 \"my_buffer\" {[0,0,0] " + "(device-compute)>;color=darkgray;id_0_1[label=execution [0,0,0] + [16,1,1]
write B0 \"my_buffer\" {[0,0,0] " "- [16,1,1]}> fontcolor=black shape=box];}subgraph cluster_id_0_2{label=<T2 (epoch)>;color=darkgray;id_0_2[label=epoch (barrier)> fontcolor=black shape=box];}id_0_1->id_0_2[color=orange];id_0_0->id_0_1[];}";