diff --git a/loopy/transform/callable.py b/loopy/transform/callable.py index 7bc39064a..2caec9d46 100644 --- a/loopy/transform/callable.py +++ b/loopy/transform/callable.py @@ -149,7 +149,7 @@ def map_subscript(self, expr, expn_state): flatten_index += idx*caller_arg.dim_tags[i].stride flatten_index += sum( - idx * tag.stride + idx * self.rec(tag.stride, expn_state) for idx, tag in zip(self.rec(expr.index_tuple, expn_state), callee_arg.dim_tags)) diff --git a/test/test_callables.py b/test/test_callables.py index eb4b1c318..f3b701b67 100644 --- a/test/test_callables.py +++ b/test/test_callables.py @@ -1404,6 +1404,32 @@ def test_inline_deps(ctx_factory): assert np.array_equal(a_dev.get(), np.arange(4)) +def test_inline_stride(): + # https://github.com/inducer/loopy/issues/728 + child_knl = lp.make_function( + [], + """ + g[0] = 2*e[0] + 3*f[0] {id=a} + g[1] = 2*e[1] + 3*f[1] {dep=a} + """, name="linear_combo") + parent_knl = lp.make_kernel( + ["{[j]:0<=j 1: exec(sys.argv[1])