Skip to content

Commit 897b270

Browse files
mfrancepilloisal42andEwanC
authored
[SYCL][Graph][HIP] Add HIP backend support to SYCL-Graph (#12230)
Tests HIP Support for Graph from oneapi-src/unified-runtime#1254 and updates documentation. Depends on #12753. --------- Co-authored-by: Andrey Alekseenko <[email protected]> Co-authored-by: Ewan Crawford <[email protected]>
1 parent be8ad8f commit 897b270

File tree

7 files changed

+36
-14
lines changed

7 files changed

+36
-14
lines changed

sycl/doc/design/CommandGraph.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ Implementation of UR command-buffers
236236
for each of the supported SYCL 2020 backends.
237237

238238
Backends which are implemented currently are: [Level Zero](#level-zero),
239-
[CUDA](#cuda), and partial support for [OpenCL](#opencl).
239+
[CUDA](#cuda), [HIP](#hip) and partial support for [OpenCL](#opencl).
240240

241241
### Level Zero
242242

@@ -351,6 +351,27 @@ An executable CUDA Graph, which contains all commands and synchronization
351351
information, is saved in the UR command-buffer to allow for efficient
352352
graph resubmission.
353353

354+
### HIP
355+
356+
The HIP backend offers a Graph managemenet API very similar to CUDA Graph
357+
feature for batching series of operations.
358+
The SYCL Graph HIP backend implementation is therefore very similar to that of CUDA.
359+
360+
UR commands (e.g. kernels) are mapped as graph nodes using the
361+
[HIP Management API](https://docs.amd.com/projects/HIP/en/docs-5.5.0/doxygen/html/group___graph.html).
362+
Synchronization between commands (UR sync-points) is implemented
363+
using graph dependencies.
364+
Executable HIP Graphs can be submitted to a HIP stream
365+
in the same way as regular kernels.
366+
The HIP backend enables enqueuing events to wait for into a stream.
367+
It also allows signaling the completion of a submission with an event.
368+
Therefore, submitting a UR command-buffer consists only of submitting to a stream
369+
the executable HIP Graph that represent this series of operations.
370+
371+
An executable HIP Graph, which contains all commands and synchronization
372+
information, is saved in the UR command-buffer to allow for efficient
373+
graph resubmission.
374+
354375
### OpenCL
355376

356377
SYCL-Graph is only enabled for an OpenCL backend when the

sycl/doc/design/images/SYCL-Graph-Architecture.svg

Lines changed: 1 addition & 1 deletion
Loading

sycl/plugins/unified_runtime/CMakeLists.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT)
5757
include(FetchContent)
5858

5959
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
60-
# commit 9b936b5748a8da86123f3f148d1cfa84e52531c4
61-
# Merge: 91c6068b 767cfd1a
62-
# Author: Piotr Balcer <[email protected]>
63-
# Date: Mon Feb 26 10:46:55 2024 +0100
64-
# Merge pull request #1354 from AllanZyne/sanitizer-device-global
65-
# [DeviceSanitizer] Support detecting out-of-bounds error on DeviceGlobals
66-
set(UNIFIED_RUNTIME_TAG 9b936b5748a8da86123f3f148d1cfa84e52531c4)
60+
61+
# commit a2757b2931daa2f8d7c9dd51b0fc846be1fd49a7
62+
# Merge: 9b936b5 + f78d369
63+
# Author: Kenneth Benzie (Benie) <[email protected]>
64+
# Date: Tue Feb 27 11:34:58 2024 +0000
65+
# Merge pull request #1254 from Bensuo/cmdbuf-support-hip
66+
# [EXP][CMDBUF] HIP adapter support for command buffers
67+
set(UNIFIED_RUNTIME_TAG a2757b2931daa2f8d7c9dd51b0fc846be1fd49a7 )
6768

6869
if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO)
6970
set(UNIFIED_RUNTIME_REPO "${SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO}")

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// REQUIRES: aspect-usm_shared_allocations
12
// RUN: %{build} -o %t.out
23
// RUN: %{run} %t.out
34
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
// should. So the Sycl graph support cannot correctly catch the error and throw
1212
// the approriate exception for negative test. An issue has been reported
1313
// https://github.com/bashbaug/SimpleOpenCLSamples/issues/95
14-
// XFAIL: cuda
14+
// XFAIL: cuda, hip
1515
// UNSUPPORTED: opencl
1616
// Note: failing negative test with HIP in the original test
17-
// TODO: disable hip when HIP backend will be supported by Graph
1817

1918
#define GRAPH_E2E_EXPLICIT
2019

sycl/test-e2e/Graph/RecordReplay/work_group_size_prop.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
// should. So the Sycl graph support cannot correctly catch the error and throw
1212
// the approriate exception for negative test. An issue has been reported
1313
// https://github.com/bashbaug/SimpleOpenCLSamples/issues/95
14-
// XFAIL: cuda
14+
// XFAIL: cuda, hip
1515
// UNSUPPORTED: opencl
1616
// Note: failing negative test with HIP in the original test
17-
// TODO: disable hip when HIP backend will be supported by Graph
1817

1918
#define GRAPH_E2E_RECORD_REPLAY
2019

sycl/test-e2e/Graph/device_query.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ int main() {
2020
auto Backend = Device.get_backend();
2121

2222
if ((Backend == backend::ext_oneapi_level_zero) ||
23-
(Backend == backend::ext_oneapi_cuda)) {
23+
(Backend == backend::ext_oneapi_cuda) ||
24+
(Backend == backend::ext_oneapi_hip)) {
2425
assert(SupportsGraphs == exp_ext::graph_support_level::native);
2526
} else if (Backend == backend::opencl) {
2627
// OpenCL backend support is conditional on the cl_khr_command_buffer

0 commit comments

Comments
 (0)