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

Commit d43bc4e

Browse files
authored
[SYCL][ESIMD] Decrease type coverage for core tests (#832)
* [SYCL][ESIMD] Decrease type coverage for core tests Because of the fact that these tests take too much time in CI. Full coverage can be re-enabled with the ESIMD_TESTS_FULL_COVERAGE preprocessor macro.
1 parent deac1c6 commit d43bc4e

File tree

6 files changed

+38
-2
lines changed

6 files changed

+38
-2
lines changed

SYCL/ESIMD/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,10 @@ This directory contains ESIMD tests which are run on Intel GPU device only.
33
Some of them can run on host device too, but in general it is not always
44
possible as some of ESIMD APIs (e.g. memory access via accessors) is not
55
implemented for the host device.
6+
7+
Tests within this directory has additional preprocessor definitions available.
8+
9+
`ESIMD_TESTS_FULL_COVERAGE` (default: not defined)\
10+
Enable extended coverage and testing logic with significantly increased
11+
compilation and execution time. Extensive tests could be run manually if needed,
12+
but do not affect CI performance for the basic functionality.

SYCL/ESIMD/api/functional/ctors/ctor_fill_core.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ int main(int, char **) {
6060
}
6161
{
6262
// Validate basic functionality works for every type
63+
6364
const auto types = get_tested_types<tested_types::core>();
6465
const auto sizes = get_all_sizes();
6566
const auto contexts = unnamed_type_pack<ctors::var_decl>::generate();

SYCL/ESIMD/api/functional/ctors/ctor_load_core.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ int main(int, char **) {
3030
esimd_test::createExceptionHandler());
3131

3232
bool passed = true;
33+
3334
const auto types = get_tested_types<tested_types::core>();
3435
const auto sizes = get_all_sizes();
3536

SYCL/ESIMD/api/functional/ctors/ctor_move_core.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ using namespace esimd_test::api::functional;
3636

3737
int main(int, char **) {
3838
bool passed = true;
39-
const auto types = get_tested_types<tested_types::fp_extra>();
39+
const auto types = get_tested_types<tested_types::core>();
4040
const auto sizes = get_all_sizes();
4141
const auto contexts =
4242
unnamed_type_pack<ctors::initializer, ctors::var_decl,

SYCL/ESIMD/api/functional/type_coverage.hpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ enum class tested_types { core, fp, fp_extra, uint, sint };
240240
// default type coverage over the tests
241241
template <tested_types required> auto get_tested_types() {
242242
if constexpr (required == tested_types::core) {
243+
#ifdef ESIMD_TESTS_FULL_COVERAGE
243244
return named_type_pack<
244245
char, unsigned char, signed char, short, unsigned short, int,
245246
unsigned int, long, unsigned long, float, long long,
@@ -248,12 +249,17 @@ template <tested_types required> auto get_tested_types() {
248249
"unsigned int", "long", "unsigned long",
249250
"float", "long long",
250251
"unsigned long long");
252+
#else
253+
return named_type_pack<float, int, unsigned int, signed char>::generate(
254+
"float", "int", "unsigned int", "signed char");
255+
#endif
251256
} else if constexpr (required == tested_types::fp) {
252257
return named_type_pack<float>::generate("float");
253258
} else if constexpr (required == tested_types::fp_extra) {
254259
return named_type_pack<sycl::half, double>::generate("sycl::half",
255260
"double");
256261
} else if constexpr (required == tested_types::uint) {
262+
#ifdef ESIMD_TESTS_FULL_COVERAGE
257263
if constexpr (!std::is_signed_v<char>) {
258264
return named_type_pack<unsigned char, unsigned short, unsigned int,
259265
unsigned long, unsigned long long,
@@ -267,7 +273,11 @@ template <tested_types required> auto get_tested_types() {
267273
"unsigned int", "unsigned long",
268274
"unsigned long long");
269275
}
276+
#else
277+
return named_type_pack<unsigned int>::generate("unsigned int");
278+
#endif
270279
} else if constexpr (required == tested_types::sint) {
280+
#ifdef ESIMD_TESTS_FULL_COVERAGE
271281
if constexpr (std::is_signed_v<char>) {
272282
return named_type_pack<signed char, short, int, long, long long,
273283
char>::generate("signed char", "short", "int",
@@ -277,6 +287,9 @@ template <tested_types required> auto get_tested_types() {
277287
long long>::generate("signed char", "short", "int",
278288
"long", "long long");
279289
}
290+
#else
291+
return named_type_pack<int, signed char>::generate("int", "signed char");
292+
#endif
280293
} else {
281294
static_assert(required != required, "Unexpected tested type");
282295
}
@@ -289,7 +302,13 @@ template <int... Values> auto inline get_sizes() {
289302

290303
// Factory method to retrieve pre-defined values_pack, to have the same
291304
// default sizes over the tests
292-
auto inline get_all_sizes() { return get_sizes<1, 8, 16, 32>(); }
305+
auto inline get_all_sizes() {
306+
#ifdef ESIMD_TESTS_FULL_COVERAGE
307+
return get_sizes<1, 8, 16, 32>();
308+
#else
309+
return get_sizes<1, 8>();
310+
#endif
311+
}
293312

294313
// It's a deprecated function and it exists only for backward compatibility and
295314
// it should be deleted in the future. Use get_all_sizes() instead.

SYCL/ESIMD/api/simd_copy_to_from.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ int main(void) {
233233

234234
bool Pass = true;
235235

236+
#ifdef ESIMD_TESTS_FULL_COVERAGE
236237
Pass &= testUSM<int8_t>(Q);
237238
Pass &= testUSM<uint16_t>(Q);
238239
Pass &= testUSM<int32_t>(Q);
@@ -248,6 +249,13 @@ int main(void) {
248249
Pass &= testAcc<float>(Q);
249250
Pass &= testAcc<double>(Q);
250251
Pass &= testAcc<half>(Q);
252+
#else
253+
Pass &= testUSM<uint16_t>(Q);
254+
Pass &= testUSM<float>(Q);
255+
256+
Pass &= testAcc<int16_t>(Q);
257+
Pass &= testAcc<float>(Q);
258+
#endif
251259

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

0 commit comments

Comments
 (0)