diff --git a/loopy/target/ispc.py b/loopy/target/ispc.py index 0464270a348b019e93092fb5d1d30a8ceaf5788d..771f2cdf638bcd4b54a088adeabb01ca636e064d 100644 --- a/loopy/target/ispc.py +++ b/loopy/target/ispc.py @@ -444,9 +444,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 7c0d003ee9e3730c6c754963c2e3d5e033298c51..75b3c05aeeb0fd1b9cfb5b0c10ad25976ea2464c 100644 --- a/test/test_target.py +++ b/test/test_target.py @@ -329,6 +329,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])