From 5ec2a8d20c525066063e149614a37fc070320ea2 Mon Sep 17 00:00:00 2001 From: Kaushik Kulkarni Date: Wed, 26 May 2021 14:27:42 -0500 Subject: [PATCH] scheduling: account for callables_table within cache_key --- loopy/schedule/__init__.py | 4 +++- test/test_callables.py | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/loopy/schedule/__init__.py b/loopy/schedule/__init__.py index f5b298d5e..ba69501ba 100644 --- a/loopy/schedule/__init__.py +++ b/loopy/schedule/__init__.py @@ -2148,7 +2148,9 @@ def get_one_scheduled_kernel(kernel, callables_table): def get_one_linearized_kernel(kernel, callables_table): from loopy import CACHING_ENABLED - sched_cache_key = kernel + # must include *callables_table* within the cache key as the preschedule + # checks depend on it. + sched_cache_key = (kernel, callables_table) from_cache = False if CACHING_ENABLED: diff --git a/test/test_callables.py b/test/test_callables.py index 2118a0fd2..7e00e545d 100644 --- a/test/test_callables.py +++ b/test/test_callables.py @@ -802,26 +802,26 @@ def test_unused_hw_axes_in_callee(ctx_factory, inline): def test_double_hw_axes_used_in_knl_call(inline): from loopy.diagnostic import LoopyError - thrice = lp.make_function( + twice = lp.make_function( "{[i]: 0<=i<10}", """ y[i] = 2*x[i] - """, name="thrice") + """, name="twice") knl = lp.make_kernel( "{[i]: 0<=i<10}", """ - y[:, i] = thrice(x[:, i]) + y[:, i] = twice(x[:, i]) """, [lp.GlobalArg("x", shape=(10, 10), dtype=float), lp.GlobalArg("y", shape=(10, 10))], name="outer") - thrice = lp.tag_inames(thrice, {"i": "l.0"}) + twice = lp.tag_inames(twice, {"i": "l.0"}) knl = lp.tag_inames(knl, {"i": "l.0"}) - knl = lp.merge([knl, thrice]) + knl = lp.merge([knl, twice]) if inline: - knl = lp.inline_callable_kernel(knl, "thrice") + knl = lp.inline_callable_kernel(knl, "twice") with pytest.raises(LoopyError): lp.generate_code_v2(knl) -- GitLab