From aee564f107546e8db9d5b0186c26aca10f2d3b8a Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Thu, 6 Sep 2018 13:38:08 -0500 Subject: [PATCH] Fix and test generation of ISPC streaming stores --- loopy/target/ispc.py | 4 ++-- test/test_target.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/loopy/target/ispc.py b/loopy/target/ispc.py index 261475eb4..9009b1444 100644 --- a/loopy/target/ispc.py +++ b/loopy/target/ispc.py @@ -437,9 +437,9 @@ class ISPCASTBuilder(CASTBuilder): else: for dep in get_dependencies(term): if filter_iname_tags_by_type( - kernel.iname_to_tags[dep], LocalIndexTag): + kernel.iname_to_tags.get(dep, []), LocalIndexTag): tag, = filter_iname_tags_by_type( - kernel.iname_to_tags[dep], LocalIndexTag, 1) + kernel.iname_to_tags.get(dep, []), LocalIndexTag, 1) if tag.axis == 0: raise LoopyError( "streaming store must have stride 1 in " diff --git a/test/test_target.py b/test/test_target.py index eb94bdc81..a00114265 100644 --- a/test/test_target.py +++ b/test/test_target.py @@ -327,6 +327,35 @@ def test_target_invalid_type_cast(): lp.TypeCast(dtype, 1) +def test_ispc_streaming_stores(): + stream_dtype = np.float32 + index_dtype = np.int32 + + knl = lp.make_kernel( + "{[i]: 0<=i0") + knl = lp.split_iname( + knl, "i", 2**18, outer_tag="g.0", slabs=(0, 1)) + knl = lp.split_iname(knl, "i_inner", 8, inner_tag="l.0") + knl = lp.tag_instructions(knl, "!streaming_store") + + knl = lp.add_and_infer_dtypes(knl, { + var: stream_dtype + for var in vars + }) + + knl = lp.set_argument_order(knl, vars + ["n"]) + + knl = lp.preprocess_kernel(knl) + knl = lp.get_one_scheduled_kernel(knl) + lp.generate_code_v2(knl).all_code() + + if __name__ == "__main__": if len(sys.argv) > 1: exec(sys.argv[1]) -- GitLab