Skip to content

Commit

Permalink
Merge pull request #873 from fknorr/compat-cl-interop
Browse files Browse the repository at this point in the history
Compatibility: Only use `cl_*` types if SYCL_CTS_ENABLE_OPENCL_INTEROP_TESTS is set
  • Loading branch information
bader authored Oct 3, 2024
2 parents e73df15 + b7bcf5f commit bbe812f
Show file tree
Hide file tree
Showing 21 changed files with 282 additions and 283 deletions.
4 changes: 2 additions & 2 deletions tests/accessor_legacy/accessor_constructors_buffer_utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ class buffer_accesor_input_data {

using range_t = sycl::range<dataDims>;
using offset_t = sycl::id<dataDims>;
using data_t = std::vector<sycl::cl_uchar>;
using data_t = std::vector<sycl::opencl::cl_uchar>;
using buffer_t = sycl::buffer<T, dataDims, allocatorT...>;

public:
Expand Down Expand Up @@ -384,7 +384,7 @@ class buffer_accesor_input_data<T, 0, allocatorT...> {

using range_t = sycl::range<dataDims>;
using offset_t = sycl::id<dataDims>;
using data_t = std::vector<sycl::cl_uchar>;
using data_t = std::vector<sycl::opencl::cl_uchar>;
using buffer_t = sycl::buffer<T, dataDims, allocatorT...>;

public:
Expand Down
16 changes: 8 additions & 8 deletions tests/accessor_legacy/accessor_types_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,49 +82,49 @@ class check_all_types_core {
"user alias");

#ifdef INT8_MAX
if (!std::is_same<std::int8_t, sycl::cl_char>::value) {
if (!std::is_same<std::int8_t, sycl::opencl::cl_char>::value) {
for_type_and_vectors<check_type, std::int8_t>(
log, queue, "std::int8_t");
}
#endif
#ifdef UINT8_MAX
if (!std::is_same<std::uint8_t, sycl::cl_uchar>::value) {
if (!std::is_same<std::uint8_t, sycl::opencl::cl_uchar>::value) {
for_type_and_vectors<check_type, std::uint8_t>(
log, queue, "std::uint8_t");
}
#endif
#ifdef INT16_MAX
if (!std::is_same<std::int16_t, sycl::cl_short>::value) {
if (!std::is_same<std::int16_t, sycl::opencl::cl_short>::value) {
for_type_and_vectors<check_type, std::int16_t>(
log, queue, "std::int16_t");
}
#endif
#ifdef UINT16_MAX
if (!std::is_same<std::uint16_t, sycl::cl_ushort>::value) {
if (!std::is_same<std::uint16_t, sycl::opencl::cl_ushort>::value) {
for_type_and_vectors<check_type, std::uint16_t>(
log, queue, "std::uint16_t");
}
#endif
#ifdef INT32_MAX
if (!std::is_same<std::int32_t, sycl::cl_int>::value) {
if (!std::is_same<std::int32_t, sycl::opencl::cl_int>::value) {
for_type_and_vectors<check_type, std::int32_t>(
log, queue, "std::int32_t");
}
#endif
#ifdef UINT32_MAX
if (!std::is_same<std::uint32_t, sycl::cl_uint>::value) {
if (!std::is_same<std::uint32_t, sycl::opencl::cl_uint>::value) {
for_type_and_vectors<check_type, std::uint32_t>(
log, queue, "std::uint32_t");
}
#endif
#ifdef INT64_MAX
if (!std::is_same<std::int64_t, sycl::cl_long>::value) {
if (!std::is_same<std::int64_t, sycl::opencl::cl_long>::value) {
for_type_and_vectors<check_type, std::int64_t>(
log, queue, "std::int64_t");
}
#endif
#ifdef UINT64_MAX
if (!std::is_same<std::uint64_t, sycl::cl_ulong>::value) {
if (!std::is_same<std::uint64_t, sycl::opencl::cl_ulong>::value) {
for_type_and_vectors<check_type, std::uint64_t>(
log, queue, "std::uint64_t");
}
Expand Down
4 changes: 2 additions & 2 deletions tests/accessor_legacy/accessor_types_fp16.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class check_all_types_fp16 {
// Extended type coverage
for_type_and_vectors<check_type, sycl::half>(
log, queue, "sycl::half");
for_type_and_vectors<check_type, sycl::cl_half>(
log, queue, "sycl::cl_half");
for_type_and_vectors<check_type, sycl::opencl::cl_half>(
log, queue, "sycl::opencl::cl_half");

#endif // SYCL_CTS_ENABLE_FULL_CONFORMANCE

Expand Down
4 changes: 2 additions & 2 deletions tests/accessor_legacy/accessor_types_fp64.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class check_all_types_fp64 {
// Extended type coverage
for_type_and_vectors<check_type, double>(
log, queue, "double");
for_type_and_vectors<check_type, sycl::cl_double>(
log, queue, "sycl::cl_double");
for_type_and_vectors<check_type, sycl::opencl::cl_double>(
log, queue, "sycl::opencl::cl_double");

#endif // SYCL_CTS_ENABLE_FULL_CONFORMANCE

Expand Down
29 changes: 11 additions & 18 deletions tests/accessor_legacy/accessor_types_image_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,18 @@

namespace TEST_NAMESPACE {

using user_alias = sycl::vec<sycl::cl_int, 4>;
using user_alias = sycl::vec<sycl::opencl::cl_int, 4>;

/**
* @brief Run specific image accessors' tests for core type set
*/
template <template <typename, typename> class action,
typename extensionTagT>
template <template <typename, typename> class action, typename extensionTagT>
class check_all_types_image_core {

template <typename T>
using check_type = action<T, extensionTagT>;

public:
static void run(sycl::queue& queue, sycl_cts::util::logger &log) {

public:
static void run(sycl::queue& queue, sycl_cts::util::logger& log) {
if (!queue.get_device().get_info<sycl::info::device::image_support>()) {
log.note("Device does not support images -- skipping check");
return;
Expand All @@ -42,18 +39,14 @@ class check_all_types_image_core {
// Skip tests in case extension not available
using availability =
sycl_cts::util::extensions::availability<extensionTagT>;
if (!availability::check(queue, log))
return;
if (!availability::check(queue, log)) return;

const auto types =
named_type_pack<sycl::cl_int4,
sycl::cl_uint4,
sycl::cl_float4,
user_alias>::generate(
"sycl::cl_int",
"sycl::cl_uint",
"sycl::cl_float",
"user_alias");
named_type_pack<sycl::cl_int4, sycl::cl_uint4, sycl::cl_float4,
user_alias>::generate("sycl::opencl::cl_int",
"sycl::opencl::cl_uint",
"sycl::opencl::cl_float",
"user_alias");

for_all_types<check_type>(types, log, queue);

Expand All @@ -63,4 +56,4 @@ class check_all_types_image_core {

} // namespace TEST_NAMESPACE

#endif // SYCL_1_2_1_TESTS_ACCESSOR_ACCESSOR_TYPES_IMAGE_CORE_H
#endif // SYCL_1_2_1_TESTS_ACCESSOR_ACCESSOR_TYPES_IMAGE_CORE_H
2 changes: 1 addition & 1 deletion tests/accessor_legacy/accessor_types_image_fp16.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class check_all_types_image_fp16 {
if (!availability::check(queue, log))
return;

check_type<sycl::cl_half4>()(log, queue, "sycl::cl_half");
check_type<sycl::cl_half4>()(log, queue, "sycl::opencl::cl_half");

queue.wait_and_throw();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/buffer/buffer_api_fp16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SYCL 2020 Conformance Test Suite
//
// Provides buffer api tests for sycl::half and sycl::cl_half
// Provides buffer api tests for sycl::half and sycl::opencl::cl_half
//
*******************************************************************************/

Expand Down Expand Up @@ -38,7 +38,7 @@ class TEST_NAME : public util::test_base {
sycl::half>(log, "sycl::half");
#if SYCL_CTS_ENABLE_FULL_CONFORMANCE
for_type_and_vectors<buffer_api_common::check_buffer_api_for_type,
sycl::cl_half>(log, "sycl::cl_half");
sycl::opencl::cl_half>(log, "sycl::opencl::cl_half");
#endif // SYCL_CTS_ENABLE_FULL_CONFORMANCE
}
};
Expand Down
15 changes: 8 additions & 7 deletions tests/buffer/buffer_api_fp64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SYCL 2020 Conformance Test Suite
//
// Provides buffer api tests for double and sycl::cl_double
// Provides buffer api tests for double and sycl::opencl::cl_double
//
*******************************************************************************/

Expand All @@ -18,16 +18,16 @@ using namespace sycl_cts;
/** test sycl::buffer API
*/
class TEST_NAME : public util::test_base {
public:
public:
/** return information about this test
*/
void get_info(test_base::info &out) const override {
void get_info(test_base::info& out) const override {
set_test_info(out, TOSTRING(TEST_NAME), TEST_FILE);
}

/** execute the test
*/
void run(util::logger &log) override {
void run(util::logger& log) override {
auto queue = util::get_cts_object::queue();
if (!queue.get_device().has(sycl::aspect::fp64)) {
log.note(
Expand All @@ -38,12 +38,13 @@ class TEST_NAME : public util::test_base {
log, "double");
#if SYCL_CTS_ENABLE_FULL_CONFORMANCE
for_type_and_vectors<buffer_api_common::check_buffer_api_for_type,
sycl::cl_double>(log, "sycl::cl_double");
#endif // SYCL_CTS_ENABLE_FULL_CONFORMANCE
sycl::opencl::cl_double>(log,
"sycl::opencl::cl_double");
#endif // SYCL_CTS_ENABLE_FULL_CONFORMANCE
}
};

// construction of this proxy will register the above test
util::test_proxy<TEST_NAME> proxy;

} // namespace TEST_NAMESPACE
} // namespace TEST_NAMESPACE
4 changes: 2 additions & 2 deletions tests/buffer/buffer_constructors_fp16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SYCL 2020 Conformance Test Suite
//
// Provides buffer constructors tests for sycl::half and sycl::cl_half
// Provides buffer constructors tests for sycl::half and sycl::opencl::cl_half
//
*******************************************************************************/

Expand Down Expand Up @@ -40,7 +40,7 @@ class TEST_NAME : public util::test_base {
#if SYCL_CTS_ENABLE_FULL_CONFORMANCE
for_type_and_vectors<
buffer_constructors_common::check_buffer_ctors_for_type,
sycl::cl_half>(log, "sycl::cl_half");
sycl::opencl::cl_half>(log, "sycl::opencl::cl_half");
#endif // SYCL_CTS_ENABLE_FULL_CONFORMANCE
}
};
Expand Down
4 changes: 2 additions & 2 deletions tests/buffer/buffer_constructors_fp64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SYCL 2020 Conformance Test Suite
//
// Provides buffer constructors tests for double and sycl::cl_double
// Provides buffer constructors tests for double and sycl::opencl::cl_double
//
*******************************************************************************/

Expand Down Expand Up @@ -40,7 +40,7 @@ class TEST_NAME : public util::test_base {
#if SYCL_CTS_ENABLE_FULL_CONFORMANCE
for_type_and_vectors<
buffer_constructors_common::check_buffer_ctors_for_type,
sycl::cl_double>(log, "sycl::cl_double");
sycl::opencl::cl_double>(log, "sycl::opencl::cl_double");
#endif // SYCL_CTS_ENABLE_FULL_CONFORMANCE
}
};
Expand Down
4 changes: 2 additions & 2 deletions tests/buffer/buffer_storage_fp16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SYCL 2020 Conformance Test Suite
//
// Provides buffer storage methods tests for sycl::half and
sycl::cl_half
sycl::opencl::cl_half
//
*******************************************************************************/

Expand Down Expand Up @@ -39,7 +39,7 @@ class TEST_NAME : public util::test_base {
sycl::half>(log, "sycl::half");
#if SYCL_CTS_ENABLE_FULL_CONFORMANCE
for_type_and_vectors<buffer_storage_common::check_buffer_storage_for_type,
sycl::cl_half>(log, "sycl::cl_half");
sycl::opencl::cl_half>(log, "sycl::opencl::cl_half");
#endif // SYCL_CTS_ENABLE_FULL_CONFORMANCE
}
};
Expand Down
15 changes: 8 additions & 7 deletions tests/buffer/buffer_storage_fp64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SYCL 2020 Conformance Test Suite
//
// Provides buffer storage methods tests for double and sycl::cl_double
// Provides buffer storage methods tests for double and sycl::opencl::cl_double
//
*******************************************************************************/

Expand All @@ -18,16 +18,16 @@ using namespace sycl_cts;
/** test sycl::buffer storage methods
*/
class TEST_NAME : public util::test_base {
public:
public:
/** return information about this test
*/
void get_info(test_base::info &out) const override {
void get_info(test_base::info& out) const override {
set_test_info(out, TOSTRING(TEST_NAME), TEST_FILE);
}

/** execute the test
*/
void run(util::logger &log) override {
void run(util::logger& log) override {
auto queue = util::get_cts_object::queue();
if (!queue.get_device().has(sycl::aspect::fp64)) {
log.note(
Expand All @@ -38,12 +38,13 @@ class TEST_NAME : public util::test_base {
double>(log, "double");
#if SYCL_CTS_ENABLE_FULL_CONFORMANCE
for_type_and_vectors<buffer_storage_common::check_buffer_storage_for_type,
sycl::cl_double>(log, "sycl::cl_double");
#endif // SYCL_CTS_ENABLE_FULL_CONFORMANCE
sycl::opencl::cl_double>(log,
"sycl::opencl::cl_double");
#endif // SYCL_CTS_ENABLE_FULL_CONFORMANCE
}
};

// construction of this proxy will register the above test
util::test_proxy<TEST_NAME> proxy;

} // namespace TEST_NAMESPACE
} // namespace TEST_NAMESPACE
4 changes: 2 additions & 2 deletions tests/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ struct image_access;
*/
template <>
struct image_access<1> {
using int_type = sycl::cl_int;
using float_type = sycl::cl_float;
using int_type = sycl::opencl::cl_int;
using float_type = sycl::opencl::cl_float;
static int_type get_int(const sycl::id<1>& i) {
return int_type(i.get(0));
}
Expand Down
Loading

0 comments on commit bbe812f

Please sign in to comment.