Skip to content

Commit a6301e9

Browse files
authored
[SYCL][Graph] Skip Graph tests based on sycl-ls output (#12812)
The graph extension tests are currently skipped during execution for devices which don't support the graphs extension. However, this early return causes the tests to be reported as passed and makes it hard from looking at the results to know if the tests actually stressed the graphs code or not. Improved this situation by changing the SYCL-Graph device info query to an aspect such that `sycl-ls --verbose` will output `ext_oneapi_graph` for supported devices. This can then be used to inform the LIT config and set a requirement for tests, enabling the tests to be obviously skipped for devices that don't support graphs. To enable setting this requirement in `lit.local.cfg` files some extra directories have been created, in particular `UnsupportedDevice` which contains tests that don't have a requirement as the tests verify expected errors are thrown when using the graphs API with unsupported devices. The removal of the device info query means that we can no longer report if a device emulates support for SYCL-Graph, however we currently have no such implementations as they haven't yet deemed to provide enough value. This is technically an ABI breaking change however due to the removal of symbols, but SYCL-Graph is currently an experimental extension so such changes may be permitted.
1 parent 6b0066a commit a6301e9

File tree

155 files changed

+173
-674
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+173
-674
lines changed

llvm/include/llvm/SYCLLowerIR/DeviceConfigFile.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def AspectExt_oneapi_tangle_group : Aspect<"ext_oneapi_tangle_group">;
6969
def AspectExt_intel_matrix : Aspect<"ext_intel_matrix">;
7070
def AspectExt_oneapi_is_composite : Aspect<"ext_oneapi_is_composite">;
7171
def AspectExt_oneapi_is_component : Aspect<"ext_oneapi_is_component">;
72+
def AspectExt_oneapi_graph : Aspect<"ext_oneapi_graph">;
7273
// Deprecated aspects
7374
def AspectInt64_base_atomics : Aspect<"int64_base_atomics">;
7475
def AspectInt64_extended_atomics : Aspect<"int64_extended_atomics">;
@@ -119,7 +120,7 @@ def : TargetInfo<"__TestAspectList",
119120
AspectExt_oneapi_interop_semaphore_import, AspectExt_oneapi_interop_semaphore_export,
120121
AspectExt_oneapi_mipmap, AspectExt_oneapi_mipmap_anisotropy, AspectExt_oneapi_mipmap_level_reference, AspectExt_intel_esimd,
121122
AspectExt_oneapi_ballot_group, AspectExt_oneapi_fixed_size_group, AspectExt_oneapi_opportunistic_group,
122-
AspectExt_oneapi_tangle_group, AspectExt_intel_matrix, AspectExt_oneapi_is_composite, AspectExt_oneapi_is_component],
123+
AspectExt_oneapi_tangle_group, AspectExt_intel_matrix, AspectExt_oneapi_is_composite, AspectExt_oneapi_is_component, AspectExt_oneapi_graph],
123124
[]>;
124125
// This definition serves the only purpose of testing whether the deprecated aspect list defined in here and in SYCL RT
125126
// match.

sycl/doc/extensions/experimental/sycl_ext_oneapi_graph.asciidoc

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Dan Holmes, Intel +
4343
Greg Lueck, Intel +
4444
Steffen Larsen, Intel +
4545
Jaime Arteaga Molina, Intel +
46+
Andrei Elovikov, Intel +
4647
Ewan Crawford, Codeplay +
4748
Ben Tracy, Codeplay +
4849
Duncan McBain, Codeplay +
@@ -296,37 +297,18 @@ Adding an executable graph as a sub-graph does not affect its existing node
296297
dependencies, such that it could be submitted in future without any side
297298
effects of prior uses as a sub-graph.
298299

299-
=== Device Info Query
300-
301-
[source, c++]
302-
----
303-
namespace sycl::ext::oneapi::experimental {
304-
enum class graph_support_level {
305-
unsupported,
306-
native,
307-
emulated
308-
};
309-
}
310-
----
300+
=== Querying Device Support
311301

312302
Due to the experimental nature of the extension, support is not available across
313-
all devices. The following device support query is added to the
314-
`sycl::ext::oneapi::experimental` namespace for reporting devices which are
315-
are currently supported, and how that support is implemented.
303+
all devices.
316304

317-
Table {counter: tableNumber}. Device Info Queries.
305+
Table {counter: tableNumber}. Device Support Aspect.
318306
[%header]
319307
|===
320-
| Device Descriptors | Return Type | Description
321-
322-
|`info::device::graph_support`
323-
|`graph_support_level`
324-
|When passed to `device::get_info<...>()`, the function returns `native`
325-
if there is an underlying SYCL backend command-buffer construct which is used
326-
to propagate the graph to the backend. If no backend construct exists, or
327-
building on top of it has not yet been implemented, then `emulated` is
328-
returned. Otherwise `unsupported` is returned if the SYCL device doesn't
329-
support using this graph extension.
308+
| Device Descriptor | Description
309+
310+
|`aspect::ext_oneapi_graph`
311+
| Indicates that the device supports the APIs described in this extension.
330312

