Skip to content

Commit b7801bd

Browse files
committed
split test (todo per commit)
1 parent d3926f7 commit b7801bd

20 files changed

Lines changed: 576 additions & 379 deletions

sycl/test-e2e/WorkGroupMemory/basic_usage.cpp renamed to sycl/test-e2e/WorkGroupMemory/basic_usage_common.hpp

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
1-
// UNSUPPORTED: hip
2-
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/17339
3-
// RUN: %{build} -o %t.out
4-
// RUN: %{run} %t.out
5-
// XFAIL: spirv-backend
6-
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/18230
1+
// Shared implementation for the work-group memory basic usage tests.
2+
3+
#pragma once
74

85
#include <sycl/builtins.hpp>
96
#include <sycl/detail/core.hpp>
107
#include <sycl/ext/oneapi/experimental/work_group_memory.hpp>
118
#include <sycl/group_barrier.hpp>
129
#include <sycl/half_type.hpp>
10+
#include <sycl/queue.hpp>
1311

1412
#include <cassert>
1513
#include <cstring>
1614

1715
namespace syclexp = sycl::ext::oneapi::experimental;
1816

19-
sycl::queue q;
20-
2117
// This test performs a swap of two scalars/arrays inside a kernel using a
2218
// work_group_memory object as a temporary buffer. The test is done for scalar
2319
// types and bounded arrays. After the kernel finishes, it is verified on the
@@ -407,19 +403,3 @@ template <typename T> void test_ptr() {
407403
}
408404
swap_array_2d(arr1, arr2, 8);
409405
}
410-
411-
int main() {
412-
test<int>();
413-
test<char>();
414-
test<uint16_t>();
415-
if (q.get_device().has(sycl::aspect::fp16))
416-
test<sycl::half>();
417-
test_ptr<float *>();
418-
test_ptr<int *>();
419-
test_ptr<char *>();
420-
test_ptr<uint16_t *>();
421-
if (q.get_device().has(sycl::aspect::fp16))
422-
test_ptr<sycl::half *>();
423-
test_ptr<float *>();
424-
return 0;
425-
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Non-pointer types version of the basic usage test.
2+
3+
// UNSUPPORTED: hip
4+
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/17339
5+
6+
// XFAIL: spirv-backend
7+
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/18230
8+
9+
// RUN: %{build} -o %t.out
10+
// RUN: %{run} %t.out
11+
12+
#include <sycl/queue.hpp>
13+
14+
sycl::queue q;
15+
16+
#include "./basic_usage_common.hpp"
17+
18+
int main() {
19+
test<float>();
20+
test<int>();
21+
test<char>();
22+
test<uint16_t>();
23+
if (q.get_device().has(sycl::aspect::fp16))
24+
test<sycl::half>();
25+
return 0;
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Pointer-types version of the basic usage test.
2+
3+
// UNSUPPORTED: hip
4+
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/17339
5+
6+
// XFAIL: spirv-backend
7+
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/18230
8+
9+
// RUN: %{build} -o %t.out
10+
// RUN: %{run} %t.out
11+
12+
#include <sycl/queue.hpp>
13+
14+
sycl::queue q;
15+
16+
#include "./basic_usage_common.hpp"
17+
18+
int main() {
19+
test_ptr<float *>();
20+
test_ptr<int *>();
21+
test_ptr<char *>();
22+
test_ptr<uint16_t *>();
23+
if (q.get_device().has(sycl::aspect::fp16))
24+
test_ptr<sycl::half *>();
25+
return 0;
26+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// 1D version of sampled image read test.
2+
3+
// REQUIRES: aspect-ext_oneapi_bindless_images
4+
5+
// UNSUPPORTED: hip
6+
// UNSUPPORTED-INTENDED: Returning non-FP values from sampling fails on HIP.
7+
8+
// UNSUPPORTED: linux && arch-intel_gpu_bmg_g21 && level_zero_v2_adapter
9+
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/20223
10+
11+
// RUN: %{build} -o %t.out
12+
// RUN: %{run} %t.out
13+
14+
#include "./read_sampled_common.hpp"
15+
16+
int main() {
17+
const unsigned int seed = 0;
18+
const float offset = 20.0;
19+
20+
std::cout << "Running 1D Sampled Image Tests!\n";
21+
bool result1D = runAll1D(offset, seed);
22+
23+
if (result1D) {
24+
std::cout << "All tests passed!\n";
25+
} else {
26+
std::cerr << "An error has occurred!\n";
27+
return 1;
28+
}
29+
30+
return 0;
31+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// 2D version of sampled image read test.
2+
3+
// REQUIRES: aspect-ext_oneapi_bindless_images
4+
5+
// UNSUPPORTED: hip
6+
// UNSUPPORTED-INTENDED: Returning non-FP values from sampling fails on HIP.
7+
8+
// UNSUPPORTED: linux && arch-intel_gpu_bmg_g21 && level_zero_v2_adapter
9+
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/20223
10+
11+
// XFAIL: cuda && cuda-major-ge-13
12+
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/21807
13+
14+
// RUN: %{build} -o %t.out
15+
// RUN: %{run} %t.out
16+
17+
#include "./read_sampled_common.hpp"
18+
19+
int main() {
20+
const unsigned int seed = 0;
21+
const float offset = 20.0;
22+
23+
std::cout << "Running 2D Sampled Image Tests!\n";
24+
bool result2D = runAll2D(offset, seed);
25+
26+
if (result2D) {
27+
std::cout << "All tests passed!\n";
28+
} else {
29+
std::cerr << "An error has occurred!\n";
30+
return 1;
31+
}
32+
33+
return 0;
34+
}

sycl/test-e2e/bindless_images/read_sampled.cpp renamed to sycl/test-e2e/bindless_images/read_sampled_common.hpp

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
// REQUIRES: aspect-ext_oneapi_bindless_images
1+
// Shared implementation for the sampled image read tests.
22

3-
// UNSUPPORTED: hip
4-
// UNSUPPORTED-INTENDED: Returning non-FP values from sampling fails on HIP.
5-
6-
// UNSUPPORTED: linux && arch-intel_gpu_bmg_g21 && level_zero_v2_adapter
7-
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/20223
8-
9-
// RUN: %{build} -o %t.out
10-
// RUN: %{run} %t.out
3+
#pragma once
114

125
// Print test names and pass status
136
// #define VERBOSE_LV1
@@ -26,6 +19,8 @@
2619
#include <iostream>
2720
#include <sycl/accessor_image.hpp>
2821
#include <sycl/detail/core.hpp>
22+
#include <sycl/image.hpp>
23+
#include <type_traits>
2924

3025
#include <sycl/ext/oneapi/bindless_images.hpp>
3126

@@ -488,7 +483,7 @@ bool runTests(sycl::range<2> dims, sycl::range<2> localSize, float offset,
488483
int seed, sycl::coordinate_normalization_mode normMode) {
489484

490485
// addressing_mode::none currently removed due to
491-
// inconsistent behavour when switching between
486+
// inconsistent behaviour when switching between
492487
// normalized and unnormalized coords.
493488
sycl::addressing_mode addrModes[4] = {
494489
sycl::addressing_mode::repeat, sycl::addressing_mode::mirrored_repeat,
@@ -718,22 +713,10 @@ bool runAll(sycl::range<NDims> dims, sycl::range<NDims> localSize, float offset,
718713
return offsetPassed && noOffsetPassed;
719714
}
720715

721-
int main() {
722-
723-
const unsigned int seed = 0;
724-
const float offset = 20.0;
725-
726-
std::cout << "Running 1D Sampled Image Tests!\n";
727-
bool result1D = runAll<1>({128}, {32}, offset, seed);
728-
std::cout << "Running 2D Sampled Image Tests!\n";
729-
bool result2D = runAll<2>({16, 16}, {8, 8}, offset, seed);
730-
731-
if (result1D && result2D) {
732-
std::cout << "All tests passed!\n";
733-
} else {
734-
std::cerr << "An error has occurred!\n";
735-
return 1;
736-
}
716+
inline bool runAll1D(float offset, int seed) {
717+
return runAll<1>(sycl::range<1>{128}, sycl::range<1>{32}, offset, seed);
718+
}
737719

738-
return 0;
720+
inline bool runAll2D(float offset, int seed) {
721+
return runAll<2>(sycl::range<2>{16, 16}, sycl::range<2>{8, 8}, offset, seed);
739722
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Unsampled version of the Vulkan/SYCL 1D image read interop test.
2+
3+
// REQUIRES: aspect-ext_oneapi_bindless_images
4+
// REQUIRES: aspect-ext_oneapi_external_memory_import || (windows && level_zero && aspect-ext_oneapi_bindless_images)
5+
// REQUIRES: vulkan
6+
7+
// RUN: %{build} %link-vulkan -o %t.out %if target-spir %{ -Wno-ignored-attributes %}
8+
9+
// clang-format off
10+
// RUN: %{run} %t.out --type float --channels 1 32
11+
// RUN: %{run} %t.out --type float --channels 2 32
12+
// RUN: %{run} %t.out --type float --channels 4 32
13+
// RUN: %{run} %t.out --type half --channels 1 32
14+
// RUN: %{run} %t.out --type half --channels 2 32
15+
// RUN: %{run} %t.out --type half --channels 4 32
16+
// RUN: %{run} %t.out --type int32 --channels 1 32
17+
// RUN: %{run} %t.out --type int32 --channels 2 32
18+
// RUN: %{run} %t.out --type int32 --channels 4 32
19+
// RUN: %{run} %t.out --type uint32 --channels 1 32
20+
// RUN: %{run} %t.out --type uint32 --channels 2 32
21+
// RUN: %{run} %t.out --type uint32 --channels 4 32
22+
// RUN: %{run} %t.out --type int16 --channels 1 32
23+
// RUN: %{run} %t.out --type int16 --channels 2 32
24+
// RUN: %{run} %t.out --type int16 --channels 4 32
25+
// RUN: %{run} %t.out --type uint16 --channels 1 32
26+
// RUN: %{run} %t.out --type uint16 --channels 2 32
27+
// RUN: %{run} %t.out --type uint16 --channels 4 32
28+
// RUN: %{run} %t.out --type uint8 --channels 1 32
29+
// RUN: %{run} %t.out --type uint8 --channels 2 32
30+
// RUN: %{run} %t.out --type uint8 --channels 4 32
31+
// RUN: %{run} %t.out --type int8 --channels 1 32
32+
// RUN: %{run} %t.out --type int8 --channels 2 32
33+
// RUN: %{run} %t.out --type int8 --channels 4 32
34+
// RUN-IF: !cuda, %{run} %t.out --type unorm8 --channels 1 32
35+
// RUN-IF: !cuda, %{run} %t.out --type unorm8 --channels 2 32
36+
// RUN-IF: !cuda, %{run} %t.out --type unorm8 --channels 4 32
37+
// clang-format on
38+
39+
#include "./vulkan_sycl_image_interop_read_1d_common.hpp"

0 commit comments

Comments
 (0)