From 5d64d8244ff100180134e4e04313fa0c1cb86212 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 21 Oct 2018 01:25:42 -0500 Subject: [PATCH 1/2] Fix, test kernel dep arrow printing for continuing downward (i.e. bad) dependencies --- loopy/kernel/tools.py | 4 ++-- test/test_loopy.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/loopy/kernel/tools.py b/loopy/kernel/tools.py index 95c3c336c..b8be6191d 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 accf9c1df..f19c76026 100644 --- a/test/test_loopy.py +++ b/test/test_loopy.py @@ -2908,6 +2908,23 @@ 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]) -- GitLab From 29e133e54b051bfadc2173eb5a4b75a76fc9c153 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 21 Oct 2018 02:05:09 -0500 Subject: [PATCH 2/2] Py2 fix --- test/test_loopy.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_loopy.py b/test/test_loopy.py index f19c76026..38d1cd6b0 100644 --- a/test/test_loopy.py +++ b/test/test_loopy.py @@ -2918,8 +2918,10 @@ def test_backwards_dep_printing_and_error(): b[i] = b[i] + c[i] {id=insn4, dep=insn3} d[i] = 7*a[i ] {id=insn5, dep=insn4} a[i] = a[i] + d[i] {id=insn6, dep=insn5} - """, [lp.GlobalArg('a, b', dtype=np.float64), - ...], lang_version=(2018, 2)) + """, [ + lp.GlobalArg('a, b', dtype=np.float64), + "..." + ]) # Used to crash with KeyError print(knl) -- GitLab