331313
|===
332314

sycl/include/sycl/device_aspect_macros.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,11 @@
313313
#define __SYCL_ALL_DEVICES_HAVE_ext_oneapi_is_component__ 0
314314
#endif
315315

316+
#ifndef __SYCL_ALL_DEVICES_HAVE_ext_oneapi_graph__
317+
// __SYCL_ASPECT(ext_oneapi_graph, 61)
318+
#define __SYCL_ALL_DEVICES_HAVE_ext_oneapi_graph__ 0
319+
#endif
320+
316321
#ifndef __SYCL_ANY_DEVICE_HAS_host__
317322
// __SYCL_ASPECT(host, 0)
318323
#define __SYCL_ANY_DEVICE_HAS_host__ 0
@@ -617,3 +622,8 @@
617622
// __SYCL_ASPECT(ext_oneapi_is_component, 60)
618623
#define __SYCL_ANY_DEVICE_HAS_ext_oneapi_is_component__ 0
619624
#endif
625+
626+
#ifndef __SYCL_ANY_DEVICE_HAS_ext_oneapi_graph__
627+
// __SYCL_ASPECT(ext_oneapi_graph, 61)
628+
#define __SYCL_ANY_DEVICE_HAS_ext_oneapi_graph__ 0
629+
#endif

sycl/include/sycl/info/aspects.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ __SYCL_ASPECT(ext_oneapi_tangle_group, 57)
5555
__SYCL_ASPECT(ext_intel_matrix, 58)
5656
__SYCL_ASPECT(ext_oneapi_is_composite, 59)
5757
__SYCL_ASPECT(ext_oneapi_is_component, 60)
58+
__SYCL_ASPECT(ext_oneapi_graph, 61)

sycl/include/sycl/info/ext_oneapi_device_traits.def

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ __SYCL_PARAM_TRAITS_SPEC(ext::oneapi::experimental, device, matrix_combinations,
1313
std::vector<ext::oneapi::experimental::matrix::combination>,
1414
PI_EXT_ONEAPI_DEVICE_INFO_MATRIX_COMBINATIONS)
1515

16-
__SYCL_PARAM_TRAITS_SPEC(
17-
ext::oneapi::experimental, device, graph_support,
18-
ext::oneapi::experimental::graph_support_level,
19-
0 /* No PI device code needed */)
20-
2116
// Bindless images pitched allocation
2217
__SYCL_PARAM_TRAITS_SPEC(ext::oneapi::experimental, device,
2318
image_row_pitch_align, uint32_t,

sycl/include/sycl/info/info_desc.hpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,9 @@ template <typename T, T param> struct compatibility_param_traits {};
193193
} /*namespace info */ \
194194
} /*namespace Namespace */
195195

196-
namespace ext::oneapi::experimental {
197-
198-
enum class graph_support_level { unsupported = 0, native = 1, emulated = 2 };
199-
200-
namespace info::device {
196+
namespace ext::oneapi::experimental::info::device {
201197
template <int Dimensions> struct max_work_groups;
202-
} // namespace info::device
203-
} // namespace ext::oneapi::experimental
198+
} // namespace ext::oneapi::experimental::info::device
204199
#include <sycl/info/ext_codeplay_device_traits.def>
205200
#include <sycl/info/ext_intel_device_traits.def>
206201
#include <sycl/info/ext_oneapi_device_traits.def>

sycl/source/detail/device_impl.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,31 @@ bool device_impl::has(aspect Aspect) const {
602602

603603
return Result != nullptr;
604604
}
605+
case aspect::ext_oneapi_graph: {
606+
size_t ResultSize = 0;
607+
bool CallSuccessful = getPlugin()->call_nocheck<PiApiKind::piDeviceGetInfo>(
608+
MDevice, PI_DEVICE_INFO_EXTENSIONS, 0, nullptr,
609+
&ResultSize) == PI_SUCCESS;
610+
if (!CallSuccessful || ResultSize == 0) {
611+
return PI_FALSE;
612+
}
613+
614+
std::unique_ptr<char[]> Result(new char[ResultSize]);
615+
CallSuccessful = getPlugin()->call_nocheck<PiApiKind::piDeviceGetInfo>(
616+
MDevice, PI_DEVICE_INFO_EXTENSIONS, ResultSize,
617+
Result.get(), nullptr) == PI_SUCCESS;
618+
619+
if (!CallSuccessful) {
620+
return PI_FALSE;
621+
}
622+
623+
std::string_view ExtensionsString(Result.get());
624+
std::cout << ExtensionsString;
625+
const bool Support =
626+
ExtensionsString.find("ur_exp_command_buffer") != std::string::npos;
627+
628+
return Support;
629+
}
605630
}
606631
throw runtime_error("This device aspect has not been implemented yet.",
607632
PI_ERROR_INVALID_DEVICE);

