Skip to content

Commit c852adf

Browse files
author
Konrad Kusiak
committed
Added Graph free function kernels test without update
1 parent f37d0c4 commit c852adf

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %{build} -o %t.out
2+
// RUN: %{run} %t.out
3+
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
4+
// 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 %}
5+
// Extra run to check for immediate-command-list in Level Zero
6+
// 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 %}
7+
//
8+
// XFAIL: cuda
9+
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/16004
10+
11+
#define GRAPH_E2E_EXPLICIT
12+
13+
#include "../Inputs/free_function_kernels.cpp"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Tests compatibility with free function kernels extension
2+
3+
#include "../graph_common.hpp"
4+
5+
SYCL_EXT_ONEAPI_FUNCTION_PROPERTY((exp_ext::single_task_kernel))
6+
void ff_0(int *ptr) {
7+
for (size_t i{0}; i < Size; ++i) {
8+
ptr[i] = i;
9+
}
10+
}
11+
12+
int main() {
13+
queue Queue{};
14+
context ctxt{Queue.get_context()};
15+
16+
exp_ext::command_graph Graph{ctxt, Queue.get_device()};
17+
18+
int *PtrA = malloc_device<int>(Size, Queue);
19+
20+
std::vector<int> HostDataA(Size);
21+
22+
Queue.memset(PtrA, 0, Size * sizeof(int)).wait();
23+
24+
#ifndef __SYCL_DEVICE_ONLY__
25+
kernel_bundle Bundle = get_kernel_bundle<bundle_state::executable>(ctxt);
26+
kernel_id Kernel_id = exp_ext::get_kernel_id<ff_0>();
27+
kernel Kernel = Bundle.get_kernel(Kernel_id);
28+
auto KernelNode = Graph.add([&](handler &cgh) {
29+
cgh.set_arg(0, PtrA);
30+
cgh.single_task(Kernel);
31+
});
32+
33+
auto ExecGraph = Graph.finalize();
34+
35+
Queue.ext_oneapi_graph(ExecGraph).wait();
36+
37+
Queue.copy(PtrA, HostDataA.data(), Size).wait();
38+
for (size_t i = 0; i < Size; i++) {
39+
assert(HostDataA[i] == i);
40+
}
41+
sycl::free(PtrA, Queue);
42+
#endif
43+
return 0;
44+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %{build} -o %t.out
2+
// RUN: %{run} %t.out
3+
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
4+
// 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 %}
5+
// Extra run to check for immediate-command-list in Level Zero
6+
// 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 %}
7+
//
8+
// XFAIL: cuda
9+
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/16004
10+
11+
#define GRAPH_E2E_RECORD_REPLAY
12+
13+
#include "../Inputs/free_function_kernels.cpp"

0 commit comments

Comments
 (0)