diff --git a/loopy/kernel/tools.py b/loopy/kernel/tools.py index 95c3c336c4aeb78efb3a8dccfbdbc554103fdef1..b8be6191d933899dbac2f37eb5b85267defa7690 100644 --- a/loopy/kernel/tools.py +++ b/loopy/kernel/tools.py @@ -1241,7 +1241,7 @@ def draw_dependencies_as_unicode_arrows( for dep in insn.depends_on: reverse_deps.setdefault(dep, set()).add(insn.id) - # mapping of (from_id, to_id) tuples to column_index + # mapping of to_id tuples to column_index dep_to_column = {} # {{{ find column assignments @@ -1318,7 +1318,7 @@ def draw_dependencies_as_unicode_arrows( elif insn.id in starts: starts.remove(insn.id) - if starts: + if starts or pointed_at_insn_id not in processed_ids: # will continue downward row[col] = do_flag_downward(u"├", pointed_at_insn_id) diff --git a/test/test_loopy.py b/test/test_loopy.py index accf9c1dff5a1f660871dd63d6af3337aced6490..38d1cd6b0e5f2e9ccd64c6ddb41b161040e515e4 100644 --- a/test/test_loopy.py +++ b/test/test_loopy.py @@ -2908,6 +2908,25 @@ def test_dep_cycle_printing_and_error(): print(lp.generate_code(knl)[0]) +def test_backwards_dep_printing_and_error(): + knl = lp.make_kernel( + "{[i]: 0<=i 1: exec(sys.argv[1])