Skip to content

Commit 090a353

Browse files
authored
[BINDLESS][E2E] Split image_get_info into three tests (#17665)
image_get_info.cpp previously comprised three types of tests which have been split into separate test files - testing queries of a `oneapi::experimental::image_mem` instance (image_get_info.cpp) - testing device queries for image requirements (either max image dimensions or pitch alignment) (image_reqs_get_info.cpp) - testing device queries for bindless images aspects (bindless_aspects.cpp) This PR splits up these tests which is useful for diagnosing problems on different backends: - image_get_info.cpp is currently only unsupported on the HIP backend (Known issue) - image_reqs_get_info.cpp is currently only unsupported on the L0 backend #17663 - bindless_aspects.cpp has been fixed on L0 backend so it now passes on all backends, by only querying `mipmap_max_anisotropy` if `aspect::ext_oneapi_mipmap_anisotropy` returns true --------- Signed-off-by: JackAKirk <[email protected]>
1 parent 42ee42e commit 090a353

File tree

3 files changed

+204
-132
lines changed

3 files changed

+204
-132
lines changed
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
// REQUIRES: aspect-ext_oneapi_bindless_images
2+
3+
// RUN: %{build} -o %t.out
4+
// RUN: %{run-unfiltered-devices} %t.out
5+
6+
#include <iostream>
7+
#include <sycl/detail/core.hpp>
8+
#include <sycl/ext/oneapi/bindless_images.hpp>
9+
10+
// Uncomment to print additional test information
11+
// #define VERBOSE_PRINT
12+
13+
int main() {
14+
15+
sycl::device dev;
16+
17+
bool validated = true;
18+
19+
try {
20+
// Extension: query for bindless image support -- device aspects
21+
bool bindlessSupport = dev.has(sycl::aspect::ext_oneapi_bindless_images);
22+
bool bindlessSharedUsmSupport =
23+
dev.has(sycl::aspect::ext_oneapi_bindless_images_shared_usm);
24+
bool usm1dSupport =
25+
dev.has(sycl::aspect::ext_oneapi_bindless_images_1d_usm);
26+
bool usm2dSupport =
27+
dev.has(sycl::aspect::ext_oneapi_bindless_images_2d_usm);
28+
29+
#ifdef VERBOSE_PRINT
30+
std::cout << "bindless_images_support: " << bindlessSupport
31+
<< "\nbindless_images_shared_usm_support: "
32+
<< bindlessSharedUsmSupport
33+
<< "\nbindless_images_1d_usm_support: " << usm1dSupport
34+
<< "\nbindless_images_2d_usm_support: " << usm2dSupport << "\n";
35+
#endif
36+
37+
// Extension: query for sampled image fetch capabilities
38+
bool sampledFetch1DUSMSupport =
39+
dev.has(sycl::aspect::ext_oneapi_bindless_sampled_image_fetch_1d_usm);
40+
bool sampledFetch2DUSMSupport =
41+
dev.has(sycl::aspect::ext_oneapi_bindless_sampled_image_fetch_2d_usm);
42+
bool sampledFetch1DSupport =
43+
dev.has(sycl::aspect::ext_oneapi_bindless_sampled_image_fetch_1d);
44+
bool sampledFetch2DSupport =
45+
dev.has(sycl::aspect::ext_oneapi_bindless_sampled_image_fetch_2d);
46+
bool sampledFetch3DSupport =
47+
dev.has(sycl::aspect::ext_oneapi_bindless_sampled_image_fetch_3d);
48+
49+
#ifdef VERBOSE_PRINT
50+
std::cout << "sampledFetch1DUSMSupport: " << sampledFetch1DUSMSupport
51+
<< "\nsampledFetch2DUSMSupport: " << sampledFetch2DUSMSupport
52+
<< "\nsampledFetch1DSupport: " << sampledFetch1DSupport
53+
<< "\nsampledFetch2DSupport: " << sampledFetch2DSupport
54+
<< "\nsampledFetch3DSupport: " << sampledFetch3DSupport << "\n";
55+
#endif
56+
// Extension: query for bindless image mipmaps support -- aspects & info
57+
bool mipmapSupport = dev.has(sycl::aspect::ext_oneapi_mipmap);
58+
bool mipmapAnisotropySupport =
59+
dev.has(sycl::aspect::ext_oneapi_mipmap_anisotropy);
60+
float mipmapMaxAnisotropy;
61+
if (mipmapAnisotropySupport) {
62+
mipmapMaxAnisotropy = dev.get_info<sycl::ext::oneapi::experimental::info::
63+
device::mipmap_max_anisotropy>();
64+
}
65+
bool mipmapLevelReferenceSupport =
66+
dev.has(sycl::aspect::ext_oneapi_mipmap_level_reference);
67+
68+
#ifdef VERBOSE_PRINT
69+
std::cout << "mipmapSupport: " << mipmapSupport
70+
<< "\nmipmapAnisotropySupport: " << mipmapAnisotropySupport
71+
<< "\nmipmapLevelReferenceSupport: "
72+
<< mipmapLevelReferenceSupport << "\n";
73+
if (mipmapAnisotropySupport) {
74+
std::cout << "mipmapMaxAnisotropy: " << mipmapMaxAnisotropy << "\n";
75+
}
76+
#endif
77+
78+
// Extension: query for bindless image cubemaps support -- aspects.
79+
bool cubemapSupport = dev.has(sycl::aspect::ext_oneapi_cubemap);
80+
bool cubemapSeamlessFilterSupport =
81+
dev.has(sycl::aspect::ext_oneapi_cubemap_seamless_filtering);
82+
83+
#ifdef VERBOSE_PRINT
84+
std::cout << "cubemapSupport: " << cubemapSupport
85+
<< "\ncubemapSeamlessFilterSupport: "
86+
<< cubemapSeamlessFilterSupport << "\n";
87+
#endif
88+
89+
// Extension: query for bindless image interop support -- device aspects
90+
bool externalMemoryImportSupport =
91+
dev.has(sycl::aspect::ext_oneapi_external_memory_import);
92+
bool externalSemaphoreImportSupport =
93+
dev.has(sycl::aspect::ext_oneapi_external_semaphore_import);
94+
95+
#ifdef VERBOSE_PRINT
96+
std::cout << "externalMemoryImportSupport: " << externalMemoryImportSupport
97+
<< "\nexternalSemaphoreImportSupport: "
98+
<< externalSemaphoreImportSupport << "\n";
99+
#endif
100+
101+
// Extension: query for bindless image array support - device aspect
102+
bool imageArraySupport = dev.has(sycl::aspect::ext_oneapi_image_array);
103+
104+
#ifdef VERBOSE_PRINT
105+
std::cout << "imageArraySupport: " << imageArraySupport << "\n";
106+
#endif
107+
108+
// Extension: query for bindless image unique addressing support - device
109+
// aspect
110+
bool uniqueAddrSupport =
111+
dev.has(sycl::aspect::ext_oneapi_unique_addressing_per_dim);
112+
113+
#ifdef VERBOSE_PRINT
114+
std::cout << "uniqueAddrSupport: " << uniqueAddrSupport << "\n";
115+
#endif
116+
117+
// Extension: query for usm sample support - device aspect
118+
bool usm1DSampleSupport =
119+
dev.has(sycl::aspect::ext_oneapi_bindless_images_sample_1d_usm);
120+
bool usm2DSampleSupport =
121+
dev.has(sycl::aspect::ext_oneapi_bindless_images_sample_2d_usm);
122+
123+
#ifdef VERBOSE_PRINT
124+
std::cout << "usm1DSampleSupport: " << usm1DSampleSupport << "\n";
125+
std::cout << "usm2DSampleSupport: " << usm2DSampleSupport << "\n";
126+
#endif
127+
128+
} catch (sycl::exception e) {
129+
std::cerr << "SYCL exception caught! : " << e.what() << "\n";
130+
return 1;
131+
} catch (...) {
132+
std::cerr << "Unknown exception caught!\n";
133+
return 2;
134+
}
135+
136+
if (validated) {
137+
std::cout << "Test Passed!\n";
138+
return 0;
139+
}
140+
141+
std::cout << "Test Failed!" << std::endl;
142+
return 3;
143+
}

sycl/test-e2e/bindless_images/image_get_info.cpp

Lines changed: 1 addition & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
// REQUIRES: aspect-ext_oneapi_bindless_images
22

3-
// UNSUPPORTED: hip || level_zero
3+
// UNSUPPORTED: hip
44
// UNSUPPORTED-INTENDED: Image channels queries not working correctly on HIP.
5-
// Also, the feature is not fully implemented in the Level Zero stack.
65

76
// RUN: %{build} -o %t.out
87
// RUN: %{run-unfiltered-devices} %t.out
98

109
#include <iostream>
1110
#include <sycl/detail/core.hpp>
12-
1311
#include <sycl/ext/oneapi/bindless_images.hpp>
1412

1513
// Uncomment to print additional test information
@@ -34,10 +32,6 @@ int main() {
3432
bool validated = true;
3533

3634
try {
37-
// Submit dummy kernel to let the runtime decide the backend (CUDA)
38-
// Without this, the default Level Zero backend is active
39-
q.submit([&](sycl::handler &cgh) { cgh.single_task([]() {}); });
40-
4135
// Extension: image descriptor - can use the same for both images
4236
sycl::ext::oneapi::experimental::image_descriptor desc(
4337
{width, height, depth}, 1, sycl::image_channel_type::signed_int32);
@@ -46,131 +40,6 @@ int main() {
4640
// Input images memory
4741
sycl::ext::oneapi::experimental::image_mem imgMem(desc, dev, ctxt);
4842

49-
// Extension: query for bindless image support -- device aspects
50-
bool bindlessSupport = dev.has(sycl::aspect::ext_oneapi_bindless_images);
51-
bool bindlessSharedUsmSupport =
52-
dev.has(sycl::aspect::ext_oneapi_bindless_images_shared_usm);
53-
bool usm1dSupport =
54-
dev.has(sycl::aspect::ext_oneapi_bindless_images_1d_usm);
55-
bool usm2dSupport =
56-
dev.has(sycl::aspect::ext_oneapi_bindless_images_2d_usm);
57-
58-
#ifdef VERBOSE_PRINT
59-
std::cout << "bindless_images_support: " << bindlessSupport
60-
<< "\nbindless_images_shared_usm_support: "
61-
<< bindlessSharedUsmSupport
62-
<< "\nbindless_images_1d_usm_support: " << usm1dSupport
63-
<< "\nbindless_images_2d_usm_support: " << usm2dSupport << "\n";
64-
#endif
65-
66-
// Extension: query for sampled image fetch capabilities
67-
bool sampledFetch1DUSMSupport =
68-
dev.has(sycl::aspect::ext_oneapi_bindless_sampled_image_fetch_1d_usm);
69-
bool sampledFetch2DUSMSupport =
70-
dev.has(sycl::aspect::ext_oneapi_bindless_sampled_image_fetch_2d_usm);
71-
bool sampledFetch1DSupport =
72-
dev.has(sycl::aspect::ext_oneapi_bindless_sampled_image_fetch_1d);
73-
bool sampledFetch2DSupport =
74-
dev.has(sycl::aspect::ext_oneapi_bindless_sampled_image_fetch_2d);
75-
bool sampledFetch3DSupport =
76-
dev.has(sycl::aspect::ext_oneapi_bindless_sampled_image_fetch_3d);
77-
78-
#ifdef VERBOSE_PRINT
79-
std::cout << "sampledFetch1DUSMSupport: " << sampledFetch1DUSMSupport
80-
<< "\nsampledFetch2DUSMSupport: " << sampledFetch2DUSMSupport
81-
<< "\nsampledFetch1DSupport: " << sampledFetch1DSupport
82-
<< "\nsampledFetch2DSupport: " << sampledFetch2DSupport
83-
<< "\nsampledFetch3DSupport: " << sampledFetch3DSupport << "\n";
84-
#endif
85-
86-
// Extension: get pitch alignment information from device -- device info
87-
// Make sure our pitch alignment queries work properly
88-
// These can be different depending on the device so we cannot test that the
89-
// values are correct
90-
// But we should at least see that the query itself works
91-
auto pitchAlign = dev.get_info<
92-
sycl::ext::oneapi::experimental::info::device::image_row_pitch_align>();
93-
auto maxPitch = dev.get_info<sycl::ext::oneapi::experimental::info::device::
94-
max_image_linear_row_pitch>();
95-
auto maxWidth = dev.get_info<sycl::ext::oneapi::experimental::info::device::
96-
max_image_linear_width>();
97-
auto maxheight = dev.get_info<sycl::ext::oneapi::experimental::info::
98-
device::max_image_linear_height>();
99-
100-
#ifdef VERBOSE_PRINT
101-
std::cout << "image_row_pitch_align: " << pitchAlign
102-
<< "\nmax_image_linear_row_pitch: " << maxPitch
103-
<< "\nmax_image_linear_width: " << maxWidth
104-
<< "\nmax_image_linear_height: " << maxheight << "\n";
105-
#endif
106-
107-
// Extension: query for bindless image mipmaps support -- aspects & info
108-
bool mipmapSupport = dev.has(sycl::aspect::ext_oneapi_mipmap);
109-
bool mipmapAnisotropySupport =
110-
dev.has(sycl::aspect::ext_oneapi_mipmap_anisotropy);
111-
float mipmapMaxAnisotropy = dev.get_info<
112-
sycl::ext::oneapi::experimental::info::device::mipmap_max_anisotropy>();
113-
bool mipmapLevelReferenceSupport =
114-
dev.has(sycl::aspect::ext_oneapi_mipmap_level_reference);
115-
116-
#ifdef VERBOSE_PRINT
117-
std::cout << "mipmapSupport: " << mipmapSupport
118-
<< "\nmipmapAnisotropySupport: " << mipmapAnisotropySupport
119-
<< "\nmipmapMaxAnisotropy: " << mipmapMaxAnisotropy
120-
<< "\nmipmapLevelReferenceSupport: "
121-
<< mipmapLevelReferenceSupport << "\n";
122-
#endif
123-
124-
// Extension: query for bindless image cubemaps support -- aspects.
125-
bool cubemapSupport = dev.has(sycl::aspect::ext_oneapi_cubemap);
126-
bool cubemapSeamlessFilterSupport =
127-
dev.has(sycl::aspect::ext_oneapi_cubemap_seamless_filtering);
128-
129-
#ifdef VERBOSE_PRINT
130-
std::cout << "cubemapSupport: " << cubemapSupport
131-
<< "\ncubemapSeamlessFilterSupport: "
132-
<< cubemapSeamlessFilterSupport << "\n";
133-
#endif
134-
135-
// Extension: query for bindless image interop support -- device aspects
136-
bool externalMemoryImportSupport =
137-
dev.has(sycl::aspect::ext_oneapi_external_memory_import);
138-
bool externalSemaphoreImportSupport =
139-
dev.has(sycl::aspect::ext_oneapi_external_semaphore_import);
140-
141-
#ifdef VERBOSE_PRINT
142-
std::cout << "externalMemoryImportSupport: " << externalMemoryImportSupport
143-
<< "\nexternalSemaphoreImportSupport: "
144-
<< externalSemaphoreImportSupport << "\n";
145-
#endif
146-
147-
// Extension: query for bindless image array support - device aspect
148-
bool imageArraySupport = dev.has(sycl::aspect::ext_oneapi_image_array);
149-
150-
#ifdef VERBOSE_PRINT
151-
std::cout << "imageArraySupport: " << imageArraySupport << "\n";
152-
#endif
153-
154-
// Extension: query for bindless image unique addressing support - device
155-
// aspect
156-
bool uniqueAddrSupport =
157-
dev.has(sycl::aspect::ext_oneapi_unique_addressing_per_dim);
158-
159-
#ifdef VERBOSE_PRINT
160-
std::cout << "uniqueAddrSupport: " << uniqueAddrSupport << "\n";
161-
#endif
162-
163-
// Extension: query for usm sample support - device aspect
164-
bool usm1DSampleSupport =
165-
dev.has(sycl::aspect::ext_oneapi_bindless_images_sample_1d_usm);
166-
bool usm2DSampleSupport =
167-
dev.has(sycl::aspect::ext_oneapi_bindless_images_sample_2d_usm);
168-
169-
#ifdef VERBOSE_PRINT
170-
std::cout << "usm1DSampleSupport: " << usm1DSampleSupport << "\n";
171-
std::cout << "usm2DSampleSupport: " << usm2DSampleSupport << "\n";
172-
#endif
173-
17443
auto rangeMem = imgMem.get_range();
17544
auto range = sycl::ext::oneapi::experimental::get_image_range(
17645
imgMem.get_handle(), dev, ctxt);
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// REQUIRES: aspect-ext_oneapi_bindless_images
2+
3+
// UNSUPPORTED: level_zero
4+
// UNSUPPORTED-INTENDED: The feature is not implemented in the Level Zero stack.
5+
// https://github.com/intel/llvm/issues/17663
6+
7+
// RUN: %{build} -o %t.out
8+
// RUN: %{run-unfiltered-devices} %t.out
9+
10+
#include <iostream>
11+
#include <sycl/detail/core.hpp>
12+
#include <sycl/ext/oneapi/bindless_images.hpp>
13+
14+
// Uncomment to print additional test information
15+
// #define VERBOSE_PRINT
16+
17+
int main() {
18+
19+
sycl::device dev;
20+
21+
bool validated = true;
22+
23+
try {
24+
// Extension: get pitch alignment information from device -- device info
25+
// Make sure our pitch alignment queries work properly
26+
// These can be different depending on the device so we cannot test that the
27+
// values are correct
28+
// But we should at least see that the query itself works
29+
auto pitchAlign = dev.get_info<
30+
sycl::ext::oneapi::experimental::info::device::image_row_pitch_align>();
31+
auto maxPitch = dev.get_info<sycl::ext::oneapi::experimental::info::device::
32+
max_image_linear_row_pitch>();
33+
auto maxWidth = dev.get_info<sycl::ext::oneapi::experimental::info::device::
34+
max_image_linear_width>();
35+
auto maxheight = dev.get_info<sycl::ext::oneapi::experimental::info::
36+
device::max_image_linear_height>();
37+
38+
#ifdef VERBOSE_PRINT
39+
std::cout << "image_row_pitch_align: " << pitchAlign
40+
<< "\nmax_image_linear_row_pitch: " << maxPitch
41+
<< "\nmax_image_linear_width: " << maxWidth
42+
<< "\nmax_image_linear_height: " << maxheight << "\n";
43+
#endif
44+
45+
} catch (sycl::exception e) {
46+
std::cerr << "SYCL exception caught! : " << e.what() << "\n";
47+
return 1;
48+
} catch (...) {
49+
std::cerr << "Unknown exception caught!\n";
50+
return 2;
51+
}
52+
53+
if (validated) {
54+
std::cout << "Test Passed!\n";
55+
return 0;
56+
}
57+
58+
std::cout << "Test Failed!" << std::endl;
59+
return 3;
60+
}

0 commit comments

Comments
 (0)