Skip to content

Commit

Permalink
sycl::opencl: clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
fknorr committed Sep 17, 2024
1 parent 79f4348 commit b7bcf5f
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 146 deletions.
27 changes: 10 additions & 17 deletions tests/accessor_legacy/accessor_types_image_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ 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::opencl::cl_int",
"sycl::opencl::cl_uint",
"sycl::opencl::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
13 changes: 7 additions & 6 deletions tests/buffer/buffer_api_fp64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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::opencl::cl_double>(log, "sycl::opencl::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
13 changes: 7 additions & 6 deletions tests/buffer/buffer_storage_fp64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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::opencl::cl_double>(log, "sycl::opencl::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
66 changes: 31 additions & 35 deletions tests/common/type_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ struct user_struct {

element_type operator[](size_t) const { return b; }

friend bool operator==(const user_struct &lhs, const user_struct &rhs) {
friend bool operator==(const user_struct& lhs, const user_struct& rhs) {
static constexpr auto eps = 1e-4f;
return (((lhs.a + eps > rhs.a) && (lhs.a < rhs.a + eps)) &&
(lhs.b == rhs.b) && (lhs.c == rhs.c));
}
friend bool operator!=(const user_struct &lhs, const user_struct &rhs) {
friend bool operator!=(const user_struct& lhs, const user_struct& rhs) {
return !(lhs == rhs);
}
};
Expand All @@ -45,7 +45,7 @@ class Base {
PrimaryType member;
Base() = default;
Base(int value) { value_operations::assign(member, value); }
bool operator==(const Base &rhs) const { return member == rhs.member; }
bool operator==(const Base& rhs) const { return member == rhs.member; }
};

template <typename PrimaryType>
Expand All @@ -63,22 +63,22 @@ struct no_cnstr {
int b;
char c;

constexpr auto &operator=(const int &v) {
constexpr auto& operator=(const int& v) {
a = v;
b = v;
c = v;
return *this;
}

friend bool operator==(const no_cnstr &lhs, const no_cnstr &rhs) {
friend bool operator==(const no_cnstr& lhs, const no_cnstr& rhs) {
return ((lhs.a == rhs.a) && (lhs.b == rhs.b) && (lhs.c == rhs.c));
}

friend bool operator!=(const no_cnstr &lhs, const no_cnstr &rhs) {
friend bool operator!=(const no_cnstr& lhs, const no_cnstr& rhs) {
return !(lhs == rhs);
}

friend no_cnstr operator+(const no_cnstr &lhs, int i) {
friend no_cnstr operator+(const no_cnstr& lhs, int i) {
return {lhs.a + static_cast<float>(i), lhs.b + i,
static_cast<char>(lhs.c + i)};
}
Expand All @@ -101,16 +101,16 @@ struct def_cnstr {
c = val;
}

constexpr auto &operator=(const int &v) {
constexpr auto& operator=(const int& v) {
assign(v);
return *this;
}

inline friend bool operator==(const def_cnstr &lhs, const def_cnstr &rhs) {
inline friend bool operator==(const def_cnstr& lhs, const def_cnstr& rhs) {
return ((lhs.a == rhs.a) && (lhs.b == rhs.b) && (lhs.c == rhs.c));
}

friend bool operator!=(const def_cnstr &lhs, const def_cnstr &rhs) {
friend bool operator!=(const def_cnstr& lhs, const def_cnstr& rhs) {
return !(lhs == rhs);
}
};
Expand All @@ -127,11 +127,11 @@ class no_def_cnstr {

constexpr no_def_cnstr(int val) : a(val * 3.0f), b(val * 2), c(val) {}

friend bool operator==(const no_def_cnstr &lhs, const no_def_cnstr &rhs) {
friend bool operator==(const no_def_cnstr& lhs, const no_def_cnstr& rhs) {
return ((lhs.a == rhs.a) && (lhs.b == rhs.b) && (lhs.c == rhs.c));
}

friend bool operator!=(const no_def_cnstr &lhs, const no_def_cnstr &rhs) {
friend bool operator!=(const no_def_cnstr& lhs, const no_def_cnstr& rhs) {
return !(lhs == rhs);
}
};
Expand All @@ -143,21 +143,21 @@ struct arrow_operator_overloaded {
int b;
char c;

void operator=(const int &v) {
void operator=(const int& v) {
this->a = v;
this->b = v;
this->c = v;
}

arrow_operator_overloaded *operator->() { return this; }
const arrow_operator_overloaded *operator->() const { return this; }
arrow_operator_overloaded* operator->() { return this; }
const arrow_operator_overloaded* operator->() const { return this; }

friend bool operator==(const arrow_operator_overloaded &lhs,
const arrow_operator_overloaded &rhs) {
friend bool operator==(const arrow_operator_overloaded& lhs,
const arrow_operator_overloaded& rhs) {
return ((lhs.a == rhs.a) && (lhs.b == rhs.b) && (lhs.c == rhs.c));
}
friend bool operator!=(const arrow_operator_overloaded &lhs,
const arrow_operator_overloaded &rhs) {
friend bool operator!=(const arrow_operator_overloaded& lhs,
const arrow_operator_overloaded& rhs) {
return !(lhs == rhs);
}
};
Expand Down Expand Up @@ -219,22 +219,18 @@ inline auto get_vector_types() {
static const auto pack = named_type_pack<
bool, char, signed char, unsigned char, short, unsigned short, int,
unsigned int, long, unsigned long, long long, unsigned long long, float,
sycl::opencl::cl_float, sycl::byte, sycl::opencl::cl_bool, sycl::opencl::cl_char, sycl::opencl::cl_uchar,
sycl::opencl::cl_short, sycl::opencl::cl_ushort, sycl::opencl::cl_int, sycl::opencl::cl_uint,
sycl::opencl::cl_long, sycl::opencl::cl_ulong>::generate("bool", "char", "signed char",
"unsigned char", "short",
"unsigned short", "int",
"unsigned int", "long",
"unsigned long", "long long",
"unsigned long long", "float",
"sycl::opencl::cl_float", "sycl::byte",
"sycl::opencl::cl_bool", "sycl::opencl::cl_char",
"sycl::opencl::cl_uchar",
"sycl::opencl::cl_short",
"sycl::opencl::cl_ushort",
"sycl::opencl::cl_int", "sycl::opencl::cl_uint",
"sycl::opencl::cl_long",
"sycl::opencl::cl_ulong");
sycl::opencl::cl_float, sycl::byte, sycl::opencl::cl_bool,
sycl::opencl::cl_char, sycl::opencl::cl_uchar, sycl::opencl::cl_short,
sycl::opencl::cl_ushort, sycl::opencl::cl_int, sycl::opencl::cl_uint,
sycl::opencl::cl_long, sycl::opencl::cl_ulong>::
generate("bool", "char", "signed char", "unsigned char", "short",
"unsigned short", "int", "unsigned int", "long", "unsigned long",
"long long", "unsigned long long", "float",
"sycl::opencl::cl_float", "sycl::byte", "sycl::opencl::cl_bool",
"sycl::opencl::cl_char", "sycl::opencl::cl_uchar",
"sycl::opencl::cl_short", "sycl::opencl::cl_ushort",
"sycl::opencl::cl_int", "sycl::opencl::cl_uint",
"sycl::opencl::cl_long", "sycl::opencl::cl_ulong");
#else
static const auto pack =
named_type_pack<bool, char, signed char, unsigned char, short,
Expand Down
30 changes: 20 additions & 10 deletions tests/group/group_async_work_group_copy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,26 @@ class TEST_NAME : public util::test_base {
for_type_and_vectors<check_type, sycl::byte>(log, "sycl::byte");

#if SYCL_CTS_ENABLE_OPENCL_INTEROP_TESTS
for_type_and_vectors<check_type, sycl::opencl::cl_bool>(log, "sycl::opencl::cl_bool");
for_type_and_vectors<check_type, sycl::opencl::cl_char>(log, "sycl::opencl::cl_char");
for_type_and_vectors<check_type, sycl::opencl::cl_uchar>(log, "sycl::opencl::cl_uchar");
for_type_and_vectors<check_type, sycl::opencl::cl_short>(log, "sycl::opencl::cl_short");
for_type_and_vectors<check_type, sycl::opencl::cl_ushort>(log, "sycl::opencl::cl_ushort");
for_type_and_vectors<check_type, sycl::opencl::cl_int>(log, "sycl::opencl::cl_int");
for_type_and_vectors<check_type, sycl::opencl::cl_uint>(log, "sycl::opencl::cl_uint");
for_type_and_vectors<check_type, sycl::opencl::cl_long>(log, "sycl::opencl::cl_long");
for_type_and_vectors<check_type, sycl::opencl::cl_ulong>(log, "sycl::opencl::cl_ulong");
for_type_and_vectors<check_type, sycl::opencl::cl_float>(log, "sycl::opencl::cl_float");
for_type_and_vectors<check_type, sycl::opencl::cl_bool>(
log, "sycl::opencl::cl_bool");
for_type_and_vectors<check_type, sycl::opencl::cl_char>(
log, "sycl::opencl::cl_char");
for_type_and_vectors<check_type, sycl::opencl::cl_uchar>(
log, "sycl::opencl::cl_uchar");
for_type_and_vectors<check_type, sycl::opencl::cl_short>(
log, "sycl::opencl::cl_short");
for_type_and_vectors<check_type, sycl::opencl::cl_ushort>(
log, "sycl::opencl::cl_ushort");
for_type_and_vectors<check_type, sycl::opencl::cl_int>(
log, "sycl::opencl::cl_int");
for_type_and_vectors<check_type, sycl::opencl::cl_uint>(
log, "sycl::opencl::cl_uint");
for_type_and_vectors<check_type, sycl::opencl::cl_long>(
log, "sycl::opencl::cl_long");
for_type_and_vectors<check_type, sycl::opencl::cl_ulong>(
log, "sycl::opencl::cl_ulong");
for_type_and_vectors<check_type, sycl::opencl::cl_float>(
log, "sycl::opencl::cl_float");
#endif

#ifdef INT8_MAX
Expand Down
15 changes: 7 additions & 8 deletions tests/group/group_async_work_group_copy_fp16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ namespace TEST_NAMESPACE {
class TEST_NAME : public util::test_base {
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();

Expand All @@ -35,10 +35,9 @@ class TEST_NAME : public util::test_base {
return;
}
// Test using queue constructed already
for_type_and_vectors<check_type, sycl::half>(queue, log,
"sycl::half");
for_type_and_vectors<check_type, sycl::opencl::cl_half>(queue, log,
"sycl::opencl::cl_half");
for_type_and_vectors<check_type, sycl::half>(queue, log, "sycl::half");
for_type_and_vectors<check_type, sycl::opencl::cl_half>(
queue, log, "sycl::opencl::cl_half");
}
}
};
Expand Down
18 changes: 9 additions & 9 deletions tests/group/group_async_work_group_copy_fp64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ namespace TEST_NAMESPACE {
class TEST_NAME : public util::test_base {
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(
"Device does not support double precision floating point operations");
"Device does not support double precision floating point "
"operations");
return;
}
// Test using queue constructed already
for_type_and_vectors<check_type, double>(queue, log,
"double");
for_type_and_vectors<check_type, double>(queue, log, "double");
#if SYCL_CTS_ENABLE_OPENCL_INTEROP_TESTS
for_type_and_vectors<check_type, sycl::opencl::cl_double>(queue, log,
"sycl::opencl::cl_double");
for_type_and_vectors<check_type, sycl::opencl::cl_double>(
queue, log, "sycl::opencl::cl_double");
#endif
}
}
Expand Down
Loading

0 comments on commit b7bcf5f

Please sign in to comment.