Skip to content

Commit 03927ef

Browse files
authored
[SYCL][Graph] Deprecate dynamic_parameter constructors that take a graph (#18199)
- Tying a dynamic param to a specific graph has no practical purpose and prevents whole graph update usage, so this is the first step to removing it - Remove error wording from spec about using dynamic params across multiple graphs - Deprecate old constructors and add new ones under breaking changes macro. - Ignore graph parameter for current constructors since it is no longer stored. - Update tests to ignore deprecation warnings under werror Full spec changes to detail new behaviour will be done during the next ABI breaking window when these deprecated constructors are also removed.
1 parent 968178d commit 03927ef

File tree

45 files changed

+179
-75
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+179
-75
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_graph.asciidoc

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,10 @@ dynamic_parameter(command_graph<graph_state::modifiable> graph,
527527
|Constructs a dynamic parameter object that can be registered with command graph
528528
nodes with an initial value.
529529

530+
[Note: This constructor which takes a graph has been deprecated and will be
531+
replaced in the next ABI breaking window. The new constructor will not associate
532+
a dynamic parameter with any specific graph. -- end note]
533+
530534
Parameters:
531535

532536
* `graph` - Graph containing the nodes which will have dynamic parameters.
@@ -1936,10 +1940,6 @@ a command-group submitted to a queue with is currently recording to a graph.
19361940
* Throws synchronously with error code `invalid` if this function is called from
19371941
a normal SYCL command-group submission.
19381942

1939-
* Throws synchronously with error code `invalid` if the graph which will be
1940-
associated with the graph node resulting from this command-group submission is
1941-
different from the one with which `dynamicParameterAcc` was created.
1942-
19431943
|
19441944
[source,c++]
19451945
----
@@ -1966,10 +1966,6 @@ a command-group submitted to a queue with is currently recording to a graph.
19661966
* Throws synchronously with error code `invalid` if this function is called from
19671967
a normal SYCL command-group submission.
19681968

1969-
* Throws synchronously with error code `invalid` if the graph which will be
1970-
associated with the graph node resulting from this command-group submission is
1971-
different from the one with which the dynamic_parameter was created.
1972-
19731969
|===
19741970

19751971
=== Thread Safety

sycl/include/sycl/ext/oneapi/experimental/graph.hpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,17 @@ class command_graph<graph_state::executable>
510510
namespace detail {
511511
class __SYCL_EXPORT dynamic_parameter_base {
512512
public:
513+
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
514+
dynamic_parameter_base(size_t ParamSize, const void *Data);
515+
dynamic_parameter_base();
516+
#else
513517
dynamic_parameter_base() = default;
518+
#endif
519+
514520
dynamic_parameter_base(
515521
sycl::ext::oneapi::experimental::command_graph<graph_state::modifiable>
516522
Graph);
523+
517524
dynamic_parameter_base(
518525
sycl::ext::oneapi::experimental::command_graph<graph_state::modifiable>
519526
Graph,
@@ -556,10 +563,17 @@ class dynamic_work_group_memory_base
556563
public:
557564
dynamic_work_group_memory_base() = default;
558565
#ifndef __SYCL_DEVICE_ONLY__
566+
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
567+
568+
dynamic_work_group_memory_base(size_t Size)
569+
: dynamic_parameter_base(), BufferSize(Size) {}
570+
#endif
571+
// TODO: Remove in next ABI breaking window
559572
dynamic_work_group_memory_base(
560573
experimental::command_graph<graph_state::modifiable> Graph, size_t Size)
561574
: dynamic_parameter_base(Graph), BufferSize(Size) {}
562575
#else
576+
dynamic_work_group_memory_base(size_t Size) : BufferSize(Size) {}
563577
dynamic_work_group_memory_base(
564578
experimental::command_graph<graph_state::modifiable> /*Graph*/,
565579
size_t Size)
@@ -592,6 +606,19 @@ __SYCL_TYPE(dynamic_work_group_memory) dynamic_work_group_memory
592606
// closed.
593607
dynamic_work_group_memory() = default;
594608

609+
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
610+
/// Constructs a new dynamic_work_group_memory object.
611+
/// @param Num Number of elements in the unbounded array DataT.
612+
dynamic_work_group_memory(size_t Num)
613+
: detail::dynamic_work_group_memory_base(
614+
Num * sizeof(std::remove_extent_t<DataT>)) {}
615+
#endif
616+
617+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
618+
__SYCL_DEPRECATED("Dynamic_work_group_memory constructors taking a graph "
619+
"object have been deprecated "
620+
"and will be removed in the next ABI breaking window.")
621+
#endif
595622
/// Constructs a new dynamic_work_group_memory object.
596623
/// @param Graph The graph associated with this object.
597624
/// @param Num Number of elements in the unbounded array DataT.
@@ -642,6 +669,19 @@ class dynamic_parameter : public detail::dynamic_parameter_base {
642669
: sycl::detail::kernel_param_kind_t::kind_std_layout;
643670

644671
public:
672+
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
673+
/// Constructs a new dynamic parameter.
674+
/// @param Graph The graph associated with this parameter.
675+
/// @param Param A reference value for this parameter used for CTAD.
676+
dynamic_parameter(const ValueT &Param)
677+
: detail::dynamic_parameter_base(sizeof(ValueT), &Param) {}
678+
#endif
679+
680+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
681+
__SYCL_DEPRECATED("Dynamic_parameter constructors taking a graph object have "
682+
"been deprecated "
683+
"and will be removed in the next ABI breaking window.")
684+
#endif
645685
/// Constructs a new dynamic parameter.
646686
/// @param Graph The graph associated with this parameter.
647687
/// @param Param A reference value for this parameter used for CTAD.

sycl/source/detail/graph_impl.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,16 +1990,17 @@ size_t executable_command_graph::get_required_mem_size() const {
19901990
return impl->getGraphImpl()->getMemPool().getMemUseCurrent();
19911991
}
19921992

1993-
dynamic_parameter_base::dynamic_parameter_base(
1994-
command_graph<graph_state::modifiable> Graph)
1995-
: impl(std::make_shared<dynamic_parameter_impl>(
1996-
sycl::detail::getSyclObjImpl(Graph))) {}
1993+
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
1994+
dynamic_parameter_base::dynamic_parameter_base()
1995+
: impl(std::make_shared<dynamic_parameter_impl>()) {}
1996+
#endif
19971997

19981998
dynamic_parameter_base::dynamic_parameter_base(
1999-
command_graph<graph_state::modifiable> Graph, size_t ParamSize,
2000-
const void *Data)
2001-
: impl(std::make_shared<dynamic_parameter_impl>(
2002-
sycl::detail::getSyclObjImpl(Graph), ParamSize, Data)) {}
1999+
command_graph<graph_state::modifiable>)
2000+
: impl(std::make_shared<dynamic_parameter_impl>()) {}
2001+
dynamic_parameter_base::dynamic_parameter_base(
2002+
command_graph<graph_state::modifiable>, size_t ParamSize, const void *Data)
2003+
: impl(std::make_shared<dynamic_parameter_impl>(ParamSize, Data)) {}
20032004

20042005
void dynamic_parameter_base::updateValue(const void *NewValue, size_t Size) {
20052006
impl->updateValue(NewValue, Size);

sycl/source/detail/graph_impl.hpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,23 +1551,19 @@ class exec_graph_impl {
15511551

15521552
class dynamic_parameter_impl {
15531553
public:
1554-
dynamic_parameter_impl(std::shared_ptr<graph_impl> GraphImpl)
1555-
: MGraph(GraphImpl),
1556-
MID(NextAvailableID.fetch_add(1, std::memory_order_relaxed)) {}
1554+
dynamic_parameter_impl()
1555+
: MID(NextAvailableID.fetch_add(1, std::memory_order_relaxed)) {}
15571556

1558-
dynamic_parameter_impl(std::shared_ptr<graph_impl> GraphImpl,
1559-
size_t ParamSize, const void *Data)
1560-
: MGraph(GraphImpl), MValueStorage(ParamSize),
1557+
dynamic_parameter_impl(size_t ParamSize, const void *Data)
1558+
: MValueStorage(ParamSize),
15611559
MID(NextAvailableID.fetch_add(1, std::memory_order_relaxed)) {
15621560
std::memcpy(MValueStorage.data(), Data, ParamSize);
15631561
}
15641562

15651563
/// sycl_ext_oneapi_raw_kernel_arg constructor
15661564
/// Parameter size is taken from member of raw_kernel_arg object.
1567-
dynamic_parameter_impl(std::shared_ptr<graph_impl> GraphImpl, size_t,
1568-
raw_kernel_arg *Data)
1569-
: MGraph(GraphImpl),
1570-
MID(NextAvailableID.fetch_add(1, std::memory_order_relaxed)) {
1565+
dynamic_parameter_impl(size_t, raw_kernel_arg *Data)
1566+
: MID(NextAvailableID.fetch_add(1, std::memory_order_relaxed)) {
15711567
size_t RawArgSize = Data->MArgSize;
15721568
const void *RawArgData = Data->MArgData;
15731569
MValueStorage.reserve(RawArgSize);
@@ -1660,8 +1656,6 @@ class dynamic_parameter_impl {
16601656
std::vector<std::pair<std::weak_ptr<node_impl>, int>> MNodes;
16611657
// Dynamic command-groups which will be updated
16621658
std::vector<DynamicCGInfo> MDynCGs;
1663-
1664-
std::weak_ptr<graph_impl> MGraph;
16651659
std::vector<std::byte> MValueStorage;
16661660

16671661
private:

sycl/source/handler.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,12 +2153,6 @@ void handler::registerDynamicParameter(
21532153
}
21542154

21552155
auto Paraimpl = detail::getSyclObjImpl(DynamicParamBase);
2156-
if (Paraimpl->MGraph.lock() != this->impl->MGraph) {
2157-
throw sycl::exception(
2158-
make_error_code(errc::invalid),
2159-
"Cannot use a Dynamic Parameter with a node associated with a graph "
2160-
"other than the one it was created with.");
2161-
}
21622156
impl->MDynamicParameters.emplace_back(Paraimpl.get(), ArgIndex);
21632157
}
21642158

sycl/test-e2e/Graph/Update/FreeFunctionKernels/dyn_work_group_memory_basic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/FreeFunctionKernels/update_before_finalize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/FreeFunctionKernels/update_with_indices_multiple_exec_graphs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/FreeFunctionKernels/update_with_indices_ordering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/FreeFunctionKernels/update_with_indices_ptr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/FreeFunctionKernels/update_with_indices_ptr_3D.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/FreeFunctionKernels/update_with_indices_ptr_double_update.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/FreeFunctionKernels/update_with_indices_ptr_multiple_nodes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/FreeFunctionKernels/update_with_indices_ptr_multiple_params.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/FreeFunctionKernels/update_with_indices_ptr_subgraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/FreeFunctionKernels/update_with_indices_scalar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/dyn_cgf_with_all_dyn_params.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/dyn_cgf_with_different_type_dyn_params.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/dyn_cgf_with_dyn_work_group_mem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/dyn_cgf_with_some_dyn_params.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/dyn_work_group_memory_basic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/dyn_work_group_memory_multiple.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// RUN: %{build} -Wno-error=deprecated-declarations -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+
// Requires constructors that don't take a graph which is currently guarded by
9+
// the breaking changes macro
10+
// REQUIRES: preview-mode
11+
12+
// Tests using dynamic_work_group_memory in a whole graph update graph.
13+
14+
#include "../graph_common.hpp"
15+
#include <sycl/group_barrier.hpp>
16+
17+
int main() {
18+
queue Queue{};
19+
20+
using T = int;
21+
constexpr int LocalSize{16};
22+
23+
T *Ptr = malloc_device<T>(Size, Queue);
24+
std::vector<T> HostData(Size);
25+
std::vector<T> HostOutputCompare(Size, LocalSize * LocalSize);
26+
27+
Queue.memset(Ptr, 0, Size * sizeof(T)).wait();
28+
29+
exp_ext::command_graph GraphA{Queue.get_context(), Queue.get_device()};
30+
31+
exp_ext::dynamic_work_group_memory<T[]> DynLocalMem(LocalSize);
32+
33+
auto KernelLambda = [=](nd_item<1> Item) {
34+
size_t GlobalID = Item.get_global_id();
35+
auto LocalRange = Item.get_local_range(0);
36+
37+
auto LocalMem = DynLocalMem.get();
38+
39+
LocalMem[Item.get_local_id()] = LocalRange;
40+
group_barrier(Item.get_group());
41+
42+
for (size_t i{0}; i < LocalRange; ++i) {
43+
Ptr[GlobalID] += LocalMem[i];
44+
}
45+
};
46+
47+
nd_range<1> NDrangeA{Size, LocalSize};
48+
GraphA.add([&](handler &CGH) { CGH.parallel_for(NDrangeA, KernelLambda); });
49+
50+
auto GraphExecA = GraphA.finalize();
51+
Queue.ext_oneapi_graph(GraphExecA).wait();
52+
53+
Queue.copy(Ptr, HostData.data(), Size).wait();
54+
for (size_t i = 0; i < Size; i++) {
55+
assert(check_value(i, HostData[i], HostOutputCompare[i], "HostData"));
56+
}
57+
58+
constexpr int NewLocalSize{64};
59+
DynLocalMem.update(NewLocalSize);
60+
exp_ext::command_graph GraphB{Queue.get_context(), Queue.get_device()};
61+
62+
nd_range<1> NDrangeB{Size, NewLocalSize};
63+
GraphB.add([&](handler &CGH) { CGH.parallel_for(NDrangeB, KernelLambda); });
64+
65+
auto GraphExecB = GraphB.finalize(exp_ext::property::graph::updatable{});
66+
GraphExecB.update(GraphA);
67+
68+
Queue.memset(Ptr, 0, Size * sizeof(T)).wait();
69+
Queue.ext_oneapi_graph(GraphExecB).wait();
70+
71+
Queue.copy(Ptr, HostData.data(), Size).wait();
72+
for (size_t i = 0; i < Size; i++) {
73+
assert(check_value(i, HostData[i], HostOutputCompare[i], "HostData"));
74+
}
75+
76+
return 0;
77+
}

sycl/test-e2e/Graph/Update/dyn_work_group_memory_multiple_nodes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/update_before_finalize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/update_nullptr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/update_with_indices_accessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

sycl/test-e2e/Graph/Update/update_with_indices_accessor_double_update.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
22
// RUN: %{run} %t.out
33
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
44
// 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 %}

0 commit comments

Comments
 (0)