Skip to content

Commit d70ed19

Browse files
[SYCL][Bindless][E2E] Enable 3-channel image test for Intel GPUs (#16537)
This patch enables the 3-channel image E2E test on Intel GPUs.
1 parent a87ac06 commit d70ed19

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

sycl/test-e2e/bindless_images/3_channel_format.cpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// REQUIRES: cuda
1+
// REQUIRES: aspect-ext_oneapi_bindless_images
22

33
// RUN: %{build} -o %t.out
4-
// RUN: %{run} %t.out
4+
// RUN: %{run-unfiltered-devices} env NEOReadDebugKeys=1 UseBindlessMode=1 UseExternalAllocatorForSshAndDsh=1 %t.out
55

66
#include <iostream>
77
#include <sycl/detail/core.hpp>
@@ -21,19 +21,22 @@ int main() {
2121
auto ctxt = q.get_context();
2222

2323
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++) {
2929
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);
3133
}
3234

3335
try {
3436
// Main point of this test is to check creating an image
3537
// 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);
3740

3841
syclexp::image_mem imgMem(desc, dev, ctxt);
3942

@@ -46,7 +49,7 @@ int main() {
4649
syclexp::unsampled_image_handle imgHandle =
4750
sycl::ext::oneapi::experimental::create_image(imgMem, desc, dev, ctxt);
4851

49-
sycl::buffer<float> buf(out.data(), width);
52+
sycl::buffer<unsigned short> buf(out.data(), width);
5053

5154
q.submit([&](sycl::handler &cgh) {
5255
sycl::accessor outAcc{buf, cgh};
@@ -55,9 +58,9 @@ int main() {
5558
#if defined(__SYCL_DEVICE_ONLY__) && defined(__NVPTX__)
5659
// This shouldn't be hit anyway since CUDA doesn't support
5760
// 3-channel formats, but we need to ensure the kernel can compile
58-
using pixel_t = sycl::float4;
61+
using pixel_t = sycl::ushort4;
5962
#else
60-
using pixel_t = sycl::float3;
63+
using pixel_t = sycl::ushort3;
6164
#endif
6265
auto pixel = syclexp::fetch_image<pixel_t>(imgHandle, int(id[0]));
6366
outAcc[id] = pixel[0];
@@ -83,7 +86,7 @@ int main() {
8386
}
8487

8588
bool validated = true;
86-
for (int i = 0; i < width; i++) {
89+
for (unsigned int i = 0; i < width; i++) {
8790
bool mismatch = false;
8891
if (out[i] != expected[i]) {
8992
mismatch = true;

0 commit comments

Comments
 (0)