Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL][ESIMD] Decrease type coverage for core tests #832

Merged
merged 12 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions SYCL/ESIMD/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ This directory contains ESIMD tests which are run on Intel GPU device only.
Some of them can run on host device too, but in general it is not always
possible as some of ESIMD APIs (e.g. memory access via accessors) is not
implemented for the host device.

Tests within this directory has additional preprocessor definitions available.

`ESIMD_TESTS_FULL_COVERAGE` (default: not defined)\
Enable extended coverage and testing logic with significantly increased
compilation and execution time. Extensive tests could be run manually if needed,
but do not affect CI performance for the basic functionality.
1 change: 1 addition & 0 deletions SYCL/ESIMD/api/functional/ctors/ctor_fill_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ int main(int, char **) {
}
{
// Validate basic functionality works for every type

const auto types = get_tested_types<tested_types::core>();
const auto sizes = get_all_sizes();
const auto contexts = unnamed_type_pack<ctors::var_decl>::generate();
Expand Down
1 change: 1 addition & 0 deletions SYCL/ESIMD/api/functional/ctors/ctor_load_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ int main(int, char **) {
esimd_test::createExceptionHandler());

bool passed = true;

const auto types = get_tested_types<tested_types::core>();
const auto sizes = get_all_sizes();

Expand Down
2 changes: 1 addition & 1 deletion SYCL/ESIMD/api/functional/ctors/ctor_move_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ using namespace esimd_test::api::functional;

int main(int, char **) {
bool passed = true;
const auto types = get_tested_types<tested_types::fp_extra>();
const auto types = get_tested_types<tested_types::core>();
const auto sizes = get_all_sizes();
const auto contexts =
unnamed_type_pack<ctors::initializer, ctors::var_decl,
Expand Down
21 changes: 20 additions & 1 deletion SYCL/ESIMD/api/functional/type_coverage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ enum class tested_types { core, fp, fp_extra, uint, sint };
// default type coverage over the tests
template <tested_types required> auto get_tested_types() {
if constexpr (required == tested_types::core) {
#ifdef ESIMD_TESTS_FULL_COVERAGE
return named_type_pack<
char, unsigned char, signed char, short, unsigned short, int,
unsigned int, long, unsigned long, float, long long,
Expand All @@ -248,12 +249,17 @@ template <tested_types required> auto get_tested_types() {
"unsigned int", "long", "unsigned long",
"float", "long long",
"unsigned long long");
#else
return named_type_pack<float, int, unsigned int, signed char>::generate(
"float", "int", "unsigned int", "signed char");
#endif
} else if constexpr (required == tested_types::fp) {
return named_type_pack<float>::generate("float");
} else if constexpr (required == tested_types::fp_extra) {
return named_type_pack<sycl::half, double>::generate("sycl::half",
"double");
} else if constexpr (required == tested_types::uint) {
#ifdef ESIMD_TESTS_FULL_COVERAGE
if constexpr (!std::is_signed_v<char>) {
return named_type_pack<unsigned char, unsigned short, unsigned int,
unsigned long, unsigned long long,
Expand All @@ -267,7 +273,11 @@ template <tested_types required> auto get_tested_types() {
"unsigned int", "unsigned long",
"unsigned long long");
}
#else
return named_type_pack<unsigned int>::generate("unsigned int");
#endif
} else if constexpr (required == tested_types::sint) {
#ifdef ESIMD_TESTS_FULL_COVERAGE
if constexpr (std::is_signed_v<char>) {
return named_type_pack<signed char, short, int, long, long long,
char>::generate("signed char", "short", "int",
Expand All @@ -277,6 +287,9 @@ template <tested_types required> auto get_tested_types() {
long long>::generate("signed char", "short", "int",
"long", "long long");
}
#else
return named_type_pack<int, signed char>::generate("int", "signed char");
#endif
} else {
static_assert(required != required, "Unexpected tested type");
}
Expand All @@ -289,7 +302,13 @@ template <int... Values> auto inline get_sizes() {

// Factory method to retrieve pre-defined values_pack, to have the same
// default sizes over the tests
auto inline get_all_sizes() { return get_sizes<1, 8, 16, 32>(); }
auto inline get_all_sizes() {
#ifdef ESIMD_TESTS_FULL_COVERAGE
return get_sizes<1, 8, 16, 32>();
#else
return get_sizes<1, 8>();
#endif
}

// It's a deprecated function and it exists only for backward compatibility and
// it should be deleted in the future. Use get_all_sizes() instead.
Expand Down
8 changes: 8 additions & 0 deletions SYCL/ESIMD/api/simd_copy_to_from.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ int main(void) {

bool Pass = true;

#ifdef ESIMD_TESTS_FULL_COVERAGE
Pass &= testUSM<int8_t>(Q);
Pass &= testUSM<uint16_t>(Q);
Pass &= testUSM<int32_t>(Q);
Expand All @@ -248,6 +249,13 @@ int main(void) {
Pass &= testAcc<float>(Q);
Pass &= testAcc<double>(Q);
Pass &= testAcc<half>(Q);
#else
Pass &= testUSM<uint16_t>(Q);
Pass &= testUSM<float>(Q);

Pass &= testAcc<int16_t>(Q);
Pass &= testAcc<float>(Q);
#endif

std::cout << (Pass ? "Test Passed\n" : "Test FAILED\n");
return Pass ? 0 : 1;
Expand Down