sycl/source/detail/device_info.hpp

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,34 +1185,6 @@ struct get_device_info_impl<
11851185
}
11861186
};
11871187

1188-
// Specialization for graph extension support
1189-
template <>
1190-
struct get_device_info_impl<
1191-
ext::oneapi::experimental::graph_support_level,
1192-
ext::oneapi::experimental::info::device::graph_support> {
1193-
static ext::oneapi::experimental::graph_support_level
1194-
get(const DeviceImplPtr &Dev) {
1195-
size_t ResultSize = 0;
1196-
Dev->getPlugin()->call<PiApiKind::piDeviceGetInfo>(
1197-
Dev->getHandleRef(), PI_DEVICE_INFO_EXTENSIONS, 0, nullptr,
1198-
&ResultSize);
1199-
if (ResultSize == 0)
1200-
return ext::oneapi::experimental::graph_support_level::unsupported;
1201-
1202-
std::unique_ptr<char[]> Result(new char[ResultSize]);
1203-
Dev->getPlugin()->call<PiApiKind::piDeviceGetInfo>(
1204-
Dev->getHandleRef(), PI_DEVICE_INFO_EXTENSIONS, ResultSize,
1205-
Result.get(), nullptr);
1206-
1207-
std::string_view ExtensionsString(Result.get());
1208-
bool CmdBufferSupport =
1209-
ExtensionsString.find("ur_exp_command_buffer") != std::string::npos;
1210-
return CmdBufferSupport
1211-
? ext::oneapi::experimental::graph_support_level::native
1212-
: ext::oneapi::experimental::graph_support_level::unsupported;
1213-
}
1214-
};
1215-
12161188
// Specialization for composite devices extension.
12171189
template <>
12181190
struct get_device_info_impl<
@@ -2175,13 +2147,6 @@ inline uint32_t get_device_info_host<
21752147
PI_ERROR_INVALID_DEVICE);
21762148
}
21772149

