Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL][Graph][HIP] Add HIP backend support to SYCL-Graph #12230

Merged
merged 23 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
caa7058
[SYCL][Graph] HIP Support testing
mfrancepillois Dec 21, 2023
816cfd3
[SYCL][Graph] Fix OpenCL backend test fails with CPU device
mfrancepillois Dec 21, 2023
9ed12b6
Disables unsupported test for hip + adds hip as supported in the test…
mfrancepillois Dec 22, 2023
8a15fa6
Fix hip backend name
mfrancepillois Dec 22, 2023
4954403
Typo
mfrancepillois Dec 22, 2023
c2e38a7
Merge branch 'sycl' into hip-support-graph
mfrancepillois Dec 22, 2023
68bf06e
Updates design doc
mfrancepillois Jan 2, 2024
4f09c5f
Merge branch 'hip-support-graph' of github.com:reble/llvm into hip-su…
mfrancepillois Jan 2, 2024
72b3d2c
Merge branch 'sycl' into hip-support-graph
mfrancepillois Jan 12, 2024
a281ceb
Merge branch 'sycl' into hip-support-graph
mfrancepillois Jan 15, 2024
156b4b7
Adds debug print
mfrancepillois Jan 15, 2024
24b67d8
Removes debug print
mfrancepillois Jan 16, 2024
05d2493
Update UR CMakeFile
mfrancepillois Jan 16, 2024
e1a1058
Merge branch 'sycl' into hip-support-graph
mfrancepillois Jan 17, 2024
6feb3fd
Merge branch 'sycl-upstream' into hip-support-graph
mfrancepillois Jan 18, 2024
809c97f
Merge branch 'sycl' into hip-support-graph
mfrancepillois Jan 19, 2024
0a2c485
Fixes merge issue
mfrancepillois Jan 19, 2024
0fec7e3
Merge remote-tracking branch 'origin/sycl' into hip-support-graph
EwanC Feb 19, 2024
6dea501
Check for shared allocation support
EwanC Feb 19, 2024
a7aa574
Merge remote-tracking branch 'origin/sycl' into hip-support-graph
EwanC Feb 26, 2024
744740e
Merge remote-tracking branch 'origin/sycl' into hip-support-graph
EwanC Feb 27, 2024
de18a50
Add REQUIRES to check usm_shared_allocations aspect
mfrancepillois Feb 29, 2024
4d9ab4f
Merge branch 'sycl' into hip-support-graph
mfrancepillois Feb 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion sycl/doc/design/CommandGraph.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Implementation of UR command-buffers
for each of the supported SYCL 2020 backends.

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

### Level Zero

Expand Down Expand Up @@ -325,6 +325,27 @@ An executable CUDA Graph, which contains all commands and synchronization
information, is saved in the UR command-buffer to allow for efficient
graph resubmission.

### HIP

The HIP backend offers a Graph managemenet API very similar to CUDA Graph
feature for batching series of operations.
The SYCL Graph HIP backend implementation is therefore very similar to that of CUDA.

UR commands (e.g. kernels) are mapped as graph nodes using the
[HIP Management API](https://docs.amd.com/projects/HIP/en/docs-5.5.0/doxygen/html/group___graph.html).
Synchronization between commands (UR sync-points) is implemented
using graph dependencies.
Executable HIP Graphs can be submitted to a HIP stream
in the same way as regular kernels.
The HIP backend enables enqueuing events to wait for into a stream.
It also allows signaling the completion of a submission with an event.
Therefore, submitting a UR command-buffer consists only of submitting to a stream
the executable HIP Graph that represent this series of operations.

An executable HIP Graph, which contains all commands and synchronization
information, is saved in the UR command-buffer to allow for efficient
graph resubmission.

### OpenCL

SYCL-Graph is only enabled for an OpenCL backend when the
Expand Down
2 changes: 1 addition & 1 deletion sycl/doc/design/images/SYCL-Graph-Architecture.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions sycl/plugins/unified_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ endif()
if(SYCL_PI_UR_USE_FETCH_CONTENT)
include(FetchContent)

set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
set(UNIFIED_RUNTIME_REPO "https://github.com/bensuo/unified-runtime.git")

# commit 3487672ceba0fd3575b5f3f15a832b100dc5fbad
# Author: Artur Gainullin <artur.gainullin@intel.com>
# Date: Fri Feb 16 09:59:50 2024 -0800
#
# [UR] Provide flexibility to replace unified-memory-framework repo and tag
set(UNIFIED_RUNTIME_TAG 3487672ceba0fd3575b5f3f15a832b100dc5fbad)
set(UNIFIED_RUNTIME_TAG cmdbuf-support-hip)
EwanC marked this conversation as resolved.
Show resolved Hide resolved

if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO)
set(UNIFIED_RUNTIME_REPO "${SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO}")
Expand Down
4 changes: 4 additions & 0 deletions sycl/test-e2e/Graph/Explicit/enqueue_ordering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ int main() {
return 0;
}

if (!Queue.get_device().has(sycl::aspect::usm_shared_allocations)) {
steffenlarsen marked this conversation as resolved.
Show resolved Hide resolved
return 0;
}

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

const size_t N = 10;
Expand Down
3 changes: 1 addition & 2 deletions sycl/test-e2e/Graph/Explicit/work_group_size_prop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
// should. So the Sycl graph support cannot correctly catch the error and throw
// the approriate exception for negative test. An issue has been reported
// https://github.com/bashbaug/SimpleOpenCLSamples/issues/95
// XFAIL: cuda
// XFAIL: cuda, hip
// UNSUPPORTED: opencl
// Note: failing negative test with HIP in the original test
// TODO: disable hip when HIP backend will be supported by Graph

#define GRAPH_E2E_EXPLICIT

Expand Down
3 changes: 1 addition & 2 deletions sycl/test-e2e/Graph/RecordReplay/work_group_size_prop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
// should. So the Sycl graph support cannot correctly catch the error and throw
// the approriate exception for negative test. An issue has been reported
// https://github.com/bashbaug/SimpleOpenCLSamples/issues/95
// XFAIL: cuda
// XFAIL: cuda, hip
// UNSUPPORTED: opencl
// Note: failing negative test with HIP in the original test
// TODO: disable hip when HIP backend will be supported by Graph

#define GRAPH_E2E_RECORD_REPLAY

Expand Down
3 changes: 2 additions & 1 deletion sycl/test-e2e/Graph/device_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ int main() {
auto Backend = Device.get_backend();

if ((Backend == backend::ext_oneapi_level_zero) ||
(Backend == backend::ext_oneapi_cuda)) {
(Backend == backend::ext_oneapi_cuda) ||
(Backend == backend::ext_oneapi_hip)) {
assert(SupportsGraphs == exp_ext::graph_support_level::native);
} else if (Backend == backend::opencl) {
// OpenCL backend support is conditional on the cl_khr_command_buffer
Expand Down
Loading