11// RUN: %{build} -o %t.out
2- // RUN: %{run} %t.out %S/../Inputs/Kernels/update_with_indices_accessor .spv
2+ // RUN: %{run} %t.out %S/../Inputs/Kernels/dyn_cgf_accessor .spv
33// 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 %S/../Inputs/Kernels/update_with_indices_accessor .spv 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
4+ // RUN: %if level_zero %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{l0_leak_check} %{run} %t.out %S/../Inputs/Kernels/dyn_cgf_accessor .spv 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
55// 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 %S/../Inputs/Kernels/update_with_indices_accessor .spv 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
6+ // RUN: %if level_zero %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{l0_leak_check} %{run} %t.out %S/../Inputs/Kernels/dyn_cgf_accessor .spv 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
77
88// REQUIRES: level_zero
9- // XFAIL: level_zero
10- // XFAIL-TRACKER: OFNAAO-307
119
1210// Tests updating an accessor argument to a graph node created from SPIR-V
1311// using dynamic command-groups.
@@ -23,8 +21,12 @@ int main(int, char **argv) {
2321 return bundle.ext_oneapi_get_kernel (name);
2422 };
2523
26- kernel kernel = getKernel (
27- KernelBundle, " _ZTSZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_EUlvE_" );
24+ kernel kernelA = getKernel (
25+ KernelBundle,
26+ " _ZTSZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_EUlNS0_4itemILi1ELb1EEEE_" );
27+ kernel kernelB = getKernel (
28+ KernelBundle,
29+ " _ZTSZZ4mainENKUlRN4sycl3_V17handlerEE0_clES2_EUlNS0_4itemILi1ELb1EEEE_" );
2830
2931 exp_ext::command_graph Graph{
3032 Queue.get_context (),
@@ -36,22 +38,27 @@ int main(int, char **argv) {
3638 BufA.set_write_back (false );
3739 BufB.set_write_back (false );
3840
41+ int PatternA = 42 ;
42+ int PatternB = 0xA ;
43+
3944 auto AccA = BufA.get_access ();
4045 auto AccB = BufB.get_access ();
4146
4247 auto CGFA = [&](handler &CGH) {
4348 CGH.require (AccA);
4449 CGH.set_arg (0 , AccA);
45- CGH.single_task (kernel);
50+ CGH.set_arg (2 , PatternA);
51+ CGH.parallel_for (sycl::range<1 >(Size), kernelA);
4652 };
4753
4854 auto CGFB = [&](handler &CGH) {
4955 CGH.require (AccB);
5056 CGH.set_arg (0 , AccB);
51- CGH.single_task (kernel);
57+ CGH.set_arg (2 , PatternB);
58+ CGH.parallel_for (sycl::range<1 >(Size), kernelB);
5259 };
5360
54- auto DynamicCG = exp_ext::dynamic_command_group (Queue , {CGFA, CGFB});
61+ auto DynamicCG = exp_ext::dynamic_command_group (Graph , {CGFA, CGFB});
5562 auto DynamicCGNode = Graph.add (DynamicCG);
5663 auto ExecGraph = Graph.finalize (exp_ext::property::graph::updatable{});
5764
@@ -62,8 +69,8 @@ int main(int, char **argv) {
6269 Queue.copy (BufA.get_access (), HostDataA.data ()).wait ();
6370 Queue.copy (BufB.get_access (), HostDataB.data ()).wait ();
6471 for (size_t i = 0 ; i < Size; i++) {
65- assert (HostDataA[i] == i );
66- assert (HostDataB[i] == 0 );
72+ assert (check_value (i, PatternA, HostDataA[i], " HostDataA " ) );
73+ assert (check_value (i, 0 , HostDataB[i], " HostDataB " ) );
6774 }
6875
6976 DynamicCG.set_active_cgf (1 );
@@ -74,8 +81,8 @@ int main(int, char **argv) {
7481 Queue.copy (BufA.get_access (), HostDataA.data ()).wait ();
7582 Queue.copy (BufB.get_access (), HostDataB.data ()).wait ();
7683 for (size_t i = 0 ; i < Size; i++) {
77- assert (HostDataA[i] == i );
78- assert (HostDataB[i] == i );
84+ assert (check_value (i, PatternA, HostDataA[i], " HostDataA " ) );
85+ assert (check_value (i, PatternB, HostDataB[i], " HostDataB " ) );
7986 }
8087 return 0 ;
8188}
0 commit comments