2178-
template <>
2179-
inline ext::oneapi::experimental::graph_support_level
2180-
get_device_info_host<ext::oneapi::experimental::info::device::graph_support>() {
2181-
// No support for graphs on the host device.
2182-
return ext::oneapi::experimental::graph_support_level::unsupported;
2183-
}
2184-
21852150
template <>
21862151
inline uint32_t get_device_info_host<
21872152
ext::oneapi::experimental::info::device::image_row_pitch_align>() {

sycl/source/detail/graph_impl.cpp

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
#include <sycl/feature_test.hpp>
1717
#include <sycl/queue.hpp>
1818

19-
// Developer switch to use emulation mode on all backends, even those that
20-
// report native support, this is useful for debugging.
21-
#define FORCE_EMULATION_MODE 0
22-
2319
namespace sycl {
2420
inline namespace _V1 {
2521

@@ -1288,21 +1284,9 @@ void executable_command_graph::finalizeImpl() {
12881284
impl->makePartitions();
12891285

12901286
auto Device = impl->getGraphImpl()->getDevice();
1291-
bool CmdBufSupport =
1292-
Device
1293-
.get_info<ext::oneapi::experimental::info::device::graph_support>() ==
1294-
graph_support_level::native;
1295-
1296-
#if FORCE_EMULATION_MODE
1297-
// Above query should still succeed in emulation mode, but ignore the
1298-
// result and use emulation.
1299-
CmdBufSupport = false;
1300-
#endif
1301-
if (CmdBufSupport) {
1302-
for (auto Partition : impl->getPartitions()) {
1303-
if (!Partition->isHostTask()) {
1304-
impl->createCommandBuffers(Device, Partition);
1305-
}
1287+
for (auto Partition : impl->getPartitions()) {
1288+
if (!Partition->isHostTask()) {
1289+
impl->createCommandBuffers(Device, Partition);
13061290
}
13071291
}
13081292
}

sycl/source/detail/graph_impl.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,9 +586,7 @@ class graph_impl {
586586
MAllowBuffers = true;
587587
}
588588

589-
if (SyclDevice.get_info<
590-
ext::oneapi::experimental::info::device::graph_support>() ==
591-
graph_support_level::unsupported) {
589+
if (!SyclDevice.has(aspect::ext_oneapi_graph)) {
592590
std::stringstream Stream;
593591
Stream << SyclDevice.get_backend();
594592
std::string BackendString = Stream.str();

sycl/test-e2e/Graph/graph_exception_global_device_extension.cpp renamed to sycl/test-e2e/Graph/Error/graph_exception_global_device_extension.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// when trying to use sycl_ext_oneapi_device_global
66
// along with Graph.
77

8-
#include "graph_common.hpp"
8+
#include "../graph_common.hpp"
99

1010
using TestProperties = decltype(sycl::ext::oneapi::experimental::properties{});
1111

@@ -143,10 +143,6 @@ template <OperationPath PathKind> void test(queue Queue) {
143143
int main() {
144144
queue Queue;
145145

146-
if (!are_graphs_supported(Queue)) {
147-
return 0;
148-
}
149-
150146
test<OperationPath::Explicit>(Queue);
151147
test<OperationPath::RecordReplay>(Queue);
152148
test<OperationPath::Shortcut>(Queue);

sycl/test-e2e/Graph/invalid_depends_on.cpp renamed to sycl/test-e2e/Graph/Error/invalid_depends_on.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,11 @@
44
// Tests that calling handler::depends_on() for events not part of the graph
55
// throws.
66

7-
#include "graph_common.hpp"
7+
#include "../graph_common.hpp"
88

99
int main() {
1010
queue Queue{};
1111

12-
if (!are_graphs_supported(Queue)) {
13-
return 0;
14-
}
15-
1612
ext::oneapi::experimental::command_graph Graph{Queue.get_context(),
1713
Queue.get_device()};
1814
ext::oneapi::experimental::command_graph Graph2{Queue.get_context(),

sycl/test-e2e/Graph/invalid_event_wait.cpp renamed to sycl/test-e2e/Graph/Error/invalid_event_wait.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,11 @@
44
// Tests that waiting on an event returned from a Record and Replay submission
55
// throws.
66

7-
#include "graph_common.hpp"
7+
#include "../graph_common.hpp"
88

99
int main() {
1010
queue Queue{};
1111

12-
if (!are_graphs_supported(Queue)) {
13-
return 0;
14-
}
15-
1612
ext::oneapi::experimental::command_graph Graph{Queue.get_context(),
1713
Queue.get_device()};
1814
Graph.begin_recording(Queue);

sycl/test-e2e/Graph/invalid_queue_wait.cpp renamed to sycl/test-e2e/Graph/Error/invalid_queue_wait.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@
33

44
// Tests that waiting on a Queue in recording mode throws.
55

6-
#include "graph_common.hpp"
6+
#include "../graph_common.hpp"
77

88
int main() {
99
queue Queue{};
1010

11-
if (!are_graphs_supported(Queue)) {
12-
return 0;
13-
}
14-
1511
ext::oneapi::experimental::command_graph Graph{Queue.get_context(),
1612
Queue.get_device()};
1713
Graph.begin_recording(Queue);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
config.required_features += ['aspect-ext_oneapi_graph']

sycl/test-e2e/Graph/Explicit/add_node_while_recording.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
int main() {
1515
queue Queue{};
1616

17-
if (!are_graphs_supported(Queue)) {
18-
return 0;
19-
}
20-
2117
bool Success = false;
2218

2319
exp_ext::command_graph Graph{Queue.get_context(), Queue.get_device()};

sycl/test-e2e/Graph/Explicit/basic_usm_host.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
// RUN: %if level_zero %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
55
// Extra run to check for immediate-command-list in Level Zero
66
// RUN: %if level_zero && linux %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
7-
//
7+
8+
// REQUIRES: aspect-usm_host_allocations
89

910
#define GRAPH_E2E_EXPLICIT
1011

sycl/test-e2e/Graph/Explicit/basic_usm_mixed.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
// RUN: %if level_zero %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
55
// Extra run to check for immediate-command-list in Level Zero
66
// RUN: %if level_zero && linux %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
7-
//
7+
8+
// REQUIRES: aspect-usm_host_allocations
9+
// REQUIRES: aspect-usm_shared_allocations
810

911
#define GRAPH_E2E_EXPLICIT
1012

sycl/test-e2e/Graph/Explicit/basic_usm_shared.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
// RUN: %if level_zero %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
55
// Extra run to check for immediate-command-list in Level Zero
66
// RUN: %if level_zero && linux %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
7-
//
7+
8+
// REQUIRES: aspect-usm_shared_allocations
89

910
#define GRAPH_E2E_EXPLICIT
1011

sycl/test-e2e/Graph/Explicit/basic_usm_system.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
// RUN: %if level_zero %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{l0_leak_check} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
55
// Extra run to check for immediate-command-list in Level Zero
66
// RUN: %if level_zero && linux %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
7-
//
7+
8+
// REQUIRES: aspect-usm_system_allocations
89

910
#define GRAPH_E2E_EXPLICIT
1011

0 commit comments

Comments
 (0)