From ab143ddf586d3cc578c792ef68992e003236ce37 Mon Sep 17 00:00:00 2001 From: "Larsen, Steffen" Date: Fri, 5 Jan 2024 03:16:25 -0800 Subject: [PATCH 01/12] Split double * atomic_ref testing This commit splits the testing of atomic_ref with double * into separate tests to allow for fp64 support checks. This is related to https://github.com/KhronosGroup/SYCL-Docs/issues/526. Signed-off-by: Larsen, Steffen --- .../atomic_ref_T_op_test_pointers_fp64.cpp | 55 ++++++++++++++++++ ...dd_sub_op_all_types_test_pointers_fp64.cpp | 56 ++++++++++++++++++ ...tomic_ref_assign_op_test_pointers_fp64.cpp | 55 ++++++++++++++++++ tests/atomic_ref/atomic_ref_common.h | 17 ++++-- ...ef_compare_exchange_test_pointers_fp64.cpp | 58 +++++++++++++++++++ .../atomic_ref_constructors_pointers_fp64.cpp | 55 ++++++++++++++++++ ...atomic_ref_exchange_test_pointers_fp64.cpp | 55 ++++++++++++++++++ ...h_add_sub_all_types_test_pointers_fp64.cpp | 57 ++++++++++++++++++ ...ic_ref_incr_decr_op_test_pointers_fp64.cpp | 58 +++++++++++++++++++ ...ic_ref_is_lock_free_test_pointers_fp64.cpp | 55 ++++++++++++++++++ .../atomic_ref_store_test_pointers_fp64.cpp | 55 ++++++++++++++++++ 11 files changed, 571 insertions(+), 5 deletions(-) create mode 100644 tests/atomic_ref/atomic_ref_T_op_test_pointers_fp64.cpp create mode 100644 tests/atomic_ref/atomic_ref_add_sub_op_all_types_test_pointers_fp64.cpp create mode 100644 tests/atomic_ref/atomic_ref_assign_op_test_pointers_fp64.cpp create mode 100644 tests/atomic_ref/atomic_ref_compare_exchange_test_pointers_fp64.cpp create mode 100644 tests/atomic_ref/atomic_ref_constructors_pointers_fp64.cpp create mode 100644 tests/atomic_ref/atomic_ref_exchange_test_pointers_fp64.cpp create mode 100644 tests/atomic_ref/atomic_ref_fetch_add_sub_all_types_test_pointers_fp64.cpp create mode 100644 tests/atomic_ref/atomic_ref_incr_decr_op_test_pointers_fp64.cpp create mode 100644 tests/atomic_ref/atomic_ref_is_lock_free_test_pointers_fp64.cpp create mode 100644 tests/atomic_ref/atomic_ref_store_test_pointers_fp64.cpp diff --git a/tests/atomic_ref/atomic_ref_T_op_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_T_op_test_pointers_fp64.cpp new file mode 100644 index 000000000..4d2d303f7 --- /dev/null +++ b/tests/atomic_ref/atomic_ref_T_op_test_pointers_fp64.cpp @@ -0,0 +1,55 @@ +/******************************************************************************* +// +// SYCL 2020 Conformance Test Suite +// +// Copyright (c) 2023 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Provides sycl::atomic_ref::operator T() test for double * +// +*******************************************************************************/ +#include "../common/disabled_for_test_case.h" +#include "catch2/catch_test_macros.hpp" + +#if !SYCL_CTS_COMPILING_WITH_HIPSYCL + +#include "atomic_ref_T_op_test.h" + +#endif // !SYCL_CTS_COMPILING_WITH_HIPSYCL + +namespace atomic_ref::tests::api::core { + +// FIXME: re-enable for hipsycl +// when sycl::info::device::atomic_memory_order_capabilities and +// sycl::info::device::atomic_memory_scope_capabilities are implemented in +// hipsycl +DISABLED_FOR_TEST_CASE(hipSYCL) +("sycl::atomic_ref::operator T() test. double *", "[atomic_ref]")({ + auto queue = sycl_cts::util::get_cts_object::queue(); + if (!queue.get_device().has(sycl::aspect::fp64)) { + SKIP( + "Device does not support double precision floating point " + "operations."); + } + const auto type_pack = + atomic_ref::tests::common::get_fp64_pointers_type_pack(); + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + SKIP( + "Device does not support atomic64 operations. " + "Skipping the test case."); + } + for_all_types(type_pack); +}); + +} // namespace atomic_ref::tests::api::core diff --git a/tests/atomic_ref/atomic_ref_add_sub_op_all_types_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_add_sub_op_all_types_test_pointers_fp64.cpp new file mode 100644 index 000000000..1c16720e3 --- /dev/null +++ b/tests/atomic_ref/atomic_ref_add_sub_op_all_types_test_pointers_fp64.cpp @@ -0,0 +1,56 @@ +/******************************************************************************* +// +// SYCL 2020 Conformance Test Suite +// +// Copyright (c) 2023 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Provides sycl::atomic_ref operator+=()/operator-=() tests for double * +// +*******************************************************************************/ +#include "../common/disabled_for_test_case.h" +#include "catch2/catch_test_macros.hpp" + +#if !SYCL_CTS_COMPILING_WITH_HIPSYCL + +#include "atomic_ref_add_sub_op_all_types_test.h" + +#endif // !SYCL_CTS_COMPILING_WITH_HIPSYCL + +namespace atomic_ref::tests::api::core { + +// FIXME: re-enable for hipsycl +// when sycl::info::device::atomic_memory_order_capabilities and +// sycl::info::device::atomic_memory_scope_capabilities are implemented in +// hipsycl +DISABLED_FOR_TEST_CASE(hipSYCL) +("sycl::atomic_ref operator+=()/operator-=() test. double *", "[atomic_ref]")({ + auto queue = sycl_cts::util::get_cts_object::queue(); + if (!queue.get_device().has(sycl::aspect::fp64)) { + SKIP( + "Device does not support double precision floating point " + "operations."); + } + const auto type_pack = + atomic_ref::tests::common::get_fp64_pointers_type_pack(); + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + SKIP( + "Device does not support atomic64 operations. " + "Skipping the test case."); + } + for_all_types( + type_pack); +}); + +} // namespace atomic_ref::tests::api::core diff --git a/tests/atomic_ref/atomic_ref_assign_op_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_assign_op_test_pointers_fp64.cpp new file mode 100644 index 000000000..7a80a106b --- /dev/null +++ b/tests/atomic_ref/atomic_ref_assign_op_test_pointers_fp64.cpp @@ -0,0 +1,55 @@ +/******************************************************************************* +// +// SYCL 2020 Conformance Test Suite +// +// Copyright (c) 2023 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Provides sycl::atomic_ref::operator=() tests for double * +// +*******************************************************************************/ +#include "../common/disabled_for_test_case.h" +#include "catch2/catch_test_macros.hpp" + +#if !SYCL_CTS_COMPILING_WITH_HIPSYCL + +#include "atomic_ref_assign_op_test.h" + +#endif // !SYCL_CTS_COMPILING_WITH_HIPSYCL + +namespace atomic_ref::tests::api::core { + +// FIXME: re-enable for hipsycl +// when sycl::info::device::atomic_memory_order_capabilities and +// sycl::info::device::atomic_memory_scope_capabilities are implemented in +// hipsycl +DISABLED_FOR_TEST_CASE(hipSYCL) +("sycl::atomic_ref::operator=() test. double *", "[atomic_ref]")({ + auto queue = sycl_cts::util::get_cts_object::queue(); + if (!queue.get_device().has(sycl::aspect::fp64)) { + SKIP( + "Device does not support double precision floating point " + "operations."); + } + const auto type_pack = + atomic_ref::tests::common::get_fp64_pointers_type_pack(); + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + SKIP( + "Device does not support atomic64 operations. " + "Skipping the test case."); + } + for_all_types(type_pack); +}); + +} // namespace atomic_ref::tests::api::core diff --git a/tests/atomic_ref/atomic_ref_common.h b/tests/atomic_ref/atomic_ref_common.h index 0d2162f84..fd296e88e 100644 --- a/tests/atomic_ref/atomic_ref_common.h +++ b/tests/atomic_ref/atomic_ref_common.h @@ -166,11 +166,10 @@ inline auto get_conformance_type_pack() { inline auto get_full_conformance_pointers_type_pack() { static const auto types = named_type_pack::generate("int *", "unsigned int *", - "long int *", "unsigned long int *", - "long long *", "unsigned long long *", - "float *", "double *"); + long long*, unsigned long long*, + float*>::generate("int *", "unsigned int *", "long int *", + "unsigned long int *", "long long *", + "unsigned long long *", "float *"); return types; } @@ -183,6 +182,14 @@ inline auto get_lightweight_pointers_type_pack() { return types; } +/** + * @brief Factory function for getting type_pack with generic pointers types + */ +inline auto get_fp64_pointers_type_pack() { + static const auto types = named_type_pack::generate("double *"); + return types; +} + /** * @brief Factory function for getting type_pack with pointers types that * depends on full conformance mode enabling status diff --git a/tests/atomic_ref/atomic_ref_compare_exchange_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_compare_exchange_test_pointers_fp64.cpp new file mode 100644 index 000000000..7fd1cbbcd --- /dev/null +++ b/tests/atomic_ref/atomic_ref_compare_exchange_test_pointers_fp64.cpp @@ -0,0 +1,58 @@ +/******************************************************************************* +// +// SYCL 2020 Conformance Test Suite +// +// Copyright (c) 2023 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Provides sycl::atomic_ref compare_exchange_strong()/compare_exchange_weak() +// tests for double * +// +*******************************************************************************/ +#include "../common/disabled_for_test_case.h" +#include "catch2/catch_test_macros.hpp" + +#if !SYCL_CTS_COMPILING_WITH_HIPSYCL + +#include "atomic_ref_compare_exchange_test.h" + +#endif // !SYCL_CTS_COMPILING_WITH_HIPSYCL + +namespace atomic_ref::tests::api::core { + +// FIXME: re-enable for hipsycl +// when sycl::info::device::atomic_memory_order_capabilities and +// sycl::info::device::atomic_memory_scope_capabilities are implemented in +// hipsycl +DISABLED_FOR_TEST_CASE(hipSYCL) +("sycl::atomic_ref compare_exchange_strong()/compare_exchange_weak() test. " + "double *", + "[atomic_ref]")({ + auto queue = sycl_cts::util::get_cts_object::queue(); + if (!queue.get_device().has(sycl::aspect::fp64)) { + SKIP( + "Device does not support double precision floating point " + "operations."); + } + const auto type_pack = + atomic_ref::tests::common::get_fp64_pointers_type_pack(); + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + SKIP( + "Device does not support atomic64 operations. " + "Skipping the test case."); + } + for_all_types(type_pack); +}); + +} // namespace atomic_ref::tests::api::core diff --git a/tests/atomic_ref/atomic_ref_constructors_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_constructors_pointers_fp64.cpp new file mode 100644 index 000000000..e848ab35a --- /dev/null +++ b/tests/atomic_ref/atomic_ref_constructors_pointers_fp64.cpp @@ -0,0 +1,55 @@ +/******************************************************************************* +// +// SYCL 2020 Conformance Test Suite +// +// Copyright (c) 2023 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Provides sycl::atomic_ref constructors test for double *. +// +*******************************************************************************/ +#include "../common/disabled_for_test_case.h" +#include "catch2/catch_test_macros.hpp" + +#if !SYCL_CTS_COMPILING_WITH_HIPSYCL + +#include "atomic_ref_constructors.h" + +#endif // !SYCL_CTS_COMPILING_WITH_HIPSYCL + +namespace atomic_ref::tests::constructors::core { + +// FIXME: re-enable for hipsycl +// when sycl::info::device::atomic_memory_order_capabilities and +// sycl::info::device::atomic_memory_scope_capabilities are implemented in +// hipsycl +DISABLED_FOR_TEST_CASE(hipSYCL) +("sycl::atomic_ref constructors. double *", "[atomic_ref]")({ + auto queue = sycl_cts::util::get_cts_object::queue(); + if (!queue.get_device().has(sycl::aspect::fp64)) { + SKIP( + "Device does not support double precision floating point " + "operations."); + } + const auto types = + atomic_ref::tests::common::get_fp64_pointers_type_pack(); + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + SKIP( + "Device does not support atomic64 operations. " + "Skipping the test case."); + } + for_all_types(types); +}); + +} // namespace atomic_ref::tests::constructors::core diff --git a/tests/atomic_ref/atomic_ref_exchange_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_exchange_test_pointers_fp64.cpp new file mode 100644 index 000000000..0580fb3b0 --- /dev/null +++ b/tests/atomic_ref/atomic_ref_exchange_test_pointers_fp64.cpp @@ -0,0 +1,55 @@ +/******************************************************************************* +// +// SYCL 2020 Conformance Test Suite +// +// Copyright (c) 2023 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Provides sycl::atomic_ref::exchange() tests for double * +// +*******************************************************************************/ +#include "../common/disabled_for_test_case.h" +#include "catch2/catch_test_macros.hpp" + +#if !SYCL_CTS_COMPILING_WITH_HIPSYCL + +#include "atomic_ref_exchange_test.h" + +#endif // !SYCL_CTS_COMPILING_WITH_HIPSYCL + +namespace atomic_ref::tests::api::core { + +// FIXME: re-enable for hipsycl +// when sycl::info::device::atomic_memory_order_capabilities and +// sycl::info::device::atomic_memory_scope_capabilities are implemented in +// hipsycl +DISABLED_FOR_TEST_CASE(hipSYCL) +("sycl::atomic_ref::exchange() test. double *", "[atomic_ref]")({ + auto queue = sycl_cts::util::get_cts_object::queue(); + if (!queue.get_device().has(sycl::aspect::fp64)) { + SKIP( + "Device does not support double precision floating point " + "operations."); + } + const auto type_pack = + atomic_ref::tests::common::get_fp64_pointers_type_pack(); + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + SKIP( + "Device does not support atomic64 operations. " + "Skipping the test case."); + } + for_all_types(type_pack); +}); + +} // namespace atomic_ref::tests::api::core diff --git a/tests/atomic_ref/atomic_ref_fetch_add_sub_all_types_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_fetch_add_sub_all_types_test_pointers_fp64.cpp new file mode 100644 index 000000000..1f6f0466a --- /dev/null +++ b/tests/atomic_ref/atomic_ref_fetch_add_sub_all_types_test_pointers_fp64.cpp @@ -0,0 +1,57 @@ +/******************************************************************************* +// +// SYCL 2020 Conformance Test Suite +// +// Copyright (c) 2023 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Provides sycl::atomic_ref fetch_add()/fetch_sub() tests for double * +// +*******************************************************************************/ +#include "../common/disabled_for_test_case.h" +#include "catch2/catch_test_macros.hpp" + +#if !SYCL_CTS_COMPILING_WITH_HIPSYCL + +#include "atomic_ref_fetch_add_sub_all_types_test.h" + +#endif // !SYCL_CTS_COMPILING_WITH_HIPSYCL + +namespace atomic_ref::tests::api::core { + +// FIXME: re-enable for hipsycl +// when sycl::info::device::atomic_memory_order_capabilities and +// sycl::info::device::atomic_memory_scope_capabilities are implemented in +// hipsycl +DISABLED_FOR_TEST_CASE(hipSYCL) +("sycl::atomic_ref fetch_add()/fetch_sub() test. double *", + "[atomic_ref]")({ + auto queue = sycl_cts::util::get_cts_object::queue(); + if (!queue.get_device().has(sycl::aspect::fp64)) { + SKIP( + "Device does not support double precision floating point " + "operations."); + } + const auto type_pack = + atomic_ref::tests::common::get_fp64_pointers_type_pack(); + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + SKIP( + "Device does not support atomic64 operations. " + "Skipping the test case."); + } + for_all_types( + type_pack); +}); + +} // namespace atomic_ref::tests::api::core diff --git a/tests/atomic_ref/atomic_ref_incr_decr_op_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_incr_decr_op_test_pointers_fp64.cpp new file mode 100644 index 000000000..478ac18fc --- /dev/null +++ b/tests/atomic_ref/atomic_ref_incr_decr_op_test_pointers_fp64.cpp @@ -0,0 +1,58 @@ +/******************************************************************************* +// +// SYCL 2020 Conformance Test Suite +// +// Copyright (c) 2023 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Provides sycl::atomic_ref +// operator++(int)/operator++()/operator--(int)/operator--() tests +// for double * +// +*******************************************************************************/ +#include "../common/disabled_for_test_case.h" +#include "catch2/catch_test_macros.hpp" + +#if !SYCL_CTS_COMPILING_WITH_HIPSYCL + +#include "atomic_ref_incr_decr_op_test.h" + +#endif // !SYCL_CTS_COMPILING_WITH_HIPSYCL + +namespace atomic_ref::tests::api::core { + +// FIXME: re-enable for hipsycl +// when sycl::info::device::atomic_memory_order_capabilities and +// sycl::info::device::atomic_memory_scope_capabilities are implemented in +// hipsycl +DISABLED_FOR_TEST_CASE(hipSYCL) +("sycl::atomic_ref increment/decrement operators test. double *", + "[atomic_ref]")({ + auto queue = sycl_cts::util::get_cts_object::queue(); + if (!queue.get_device().has(sycl::aspect::fp64)) { + SKIP( + "Device does not support double precision floating point " + "operations."); + } + const auto type_pack = + atomic_ref::tests::common::get_fp64_pointers_type_pack(); + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + SKIP( + "Device does not support atomic64 operations. " + "Skipping the test case."); + } + for_all_types(type_pack); +}); + +} // namespace atomic_ref::tests::api::core diff --git a/tests/atomic_ref/atomic_ref_is_lock_free_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_is_lock_free_test_pointers_fp64.cpp new file mode 100644 index 000000000..95a26477a --- /dev/null +++ b/tests/atomic_ref/atomic_ref_is_lock_free_test_pointers_fp64.cpp @@ -0,0 +1,55 @@ +/******************************************************************************* +// +// SYCL 2020 Conformance Test Suite +// +// Copyright (c) 2023 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Provides sycl::atomic_ref::is_lock_free() test for double * +// +*******************************************************************************/ +#include "../common/disabled_for_test_case.h" +#include "catch2/catch_test_macros.hpp" + +#if !SYCL_CTS_COMPILING_WITH_HIPSYCL + +#include "atomic_ref_is_lock_free_test.h" + +#endif // !SYCL_CTS_COMPILING_WITH_HIPSYCL + +namespace atomic_ref::tests::api::core { + +// FIXME: re-enable for hipsycl +// when sycl::info::device::atomic_memory_order_capabilities and +// sycl::info::device::atomic_memory_scope_capabilities are implemented in +// hipsycl +DISABLED_FOR_TEST_CASE(hipSYCL) +("sycl::atomic_ref::is_lock_free() test. double *", "[atomic_ref]")({ + auto queue = sycl_cts::util::get_cts_object::queue(); + if (!queue.get_device().has(sycl::aspect::fp64)) { + SKIP( + "Device does not support double precision floating point " + "operations."); + } + const auto type_pack = + atomic_ref::tests::common::get_fp64_pointers_type_pack(); + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + SKIP( + "Device does not support atomic64 operations. " + "Skipping the test case."); + } + for_all_types(type_pack); +}); + +} // namespace atomic_ref::tests::api::core diff --git a/tests/atomic_ref/atomic_ref_store_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_store_test_pointers_fp64.cpp new file mode 100644 index 000000000..7ec46b93e --- /dev/null +++ b/tests/atomic_ref/atomic_ref_store_test_pointers_fp64.cpp @@ -0,0 +1,55 @@ +/******************************************************************************* +// +// SYCL 2020 Conformance Test Suite +// +// Copyright (c) 2023 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Provides sycl::atomic_ref::store() test for double * +// +*******************************************************************************/ +#include "../common/disabled_for_test_case.h" +#include "catch2/catch_test_macros.hpp" + +#if !SYCL_CTS_COMPILING_WITH_HIPSYCL + +#include "atomic_ref_store_test.h" + +#endif // !SYCL_CTS_COMPILING_WITH_HIPSYCL + +namespace atomic_ref::tests::api::core { + +// FIXME: re-enable for hipsycl +// when sycl::info::device::atomic_memory_order_capabilities and +// sycl::info::device::atomic_memory_scope_capabilities are implemented in +// hipsycl +DISABLED_FOR_TEST_CASE(hipSYCL) +("sycl::atomic_ref::store() test. double *", "[atomic_ref]")({ + auto queue = sycl_cts::util::get_cts_object::queue(); + if (!queue.get_device().has(sycl::aspect::fp64)) { + SKIP( + "Device does not support double precision floating point " + "operations."); + } + const auto type_pack = + atomic_ref::tests::common::get_fp64_pointers_type_pack(); + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + SKIP( + "Device does not support atomic64 operations. " + "Skipping the test case."); + } + for_all_types(type_pack); +}); + +} // namespace atomic_ref::tests::api::core From 570e1f34de87ddbd5ae1d5467344e05a16a50865 Mon Sep 17 00:00:00 2001 From: "Larsen, Steffen" Date: Fri, 5 Jan 2024 07:36:33 -0800 Subject: [PATCH 02/12] Fix formatting Signed-off-by: Larsen, Steffen --- tests/atomic_ref/atomic_ref_T_op_test_pointers_fp64.cpp | 2 +- tests/atomic_ref/atomic_ref_assign_op_test_pointers_fp64.cpp | 2 +- .../atomic_ref_compare_exchange_test_pointers_fp64.cpp | 2 +- tests/atomic_ref/atomic_ref_constructors_pointers_fp64.cpp | 5 ++--- tests/atomic_ref/atomic_ref_exchange_test_pointers_fp64.cpp | 2 +- ...atomic_ref_fetch_add_sub_all_types_test_pointers_fp64.cpp | 5 ++--- .../atomic_ref_incr_decr_op_test_pointers_fp64.cpp | 2 +- .../atomic_ref_is_lock_free_test_pointers_fp64.cpp | 2 +- tests/atomic_ref/atomic_ref_store_test_pointers_fp64.cpp | 2 +- 9 files changed, 11 insertions(+), 13 deletions(-) diff --git a/tests/atomic_ref/atomic_ref_T_op_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_T_op_test_pointers_fp64.cpp index 4d2d303f7..f3b6deef2 100644 --- a/tests/atomic_ref/atomic_ref_T_op_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_T_op_test_pointers_fp64.cpp @@ -44,7 +44,7 @@ DISABLED_FOR_TEST_CASE(hipSYCL) } const auto type_pack = atomic_ref::tests::common::get_fp64_pointers_type_pack(); - if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { SKIP( "Device does not support atomic64 operations. " "Skipping the test case."); diff --git a/tests/atomic_ref/atomic_ref_assign_op_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_assign_op_test_pointers_fp64.cpp index 7a80a106b..bf3c462fc 100644 --- a/tests/atomic_ref/atomic_ref_assign_op_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_assign_op_test_pointers_fp64.cpp @@ -44,7 +44,7 @@ DISABLED_FOR_TEST_CASE(hipSYCL) } const auto type_pack = atomic_ref::tests::common::get_fp64_pointers_type_pack(); - if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { SKIP( "Device does not support atomic64 operations. " "Skipping the test case."); diff --git a/tests/atomic_ref/atomic_ref_compare_exchange_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_compare_exchange_test_pointers_fp64.cpp index 7fd1cbbcd..8d549c9fc 100644 --- a/tests/atomic_ref/atomic_ref_compare_exchange_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_compare_exchange_test_pointers_fp64.cpp @@ -47,7 +47,7 @@ DISABLED_FOR_TEST_CASE(hipSYCL) } const auto type_pack = atomic_ref::tests::common::get_fp64_pointers_type_pack(); - if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { SKIP( "Device does not support atomic64 operations. " "Skipping the test case."); diff --git a/tests/atomic_ref/atomic_ref_constructors_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_constructors_pointers_fp64.cpp index e848ab35a..29035ae21 100644 --- a/tests/atomic_ref/atomic_ref_constructors_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_constructors_pointers_fp64.cpp @@ -42,9 +42,8 @@ DISABLED_FOR_TEST_CASE(hipSYCL) "Device does not support double precision floating point " "operations."); } - const auto types = - atomic_ref::tests::common::get_fp64_pointers_type_pack(); - if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + const auto types = atomic_ref::tests::common::get_fp64_pointers_type_pack(); + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { SKIP( "Device does not support atomic64 operations. " "Skipping the test case."); diff --git a/tests/atomic_ref/atomic_ref_exchange_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_exchange_test_pointers_fp64.cpp index 0580fb3b0..dfb5d9262 100644 --- a/tests/atomic_ref/atomic_ref_exchange_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_exchange_test_pointers_fp64.cpp @@ -44,7 +44,7 @@ DISABLED_FOR_TEST_CASE(hipSYCL) } const auto type_pack = atomic_ref::tests::common::get_fp64_pointers_type_pack(); - if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { SKIP( "Device does not support atomic64 operations. " "Skipping the test case."); diff --git a/tests/atomic_ref/atomic_ref_fetch_add_sub_all_types_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_fetch_add_sub_all_types_test_pointers_fp64.cpp index 1f6f0466a..bd4437db0 100644 --- a/tests/atomic_ref/atomic_ref_fetch_add_sub_all_types_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_fetch_add_sub_all_types_test_pointers_fp64.cpp @@ -35,8 +35,7 @@ namespace atomic_ref::tests::api::core { // sycl::info::device::atomic_memory_scope_capabilities are implemented in // hipsycl DISABLED_FOR_TEST_CASE(hipSYCL) -("sycl::atomic_ref fetch_add()/fetch_sub() test. double *", - "[atomic_ref]")({ +("sycl::atomic_ref fetch_add()/fetch_sub() test. double *", "[atomic_ref]")({ auto queue = sycl_cts::util::get_cts_object::queue(); if (!queue.get_device().has(sycl::aspect::fp64)) { SKIP( @@ -45,7 +44,7 @@ DISABLED_FOR_TEST_CASE(hipSYCL) } const auto type_pack = atomic_ref::tests::common::get_fp64_pointers_type_pack(); - if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { SKIP( "Device does not support atomic64 operations. " "Skipping the test case."); diff --git a/tests/atomic_ref/atomic_ref_incr_decr_op_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_incr_decr_op_test_pointers_fp64.cpp index 478ac18fc..85481c60c 100644 --- a/tests/atomic_ref/atomic_ref_incr_decr_op_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_incr_decr_op_test_pointers_fp64.cpp @@ -47,7 +47,7 @@ DISABLED_FOR_TEST_CASE(hipSYCL) } const auto type_pack = atomic_ref::tests::common::get_fp64_pointers_type_pack(); - if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { SKIP( "Device does not support atomic64 operations. " "Skipping the test case."); diff --git a/tests/atomic_ref/atomic_ref_is_lock_free_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_is_lock_free_test_pointers_fp64.cpp index 95a26477a..57f3b4029 100644 --- a/tests/atomic_ref/atomic_ref_is_lock_free_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_is_lock_free_test_pointers_fp64.cpp @@ -44,7 +44,7 @@ DISABLED_FOR_TEST_CASE(hipSYCL) } const auto type_pack = atomic_ref::tests::common::get_fp64_pointers_type_pack(); - if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { SKIP( "Device does not support atomic64 operations. " "Skipping the test case."); diff --git a/tests/atomic_ref/atomic_ref_store_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_store_test_pointers_fp64.cpp index 7ec46b93e..524d0fe70 100644 --- a/tests/atomic_ref/atomic_ref_store_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_store_test_pointers_fp64.cpp @@ -44,7 +44,7 @@ DISABLED_FOR_TEST_CASE(hipSYCL) } const auto type_pack = atomic_ref::tests::common::get_fp64_pointers_type_pack(); - if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { + if (is_64_bits_pointer() && device_has_not_aspect_atomic64()) { SKIP( "Device does not support atomic64 operations. " "Skipping the test case."); From 7bb70225c83a5338857e28a5e9a0d9780e45a36d Mon Sep 17 00:00:00 2001 From: JackAKirk Date: Thu, 11 Jan 2024 09:32:35 -0800 Subject: [PATCH 03/12] Fixed bug where sizeof(int) was used even if T!=int. Signed-off-by: JackAKirk --- tests/queue/queue_shortcuts_usm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/queue/queue_shortcuts_usm.h b/tests/queue/queue_shortcuts_usm.h index 67351aaaf..2861e5bd6 100644 --- a/tests/queue/queue_shortcuts_usm.h +++ b/tests/queue/queue_shortcuts_usm.h @@ -258,11 +258,11 @@ void test_unified_shared_memory(sycl::queue q, unsigned int element_count) { T* ptr = sycl::malloc_device(element_count, q); constexpr int advice = 0; sycl::event advise_no_events = - q.mem_advise(ptr, element_count * sizeof(int), advice); + q.mem_advise(ptr, element_count * sizeof(T), advice); sycl::event advise_single_event = q.mem_advise( - ptr, element_count * sizeof(int), advice, advise_no_events); + ptr, element_count * sizeof(T), advice, advise_no_events); sycl::event advise_multiple_events = - q.mem_advise(ptr, element_count * sizeof(int), advice, + q.mem_advise(ptr, element_count * sizeof(T), advice, {advise_no_events, advise_single_event}); advise_multiple_events.wait(); advise_no_events.wait(); From 31a5db95fbfdf9d8dca5651546bf7916a1b0c1c9 Mon Sep 17 00:00:00 2001 From: JackAKirk Date: Thu, 11 Jan 2024 09:54:38 -0800 Subject: [PATCH 04/12] Fix format. Signed-off-by: JackAKirk --- tests/queue/queue_shortcuts_usm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/queue/queue_shortcuts_usm.h b/tests/queue/queue_shortcuts_usm.h index 2861e5bd6..1291f569d 100644 --- a/tests/queue/queue_shortcuts_usm.h +++ b/tests/queue/queue_shortcuts_usm.h @@ -259,8 +259,8 @@ void test_unified_shared_memory(sycl::queue q, unsigned int element_count) { constexpr int advice = 0; sycl::event advise_no_events = q.mem_advise(ptr, element_count * sizeof(T), advice); - sycl::event advise_single_event = q.mem_advise( - ptr, element_count * sizeof(T), advice, advise_no_events); + sycl::event advise_single_event = + q.mem_advise(ptr, element_count * sizeof(T), advice, advise_no_events); sycl::event advise_multiple_events = q.mem_advise(ptr, element_count * sizeof(T), advice, {advise_no_events, advise_single_event}); From 82e4812d437572e85527c5589cfda040acd632cb Mon Sep 17 00:00:00 2001 From: Andrei Elovikov Date: Tue, 16 Jan 2024 14:25:55 -0800 Subject: [PATCH 05/12] Switch nan-tests to verify fixed-width arg types for marray The spec has been updated in https://github.com/KhronosGroup/SYCL-Docs/pull/519/, this PR aligns CTS with it. --- tests/math_builtin_api/modules/sycl_functions.py | 12 ++++++------ tests/math_builtin_api/modules/sycl_types.py | 9 +++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/math_builtin_api/modules/sycl_functions.py b/tests/math_builtin_api/modules/sycl_functions.py index cc6661aa5..181a57582 100644 --- a/tests/math_builtin_api/modules/sycl_functions.py +++ b/tests/math_builtin_api/modules/sycl_functions.py @@ -950,31 +950,31 @@ def create_float_signatures(): sig_list.append(f_modf_3) - f_nan_1 = funsig("sycl", "float", "nan", ["unsigned"]) + f_nan_1 = funsig("sycl", "float", "nan", ["uint32_t"]) sig_list.append(f_nan_1) f_nan_2 = funsig("sycl", "vgenfloatf", "nan", ["ugenint"], "0", "", [], [["vgenfloatf", "ugenint", "base_type"]], template_arg_map=[0]) sig_list.append(f_nan_2) - f_nan_3 = funsig("sycl", "mgenfloatf", "nan", ["ugenint"], "0", "", [], [["mgenfloatf", "ugenint", "base_type"]], template_arg_map=[0]) + f_nan_3 = funsig("sycl", "mgenfloatf", "nan", ["muint32n"], "0", "", [], [["mgenfloatf", "muint32n", "base_type"]], template_arg_map=[0]) sig_list.append(f_nan_3) - f_nan_4 = funsig("sycl", "double", "nan", ["unsigned long"], "0") + f_nan_4 = funsig("sycl", "double", "nan", ["uint64_t"], "0") sig_list.append(f_nan_4) f_nan_5 = funsig("sycl", "vgenfloatd", "nan", ["ugenlonginteger"], "0", "", [], [["vgenfloatd", "ugenlonginteger", "base_type"]], template_arg_map=[0]) sig_list.append(f_nan_5) - f_nan_6 = funsig("sycl", "mgenfloatd", "nan", ["ugenlonginteger"], "0", "", [], [["mgenfloatd", "ugenlonginteger", "base_type"]], template_arg_map=[0]) + f_nan_6 = funsig("sycl", "mgenfloatd", "nan", ["muint64n"], "0", "", [], [["mgenfloatd", "muint64n", "base_type"]], template_arg_map=[0]) sig_list.append(f_nan_6) - f_nan_7 = funsig("sycl", "sycl::half", "nan", ["unsigned short"], "0") + f_nan_7 = funsig("sycl", "sycl::half", "nan", ["uint16_t"], "0") sig_list.append(f_nan_7) f_nan_8 = funsig("sycl", "vgenfloath", "nan", ["ugenshort"], "0", "", [], [["vgenfloath", "ugenshort", "base_type"]], template_arg_map=[0]) sig_list.append(f_nan_8) - f_nan_9 = funsig("sycl", "mgenfloath", "nan", ["ugenshort"], "0", "", [], [["mgenfloath", "ugenshort", "base_type"]], template_arg_map=[0]) + f_nan_9 = funsig("sycl", "mgenfloath", "nan", ["muint16n"], "0", "", [], [["mgenfloath", "muint16n", "base_type"]], template_arg_map=[0]) sig_list.append(f_nan_9) diff --git a/tests/math_builtin_api/modules/sycl_types.py b/tests/math_builtin_api/modules/sycl_types.py index 61adce53b..e192561f0 100644 --- a/tests/math_builtin_api/modules/sycl_types.py +++ b/tests/math_builtin_api/modules/sycl_types.py @@ -1250,6 +1250,9 @@ def create_types(): t_mushort_n = argtype("mushortn", "NULL", "NULL", 0, ["sycl::marray","sycl::marray","sycl::marray","sycl::marray","sycl::marray"]) type_dic["mushortn"] = t_mushort_n + t_muint16_n = argtype("muint16n", "NULL", "NULL", 0, ["sycl::marray","sycl::marray","sycl::marray","sycl::marray","sycl::marray"]) + type_dic["muint16n"] = t_muint16_n + t_ushort_n = argtype("ushortn", "NULL", "NULL", 0, ["vuint16n","mushortn"]) type_dic["ushortn"] = t_ushort_n @@ -1278,6 +1281,9 @@ def create_types(): t_muint_n = argtype("muintn", "NULL", "NULL", 0, ["sycl::marray","sycl::marray","sycl::marray","sycl::marray","sycl::marray"]) type_dic["muintn"] = t_muint_n + t_muint32_n = argtype("muint32n", "NULL", "NULL", 0, ["sycl::marray","sycl::marray","sycl::marray","sycl::marray","sycl::marray"]) + type_dic["muint32n"] = t_muint32_n + t_uint_n = argtype("uintn", "NULL", "NULL", 0, ["vuint32n","muintn"]) type_dic["uintn"] = t_uint_n @@ -1306,6 +1312,9 @@ def create_types(): t_mulong_n = argtype("mulongn", "NULL", "NULL", 0, ["sycl::marray","sycl::marray","sycl::marray","sycl::marray","sycl::marray"]) type_dic["mulongn"] = t_mulong_n + t_muint64_n = argtype("muint64n", "NULL", "NULL", 0, ["sycl::marray","sycl::marray","sycl::marray","sycl::marray","sycl::marray"]) + type_dic["muint64n"] = t_muint64_n + t_ulong_n = argtype("ulongn", "NULL", "NULL", 0, ["vuint64n","mulongn"]) type_dic["ulongn"] = t_ulong_n From 152821a0ce1ab3848b271b4bcfd1ac19d1f07aa1 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Wed, 17 Jan 2024 05:52:36 -0800 Subject: [PATCH 06/12] Fix `-Wc++11-narrowing` warnings Newer versions of `clang` make it error by default, which affect clang-based implementations (like DPCPP). --- tests/common/type_list.h | 56 +++++++++++++------ tests/spec_constants/spec_constants_common.h | 4 +- .../spec_constants_defined_various_ways.h | 4 +- ...ec_constants_defined_various_ways_helper.h | 18 +++--- ...pec_constants_exceptions_throwing_common.h | 4 +- .../spec_constants/spec_constants_external.h | 10 ++-- .../spec_constants/spec_constants_multiple.h | 14 ++--- ...spec_constants_same_command_group_common.h | 14 ++--- .../spec_constants_same_name_inter_link.h | 8 +-- ...ec_constants_same_name_inter_link_helper.h | 2 +- .../spec_constants_same_name_stress_helper.h | 20 +++---- .../spec_constants_separate_unit.cpp | 2 +- .../spec_constants_via_handler_common.h | 30 +++++----- .../spec_constants_via_kernel_bundle.h | 8 +-- 14 files changed, 110 insertions(+), 84 deletions(-) diff --git a/tests/common/type_list.h b/tests/common/type_list.h index 64ad0f270..c6476c117 100644 --- a/tests/common/type_list.h +++ b/tests/common/type_list.h @@ -164,31 +164,55 @@ struct arrow_operator_overloaded { // Returns instance of type T template -inline constexpr auto get_init_value_helper(int x) { - return x; -} +struct init_value_helper { + static constexpr auto get(int x) { + return static_cast(x); + } +}; + +// Returns instance of type T +template +struct init_value_helper> { + static constexpr auto get(int x) { + return sycl::vec{static_cast(x)}; + } +}; + +// Returns instance of type T +template +struct init_value_helper> { + static constexpr auto get(int x) { + return sycl::marray{static_cast(x)}; + } +}; // Returns instance of type bool template <> -inline constexpr auto get_init_value_helper(int x) { - return (x % 2 != 0); -} +struct init_value_helper { + static constexpr bool get(int x) { + return x % 2 != 0; + } +}; // Returns instance of user defined struct with no constructor template <> -inline constexpr auto get_init_value_helper(int x) { - no_cnstr instance{}; - instance = x; - return instance; -} +struct init_value_helper { + static constexpr auto get(int x) { + no_cnstr instance{}; + instance = x; + return instance; + } +}; // Returns instance of user defined struct default constructor template <> -inline constexpr auto get_init_value_helper(int x) { - def_cnstr instance; - instance = x; - return instance; -} +struct init_value_helper { + static constexpr auto get(int x) { + def_cnstr instance; + instance = x; + return instance; + } +}; } // namespace user_def_types diff --git a/tests/spec_constants/spec_constants_common.h b/tests/spec_constants/spec_constants_common.h index ab4d8a1d3..68d7fd723 100644 --- a/tests/spec_constants/spec_constants_common.h +++ b/tests/spec_constants/spec_constants_common.h @@ -48,11 +48,11 @@ constexpr int default_val = 20; template constexpr sycl::specialization_id spec_const( - user_def_types::get_init_value_helper(default_val)); + user_def_types::init_value_helper::get(default_val)); template void fill_init_values(T &result, int val) { - result = user_def_types::get_init_value_helper(val); + result = user_def_types::init_value_helper::get(val); } template diff --git a/tests/spec_constants/spec_constants_defined_various_ways.h b/tests/spec_constants/spec_constants_defined_various_ways.h index 0f52b6f43..c45ac2d52 100644 --- a/tests/spec_constants/spec_constants_defined_various_ways.h +++ b/tests/spec_constants/spec_constants_defined_various_ways.h @@ -35,8 +35,8 @@ void perform_test(util::logger &log, const std::string &type_name, } } sycl::range<1> range(1); - T result { user_def_types::get_init_value_helper(0) }; - T ref { user_def_types::get_init_value_helper(0) }; + T result { user_def_types::init_value_helper::get(0) }; + T ref { user_def_types::init_value_helper::get(0) }; { fill_init_values(ref, case_num); sycl::buffer result_buffer(&result, range); diff --git a/tests/spec_constants/spec_constants_defined_various_ways_helper.h b/tests/spec_constants/spec_constants_defined_various_ways_helper.h index 7482205ce..036881309 100644 --- a/tests/spec_constants/spec_constants_defined_various_ways_helper.h +++ b/tests/spec_constants/spec_constants_defined_various_ways_helper.h @@ -56,14 +56,14 @@ static std::string get_hint(sc_vw_id test_id) { // Defined in a non-global named namespace template constexpr sycl::specialization_id sc_nonglob( - user_def_types::get_init_value_helper(case_num)); + user_def_types::init_value_helper::get(case_num)); // A static member variable of a struct in a non-global namespace struct struct_nonglob { constexpr struct_nonglob() {} template static constexpr sycl::specialization_id sc{ - user_def_types::get_init_value_helper(case_num)}; + user_def_types::init_value_helper::get(case_num)}; }; } // namespace spec_const_help @@ -71,33 +71,33 @@ namespace { // Defined in an unnamed namespace template constexpr sycl::specialization_id sc_unnamed( - user_def_types::get_init_value_helper(case_num)); + user_def_types::init_value_helper::get(case_num)); // A static member variable of a struct in an unnamed namespace struct struct_unnamed { constexpr struct_unnamed() {} template static constexpr sycl::specialization_id sc{ - user_def_types::get_init_value_helper(case_num)}; + user_def_types::init_value_helper::get(case_num)}; }; } // unnamed namespace // Defined in the global namespace as inline constexpr template inline constexpr sycl::specialization_id sc_glob_inl( - user_def_types::get_init_value_helper(case_num)); + user_def_types::init_value_helper::get(case_num)); // Defined in the global namespace as static constexpr template static constexpr sycl::specialization_id sc_glob_static( - user_def_types::get_init_value_helper(case_num)); + user_def_types::init_value_helper::get(case_num)); // A static member variable of a struct in the global namespace struct struct_glob { constexpr struct_glob() {} template static constexpr sycl::specialization_id sc{ - user_def_types::get_init_value_helper(case_num)}; + user_def_types::init_value_helper::get(case_num)}; }; // A static member variable declared inline constexpr of a struct in the global @@ -106,7 +106,7 @@ struct struct_glob_inl { constexpr struct_glob_inl() {} template static inline constexpr sycl::specialization_id sc{ - user_def_types::get_init_value_helper(case_num)}; + user_def_types::init_value_helper::get(case_num)}; }; // A static member variable of a templated struct in the global namespace @@ -115,7 +115,7 @@ struct struct_glob_tmpl { constexpr struct_glob_tmpl() {} template static constexpr sycl::specialization_id sc{ - user_def_types::get_init_value_helper(case_num)}; + user_def_types::init_value_helper::get(case_num)}; }; #endif // __SYCLCTS_TESTS_SPEC_CONST_DEFINED_VARIOUS_WAYS_HELPER_H diff --git a/tests/spec_constants/spec_constants_exceptions_throwing_common.h b/tests/spec_constants/spec_constants_exceptions_throwing_common.h index 63f13cbfa..2d0eb9601 100644 --- a/tests/spec_constants/spec_constants_exceptions_throwing_common.h +++ b/tests/spec_constants/spec_constants_exceptions_throwing_common.h @@ -51,7 +51,7 @@ class check_spec_constant_exception_throw_for_type { // kernel_bundle { bool exception_was_thrown = false; - T res{user_def_types::get_init_value_helper(0)}; + T res{user_def_types::init_value_helper::get(0)}; const int case_num = 1; auto queue = sycl_cts::util::get_cts_object::queue(); @@ -85,7 +85,7 @@ class check_spec_constant_exception_throw_for_type { // kernel_bundle { bool exception_was_thrown = false; - T sc_val{user_def_types::get_init_value_helper(0)}; + T sc_val{user_def_types::init_value_helper::get(0)}; const int case_num = 2; auto queue = sycl_cts::util::get_cts_object::queue(); diff --git a/tests/spec_constants/spec_constants_external.h b/tests/spec_constants/spec_constants_external.h index 472af54e7..b297de2ce 100644 --- a/tests/spec_constants/spec_constants_external.h +++ b/tests/spec_constants/spec_constants_external.h @@ -17,7 +17,7 @@ using namespace get_spec_const; template inline constexpr sycl::specialization_id spec_const_external( - user_def_types::get_init_value_helper(default_val)); + user_def_types::init_value_helper::get(default_val)); #define FUNC_DECLARE(TYPE) \ SYCL_EXTERNAL bool check_kernel_handler_by_reference_external_handler( \ @@ -74,7 +74,7 @@ class check_specialization_constants_external { // handler bool passed = false; { - T ref { user_def_types::get_init_value_helper(5) }; + T ref { user_def_types::init_value_helper::get(5) }; const int case_num = static_cast(test_cases_external::by_reference_via_handler); sycl::buffer result_buffer(&passed, range); @@ -99,7 +99,7 @@ class check_specialization_constants_external { // handler passed = false; { - T ref { user_def_types::get_init_value_helper(10) }; + T ref { user_def_types::init_value_helper::get(10) }; const int case_num = static_cast(test_cases_external::by_value_via_handler); sycl::buffer result_buffer(&passed, range); @@ -128,7 +128,7 @@ class check_specialization_constants_external { // via kernel_bundle passed = false; { - T ref { user_def_types::get_init_value_helper(15) }; + T ref { user_def_types::init_value_helper::get(15) }; const int case_num = static_cast(test_cases_external::by_reference_via_bundle); sycl::buffer result_buffer(&passed, range); @@ -170,7 +170,7 @@ class check_specialization_constants_external { // kernel_bundle passed = false; { - T ref { user_def_types::get_init_value_helper(20) }; + T ref { user_def_types::init_value_helper::get(20) }; const int case_num = static_cast(test_cases_external::by_value_via_bundle); sycl::buffer result_buffer(&passed, range); diff --git a/tests/spec_constants/spec_constants_multiple.h b/tests/spec_constants/spec_constants_multiple.h index 71b8d8168..48c206fbe 100644 --- a/tests/spec_constants/spec_constants_multiple.h +++ b/tests/spec_constants/spec_constants_multiple.h @@ -16,7 +16,7 @@ template constexpr sycl::specialization_id sc_multiple( - user_def_types::get_init_value_helper(def_val)); + user_def_types::init_value_helper::get(def_val)); namespace specialization_constants_multiple { using namespace sycl_cts; @@ -57,9 +57,9 @@ class check_specialization_constants_multiple_for_type { int val_A = 5; int val_B = 10; int val_C = 30; - T ref1{user_def_types::get_init_value_helper(0)}; - T ref2{user_def_types::get_init_value_helper(0)}; - T ref3{user_def_types::get_init_value_helper(0)}; + T ref1{user_def_types::init_value_helper::get(0)}; + T ref2{user_def_types::init_value_helper::get(0)}; + T ref3{user_def_types::init_value_helper::get(0)}; fill_init_values(ref1, val_A); fill_init_values(ref2, val_B); fill_init_values(ref3, val_C); @@ -115,13 +115,13 @@ class check_specialization_constants_multiple_for_type { !check_equal_values(ref2, result_vec[1].value) || !check_equal_values(ref3, result_vec[2].value) || !check_equal_values( - T(user_def_types::get_init_value_helper(def_values[3])), + T(user_def_types::init_value_helper::get(def_values[3])), result_vec[3].value) || !check_equal_values( - T(user_def_types::get_init_value_helper(def_values[4])), + T(user_def_types::init_value_helper::get(def_values[4])), result_vec[4].value) || !check_equal_values( - T(user_def_types::get_init_value_helper(def_values[5])), + T(user_def_types::init_value_helper::get(def_values[5])), result_vec[5].value)) FAIL(log, "multiple spec const for " + type_name_string::get(type_name)); diff --git a/tests/spec_constants/spec_constants_same_command_group_common.h b/tests/spec_constants/spec_constants_same_command_group_common.h index 3cdfc3cff..6a2ae2c66 100644 --- a/tests/spec_constants/spec_constants_same_command_group_common.h +++ b/tests/spec_constants/spec_constants_same_command_group_common.h @@ -46,13 +46,13 @@ template class check_specialization_constants_same_command_group { public: void operator()(util::logger &log, const std::string &type_name) { - T ref_A{user_def_types::get_init_value_helper(5)}; - T ref_B{user_def_types::get_init_value_helper(10)}; + T ref_A{user_def_types::init_value_helper::get(5)}; + T ref_B{user_def_types::init_value_helper::get(10)}; auto queue = util::get_cts_object::queue(); sycl::range<1> range(1); { - T result1{user_def_types::get_init_value_helper(0)}; - T result2{user_def_types::get_init_value_helper(0)}; + T result1{user_def_types::init_value_helper::get(0)}; + T result2{user_def_types::init_value_helper::get(0)}; { command_group_object cmo; sycl::buffer result_buffer1(&result1, range); @@ -73,8 +73,8 @@ class check_specialization_constants_same_command_group { } { - T result1{user_def_types::get_init_value_helper(0)}; - T result2{user_def_types::get_init_value_helper(0)}; + T result1{user_def_types::init_value_helper::get(0)}; + T result2{user_def_types::init_value_helper::get(0)}; { command_group_object cmo; sycl::buffer result_buffer1(&result1, range); @@ -91,7 +91,7 @@ class check_specialization_constants_same_command_group { if (!check_equal_values(ref_A, result1)) FAIL(log, "case 2 failed for value A for " + type_name); if (!check_equal_values( - T(user_def_types::get_init_value_helper(default_val)), + T(user_def_types::init_value_helper::get(default_val)), result2)) FAIL(log, "case 2 failed for default value for " + type_name); } diff --git a/tests/spec_constants/spec_constants_same_name_inter_link.h b/tests/spec_constants/spec_constants_same_name_inter_link.h index d341294e3..3587d5822 100644 --- a/tests/spec_constants/spec_constants_same_name_inter_link.h +++ b/tests/spec_constants/spec_constants_same_name_inter_link.h @@ -48,10 +48,10 @@ class check_specialization_constants_same_name_inter_link_for_type { } } sycl::range<1> range(1); - T def_value{user_def_types::get_init_value_helper(0)}; - T ref_def_value{user_def_types::get_init_value_helper(0)}; - T result{user_def_types::get_init_value_helper(0)}; - T ref{user_def_types::get_init_value_helper(0)}; + T def_value{user_def_types::init_value_helper::get(0)}; + T ref_def_value{user_def_types::init_value_helper::get(0)}; + T result{user_def_types::init_value_helper::get(0)}; + T ref{user_def_types::init_value_helper::get(0)}; { // Setting ref values according to TU number fill_init_values(ref_def_value, TestConfig::tu); diff --git a/tests/spec_constants/spec_constants_same_name_inter_link_helper.h b/tests/spec_constants/spec_constants_same_name_inter_link_helper.h index a47863335..7c5f7ebcf 100644 --- a/tests/spec_constants/spec_constants_same_name_inter_link_helper.h +++ b/tests/spec_constants/spec_constants_same_name_inter_link_helper.h @@ -30,7 +30,7 @@ namespace { // SC_SN_IL_TU_NUM is defined in every TU template constexpr sycl::specialization_id sc_same_name_inter_link( - user_def_types::get_init_value_helper(SC_SN_IL_TU_NUM)); + user_def_types::init_value_helper::get(SC_SN_IL_TU_NUM)); } // namespace diff --git a/tests/spec_constants/spec_constants_same_name_stress_helper.h b/tests/spec_constants/spec_constants_same_name_stress_helper.h index db75b3d3d..779c5fea4 100644 --- a/tests/spec_constants/spec_constants_same_name_stress_helper.h +++ b/tests/spec_constants/spec_constants_same_name_stress_helper.h @@ -56,21 +56,21 @@ static std::string get_hint(int test_id) { // Specialization constant defined in global namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::get_init_value_helper( + user_def_types::init_value_helper::get( to_integral(spec_const_help::sc_st_id::glob))); namespace g_outer { // Specialization constant defined in outer namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::get_init_value_helper( + user_def_types::init_value_helper::get( to_integral(spec_const_help::sc_st_id::outer))); namespace g_inner { // Specialization constant defined in outer::inner namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::get_init_value_helper( + user_def_types::init_value_helper::get( to_integral(spec_const_help::sc_st_id::outer_inner))); } // namespace g_inner @@ -78,7 +78,7 @@ namespace { // Specialization constant defined in outer::unnamed namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::get_init_value_helper( + user_def_types::init_value_helper::get( to_integral(spec_const_help::sc_st_id::outer_unnamed))); template @@ -88,7 +88,7 @@ namespace g_u_inner { // Specialization constant defined in outer::unnamed::inner namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::get_init_value_helper( + user_def_types::init_value_helper::get( to_integral(spec_const_help::sc_st_id::outer_unnamed_inner))); template @@ -99,7 +99,7 @@ namespace { // namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::get_init_value_helper( + user_def_types::init_value_helper::get( to_integral(spec_const_help::sc_st_id::outer_unnamed_inner_unnamed))); template @@ -113,7 +113,7 @@ namespace { // Specialization constant defined in unnamed namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::get_init_value_helper( + user_def_types::init_value_helper::get( to_integral(spec_const_help::sc_st_id::unnamed))); template @@ -123,7 +123,7 @@ namespace u_outer { // Specialization constant defined in unnamed::outer namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::get_init_value_helper( + user_def_types::init_value_helper::get( to_integral(spec_const_help::sc_st_id::unnamed_outer))); template @@ -133,7 +133,7 @@ namespace { // Specialization constant defined in unnamed::outer::unnamed namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::get_init_value_helper( + user_def_types::init_value_helper::get( to_integral(spec_const_help::sc_st_id::unnamed_outer_unnamed))); template @@ -144,7 +144,7 @@ namespace u_inner { // namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::get_init_value_helper( + user_def_types::init_value_helper::get( to_integral(spec_const_help::sc_st_id::unnamed_outer_unnamed_inner))); template diff --git a/tests/spec_constants/spec_constants_separate_unit.cpp b/tests/spec_constants/spec_constants_separate_unit.cpp index a801371d8..a52113f81 100644 --- a/tests/spec_constants/spec_constants_separate_unit.cpp +++ b/tests/spec_constants/spec_constants_separate_unit.cpp @@ -14,7 +14,7 @@ using namespace get_spec_const; template inline constexpr sycl::specialization_id spec_const_external( - user_def_types::get_init_value_helper(default_val)); + user_def_types::init_value_helper::get(default_val)); template bool check_kernel_handler_by_reference_external(sycl::kernel_handler &h, diff --git a/tests/spec_constants/spec_constants_via_handler_common.h b/tests/spec_constants/spec_constants_via_handler_common.h index 410cade48..c545ecf50 100644 --- a/tests/spec_constants/spec_constants_via_handler_common.h +++ b/tests/spec_constants/spec_constants_via_handler_common.h @@ -22,14 +22,14 @@ inline constexpr int val_A = 5; template constexpr sycl::specialization_id sc_multiple( - user_def_types::get_init_value_helper(case_num)); + user_def_types::init_value_helper::get(case_num)); template class kernel; template bool check_kernel_handler_by_reference(sycl::kernel_handler &h) { - T ref{user_def_types::get_init_value_helper(0)}; + T ref{user_def_types::init_value_helper::get(0)}; fill_init_values(ref, val_A); return check_equal_values( ref, h.get_specialization_constant>()); @@ -37,7 +37,7 @@ bool check_kernel_handler_by_reference(sycl::kernel_handler &h) { template bool check_kernel_handler_by_value(sycl::kernel_handler h) { - T ref{user_def_types::get_init_value_helper(0)}; + T ref{user_def_types::init_value_helper::get(0)}; fill_init_values(ref, val_A); return check_equal_values( ref, h.get_specialization_constant>()); @@ -49,9 +49,9 @@ class check_spec_constant_with_handler_for_type { void operator()(util::logger &log, const std::string &type_name) { auto queue = util::get_cts_object::queue(); sycl::range<1> range(1); - T result{user_def_types::get_init_value_helper(0)}; - T ref{user_def_types::get_init_value_helper(0)}; - T ref_other{user_def_types::get_init_value_helper(0)}; + T result{user_def_types::init_value_helper::get(0)}; + T ref{user_def_types::init_value_helper::get(0)}; + T ref_other{user_def_types::init_value_helper::get(0)}; int val_B = 10; fill_init_values(ref, val_A); fill_init_values(ref_other, val_B); @@ -59,7 +59,7 @@ class check_spec_constant_with_handler_for_type { { const int case_num = 1; { - result = user_def_types::get_init_value_helper(0); + result = user_def_types::init_value_helper::get(0); queue.submit([&](sycl::handler &cgh) { cgh.set_specialization_constant>(ref); result = cgh.get_specialization_constant>(); @@ -74,7 +74,7 @@ class check_spec_constant_with_handler_for_type { { const int case_num = 2; { - result = user_def_types::get_init_value_helper(0); + result = user_def_types::init_value_helper::get(0); queue.submit([&](sycl::handler &cgh) { cgh.set_specialization_constant>(ref); cgh.set_specialization_constant>(ref_other); @@ -91,7 +91,7 @@ class check_spec_constant_with_handler_for_type { { const int case_num = 3; { - result = user_def_types::get_init_value_helper(0); + result = user_def_types::init_value_helper::get(0); sycl::buffer result_buffer(&result, range); queue.submit([&](sycl::handler &cgh) { auto res_acc = @@ -113,7 +113,7 @@ class check_spec_constant_with_handler_for_type { { const int case_num = 4; { - result = user_def_types::get_init_value_helper(0); + result = user_def_types::init_value_helper::get(0); sycl::buffer result_buffer(&result, range); queue.submit([&](sycl::handler &cgh) { auto res_acc = @@ -164,13 +164,14 @@ class check_spec_constant_with_handler_for_type { { const int case_num = 6; { - result = user_def_types::get_init_value_helper(0); + result = user_def_types::init_value_helper::get(0); queue.submit([&](sycl::handler &cgh) { result = cgh.get_specialization_constant>(); }); } if (!check_equal_values( - T(user_def_types::get_init_value_helper(default_val)), result)) + T(user_def_types::init_value_helper::get(default_val)), + result)) FAIL(log, "case " + std::to_string(case_num) + " for " + type_name_string::get(type_name)); } @@ -180,7 +181,7 @@ class check_spec_constant_with_handler_for_type { { const int case_num = 7; { - result = user_def_types::get_init_value_helper(0); + result = user_def_types::init_value_helper::get(0); sycl::buffer result_buffer(&result, range); queue.submit([&](sycl::handler &cgh) { auto res_acc = @@ -192,7 +193,8 @@ class check_spec_constant_with_handler_for_type { }); } if (!check_equal_values( - T(user_def_types::get_init_value_helper(default_val)), result)) + T(user_def_types::init_value_helper::get(default_val)), + result)) FAIL(log, "case " + std::to_string(case_num) + " for " + type_name_string::get(type_name)); } diff --git a/tests/spec_constants/spec_constants_via_kernel_bundle.h b/tests/spec_constants/spec_constants_via_kernel_bundle.h index caf2704a2..2c515d5e2 100644 --- a/tests/spec_constants/spec_constants_via_kernel_bundle.h +++ b/tests/spec_constants/spec_constants_via_kernel_bundle.h @@ -136,7 +136,7 @@ struct values> : values {}; */ template constexpr sycl::specialization_id spec_const_by_kernel_bundle( - user_def_types::get_init_value_helper( + user_def_types::init_value_helper::get( specialization_constants_via_kernel_bundle::values::initial)); namespace specialization_constants_via_kernel_bundle { @@ -300,7 +300,7 @@ void set_value(sycl::kernel_bundle& bundle) { " set_specialization_constant"); for (int i = 0; i < id::n_set; ++i) { // Prepare value to store - T value { user_def_types::get_init_value_helper(0) }; + T value { user_def_types::init_value_helper::get(0) }; fill_init_values(value, values::reference(i)); bundle.template set_specialization_constant< @@ -323,11 +323,11 @@ bool check_value(specStorageT&& storage) { using namespace get_spec_const; // Prepare to read value - T value { user_def_types::get_init_value_helper(0) }; + T value { user_def_types::init_value_helper::get(0) }; fill_init_values(value, values::empty); // Prepare to compare values - T expected { user_def_types::get_init_value_helper(0) }; + T expected { user_def_types::init_value_helper::get(0) }; if constexpr (id::n_set == 0) { fill_init_values(expected, values::initial); } else { From a627bcd9d8f37f96a36c23bb03642eee55ced9a8 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Wed, 17 Jan 2024 06:02:33 -0800 Subject: [PATCH 07/12] Apply clang-format --- tests/common/type_list.h | 8 ++------ .../spec_constants/spec_constants_defined_various_ways.h | 4 ++-- tests/spec_constants/spec_constants_external.h | 8 ++++---- tests/spec_constants/spec_constants_via_kernel_bundle.h | 6 +++--- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/tests/common/type_list.h b/tests/common/type_list.h index c6476c117..abded3432 100644 --- a/tests/common/type_list.h +++ b/tests/common/type_list.h @@ -165,9 +165,7 @@ struct arrow_operator_overloaded { // Returns instance of type T template struct init_value_helper { - static constexpr auto get(int x) { - return static_cast(x); - } + static constexpr auto get(int x) { return static_cast(x); } }; // Returns instance of type T @@ -189,9 +187,7 @@ struct init_value_helper> { // Returns instance of type bool template <> struct init_value_helper { - static constexpr bool get(int x) { - return x % 2 != 0; - } + static constexpr bool get(int x) { return x % 2 != 0; } }; // Returns instance of user defined struct with no constructor diff --git a/tests/spec_constants/spec_constants_defined_various_ways.h b/tests/spec_constants/spec_constants_defined_various_ways.h index c45ac2d52..cee2676a3 100644 --- a/tests/spec_constants/spec_constants_defined_various_ways.h +++ b/tests/spec_constants/spec_constants_defined_various_ways.h @@ -35,8 +35,8 @@ void perform_test(util::logger &log, const std::string &type_name, } } sycl::range<1> range(1); - T result { user_def_types::init_value_helper::get(0) }; - T ref { user_def_types::init_value_helper::get(0) }; + T result{user_def_types::init_value_helper::get(0)}; + T ref{user_def_types::init_value_helper::get(0)}; { fill_init_values(ref, case_num); sycl::buffer result_buffer(&result, range); diff --git a/tests/spec_constants/spec_constants_external.h b/tests/spec_constants/spec_constants_external.h index b297de2ce..b0ab03dd9 100644 --- a/tests/spec_constants/spec_constants_external.h +++ b/tests/spec_constants/spec_constants_external.h @@ -74,7 +74,7 @@ class check_specialization_constants_external { // handler bool passed = false; { - T ref { user_def_types::init_value_helper::get(5) }; + T ref{user_def_types::init_value_helper::get(5)}; const int case_num = static_cast(test_cases_external::by_reference_via_handler); sycl::buffer result_buffer(&passed, range); @@ -99,7 +99,7 @@ class check_specialization_constants_external { // handler passed = false; { - T ref { user_def_types::init_value_helper::get(10) }; + T ref{user_def_types::init_value_helper::get(10)}; const int case_num = static_cast(test_cases_external::by_value_via_handler); sycl::buffer result_buffer(&passed, range); @@ -128,7 +128,7 @@ class check_specialization_constants_external { // via kernel_bundle passed = false; { - T ref { user_def_types::init_value_helper::get(15) }; + T ref{user_def_types::init_value_helper::get(15)}; const int case_num = static_cast(test_cases_external::by_reference_via_bundle); sycl::buffer result_buffer(&passed, range); @@ -170,7 +170,7 @@ class check_specialization_constants_external { // kernel_bundle passed = false; { - T ref { user_def_types::init_value_helper::get(20) }; + T ref{user_def_types::init_value_helper::get(20)}; const int case_num = static_cast(test_cases_external::by_value_via_bundle); sycl::buffer result_buffer(&passed, range); diff --git a/tests/spec_constants/spec_constants_via_kernel_bundle.h b/tests/spec_constants/spec_constants_via_kernel_bundle.h index 2c515d5e2..04b92c5e5 100644 --- a/tests/spec_constants/spec_constants_via_kernel_bundle.h +++ b/tests/spec_constants/spec_constants_via_kernel_bundle.h @@ -300,7 +300,7 @@ void set_value(sycl::kernel_bundle& bundle) { " set_specialization_constant"); for (int i = 0; i < id::n_set; ++i) { // Prepare value to store - T value { user_def_types::init_value_helper::get(0) }; + T value{user_def_types::init_value_helper::get(0)}; fill_init_values(value, values::reference(i)); bundle.template set_specialization_constant< @@ -323,11 +323,11 @@ bool check_value(specStorageT&& storage) { using namespace get_spec_const; // Prepare to read value - T value { user_def_types::init_value_helper::get(0) }; + T value{user_def_types::init_value_helper::get(0)}; fill_init_values(value, values::empty); // Prepare to compare values - T expected { user_def_types::init_value_helper::get(0) }; + T expected{user_def_types::init_value_helper::get(0)}; if constexpr (id::n_set == 0) { fill_init_values(expected, values::initial); } else { From 3e70ddf3f2e012e475260a56e2d641e70a68695b Mon Sep 17 00:00:00 2001 From: Alexey Bader Date: Wed, 17 Jan 2024 15:23:29 -0800 Subject: [PATCH 08/12] Update year in copyright comments. --- tests/atomic_ref/atomic_ref_T_op_test_pointers_fp64.cpp | 2 +- .../atomic_ref_add_sub_op_all_types_test_pointers_fp64.cpp | 2 +- tests/atomic_ref/atomic_ref_assign_op_test_pointers_fp64.cpp | 2 +- .../atomic_ref_compare_exchange_test_pointers_fp64.cpp | 2 +- tests/atomic_ref/atomic_ref_constructors_pointers_fp64.cpp | 2 +- tests/atomic_ref/atomic_ref_exchange_test_pointers_fp64.cpp | 2 +- .../atomic_ref_fetch_add_sub_all_types_test_pointers_fp64.cpp | 2 +- tests/atomic_ref/atomic_ref_incr_decr_op_test_pointers_fp64.cpp | 2 +- tests/atomic_ref/atomic_ref_is_lock_free_test_pointers_fp64.cpp | 2 +- tests/atomic_ref/atomic_ref_store_test_pointers_fp64.cpp | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/atomic_ref/atomic_ref_T_op_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_T_op_test_pointers_fp64.cpp index f3b6deef2..1af1bddfc 100644 --- a/tests/atomic_ref/atomic_ref_T_op_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_T_op_test_pointers_fp64.cpp @@ -2,7 +2,7 @@ // // SYCL 2020 Conformance Test Suite // -// Copyright (c) 2023 The Khronos Group Inc. +// Copyright (c) 2024 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/atomic_ref/atomic_ref_add_sub_op_all_types_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_add_sub_op_all_types_test_pointers_fp64.cpp index 1c16720e3..58e7d3481 100644 --- a/tests/atomic_ref/atomic_ref_add_sub_op_all_types_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_add_sub_op_all_types_test_pointers_fp64.cpp @@ -2,7 +2,7 @@ // // SYCL 2020 Conformance Test Suite // -// Copyright (c) 2023 The Khronos Group Inc. +// Copyright (c) 2024 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/atomic_ref/atomic_ref_assign_op_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_assign_op_test_pointers_fp64.cpp index bf3c462fc..f8f143a97 100644 --- a/tests/atomic_ref/atomic_ref_assign_op_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_assign_op_test_pointers_fp64.cpp @@ -2,7 +2,7 @@ // // SYCL 2020 Conformance Test Suite // -// Copyright (c) 2023 The Khronos Group Inc. +// Copyright (c) 2024 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/atomic_ref/atomic_ref_compare_exchange_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_compare_exchange_test_pointers_fp64.cpp index 8d549c9fc..f8d227931 100644 --- a/tests/atomic_ref/atomic_ref_compare_exchange_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_compare_exchange_test_pointers_fp64.cpp @@ -2,7 +2,7 @@ // // SYCL 2020 Conformance Test Suite // -// Copyright (c) 2023 The Khronos Group Inc. +// Copyright (c) 2024 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/atomic_ref/atomic_ref_constructors_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_constructors_pointers_fp64.cpp index 29035ae21..12e707d9f 100644 --- a/tests/atomic_ref/atomic_ref_constructors_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_constructors_pointers_fp64.cpp @@ -2,7 +2,7 @@ // // SYCL 2020 Conformance Test Suite // -// Copyright (c) 2023 The Khronos Group Inc. +// Copyright (c) 2024 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/atomic_ref/atomic_ref_exchange_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_exchange_test_pointers_fp64.cpp index dfb5d9262..b87a0b5a8 100644 --- a/tests/atomic_ref/atomic_ref_exchange_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_exchange_test_pointers_fp64.cpp @@ -2,7 +2,7 @@ // // SYCL 2020 Conformance Test Suite // -// Copyright (c) 2023 The Khronos Group Inc. +// Copyright (c) 2024 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/atomic_ref/atomic_ref_fetch_add_sub_all_types_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_fetch_add_sub_all_types_test_pointers_fp64.cpp index bd4437db0..fcf14ba7c 100644 --- a/tests/atomic_ref/atomic_ref_fetch_add_sub_all_types_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_fetch_add_sub_all_types_test_pointers_fp64.cpp @@ -2,7 +2,7 @@ // // SYCL 2020 Conformance Test Suite // -// Copyright (c) 2023 The Khronos Group Inc. +// Copyright (c) 2024 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/atomic_ref/atomic_ref_incr_decr_op_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_incr_decr_op_test_pointers_fp64.cpp index 85481c60c..f7a6039b2 100644 --- a/tests/atomic_ref/atomic_ref_incr_decr_op_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_incr_decr_op_test_pointers_fp64.cpp @@ -2,7 +2,7 @@ // // SYCL 2020 Conformance Test Suite // -// Copyright (c) 2023 The Khronos Group Inc. +// Copyright (c) 2024 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/atomic_ref/atomic_ref_is_lock_free_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_is_lock_free_test_pointers_fp64.cpp index 57f3b4029..8012bfd19 100644 --- a/tests/atomic_ref/atomic_ref_is_lock_free_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_is_lock_free_test_pointers_fp64.cpp @@ -2,7 +2,7 @@ // // SYCL 2020 Conformance Test Suite // -// Copyright (c) 2023 The Khronos Group Inc. +// Copyright (c) 2024 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/atomic_ref/atomic_ref_store_test_pointers_fp64.cpp b/tests/atomic_ref/atomic_ref_store_test_pointers_fp64.cpp index 524d0fe70..c15bc5e83 100644 --- a/tests/atomic_ref/atomic_ref_store_test_pointers_fp64.cpp +++ b/tests/atomic_ref/atomic_ref_store_test_pointers_fp64.cpp @@ -2,7 +2,7 @@ // // SYCL 2020 Conformance Test Suite // -// Copyright (c) 2023 The Khronos Group Inc. +// Copyright (c) 2024 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From 6211bfc04faed9ce593f601af3b1e925e6ea7d33 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Fri, 19 Jan 2024 03:40:43 -0800 Subject: [PATCH 09/12] Rework according to the comments --- tests/buffer/buffer_deduction_guides.cpp | 12 ++-- tests/common/type_list.h | 65 +++++++++---------- tests/multi_ptr/multi_ptr_access_members.h | 16 ++--- .../multi_ptr_accessor_constructor.h | 3 +- .../multi_ptr_common_assignment_ops.h | 4 +- .../multi_ptr/multi_ptr_common_constructors.h | 2 +- tests/multi_ptr/multi_ptr_comparison_op.h | 4 +- .../multi_ptr_convert_assignment_ops.h | 6 +- .../multi_ptr/multi_ptr_deduction_guides.cpp | 2 +- .../multi_ptr_explicit_conversions.h | 4 +- .../multi_ptr_implicit_conversions.h | 4 +- tests/multi_ptr/multi_ptr_prefetch_member.h | 2 +- tests/spec_constants/spec_constants_common.h | 4 +- .../spec_constants_defined_various_ways.h | 4 +- ...ec_constants_defined_various_ways_helper.h | 18 ++--- ...pec_constants_exceptions_throwing_common.h | 4 +- .../spec_constants/spec_constants_external.h | 10 +-- .../spec_constants/spec_constants_multiple.h | 14 ++-- ...spec_constants_same_command_group_common.h | 14 ++-- .../spec_constants_same_name_inter_link.h | 8 +-- ...ec_constants_same_name_inter_link_helper.h | 2 +- .../spec_constants_same_name_stress_helper.h | 20 +++--- .../spec_constants_separate_unit.cpp | 2 +- .../spec_constants_via_handler_common.h | 28 ++++---- .../spec_constants_via_kernel_bundle.h | 8 +-- 25 files changed, 127 insertions(+), 133 deletions(-) diff --git a/tests/buffer/buffer_deduction_guides.cpp b/tests/buffer/buffer_deduction_guides.cpp index 7b1a5e4a9..84eea53ae 100644 --- a/tests/buffer/buffer_deduction_guides.cpp +++ b/tests/buffer/buffer_deduction_guides.cpp @@ -41,9 +41,9 @@ class check_buffer_deduction { void operator()(const std::string& type) { // create container // using this API because of no_cnstr and no_def_cnstr types - std::array arr = {user_def_types::get_init_value_helper(0), - user_def_types::get_init_value_helper(0), - user_def_types::get_init_value_helper(0)}; + std::array arr = {user_def_types::get_init_value(0), + user_def_types::get_init_value(0), + user_def_types::get_init_value(0)}; type_name = type; test_inputiterator(arr); @@ -123,9 +123,9 @@ class check_buffer_deduction { const int arr_size = r.size(); std::unique_ptr data( - new T[size]{user_def_types::get_init_value_helper(0), - user_def_types::get_init_value_helper(0), - user_def_types::get_init_value_helper(0)}); + new T[size]{user_def_types::get_init_value(0), + user_def_types::get_init_value(0), + user_def_types::get_init_value(0)}); INFO("buffer_ctors_deduction::test_type() " + type_name); // buffer with no alloccator and no property list diff --git a/tests/common/type_list.h b/tests/common/type_list.h index abded3432..6ecf8d4c9 100644 --- a/tests/common/type_list.h +++ b/tests/common/type_list.h @@ -162,53 +162,52 @@ struct arrow_operator_overloaded { } }; -// Returns instance of type T +// Helper structure to extract element type of vec/marray +// Fallback for scalars, which returns unmodified T template -struct init_value_helper { - static constexpr auto get(int x) { return static_cast(x); } +struct vec_marray_element_type { + using type = T; }; -// Returns instance of type T +// vec and marray specializations template -struct init_value_helper> { - static constexpr auto get(int x) { - return sycl::vec{static_cast(x)}; - } +struct vec_marray_element_type> { + using type = T; }; -// Returns instance of type T template -struct init_value_helper> { - static constexpr auto get(int x) { - return sycl::marray{static_cast(x)}; - } +struct vec_marray_element_type> { + using type = T; }; -// Returns instance of type bool +// Returns instance of type T +template +inline constexpr auto get_init_value(int x) { + // Explicit cast is required to silence a warning about narrowing conversion + // in case when T is smaller than int. + return T{static_cast::type>(x)}; +} + +// Special case for bool template <> -struct init_value_helper { - static constexpr bool get(int x) { return x % 2 != 0; } -}; +inline constexpr auto get_init_value(int x) { + return x % 2 != 0; +} -// Returns instance of user defined struct with no constructor +// Specializations for user-defined types template <> -struct init_value_helper { - static constexpr auto get(int x) { - no_cnstr instance{}; - instance = x; - return instance; - } -}; +inline constexpr auto get_init_value(int x) { + no_cnstr instance{}; + instance = x; + return instance; +} -// Returns instance of user defined struct default constructor template <> -struct init_value_helper { - static constexpr auto get(int x) { - def_cnstr instance; - instance = x; - return instance; - } -}; +inline constexpr auto get_init_value(int x) { + def_cnstr instance; + instance = x; + return instance; +} } // namespace user_def_types diff --git a/tests/multi_ptr/multi_ptr_access_members.h b/tests/multi_ptr/multi_ptr_access_members.h index 83f3e15fc..014eb047a 100644 --- a/tests/multi_ptr/multi_ptr_access_members.h +++ b/tests/multi_ptr/multi_ptr_access_members.h @@ -51,14 +51,10 @@ struct test_result { int value_to_init = 49; // Variables that will be used to check that access members returns correct // value - T dereference_ret_value = - user_def_types::get_init_value_helper(value_to_init); - T dereference_op_ret_value = - user_def_types::get_init_value_helper(value_to_init); - T get_member_ret_value = - user_def_types::get_init_value_helper(value_to_init); - T get_raw_member_ret_value = - user_def_types::get_init_value_helper(value_to_init); + T dereference_ret_value = user_def_types::get_init_value(value_to_init); + T dereference_op_ret_value = user_def_types::get_init_value(value_to_init); + T get_member_ret_value = user_def_types::get_init_value(value_to_init); + T get_raw_member_ret_value = user_def_types::get_init_value(value_to_init); }; } // namespace detail @@ -92,7 +88,7 @@ class run_access_members_tests { const std::string &is_decorated_name) { auto queue = once_per_unit::get_queue(); constexpr int val_to_init = 42; - T value = user_def_types::get_init_value_helper(val_to_init); + T value = user_def_types::get_init_value(val_to_init); // Variable that contains all variables that will be used to verify test // result @@ -170,7 +166,7 @@ class run_access_members_tests { } }); } - T expected_value = user_def_types::get_init_value_helper(val_to_init); + T expected_value = user_def_types::get_init_value(val_to_init); // Dereference and multi_ptr::operator->() available only when: // !std::is_void::value if constexpr (!std::is_void_v) { diff --git a/tests/multi_ptr/multi_ptr_accessor_constructor.h b/tests/multi_ptr/multi_ptr_accessor_constructor.h index 606211151..90092fb50 100644 --- a/tests/multi_ptr/multi_ptr_accessor_constructor.h +++ b/tests/multi_ptr/multi_ptr_accessor_constructor.h @@ -63,8 +63,7 @@ void run_tests(sycl_cts::util::logger& log, const std::string& type_name) { bool same_value = false; // default value - T init_value = - user_def_types::get_init_value_helper>(10); + T init_value = user_def_types::get_init_value>(10); auto queue = once_per_unit::get_queue(); diff --git a/tests/multi_ptr/multi_ptr_common_assignment_ops.h b/tests/multi_ptr/multi_ptr_common_assignment_ops.h index 42228569b..b7ea13b83 100644 --- a/tests/multi_ptr/multi_ptr_common_assignment_ops.h +++ b/tests/multi_ptr/multi_ptr_common_assignment_ops.h @@ -60,7 +60,7 @@ class run_common_assign_tests { const std::string &address_space_name, const std::string &is_decorated_name) { auto queue = once_per_unit::get_queue(); - T value = user_def_types::get_init_value_helper(expected_val); + T value = user_def_types::get_init_value(expected_val); sycl::range r(1); std::array res; res.fill(false); @@ -96,7 +96,7 @@ class run_common_assign_tests { check(const_mptr_in, mptr_in, ref, res_acc); } else { T private_val = - user_def_types::get_init_value_helper(expected_val); + user_def_types::get_init_value(expected_val); multi_ptr_t mptr_in = sycl::address_space_cast( diff --git a/tests/multi_ptr/multi_ptr_common_constructors.h b/tests/multi_ptr/multi_ptr_common_constructors.h index 9b41f9778..861eeddd3 100644 --- a/tests/multi_ptr/multi_ptr_common_constructors.h +++ b/tests/multi_ptr/multi_ptr_common_constructors.h @@ -79,7 +79,7 @@ void run_tests(sycl_cts::util::logger &log, const std::string &type_name) { // Arrays for result values bool same_type[types_size]{}; bool same_value[values_size]{}; - T ref_value{user_def_types::get_init_value_helper(0)}; + T ref_value{user_def_types::get_init_value(0)}; auto queue = once_per_unit::get_queue(); using GlobalAccType = sycl::accessor; diff --git a/tests/multi_ptr/multi_ptr_comparison_op.h b/tests/multi_ptr/multi_ptr_comparison_op.h index 9902f25ed..6994d9d9b 100644 --- a/tests/multi_ptr/multi_ptr_comparison_op.h +++ b/tests/multi_ptr/multi_ptr_comparison_op.h @@ -142,8 +142,8 @@ class run_multi_ptr_comparison_op_test { using multi_ptr_t = sycl::multi_ptr; - const T m_small_value = user_def_types::get_init_value_helper(1); - const T m_great_value = user_def_types::get_init_value_helper(2); + const T m_small_value = user_def_types::get_init_value(1); + const T m_great_value = user_def_types::get_init_value(2); // Use an array to be sure that we have two elements that has consecutive // memory addresses const T m_values_arr[2] = {m_small_value, m_great_value}; diff --git a/tests/multi_ptr/multi_ptr_convert_assignment_ops.h b/tests/multi_ptr/multi_ptr_convert_assignment_ops.h index d1acf7d9f..46766c130 100644 --- a/tests/multi_ptr/multi_ptr_convert_assignment_ops.h +++ b/tests/multi_ptr/multi_ptr_convert_assignment_ops.h @@ -59,7 +59,7 @@ class run_convert_assignment_operators_tests { const std::string &src_is_decorated_name, const std::string &dst_is_decorated_name) { auto queue = once_per_unit::get_queue(); - T value = user_def_types::get_init_value_helper(expected_val); + T value = user_def_types::get_init_value(expected_val); auto r = sycl::range(1); SECTION( sycl_cts::section_name( @@ -113,7 +113,7 @@ class run_convert_assignment_operators_tests { res_acc[0] = *(mptr_out.get_raw()) == ref; } else { T private_val = - user_def_types::get_init_value_helper(expected_val); + user_def_types::get_init_value(expected_val); const src_multi_ptr_t mptr_in( sycl::address_space_cast< @@ -184,7 +184,7 @@ class run_convert_assignment_operators_tests { res_acc[0] = *(mptr_out.get_raw()) == ref; } else { T private_val = - user_def_types::get_init_value_helper(expected_val); + user_def_types::get_init_value(expected_val); const src_multi_ptr_t mptr_in( sycl::address_space_cast< diff --git a/tests/multi_ptr/multi_ptr_deduction_guides.cpp b/tests/multi_ptr/multi_ptr_deduction_guides.cpp index 77bb17d35..9565e85c0 100644 --- a/tests/multi_ptr/multi_ptr_deduction_guides.cpp +++ b/tests/multi_ptr/multi_ptr_deduction_guides.cpp @@ -70,7 +70,7 @@ class check_multi_ptr_deduction { accessor, local_accessor>; bool res = false; - T data{user_def_types::get_init_value_helper(0)}; + T data{user_def_types::get_init_value(0)}; auto r = sycl_cts::util::get_cts_object::range::get(1, 1, 1); { sycl::buffer buf_res(&res, {1}); diff --git a/tests/multi_ptr/multi_ptr_explicit_conversions.h b/tests/multi_ptr/multi_ptr_explicit_conversions.h index 33d663129..a2853bd48 100644 --- a/tests/multi_ptr/multi_ptr_explicit_conversions.h +++ b/tests/multi_ptr/multi_ptr_explicit_conversions.h @@ -66,7 +66,7 @@ class run_explicit_convert_tests { template void run_test(sycl::queue &queue, sycl::range<1> &r) { bool res = false; - T value = user_def_types::get_init_value_helper(expected_val); + T value = user_def_types::get_init_value(expected_val); { sycl::buffer res_buf(&res, sycl::range<1>(1)); sycl::buffer val_buffer(&value, sycl::range<1>(1)); @@ -103,7 +103,7 @@ class run_explicit_convert_tests { res_acc[0] = (*(mptr_out.get()) == ref); } else { T private_val = - user_def_types::get_init_value_helper(expected_val); + user_def_types::get_init_value(expected_val); input_multi_ptr_t mptr_in = sycl::address_space_cast< sycl::access::address_space::generic_space, decorated, T>( diff --git a/tests/multi_ptr/multi_ptr_implicit_conversions.h b/tests/multi_ptr/multi_ptr_implicit_conversions.h index 0839abbda..91adf3693 100644 --- a/tests/multi_ptr/multi_ptr_implicit_conversions.h +++ b/tests/multi_ptr/multi_ptr_implicit_conversions.h @@ -76,7 +76,7 @@ class run_implicit_convert_tests { template void preform_implicit_conversion_test() { auto queue = once_per_unit::get_queue(); - T value = user_def_types::get_init_value_helper(expected_val); + T value = user_def_types::get_init_value(expected_val); bool res = false; constexpr sycl::access::decorated src_multi_ptr_decorated = @@ -128,7 +128,7 @@ class run_implicit_convert_tests { const T value_dest = *(reinterpret_cast(mptr_dest.get())); res_acc[0] = (value_dest == - user_def_types::get_init_value_helper(expected_val)); + user_def_types::get_init_value(expected_val)); }; using kname = diff --git a/tests/multi_ptr/multi_ptr_prefetch_member.h b/tests/multi_ptr/multi_ptr_prefetch_member.h index 820ff34ea..17f9a081d 100644 --- a/tests/multi_ptr/multi_ptr_prefetch_member.h +++ b/tests/multi_ptr/multi_ptr_prefetch_member.h @@ -60,7 +60,7 @@ class run_prefetch_test { "Data type shouldn't be is same to void type"); auto queue = once_per_unit::get_queue(); - T value = user_def_types::get_init_value_helper(expected_val); + T value = user_def_types::get_init_value(expected_val); SECTION(sycl_cts::section_name("Check multi_ptr::prefetch()") .with("T", type_name) .with("address_space", "access::address_space::global_space") diff --git a/tests/spec_constants/spec_constants_common.h b/tests/spec_constants/spec_constants_common.h index 68d7fd723..9b53817e3 100644 --- a/tests/spec_constants/spec_constants_common.h +++ b/tests/spec_constants/spec_constants_common.h @@ -48,11 +48,11 @@ constexpr int default_val = 20; template constexpr sycl::specialization_id spec_const( - user_def_types::init_value_helper::get(default_val)); + user_def_types::get_init_value(default_val)); template void fill_init_values(T &result, int val) { - result = user_def_types::init_value_helper::get(val); + result = user_def_types::get_init_value(val); } template diff --git a/tests/spec_constants/spec_constants_defined_various_ways.h b/tests/spec_constants/spec_constants_defined_various_ways.h index cee2676a3..50a314b08 100644 --- a/tests/spec_constants/spec_constants_defined_various_ways.h +++ b/tests/spec_constants/spec_constants_defined_various_ways.h @@ -35,8 +35,8 @@ void perform_test(util::logger &log, const std::string &type_name, } } sycl::range<1> range(1); - T result{user_def_types::init_value_helper::get(0)}; - T ref{user_def_types::init_value_helper::get(0)}; + T result{user_def_types::get_init_value(0)}; + T ref{user_def_types::get_init_value(0)}; { fill_init_values(ref, case_num); sycl::buffer result_buffer(&result, range); diff --git a/tests/spec_constants/spec_constants_defined_various_ways_helper.h b/tests/spec_constants/spec_constants_defined_various_ways_helper.h index 036881309..16158a577 100644 --- a/tests/spec_constants/spec_constants_defined_various_ways_helper.h +++ b/tests/spec_constants/spec_constants_defined_various_ways_helper.h @@ -56,14 +56,14 @@ static std::string get_hint(sc_vw_id test_id) { // Defined in a non-global named namespace template constexpr sycl::specialization_id sc_nonglob( - user_def_types::init_value_helper::get(case_num)); + user_def_types::get_init_value(case_num)); // A static member variable of a struct in a non-global namespace struct struct_nonglob { constexpr struct_nonglob() {} template static constexpr sycl::specialization_id sc{ - user_def_types::init_value_helper::get(case_num)}; + user_def_types::get_init_value(case_num)}; }; } // namespace spec_const_help @@ -71,33 +71,33 @@ namespace { // Defined in an unnamed namespace template constexpr sycl::specialization_id sc_unnamed( - user_def_types::init_value_helper::get(case_num)); + user_def_types::get_init_value(case_num)); // A static member variable of a struct in an unnamed namespace struct struct_unnamed { constexpr struct_unnamed() {} template static constexpr sycl::specialization_id sc{ - user_def_types::init_value_helper::get(case_num)}; + user_def_types::get_init_value(case_num)}; }; } // unnamed namespace // Defined in the global namespace as inline constexpr template inline constexpr sycl::specialization_id sc_glob_inl( - user_def_types::init_value_helper::get(case_num)); + user_def_types::get_init_value(case_num)); // Defined in the global namespace as static constexpr template static constexpr sycl::specialization_id sc_glob_static( - user_def_types::init_value_helper::get(case_num)); + user_def_types::get_init_value(case_num)); // A static member variable of a struct in the global namespace struct struct_glob { constexpr struct_glob() {} template static constexpr sycl::specialization_id sc{ - user_def_types::init_value_helper::get(case_num)}; + user_def_types::get_init_value(case_num)}; }; // A static member variable declared inline constexpr of a struct in the global @@ -106,7 +106,7 @@ struct struct_glob_inl { constexpr struct_glob_inl() {} template static inline constexpr sycl::specialization_id sc{ - user_def_types::init_value_helper::get(case_num)}; + user_def_types::get_init_value(case_num)}; }; // A static member variable of a templated struct in the global namespace @@ -115,7 +115,7 @@ struct struct_glob_tmpl { constexpr struct_glob_tmpl() {} template static constexpr sycl::specialization_id sc{ - user_def_types::init_value_helper::get(case_num)}; + user_def_types::get_init_value(case_num)}; }; #endif // __SYCLCTS_TESTS_SPEC_CONST_DEFINED_VARIOUS_WAYS_HELPER_H diff --git a/tests/spec_constants/spec_constants_exceptions_throwing_common.h b/tests/spec_constants/spec_constants_exceptions_throwing_common.h index 2d0eb9601..8e92954f1 100644 --- a/tests/spec_constants/spec_constants_exceptions_throwing_common.h +++ b/tests/spec_constants/spec_constants_exceptions_throwing_common.h @@ -51,7 +51,7 @@ class check_spec_constant_exception_throw_for_type { // kernel_bundle { bool exception_was_thrown = false; - T res{user_def_types::init_value_helper::get(0)}; + T res{user_def_types::get_init_value(0)}; const int case_num = 1; auto queue = sycl_cts::util::get_cts_object::queue(); @@ -85,7 +85,7 @@ class check_spec_constant_exception_throw_for_type { // kernel_bundle { bool exception_was_thrown = false; - T sc_val{user_def_types::init_value_helper::get(0)}; + T sc_val{user_def_types::get_init_value(0)}; const int case_num = 2; auto queue = sycl_cts::util::get_cts_object::queue(); diff --git a/tests/spec_constants/spec_constants_external.h b/tests/spec_constants/spec_constants_external.h index b0ab03dd9..129e7f380 100644 --- a/tests/spec_constants/spec_constants_external.h +++ b/tests/spec_constants/spec_constants_external.h @@ -17,7 +17,7 @@ using namespace get_spec_const; template inline constexpr sycl::specialization_id spec_const_external( - user_def_types::init_value_helper::get(default_val)); + user_def_types::get_init_value(default_val)); #define FUNC_DECLARE(TYPE) \ SYCL_EXTERNAL bool check_kernel_handler_by_reference_external_handler( \ @@ -74,7 +74,7 @@ class check_specialization_constants_external { // handler bool passed = false; { - T ref{user_def_types::init_value_helper::get(5)}; + T ref{user_def_types::get_init_value(5)}; const int case_num = static_cast(test_cases_external::by_reference_via_handler); sycl::buffer result_buffer(&passed, range); @@ -99,7 +99,7 @@ class check_specialization_constants_external { // handler passed = false; { - T ref{user_def_types::init_value_helper::get(10)}; + T ref{user_def_types::get_init_value(10)}; const int case_num = static_cast(test_cases_external::by_value_via_handler); sycl::buffer result_buffer(&passed, range); @@ -128,7 +128,7 @@ class check_specialization_constants_external { // via kernel_bundle passed = false; { - T ref{user_def_types::init_value_helper::get(15)}; + T ref{user_def_types::get_init_value(15)}; const int case_num = static_cast(test_cases_external::by_reference_via_bundle); sycl::buffer result_buffer(&passed, range); @@ -170,7 +170,7 @@ class check_specialization_constants_external { // kernel_bundle passed = false; { - T ref{user_def_types::init_value_helper::get(20)}; + T ref{user_def_types::get_init_value(20)}; const int case_num = static_cast(test_cases_external::by_value_via_bundle); sycl::buffer result_buffer(&passed, range); diff --git a/tests/spec_constants/spec_constants_multiple.h b/tests/spec_constants/spec_constants_multiple.h index 48c206fbe..5f8ea7556 100644 --- a/tests/spec_constants/spec_constants_multiple.h +++ b/tests/spec_constants/spec_constants_multiple.h @@ -16,7 +16,7 @@ template constexpr sycl::specialization_id sc_multiple( - user_def_types::init_value_helper::get(def_val)); + user_def_types::get_init_value(def_val)); namespace specialization_constants_multiple { using namespace sycl_cts; @@ -57,9 +57,9 @@ class check_specialization_constants_multiple_for_type { int val_A = 5; int val_B = 10; int val_C = 30; - T ref1{user_def_types::init_value_helper::get(0)}; - T ref2{user_def_types::init_value_helper::get(0)}; - T ref3{user_def_types::init_value_helper::get(0)}; + T ref1{user_def_types::get_init_value(0)}; + T ref2{user_def_types::get_init_value(0)}; + T ref3{user_def_types::get_init_value(0)}; fill_init_values(ref1, val_A); fill_init_values(ref2, val_B); fill_init_values(ref3, val_C); @@ -115,13 +115,13 @@ class check_specialization_constants_multiple_for_type { !check_equal_values(ref2, result_vec[1].value) || !check_equal_values(ref3, result_vec[2].value) || !check_equal_values( - T(user_def_types::init_value_helper::get(def_values[3])), + T(user_def_types::get_init_value(def_values[3])), result_vec[3].value) || !check_equal_values( - T(user_def_types::init_value_helper::get(def_values[4])), + T(user_def_types::get_init_value(def_values[4])), result_vec[4].value) || !check_equal_values( - T(user_def_types::init_value_helper::get(def_values[5])), + T(user_def_types::get_init_value(def_values[5])), result_vec[5].value)) FAIL(log, "multiple spec const for " + type_name_string::get(type_name)); diff --git a/tests/spec_constants/spec_constants_same_command_group_common.h b/tests/spec_constants/spec_constants_same_command_group_common.h index 6a2ae2c66..e4a4b8592 100644 --- a/tests/spec_constants/spec_constants_same_command_group_common.h +++ b/tests/spec_constants/spec_constants_same_command_group_common.h @@ -46,13 +46,13 @@ template class check_specialization_constants_same_command_group { public: void operator()(util::logger &log, const std::string &type_name) { - T ref_A{user_def_types::init_value_helper::get(5)}; - T ref_B{user_def_types::init_value_helper::get(10)}; + T ref_A{user_def_types::get_init_value(5)}; + T ref_B{user_def_types::get_init_value(10)}; auto queue = util::get_cts_object::queue(); sycl::range<1> range(1); { - T result1{user_def_types::init_value_helper::get(0)}; - T result2{user_def_types::init_value_helper::get(0)}; + T result1{user_def_types::get_init_value(0)}; + T result2{user_def_types::get_init_value(0)}; { command_group_object cmo; sycl::buffer result_buffer1(&result1, range); @@ -73,8 +73,8 @@ class check_specialization_constants_same_command_group { } { - T result1{user_def_types::init_value_helper::get(0)}; - T result2{user_def_types::init_value_helper::get(0)}; + T result1{user_def_types::get_init_value(0)}; + T result2{user_def_types::get_init_value(0)}; { command_group_object cmo; sycl::buffer result_buffer1(&result1, range); @@ -91,7 +91,7 @@ class check_specialization_constants_same_command_group { if (!check_equal_values(ref_A, result1)) FAIL(log, "case 2 failed for value A for " + type_name); if (!check_equal_values( - T(user_def_types::init_value_helper::get(default_val)), + T(user_def_types::get_init_value(default_val)), result2)) FAIL(log, "case 2 failed for default value for " + type_name); } diff --git a/tests/spec_constants/spec_constants_same_name_inter_link.h b/tests/spec_constants/spec_constants_same_name_inter_link.h index 3587d5822..0f6b70376 100644 --- a/tests/spec_constants/spec_constants_same_name_inter_link.h +++ b/tests/spec_constants/spec_constants_same_name_inter_link.h @@ -48,10 +48,10 @@ class check_specialization_constants_same_name_inter_link_for_type { } } sycl::range<1> range(1); - T def_value{user_def_types::init_value_helper::get(0)}; - T ref_def_value{user_def_types::init_value_helper::get(0)}; - T result{user_def_types::init_value_helper::get(0)}; - T ref{user_def_types::init_value_helper::get(0)}; + T def_value{user_def_types::get_init_value(0)}; + T ref_def_value{user_def_types::get_init_value(0)}; + T result{user_def_types::get_init_value(0)}; + T ref{user_def_types::get_init_value(0)}; { // Setting ref values according to TU number fill_init_values(ref_def_value, TestConfig::tu); diff --git a/tests/spec_constants/spec_constants_same_name_inter_link_helper.h b/tests/spec_constants/spec_constants_same_name_inter_link_helper.h index 7c5f7ebcf..6f56c0a51 100644 --- a/tests/spec_constants/spec_constants_same_name_inter_link_helper.h +++ b/tests/spec_constants/spec_constants_same_name_inter_link_helper.h @@ -30,7 +30,7 @@ namespace { // SC_SN_IL_TU_NUM is defined in every TU template constexpr sycl::specialization_id sc_same_name_inter_link( - user_def_types::init_value_helper::get(SC_SN_IL_TU_NUM)); + user_def_types::get_init_value(SC_SN_IL_TU_NUM)); } // namespace diff --git a/tests/spec_constants/spec_constants_same_name_stress_helper.h b/tests/spec_constants/spec_constants_same_name_stress_helper.h index 779c5fea4..4e3fb9c4c 100644 --- a/tests/spec_constants/spec_constants_same_name_stress_helper.h +++ b/tests/spec_constants/spec_constants_same_name_stress_helper.h @@ -56,21 +56,21 @@ static std::string get_hint(int test_id) { // Specialization constant defined in global namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::init_value_helper::get( + user_def_types::get_init_value( to_integral(spec_const_help::sc_st_id::glob))); namespace g_outer { // Specialization constant defined in outer namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::init_value_helper::get( + user_def_types::get_init_value( to_integral(spec_const_help::sc_st_id::outer))); namespace g_inner { // Specialization constant defined in outer::inner namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::init_value_helper::get( + user_def_types::get_init_value( to_integral(spec_const_help::sc_st_id::outer_inner))); } // namespace g_inner @@ -78,7 +78,7 @@ namespace { // Specialization constant defined in outer::unnamed namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::init_value_helper::get( + user_def_types::get_init_value( to_integral(spec_const_help::sc_st_id::outer_unnamed))); template @@ -88,7 +88,7 @@ namespace g_u_inner { // Specialization constant defined in outer::unnamed::inner namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::init_value_helper::get( + user_def_types::get_init_value( to_integral(spec_const_help::sc_st_id::outer_unnamed_inner))); template @@ -99,7 +99,7 @@ namespace { // namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::init_value_helper::get( + user_def_types::get_init_value( to_integral(spec_const_help::sc_st_id::outer_unnamed_inner_unnamed))); template @@ -113,7 +113,7 @@ namespace { // Specialization constant defined in unnamed namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::init_value_helper::get( + user_def_types::get_init_value( to_integral(spec_const_help::sc_st_id::unnamed))); template @@ -123,7 +123,7 @@ namespace u_outer { // Specialization constant defined in unnamed::outer namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::init_value_helper::get( + user_def_types::get_init_value( to_integral(spec_const_help::sc_st_id::unnamed_outer))); template @@ -133,7 +133,7 @@ namespace { // Specialization constant defined in unnamed::outer::unnamed namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::init_value_helper::get( + user_def_types::get_init_value( to_integral(spec_const_help::sc_st_id::unnamed_outer_unnamed))); template @@ -144,7 +144,7 @@ namespace u_inner { // namespace template constexpr sycl::specialization_id sc_same_name( - user_def_types::init_value_helper::get( + user_def_types::get_init_value( to_integral(spec_const_help::sc_st_id::unnamed_outer_unnamed_inner))); template diff --git a/tests/spec_constants/spec_constants_separate_unit.cpp b/tests/spec_constants/spec_constants_separate_unit.cpp index a52113f81..2d84f6e46 100644 --- a/tests/spec_constants/spec_constants_separate_unit.cpp +++ b/tests/spec_constants/spec_constants_separate_unit.cpp @@ -14,7 +14,7 @@ using namespace get_spec_const; template inline constexpr sycl::specialization_id spec_const_external( - user_def_types::init_value_helper::get(default_val)); + user_def_types::get_init_value(default_val)); template bool check_kernel_handler_by_reference_external(sycl::kernel_handler &h, diff --git a/tests/spec_constants/spec_constants_via_handler_common.h b/tests/spec_constants/spec_constants_via_handler_common.h index c545ecf50..3e9837adc 100644 --- a/tests/spec_constants/spec_constants_via_handler_common.h +++ b/tests/spec_constants/spec_constants_via_handler_common.h @@ -22,14 +22,14 @@ inline constexpr int val_A = 5; template constexpr sycl::specialization_id sc_multiple( - user_def_types::init_value_helper::get(case_num)); + user_def_types::get_init_value(case_num)); template class kernel; template bool check_kernel_handler_by_reference(sycl::kernel_handler &h) { - T ref{user_def_types::init_value_helper::get(0)}; + T ref{user_def_types::get_init_value(0)}; fill_init_values(ref, val_A); return check_equal_values( ref, h.get_specialization_constant>()); @@ -37,7 +37,7 @@ bool check_kernel_handler_by_reference(sycl::kernel_handler &h) { template bool check_kernel_handler_by_value(sycl::kernel_handler h) { - T ref{user_def_types::init_value_helper::get(0)}; + T ref{user_def_types::get_init_value(0)}; fill_init_values(ref, val_A); return check_equal_values( ref, h.get_specialization_constant>()); @@ -49,9 +49,9 @@ class check_spec_constant_with_handler_for_type { void operator()(util::logger &log, const std::string &type_name) { auto queue = util::get_cts_object::queue(); sycl::range<1> range(1); - T result{user_def_types::init_value_helper::get(0)}; - T ref{user_def_types::init_value_helper::get(0)}; - T ref_other{user_def_types::init_value_helper::get(0)}; + T result{user_def_types::get_init_value(0)}; + T ref{user_def_types::get_init_value(0)}; + T ref_other{user_def_types::get_init_value(0)}; int val_B = 10; fill_init_values(ref, val_A); fill_init_values(ref_other, val_B); @@ -59,7 +59,7 @@ class check_spec_constant_with_handler_for_type { { const int case_num = 1; { - result = user_def_types::init_value_helper::get(0); + result = user_def_types::get_init_value(0); queue.submit([&](sycl::handler &cgh) { cgh.set_specialization_constant>(ref); result = cgh.get_specialization_constant>(); @@ -74,7 +74,7 @@ class check_spec_constant_with_handler_for_type { { const int case_num = 2; { - result = user_def_types::init_value_helper::get(0); + result = user_def_types::get_init_value(0); queue.submit([&](sycl::handler &cgh) { cgh.set_specialization_constant>(ref); cgh.set_specialization_constant>(ref_other); @@ -91,7 +91,7 @@ class check_spec_constant_with_handler_for_type { { const int case_num = 3; { - result = user_def_types::init_value_helper::get(0); + result = user_def_types::get_init_value(0); sycl::buffer result_buffer(&result, range); queue.submit([&](sycl::handler &cgh) { auto res_acc = @@ -113,7 +113,7 @@ class check_spec_constant_with_handler_for_type { { const int case_num = 4; { - result = user_def_types::init_value_helper::get(0); + result = user_def_types::get_init_value(0); sycl::buffer result_buffer(&result, range); queue.submit([&](sycl::handler &cgh) { auto res_acc = @@ -164,13 +164,13 @@ class check_spec_constant_with_handler_for_type { { const int case_num = 6; { - result = user_def_types::init_value_helper::get(0); + result = user_def_types::get_init_value(0); queue.submit([&](sycl::handler &cgh) { result = cgh.get_specialization_constant>(); }); } if (!check_equal_values( - T(user_def_types::init_value_helper::get(default_val)), + T(user_def_types::get_init_value(default_val)), result)) FAIL(log, "case " + std::to_string(case_num) + " for " + type_name_string::get(type_name)); @@ -181,7 +181,7 @@ class check_spec_constant_with_handler_for_type { { const int case_num = 7; { - result = user_def_types::init_value_helper::get(0); + result = user_def_types::get_init_value(0); sycl::buffer result_buffer(&result, range); queue.submit([&](sycl::handler &cgh) { auto res_acc = @@ -193,7 +193,7 @@ class check_spec_constant_with_handler_for_type { }); } if (!check_equal_values( - T(user_def_types::init_value_helper::get(default_val)), + T(user_def_types::get_init_value(default_val)), result)) FAIL(log, "case " + std::to_string(case_num) + " for " + type_name_string::get(type_name)); diff --git a/tests/spec_constants/spec_constants_via_kernel_bundle.h b/tests/spec_constants/spec_constants_via_kernel_bundle.h index 04b92c5e5..5f299a804 100644 --- a/tests/spec_constants/spec_constants_via_kernel_bundle.h +++ b/tests/spec_constants/spec_constants_via_kernel_bundle.h @@ -136,7 +136,7 @@ struct values> : values {}; */ template constexpr sycl::specialization_id spec_const_by_kernel_bundle( - user_def_types::init_value_helper::get( + user_def_types::get_init_value( specialization_constants_via_kernel_bundle::values::initial)); namespace specialization_constants_via_kernel_bundle { @@ -300,7 +300,7 @@ void set_value(sycl::kernel_bundle& bundle) { " set_specialization_constant"); for (int i = 0; i < id::n_set; ++i) { // Prepare value to store - T value{user_def_types::init_value_helper::get(0)}; + T value{user_def_types::get_init_value(0)}; fill_init_values(value, values::reference(i)); bundle.template set_specialization_constant< @@ -323,11 +323,11 @@ bool check_value(specStorageT&& storage) { using namespace get_spec_const; // Prepare to read value - T value{user_def_types::init_value_helper::get(0)}; + T value{user_def_types::get_init_value(0)}; fill_init_values(value, values::empty); // Prepare to compare values - T expected{user_def_types::init_value_helper::get(0)}; + T expected{user_def_types::get_init_value(0)}; if constexpr (id::n_set == 0) { fill_init_values(expected, values::initial); } else { From f2ad8b4327af823794c89183e63eb2c61c20d59d Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Fri, 19 Jan 2024 03:44:47 -0800 Subject: [PATCH 10/12] Cleanup unnecessary casts --- tests/spec_constants/spec_constants_multiple.h | 15 ++++++--------- .../spec_constants_same_command_group_common.h | 5 ++--- .../spec_constants_via_handler_common.h | 10 ++++------ 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/tests/spec_constants/spec_constants_multiple.h b/tests/spec_constants/spec_constants_multiple.h index 5f8ea7556..1396f9567 100644 --- a/tests/spec_constants/spec_constants_multiple.h +++ b/tests/spec_constants/spec_constants_multiple.h @@ -114,15 +114,12 @@ class check_specialization_constants_multiple_for_type { if (!check_equal_values(ref1, result_vec[0].value) || !check_equal_values(ref2, result_vec[1].value) || !check_equal_values(ref3, result_vec[2].value) || - !check_equal_values( - T(user_def_types::get_init_value(def_values[3])), - result_vec[3].value) || - !check_equal_values( - T(user_def_types::get_init_value(def_values[4])), - result_vec[4].value) || - !check_equal_values( - T(user_def_types::get_init_value(def_values[5])), - result_vec[5].value)) + !check_equal_values(user_def_types::get_init_value(def_values[3]), + result_vec[3].value) || + !check_equal_values(user_def_types::get_init_value(def_values[4]), + result_vec[4].value) || + !check_equal_values(user_def_types::get_init_value(def_values[5]), + result_vec[5].value)) FAIL(log, "multiple spec const for " + type_name_string::get(type_name)); } diff --git a/tests/spec_constants/spec_constants_same_command_group_common.h b/tests/spec_constants/spec_constants_same_command_group_common.h index e4a4b8592..6c2ab3ed5 100644 --- a/tests/spec_constants/spec_constants_same_command_group_common.h +++ b/tests/spec_constants/spec_constants_same_command_group_common.h @@ -90,9 +90,8 @@ class check_specialization_constants_same_command_group { } if (!check_equal_values(ref_A, result1)) FAIL(log, "case 2 failed for value A for " + type_name); - if (!check_equal_values( - T(user_def_types::get_init_value(default_val)), - result2)) + if (!check_equal_values(user_def_types::get_init_value(default_val), + result2)) FAIL(log, "case 2 failed for default value for " + type_name); } } diff --git a/tests/spec_constants/spec_constants_via_handler_common.h b/tests/spec_constants/spec_constants_via_handler_common.h index 3e9837adc..87a883796 100644 --- a/tests/spec_constants/spec_constants_via_handler_common.h +++ b/tests/spec_constants/spec_constants_via_handler_common.h @@ -169,9 +169,8 @@ class check_spec_constant_with_handler_for_type { result = cgh.get_specialization_constant>(); }); } - if (!check_equal_values( - T(user_def_types::get_init_value(default_val)), - result)) + if (!check_equal_values(user_def_types::get_init_value(default_val), + result)) FAIL(log, "case " + std::to_string(case_num) + " for " + type_name_string::get(type_name)); } @@ -192,9 +191,8 @@ class check_spec_constant_with_handler_for_type { }); }); } - if (!check_equal_values( - T(user_def_types::get_init_value(default_val)), - result)) + if (!check_equal_values(user_def_types::get_init_value(default_val), + result)) FAIL(log, "case " + std::to_string(case_num) + " for " + type_name_string::get(type_name)); } From 62920406727c01628813327f1b08051be5157ceb Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Fri, 19 Jan 2024 03:46:48 -0800 Subject: [PATCH 11/12] apply clang-format --- tests/multi_ptr/multi_ptr_implicit_conversions.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/multi_ptr/multi_ptr_implicit_conversions.h b/tests/multi_ptr/multi_ptr_implicit_conversions.h index 91adf3693..0a92b5158 100644 --- a/tests/multi_ptr/multi_ptr_implicit_conversions.h +++ b/tests/multi_ptr/multi_ptr_implicit_conversions.h @@ -127,8 +127,8 @@ class run_implicit_convert_tests { // for cases, when dest_multi_ptr_t equals to multi_ptr const T value_dest = *(reinterpret_cast(mptr_dest.get())); - res_acc[0] = (value_dest == - user_def_types::get_init_value(expected_val)); + res_acc[0] = + (value_dest == user_def_types::get_init_value(expected_val)); }; using kname = From e4e58e7869469676a0ada25bd4d6b455581be309 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Fri, 19 Jan 2024 06:30:57 -0800 Subject: [PATCH 12/12] Fix build with hipSYCL --- tests/common/type_list.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/common/type_list.h b/tests/common/type_list.h index 6ecf8d4c9..5c6dc344f 100644 --- a/tests/common/type_list.h +++ b/tests/common/type_list.h @@ -175,10 +175,12 @@ struct vec_marray_element_type> { using type = T; }; +#ifndef SYCL_CTS_COMPILING_WITH_HIPSYCL template struct vec_marray_element_type> { using type = T; }; +#endif // Returns instance of type T template