Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/common/common_vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@

namespace {

template <typename T>
using rel_log_ret_t = std::conditional_t<
sizeof(T) == 1, std::int8_t,
std::conditional_t<
sizeof(T) == 2, std::int16_t,
std::conditional_t<sizeof(T) == 4, std::int32_t,
std::conditional_t<sizeof(T) == 8, std::int64_t,
void /*Not expected*/>>>>;

/**
* @brief Helper function to check the size of a vector is correct.
*/
Expand Down
15 changes: 14 additions & 1 deletion tests/vector_operators/generate_vector_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,9 @@
""")

specific_return_type_test_template = Template("""
#if SYCL_CTS_COMPILING_WITH_SIMSYCL
FAIL_CHECK("SimSYCL has incorrect return types for logical/relational operators.");
#else
/** Tests each logical and relational operator available to vector types
*/
auto testVec1 = sycl::vec<${type}, ${size}>(static_cast<${type}>(${test_value_1}));
Expand Down Expand Up @@ -732,6 +735,7 @@
if (!check_vector_values(resVec, resArr)) {
resAcc[0] = false;
}
#endif
""")

non_fp_bitwise_test_template = Template("""
Expand Down Expand Up @@ -1355,7 +1359,7 @@ def generate_all_types_specific_return_type_test(type_str, size):
type=type_str,
size=str(size),
swizzle=get_swizzle(size),
ret_type=Data.opencl_sized_return_type_dict[type_str],
ret_type=f'rel_log_ret_t<{type_str}>',
test_value_1=1,
test_value_2=2)
return wrap_with_kernel(
Expand Down Expand Up @@ -1419,6 +1423,15 @@ def generate_operator_tests(type_str, input_file, output_file):
type_str, test_str, str(size))
func_calls += make_func_call(TEST_NAME + '_ALL_TYPES', type_str,
str(size))

test_str = generate_all_types_specific_return_type_test(
type_str, size)
test_func_str += wrap_with_test_func(
TEST_NAME + '_SPECIFIC_RETURN_TYPES', type_str, test_str,
str(size))
func_calls += make_func_call(TEST_NAME + '_SPECIFIC_RETURN_TYPES',
type_str, str(size))

if not type_str in [
'float', 'double', 'sycl::half'
]:
Expand Down