1
- // REQUIRES: cuda
1
+ // REQUIRES: aspect-ext_oneapi_bindless_images
2
2
3
3
// RUN: %{build} -o %t.out
4
- // RUN: %{run} %t.out
4
+ // RUN: %{run-unfiltered-devices} env NEOReadDebugKeys=1 UseBindlessMode=1 UseExternalAllocatorForSshAndDsh=1 %t.out
5
5
6
6
#include < iostream>
7
7
#include < sycl/detail/core.hpp>
@@ -21,19 +21,22 @@ int main() {
21
21
auto ctxt = q.get_context ();
22
22
23
23
constexpr size_t width = 512 ;
24
- std::vector<float > out (width);
25
- std::vector<float > expected (width);
26
- std::vector<sycl::float3 > dataIn (width);
27
- float exp = 512 ;
28
- for (int i = 0 ; i < width; i++) {
24
+ std::vector<unsigned short > out (width);
25
+ std::vector<unsigned short > expected (width);
26
+ std::vector<unsigned short > dataIn (width * 3 );
27
+ unsigned short exp = 512 ;
28
+ for (unsigned int i = 0 ; i < width; i++) {
29
29
expected[i] = exp;
30
- dataIn[i] = sycl::float3 (exp, width, i);
30
+ dataIn[(i * 3 )] = exp;
31
+ dataIn[(i * 3 ) + 1 ] = static_cast <unsigned short >(width);
32
+ dataIn[(i * 3 ) + 2 ] = static_cast <unsigned short >(i);
31
33
}
32
34
33
35
try {
34
36
// Main point of this test is to check creating an image
35
37
// with a 3-channel format
36
- syclexp::image_descriptor desc ({width}, 3 , sycl::image_channel_type::fp32);
38
+ syclexp::image_descriptor desc ({width}, 3 ,
39
+ sycl::image_channel_type::unsigned_int16);
37
40
38
41
syclexp::image_mem imgMem (desc, dev, ctxt);
39
42
@@ -46,7 +49,7 @@ int main() {
46
49
syclexp::unsampled_image_handle imgHandle =
47
50
sycl::ext::oneapi::experimental::create_image (imgMem, desc, dev, ctxt);
48
51
49
- sycl::buffer<float > buf (out.data (), width);
52
+ sycl::buffer<unsigned short > buf (out.data (), width);
50
53
51
54
q.submit ([&](sycl::handler &cgh) {
52
55
sycl::accessor outAcc{buf, cgh};
@@ -55,9 +58,9 @@ int main() {
55
58
#if defined(__SYCL_DEVICE_ONLY__) && defined(__NVPTX__)
56
59
// This shouldn't be hit anyway since CUDA doesn't support
57
60
// 3-channel formats, but we need to ensure the kernel can compile
58
- using pixel_t = sycl::float4 ;
61
+ using pixel_t = sycl::ushort4 ;
59
62
#else
60
- using pixel_t = sycl::float3 ;
63
+ using pixel_t = sycl::ushort3 ;
61
64
#endif
62
65
auto pixel = syclexp::fetch_image<pixel_t >(imgHandle, int (id[0 ]));
63
66
outAcc[id] = pixel[0 ];
@@ -83,7 +86,7 @@ int main() {
83
86
}
84
87
85
88
bool validated = true ;
86
- for (int i = 0 ; i < width; i++) {
89
+ for (unsigned int i = 0 ; i < width; i++) {
87
90
bool mismatch = false ;
88
91
if (out[i] != expected[i]) {
89
92
mismatch = true ;
0 commit comments