v2: mark temporary storage as volatile vstore_half requires workaround using short as local/private type Tests pass on beignet(IVB), and intel CPU
Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu> --- generated_tests/gen_cl_vstore_tests.py | 81 ++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/generated_tests/gen_cl_vstore_tests.py b/generated_tests/gen_cl_vstore_tests.py index d84541f29..1b8409450 100644 --- a/generated_tests/gen_cl_vstore_tests.py +++ b/generated_tests/gen_cl_vstore_tests.py @@ -116,14 +116,95 @@ def gen_test_global(suffix, t, mem_type, vec_sizes): f.close() +def gen_test_local_private(suffix, t, mem_type, vec_sizes, addr_space): + f = begin_test(suffix, t, mem_type, vec_sizes, addr_space) + for s in vec_sizes: + size = int(s) if s != '' else 1 + type_name = t + s + f.write(textwrap.dedent(""" + kernel void vstore{suffix}{n}_{addr_space}(global {mem_type} *out, + global {type_name} *in) {{ + {type_name} tmp = in[0]; + volatile {addr_space} {mem_type} loc[{size}]; + vstore{suffix}{n}(({type_name})0, 0, ({addr_space} {mem_type}*)loc); + vstore{suffix}{n}(tmp, 0, ({addr_space} {mem_type}*)loc + 1); + for (int i = 0; i < {size}; ++i) + out[i] = loc[i]; + }} + + kernel void vstore{suffix}{n}_{addr_space}_offset(global {mem_type} *out, + global {type_name} *in) {{ + {type_name} tmp = ({type_name})0; + volatile {addr_space} {mem_type} loc[{offset_size}]; + vstore{suffix}{n}(tmp, 0, ({addr_space} {mem_type}*)loc); + vstore{suffix}{n}(tmp, 0, ({addr_space} {mem_type}*)loc + 1); + tmp = in[0]; + vstore{suffix}{n}(tmp, 1, ({addr_space} {mem_type}*)loc + 1); + for (int i = 0; i < {offset_size}; ++i) + out[i] = loc[i]; + }} + """.format(type_name=type_name, mem_type=mem_type, n=s, suffix=suffix, + offset_size=size*2 + 1, size=size + 1, addr_space=addr_space))) + + f.close() + +# vstore_half is special, becuase CLC won't allow us to use half type without +# cl_khr_fp16 +def gen_test_local_private_half(suffix, t, vec_sizes, addr_space): + f = begin_test(suffix, t, 'half', vec_sizes, addr_space) + for s in vec_sizes: + size = int(s) if s != '' else 1 + type_name = t + s + f.write(textwrap.dedent(""" + kernel void vstore{suffix}{n}_{addr_space}(global half *out, + global {type_name} *in) {{ + {type_name} tmp = in[0]; + volatile {addr_space} short loc[{size}]; + vstore{suffix}{n}(({type_name})0, 0, ({addr_space} half*)loc); + vstore{suffix}{n}(tmp, 0, ({addr_space} half*)loc + 1); + for (int i = 0; i < {size}; ++i) + ((global short *)out)[i] = loc[i]; + }} + + kernel void vstore{suffix}{n}_{addr_space}_offset(global half *out, + global {type_name} *in) {{ + {type_name} tmp = ({type_name})0; + volatile {addr_space} short loc[{offset_size}]; + vstore{suffix}{n}(tmp, 0, ({addr_space} half*)loc); + vstore{suffix}{n}(tmp, 0, ({addr_space} half*)loc + 1); + tmp = in[0]; + vstore{suffix}{n}(tmp, 1, ({addr_space} half*)loc + 1); + for (int i = 0; i < {offset_size}; ++i) + ((global short *)out)[i] = loc[i]; + }} + """.format(type_name=type_name, n=s, suffix=suffix, + offset_size=size*2 + 1, size=size + 1, addr_space=addr_space))) + +def gen_test_local(suffix, t, mem_type, vec_sizes): + if (mem_type == 'half'): + gen_test_local_private_half(suffix, t, vec_sizes, 'local') + else: + gen_test_local_private(suffix, t, mem_type, vec_sizes, 'local') + +def gen_test_private(suffix, t, mem_type, vec_sizes): + if (mem_type == 'half'): + gen_test_local_private_half(suffix, t, vec_sizes, 'private') + else: + gen_test_local_private(suffix, t, mem_type, vec_sizes, 'private') def main(): utils.safe_makedirs(dirName) for t in TYPES: gen_test_global('', t, t, VEC_SIZES); + gen_test_local('', t, t, VEC_SIZES); + gen_test_private('', t, t, VEC_SIZES); gen_test_global('_half', 'float', 'half', [''] + VEC_SIZES); gen_test_global('_half', 'double', 'half', [''] + VEC_SIZES); + gen_test_local('_half', 'float', 'half', [''] + VEC_SIZES); + gen_test_local('_half', 'double', 'half', [''] + VEC_SIZES); + gen_test_private('_half', 'float', 'half', [''] + VEC_SIZES); + gen_test_private('_half', 'double', 'half', [''] + VEC_SIZES); if __name__ == '__main__': main() -- 2.13.5 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit