forked from intel/llvm
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL][Graph] Fix memset queue shortcut when queue is recorded (intel…
…#12508) Memset queue shortcut `queue::memset()` manages the memset direclty from the host (without going through the normal path, i.e. the handler). We added a specific case when the queue is recorded to use the normal path instead of the optimized path.
- Loading branch information
1 parent
c872cad
commit 91087b9
Showing
3 changed files
with
55 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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 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,48 @@ | ||
// 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 UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %} | ||
// | ||
// Tests adding a USM memset queue shortcut operation as a graph node. | ||
|
||
#include "../graph_common.hpp" | ||
|
||
int main() { | ||
|
||
queue Queue; | ||
|
||
if (!are_graphs_supported(Queue)) { | ||
return 0; | ||
} | ||
|
||
exp_ext::command_graph Graph{Queue.get_context(), Queue.get_device()}; | ||
|
||
const size_t N = 10; | ||
unsigned char *Arr = malloc_device<unsigned char>(N, Queue); | ||
|
||
int Value = 77; | ||
Graph.begin_recording(Queue); | ||
auto Init = Queue.memset(Arr, Value, N); | ||
Queue.submit([&](handler &CGH) { | ||
CGH.depends_on(Init); | ||
CGH.single_task<class double_dest>([=]() { | ||
for (int i = 0; i < Size; i++) | ||
Arr[i] = 2 * Arr[i]; | ||
}); | ||
}); | ||
|
||
Graph.end_recording(); | ||
|
||
auto ExecGraph = Graph.finalize(); | ||
|
||
Queue.submit([&](handler &CGH) { CGH.ext_oneapi_graph(ExecGraph); }).wait(); | ||
|
||
std::vector<unsigned char> Output(N); | ||
Queue.memcpy(Output.data(), Arr, N).wait(); | ||
for (int i = 0; i < N; i++) | ||
assert(Output[i] == (Value * 2)); | ||
|
||
sycl::free(Arr, Queue); | ||
|
||
return 0; | ||
} |
This file contains 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