Skip to content

Commit

Permalink
Split double * atomic_ref testing
Browse files Browse the repository at this point in the history
This commit splits the testing of atomic_ref with double * into separate
tests to allow for fp64 support checks. This is related to
KhronosGroup/SYCL-Docs#526.

Signed-off-by: Larsen, Steffen <[email protected]>
  • Loading branch information
steffenlarsen committed Jan 5, 2024
1 parent 9691bc0 commit ab143dd
Show file tree
Hide file tree
Showing 11 changed files with 571 additions and 5 deletions.
55 changes: 55 additions & 0 deletions tests/atomic_ref/atomic_ref_T_op_test_pointers_fp64.cpp
Original file line number Diff line number Diff line change
@@ -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<void *>() && device_has_not_aspect_atomic64()) {
SKIP(
"Device does not support atomic64 operations. "
"Skipping the test case.");
}
for_all_types<atomic_ref::tests::api::run_T_op_test>(type_pack);
});

} // namespace atomic_ref::tests::api::core
Original file line number Diff line number Diff line change
@@ -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<void*>() && device_has_not_aspect_atomic64()) {
SKIP(
"Device does not support atomic64 operations. "
"Skipping the test case.");
}
for_all_types<atomic_ref::tests::api::run_add_sub_op_all_types_test>(
type_pack);
});

} // namespace atomic_ref::tests::api::core
55 changes: 55 additions & 0 deletions tests/atomic_ref/atomic_ref_assign_op_test_pointers_fp64.cpp
Original file line number Diff line number Diff line change
@@ -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<void *>() && device_has_not_aspect_atomic64()) {
SKIP(
"Device does not support atomic64 operations. "
"Skipping the test case.");
}
for_all_types<atomic_ref::tests::api::run_assign_op_test>(type_pack);
});

} // namespace atomic_ref::tests::api::core
17 changes: 12 additions & 5 deletions tests/atomic_ref/atomic_ref_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int*, unsigned int*, long int*, unsigned long int*,
long long*, unsigned long long*, float*,
double*>::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;
}

Expand All @@ -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<double*>::generate("double *");
return types;
}

/**
* @brief Factory function for getting type_pack with pointers types that
* depends on full conformance mode enabling status
Expand Down
Original file line number Diff line number Diff line change
@@ -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<void *>() && device_has_not_aspect_atomic64()) {
SKIP(
"Device does not support atomic64 operations. "
"Skipping the test case.");
}
for_all_types<atomic_ref::tests::api::run_compare_exchange_test>(type_pack);
});

} // namespace atomic_ref::tests::api::core
55 changes: 55 additions & 0 deletions tests/atomic_ref/atomic_ref_constructors_pointers_fp64.cpp
Original file line number Diff line number Diff line change
@@ -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<void *>() && device_has_not_aspect_atomic64()) {
SKIP(
"Device does not support atomic64 operations. "
"Skipping the test case.");
}
for_all_types<atomic_ref::tests::constructors::run_test>(types);
});

} // namespace atomic_ref::tests::constructors::core
55 changes: 55 additions & 0 deletions tests/atomic_ref/atomic_ref_exchange_test_pointers_fp64.cpp
Original file line number Diff line number Diff line change
@@ -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<void *>() && device_has_not_aspect_atomic64()) {
SKIP(
"Device does not support atomic64 operations. "
"Skipping the test case.");
}
for_all_types<atomic_ref::tests::api::run_exchange_test>(type_pack);
});

} // namespace atomic_ref::tests::api::core
Loading

0 comments on commit ab143dd

Please sign in to comment.