Skip to content

Commit 1d5eac3

Browse files
[SYCL][E2E] bindless image - switch tests to immediate command list, etc (#22046)
Bindless image semaphores require immediate command lists. This updates the docs and the tests to be aligned with this requirement. Updating the tests with this change means that certain tests that used to fail now pass, so they are are being enabled. Also, some of the failing tests pass with the correct graphic driver, so that expectation is now more explicit in the tests. And, lastly, a few of the tests tripped the validator because they can forget to free a resource if an exception is encountered - fixed that too. --------- Signed-off-by: Chris Perkins <chris.perkins@intel.com>
1 parent 68d84fd commit 1d5eac3

26 files changed

Lines changed: 811 additions & 535 deletions

sycl/doc/extensions/experimental/sycl_ext_oneapi_bindless_images.asciidoc

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,13 +2259,18 @@ memory resources handles can take different forms of structure and type
22592259
depending on the API and operating system, so do external semaphore resource
22602260
handles.
22612261

2262-
It is important to note, that the use of imported external semaphore objects
2263-
within SYCL has the restriction in that imported external semaphores can only
2264-
be used in conjuction with SYCL queues that have been constructed with the
2265-
`property::queue::in_order` property. The semaphore synchronization mechanism
2266-
is not supported for the default SYCL out-of-order queues. Use of the semaphore
2267-
synchronization mechanism with SYCL queues which were not constructed with the
2268-
`queue::in_order` property will result in undefined behaviour.
2262+
It is important to note that the use of imported external semaphore objects
2263+
within SYCL requires the SYCL queue to have been constructed with both of the
2264+
following properties:
2265+
2266+
* `sycl::property::queue::in_order` -- the semaphore synchronization mechanism
2267+
is not supported on the default out-of-order queues.
2268+
* `sycl::ext::intel::property::queue::immediate_command_list` -- external
2269+
semaphore operations are only supported on queues backed by immediate
2270+
command lists. This restriction might be lifted in the future.
2271+
2272+
Use of the semaphore synchronization mechanism with a SYCL queue that was not
2273+
constructed with both of these properties will result in undefined behaviour.
22692274

22702275
External semaphore import is facilitated through the following proposed
22712276
descriptor struct.

sycl/test-e2e/bindless_images/dx11_interop/read_write_unsampled.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "dx11_interop.h"
1111

1212
#include <sycl/ext/oneapi/bindless_images.hpp>
13+
#include <sycl/properties/queue_properties.hpp>
1314

1415
#ifdef TEST_SEMAPHORE_IMPORT
1516
#include <d3d11_4.h> // Used for ID3D11Device5 / ID3D11DeviceContext4 / ID3D11Fence
@@ -435,8 +436,16 @@ int runTest(D3D11ProgramState &d3d11ProgramState, sycl::queue syclQueue,
435436
}
436437

437438
int main() {
438-
// Create SYCL queue, relying on SYCL device selection
439+
// Create SYCL queue, relying on SYCL device selection.
440+
#ifdef TEST_SEMAPHORE_IMPORT
441+
// External semaphore ops require an in-order queue backed by immediate
442+
// command lists (see sycl_ext_oneapi_bindless_images.asciidoc).
443+
sycl::queue syclQueue{
444+
{sycl::property::queue::in_order{},
445+
sycl::ext::intel::property::queue::immediate_command_list{}}};
446+
#else
439447
sycl::queue syclQueue;
448+
#endif
440449
sycl::device syclDevice = syclQueue.get_device();
441450

442451
// Initialize D3D11 and create DX11 programs state from the SYCL device

sycl/test-e2e/bindless_images/dx12_interop/D3D12_sycl_buffer_timeline_semaphore.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,7 @@
22
// REQUIRES: aspect-ext_oneapi_external_semaphore_import
33
// REQUIRES: windows
44

5-
// UNSUPPORTED: gpu-intel-dg2
6-
// UNSUPPORTED-TRACKER: GSD-12428
7-
// semaphores-do-not-work-dg2
8-
9-
// UNSUPPORTED: gpu-intel-gen12
10-
// UNSUPPORTED-TRACKER: GSD-12427
11-
// Gen12-semaphores-work-but-this-test-hangs.
12-
13-
// UNSUPPORTED: arch-intel_gpu_bmg_g21
14-
// UNSUPPORTED-TRACKER: GSD-12436
15-
// this test works on BMG, but if run in parallel with itself, or with other
16-
// semaphore tests, it can hang.
5+
// REQUIRES-INTEL-DRIVER: lin: 38303 win: 101.9999
176

187
// RUN: %{build} %link-directx -o %t.exe %if target-spir %{ -Wno-ignored-attributes %}
198
// RUN: %{run} %t.exe --no-sem
@@ -50,6 +39,7 @@
5039
#include <string>
5140
#include <sycl/detail/core.hpp>
5241
#include <sycl/ext/oneapi/bindless_images.hpp>
42+
#include <sycl/properties/queue_properties.hpp>
5343
#include <vector>
5444

5545
#define WIN32_LEAN_AND_MEAN
@@ -120,7 +110,15 @@ int main(int argc, char **argv) {
120110

121111
// SYCL INTEROP
122112
try {
123-
sycl::queue q;
113+
// Bindless image interop requires an in-order queue (per spec). External
114+
// semaphore ops additionally require immediate command lists; see
115+
// sycl_ext_oneapi_bindless_images.asciidoc.
116+
sycl::property_list qProps =
117+
useSemaphores ? sycl::property_list{sycl::property::queue::in_order{},
118+
sycl::ext::intel::property::queue::
119+
immediate_command_list{}}
120+
: sycl::property_list{sycl::property::queue::in_order{}};
121+
sycl::queue q{qProps};
124122
auto device = q.get_device();
125123
auto context = q.get_context();
126124

sycl/test-e2e/bindless_images/dx12_interop/D3D12_sycl_interop_1D_read.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@
7474

7575

7676
// Semaphore coverage tests
77-
// At this time, semaphores aren't working on DG2 (GSD-12428), and can hang on BMG if run in parallel (GSD-12436).
77+
// On Windows, we require driver 38303 or later to avoid semaphore issues, which the CI does not yet have.
78+
// Rather than mark the WHOLE test as requiring 38303, which would mean no testing nowhere,
79+
// we are limiting it with R U N - I F
80+
7881
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type float --channels 4 --semaphores 33x
7982
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type half --channels 2 --semaphores 33x
8083
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type int32 --channels 1 --semaphores 33x
@@ -98,6 +101,7 @@
98101
#include <sycl/detail/core.hpp>
99102
#include <sycl/ext/oneapi/bindless_images.hpp>
100103
#include <sycl/ext/oneapi/bindless_images_interop.hpp>
104+
#include <sycl/properties/queue_properties.hpp>
101105

102106
namespace syclexp = sycl::ext::oneapi::experimental;
103107

@@ -187,7 +191,15 @@ int runTest(
187191

188192
// SYCL Import and Verification
189193
try {
190-
sycl::queue q;
194+
// Bindless image interop requires an in-order queue (per spec). External
195+
// semaphore ops additionally require immediate command lists; see
196+
// sycl_ext_oneapi_bindless_images.asciidoc.
197+
sycl::property_list qProps =
198+
useSemaphores ? sycl::property_list{sycl::property::queue::in_order{},
199+
sycl::ext::intel::property::queue::
200+
immediate_command_list{}}
201+
: sycl::property_list{sycl::property::queue::in_order{}};
202+
sycl::queue q{qProps};
191203

192204
syclexp::external_mem_descriptor<syclexp::resource_win32_handle> extMemDesc{
193205
imgRes.sharedHandle, syclexp::external_mem_handle_type::win32_nt_handle,

sycl/test-e2e/bindless_images/dx12_interop/D3D12_sycl_interop_1D_write_unsampled.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
// clang-format off
99
/*
10-
clang++.exe -fsycl -o ds1w.exe D3D12_sycl_interop_1D_write.cpp -ld3d12 -ldxgi -ld3dcompiler
10+
clang++.exe -fsycl -o ds1w.exe D3D12_sycl_interop_1D_write_unsampled.cpp -ld3d12 -ldxgi -ld3dcompiler
1111
1212
FLAGS:
1313
--sampled ERROR: Sampled image writes are not supported
@@ -42,12 +42,12 @@
4242
// RUN: %{run} %t.exe --type int8 --channels 1 33x
4343
// RUN: %{run} %t.exe --type int8 --channels 2 33x
4444
// RUN: %{run} %t.exe --type int8 --channels 4 33x
45-
// RUN: %{run} %t.exe --type unorm8 --channels 1 33x
46-
// RUN: %{run} %t.exe --type unorm8 --channels 2 33x
47-
// RUN: %{run} %t.exe --type unorm8 --channels 4 33x
4845

4946
// Semaphore coverage tests
50-
// At this time, semaphores aren't working on DG2 (GSD-12428), and can hang on BMG if run in parallel (GSD-12436).
47+
// On Windows, we require driver 38303 or later to avoid semaphore issues, which the CI does not yet have.
48+
// Rather than mark the WHOLE test as requiring 38303, which would mean no testing nowhere,
49+
// we are limiting it with R U N - I F
50+
5151
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type float --channels 4 --semaphores 33x
5252
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type float --channels 1 --semaphores 33x
5353
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type half --channels 2 --semaphores 33x
@@ -57,7 +57,6 @@
5757
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type uint16 --channels 4 --semaphores 33x
5858
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type uint8 --channels 1 --semaphores 33x
5959
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type int8 --channels 2 --semaphores 33x
60-
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type unorm8 --channels 4 --semaphores 33x
6160
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type half --channels 4 --semaphores 33x
6261
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type uint32 --channels 2 --semaphores 33x
6362

@@ -71,6 +70,7 @@
7170
#include <sycl/detail/core.hpp>
7271
#include <sycl/ext/oneapi/bindless_images.hpp>
7372
#include <sycl/ext/oneapi/bindless_images_interop.hpp>
73+
#include <sycl/properties/queue_properties.hpp>
7474

7575
namespace syclexp = sycl::ext::oneapi::experimental;
7676

@@ -148,7 +148,15 @@ int runTest(
148148
}
149149

150150
try {
151-
sycl::queue q;
151+
// Bindless image interop requires an in-order queue (per spec). External
152+
// semaphore ops additionally require immediate command lists; see
153+
// sycl_ext_oneapi_bindless_images.asciidoc.
154+
sycl::property_list qProps =
155+
useSemaphores ? sycl::property_list{sycl::property::queue::in_order{},
156+
sycl::ext::intel::property::queue::
157+
immediate_command_list{}}
158+
: sycl::property_list{sycl::property::queue::in_order{}};
159+
sycl::queue q{qProps};
152160

153161
syclexp::external_mem_descriptor<syclexp::resource_win32_handle> extMemDesc{
154162
imgRes.sharedHandle, syclexp::external_mem_handle_type::win32_nt_handle,

sycl/test-e2e/bindless_images/dx12_interop/D3D12_sycl_interop_2D_arithmetic.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
// REQUIRES: aspect-ext_oneapi_external_memory_import
33
// REQUIRES: windows
44

5-
// UNSUPPORTED: arch-intel_gpu_bmg_g21
6-
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/20384
7-
// also GSD-12429
8-
95
// RUN: %{build} -o %t.exe %link-directx
106
// RUN: %{run} %t.exe --type float --channels 4 8x8
117

@@ -26,7 +22,6 @@
2622
2723
DG2:
2824
- WORKS, including --sampled
29-
- semaphores segfault
3025
3126
DG2 $ sycl-ls
3227
[level_zero:gpu][level_zero:0] Intel(R) oneAPI Unified Runtime over
@@ -61,9 +56,6 @@
6156
// RUN: %{run} %t.exe --type int8 --channels 1 32x33
6257
// RUN: %{run} %t.exe --type int8 --channels 2 32x33
6358
// RUN: %{run} %t.exe --type int8 --channels 4 32x33
64-
// RUN-IF: !gpu-intel-bmg, %{run} %t.exe --type unorm8 --channels 1 32x33
65-
// RUN-IF: !gpu-intel-bmg, %{run} %t.exe --type unorm8 --channels 2 32x33
66-
// RUN-IF: !gpu-intel-bmg, %{run} %t.exe --type unorm8 --channels 4 32x33
6759
// RUN: %{run} %t.exe --type float --channels 1 --sampled 32x33
6860
// RUN: %{run} %t.exe --type float --channels 2 --sampled 32x33
6961
// RUN: %{run} %t.exe --type float --channels 4 --sampled 32x33
@@ -88,12 +80,12 @@
8880
// RUN: %{run} %t.exe --type int8 --channels 1 --sampled 32x33
8981
// RUN: %{run} %t.exe --type int8 --channels 2 --sampled 32x33
9082
// RUN: %{run} %t.exe --type int8 --channels 4 --sampled 32x33
91-
// RUN-IF: !gpu-intel-bmg, %{run} %t.exe --type unorm8 --channels 1 --sampled 32x33
92-
// RUN-IF: !gpu-intel-bmg, %{run} %t.exe --type unorm8 --channels 2 --sampled 32x33
93-
// RUN-IF: !gpu-intel-bmg, %{run} %t.exe --type unorm8 --channels 4 --sampled 32x33
9483

9584
// Semaphore coverage tests
96-
// At this time, semaphores aren't working on DG2 (GSD-12428), and can hang on BMG if run in parallel (GSD-12436).
85+
// On Windows, we require driver 38303 or later to avoid semaphore issues, which the CI does not yet have.
86+
// Rather than mark the WHOLE test as requiring 38303, which would mean no testing nowhere,
87+
// we are limiting it with R U N - I F
88+
9789
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type float --channels 4 --semaphores 32x33
9890
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type half --channels 2 --semaphores 32x33
9991
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type int32 --channels 1 --semaphores 32x33
@@ -105,7 +97,6 @@
10597
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type float --channels 4 --sampled --semaphores 32x33
10698
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type half --channels 2 --sampled --semaphores 32x33
10799
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type int32 --channels 1 --sampled --semaphores 32x33
108-
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type unorm8 --channels 4 --sampled --semaphores 32x33
109100

110101
// clang-format on
111102

@@ -118,6 +109,7 @@
118109
#include <sycl/detail/core.hpp>
119110
#include <sycl/ext/oneapi/bindless_images.hpp>
120111
#include <sycl/ext/oneapi/bindless_images_interop.hpp>
112+
#include <sycl/properties/queue_properties.hpp>
121113
#include <vector>
122114

123115
namespace syclexp = sycl::ext::oneapi::experimental;
@@ -415,7 +407,15 @@ int runTest(
415407
signalExportableFence(ctx, extFenceB);
416408

417409
try {
418-
sycl::queue q;
410+
// Bindless image interop requires an in-order queue (per spec). External
411+
// semaphore ops additionally require immediate command lists; see
412+
// sycl_ext_oneapi_bindless_images.asciidoc.
413+
sycl::property_list qProps =
414+
useSemaphores ? sycl::property_list{sycl::property::queue::in_order{},
415+
sycl::ext::intel::property::queue::
416+
immediate_command_list{}}
417+
: sycl::property_list{sycl::property::queue::in_order{}};
418+
sycl::queue q{qProps};
419419

420420
auto extMemA = syclexp::import_external_memory(
421421
syclexp::external_mem_descriptor<syclexp::resource_win32_handle>{

sycl/test-e2e/bindless_images/dx12_interop/D3D12_sycl_interop_2D_read.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
// REQUIRES: aspect-ext_oneapi_external_memory_import
33
// REQUIRES: windows
44

5-
// UNSUPPORTED: arch-intel_gpu_bmg_g21
6-
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/20384
7-
// also: GSD-12429
8-
95
// RUN: %{build} -o %t.exe %link-directx
106
// RUN: %{run} %t.exe --type float --channels 4 32x33
117

@@ -23,9 +19,7 @@
2319
WxH Set custom Width x Height (e.g. 8x4)
2420
2521
26-
BMG:
27-
- 1x1 works, nothing else. Suggesting offset/pitch issue.
28-
- semaphores segfault. suggesting segfaulting semaphores.
22+
2923
3024
BMG $ sycl-ls
3125
[level_zero:gpu][level_zero:0] Intel(R) oneAPI Unified Runtime over
@@ -35,7 +29,6 @@
3529
3630
DG2:
3731
- WORKS, including --sampled
38-
- semaphores segfault
3932
4033
DG2 $ sycl-ls
4134
[level_zero:gpu][level_zero:0] Intel(R) oneAPI Unified Runtime over
@@ -98,7 +91,10 @@
9891
// RUN: %{run} %t.exe --type int8 --channels 4 --sampled 32x33
9992

10093
// Semaphore coverage tests
101-
// At this time, semaphores aren't working on DG2 (GSD-12428), and can hang on BMG if run in parallel (GSD-12436).
94+
// On Windows, we require driver 38303 or later to avoid semaphore issues, which the CI does not yet have.
95+
// Rather than mark the WHOLE test as requiring 38303, which would mean no testing nowhere,
96+
// we are limiting it with R U N - I F
97+
10298
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type float --channels 4 --semaphores 32x33
10399
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type half --channels 2 --semaphores 32x33
104100
// RUN-IF: (!gpu-intel-dg2 && !arch-intel_gpu_bmg_g21), %{run} %t.exe --type int32 --channels 1 --semaphores 32x33
@@ -122,6 +118,7 @@
122118
#include <sycl/detail/core.hpp>
123119
#include <sycl/ext/oneapi/bindless_images.hpp>
124120
#include <sycl/ext/oneapi/bindless_images_interop.hpp>
121+
#include <sycl/properties/queue_properties.hpp>
125122

126123
namespace syclexp = sycl::ext::oneapi::experimental;
127124

@@ -208,7 +205,15 @@ int runTest(
208205

209206
// SYCL Import and Verification
210207
try {
211-
sycl::queue q;
208+
// Bindless image interop requires an in-order queue (per spec). External
209+
// semaphore ops additionally require immediate command lists; see
210+
// sycl_ext_oneapi_bindless_images.asciidoc.
211+
sycl::property_list qProps =
212+
useSemaphores ? sycl::property_list{sycl::property::queue::in_order{},
213+
sycl::ext::intel::property::queue::
214+
immediate_command_list{}}
215+
: sycl::property_list{sycl::property::queue::in_order{}};
216+
sycl::queue q{qProps};
212217

213218
syclexp::external_mem_descriptor<syclexp::resource_win32_handle> extMemDesc{
214219
imgRes.sharedHandle, syclexp::external_mem_handle_type::win32_nt_handle,

0 commit comments

Comments
 (0)