-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][Graph] Optimize graph enqueue for in-order queues #18792
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
Merged
uditagarwal97
merged 26 commits into
intel:sycl
from
reble:fabio/eventless_graph_enqueue
Jun 18, 2025
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
7a5c5fd
Optimization enqueue work in progress
fabiomestre 0241111
Fix Unit test failure
fabiomestre d3445ef
Fix command-buffer dependencies on the legacy adapter when immediate …
fabiomestre dd8f6d1
Fix data race in multiple_exec_graphs test
fabiomestre 240c952
Let L0 event implementation handler dependencies for in-order queue
fabiomestre d70fc37
Wait for command-buffer execution before destroying
fabiomestre 109bc20
Don't rely on default context being the same for ext_oneapi_enqueue_f…
fabiomestre 91c84a7
Remove commented code
fabiomestre da3720a
Revert changes to graph_common
fabiomestre 4894aca
Try to remove extra sync in V2 adapter
fabiomestre 76e58f8
Add unit-tests for eventless path
fabiomestre 1582ab7
Address review comments
fabiomestre 74d22e5
Merge remote-tracking branch 'origin/sycl' into fabio/eventless_graph…
fabiomestre 597dd41
Update new functions to not use shared_ptr argument for queue
fabiomestre 9343cf9
Address review comments
fabiomestre c4cafcf
Fix typo
fabiomestre a9e3270
Merge remote-tracking branch 'origin/sycl' into fabio/eventless_graph…
fabiomestre 97fa20e
Revert opencl adapter changes
fabiomestre a25ad87
Merge remote-tracking branch 'origin/sycl' into fabio/eventless_graph…
fabiomestre 71cc56f
Workaround HIP limitations
fabiomestre 03fe4b6
Update comment for new hip variable
fabiomestre 92cf34f
Merge remote-tracking branch 'origin/sycl' into fabio/eventless_graph…
fabiomestre 758cecf
[HIP] Enqueue event wait instead of waiting on the host
fabiomestre fc2ad25
Merge remote-tracking branch 'origin/sycl' into fabio/eventless_graph…
fabiomestre a034bb8
Fix build failures after rebase
fabiomestre d31495e
Merge remote-tracking branch 'origin/sycl' into fabio/eventless_graph…
fabiomestre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
sycl/test-e2e/Graph/RecordReplay/ext_oneapi_enqueue_functions_with_dependencies.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// RUN: %{build} -o %t.out | ||
// RUN: %{run} %t.out | ||
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG | ||
// 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 %} | ||
// Extra run to check for immediate-command-list in Level Zero | ||
// RUN: %if level_zero %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %} | ||
|
||
// Tests the enqueue free function kernel shortcuts. | ||
|
||
#include "../graph_common.hpp" | ||
#include <sycl/ext/oneapi/experimental/enqueue_functions.hpp> | ||
#include <sycl/properties/all_properties.hpp> | ||
|
||
int main() { | ||
device Device{}; | ||
context Context{Device}; | ||
|
||
queue InOrderQueue{Context, Device, property::queue::in_order{}}; | ||
queue OtherQueue{Context, Device, property::queue::in_order{}}; | ||
|
||
using T = int; | ||
|
||
T *PtrA = malloc_device<T>(Size, InOrderQueue); | ||
T *PtrB = malloc_device<T>(Size, InOrderQueue); | ||
T *PtrC = malloc_device<T>(Size, InOrderQueue); | ||
|
||
exp_ext::command_graph Graph{InOrderQueue}; | ||
Graph.begin_recording(InOrderQueue); | ||
|
||
T Pattern = 42; | ||
exp_ext::fill(InOrderQueue, PtrA, Pattern, Size); | ||
|
||
exp_ext::single_task(InOrderQueue, [=]() { | ||
for (size_t i = 0; i < Size; ++i) { | ||
PtrB[i] = i; | ||
} | ||
}); | ||
|
||
exp_ext::parallel_for( | ||
InOrderQueue, sycl::range<1>{Size}, | ||
[=](sycl::item<1> Item) { PtrC[Item] += PtrA[Item] * PtrB[Item]; }); | ||
|
||
std::vector<T> Output(Size); | ||
exp_ext::copy(InOrderQueue, PtrC, Output.data(), Size); | ||
|
||
Graph.end_recording(); | ||
|
||
auto GraphExec = Graph.finalize(); | ||
|
||
const size_t MemsetValue = 12; | ||
sycl::event Event = | ||
exp_ext::submit_with_event(OtherQueue, [&](sycl::handler &CGH) { | ||
exp_ext::single_task(CGH, [=]() { | ||
for (size_t I = 0; I < Size; ++I) | ||
PtrC[I] = MemsetValue; | ||
}); | ||
}); | ||
|
||
exp_ext::submit(InOrderQueue, [&](sycl::handler &CGH) { | ||
CGH.depends_on(Event); | ||
exp_ext::execute_graph(CGH, GraphExec); | ||
}); | ||
|
||
InOrderQueue.wait_and_throw(); | ||
|
||
free(PtrA, InOrderQueue); | ||
free(PtrB, InOrderQueue); | ||
free(PtrC, InOrderQueue); | ||
|
||
for (size_t i = 0; i < Size; i++) { | ||
T Ref = Pattern * i + MemsetValue; | ||
assert(check_value(i, Ref, Output[i], "Output")); | ||
} | ||
|
||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.