-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL][Graph] Implement dynamic local accessors #18437
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
base: sycl
Are you sure you want to change the base?
[SYCL][Graph] Implement dynamic local accessors #18437
Conversation
56eaa40
to
32945a2
Compare
00f1bbf
to
da31888
Compare
db1d142
to
19e107c
Compare
* Implements the dynamic_local_accessor class with compiler support. * Refactor the recently added dynamic_work_group_memory class to only use one impl member variable. This brings it closer to the design of other sycl classes and avoids future ABI break issues.
19e107c
to
cb78e9d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple comments from a first pass
@@ -3520,7 +3519,14 @@ _ZN4sycl3_V17handler11saveCodeLocENS0_6detail13code_locationE | |||
_ZN4sycl3_V17handler11saveCodeLocENS0_6detail13code_locationEb | |||
_ZN4sycl3_V17handler11storeRawArgEPKvm | |||
_ZN4sycl3_V17handler12addReductionERKSt10shared_ptrIKvE | |||
_ZN4sycl3_V17handler12setArgHelperEiRNS0_3ext6oneapi12experimental6detail30dynamic_work_group_memory_baseE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are breaking changed here from a symbols being removed, is it possible to avoid that with the preview macro to guard code that will be removed in the next ABI breaking window?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I can make that change. I was hoping this wouldn't be needed since support for dynamic_work_group_memory was added very recently and the specification hasn't merged yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh I missed that these were to dynamic_work_group_memory, I think your right that this shouldn't be an issue then, but can you highlight in the PR description why we don't think this ABI break is an issue.
{ | ||
} | ||
|
||
local_accessor<DataT, Dimensions> get() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the spec PR I don't think we say this method is const, so that is something to update in the spec
|
||
SYCLIntegrationHeader::kernel_param_kind_t ParamKind = | ||
SYCLIntegrationHeader::kind_accessor; | ||
|
||
if (SemaSYCL::isSyclType(FieldTy, SYCLTypeAttr::dynamic_local_accessor)) { | ||
ParamKind = SYCLIntegrationHeader::kind_dynamic_accessor; | ||
} | ||
|
||
Header.addParamDesc(ParamKind, Info, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, this could be made into ternary operator. Also same below.
SYCLIntegrationHeader::kernel_param_kind_t ParamKind = | |
SYCLIntegrationHeader::kind_accessor; | |
if (SemaSYCL::isSyclType(FieldTy, SYCLTypeAttr::dynamic_local_accessor)) { | |
ParamKind = SYCLIntegrationHeader::kind_dynamic_accessor; | |
} | |
Header.addParamDesc(ParamKind, Info, | |
SYCLIntegrationHeader::kernel_param_kind_t ParamKind = | |
SemaSYCL::isSyclType(FieldTy, SYCLTypeAttr::dynamic_local_accessor) | |
? SYCLIntegrationHeader::kind_dynamic_accessor | |
: SYCLIntegrationHeader::kind_accessor; | |
Header.addParamDesc(ParamKind, Info, |
@@ -623,9 +629,15 @@ __SYCL_TYPE(dynamic_work_group_memory) dynamic_work_group_memory | |||
/// @param Graph The graph associated with this object. | |||
/// @param Num Number of elements in the unbounded array DataT. | |||
dynamic_work_group_memory( | |||
experimental::command_graph<graph_state::modifiable> Graph, size_t Num) | |||
[[maybe_unused]] experimental::command_graph<graph_state::modifiable> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If some of the jenkins jobs are still using gcc 7.5, then those [[maybe_unused]]
in the constructor will cause a failure because of a gcc bug, see #17736
But I guess it will show up on the pre-commit CI too. Maybe the gcc version was bumped already.
@@ -1802,20 +1837,37 @@ class __SYCL_EXPORT handler { | |||
// set_arg for graph dynamic_parameters | |||
template <typename T> | |||
void set_arg(int argIndex, | |||
ext::oneapi::experimental::dynamic_parameter<T> &dynamicParam) { | |||
[[maybe_unused]] ext::oneapi::experimental::dynamic_parameter<T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why [[maybe_unused]]
here?
[[maybe_unused]] ext::oneapi::experimental::dynamic_work_group_memory< | ||
DataT, PropertyListT> &DynWorkGroupMem) { | ||
|
||
#ifndef __SYCL_DEVICE_ONLY__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this required for dynamic work group memory but not the existing work group mem set_arg()
which looks to be doing basically the same thing?
#endif | ||
|
||
dynamic_work_group_memory_base::dynamic_work_group_memory_base( | ||
[[maybe_unused]] experimental::command_graph<graph_state::modifiable> Graph, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for [[maybe_unused]]
here vs just having the graph parameter be unnamed? Since it is never used at all.
auto *DynParamImpl = static_cast< | ||
ext::oneapi::experimental::detail::dynamic_parameter_impl *>(Ptr); | ||
|
||
registerDynamicParameter(DynParamImpl, Index + IndexShift); | ||
|
||
auto *DynLocalAccessorImpl = static_cast< | ||
ext::oneapi::experimental::detail::dynamic_local_accessor_impl *>( | ||
DynParamImpl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need separate casts here? Can't we just cast to dynamic_local_accessor_impl *
and pass that to registerDynamicParameter()
?
// 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 using more than one dynamic_work_group_memory object in the same node. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Tests using more than one dynamic_work_group_memory object in the same node. | |
// Tests using more than one dynamic_local_accessor object in the same node. |
// 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 updating dynamic_work_group_memory with a new size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Tests updating dynamic_work_group_memory with a new size. | |
// Tests updating dynamic_local_accessor with a new size. |
// 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 using a dynamic command-group object with dynamic_work_group_memory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Tests using a dynamic command-group object with dynamic_work_group_memory. | |
// Tests using a dynamic command-group object with dynamic_local_accessor. |
// 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 using a dynamic_work_group_memory with multiple nodes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Tests using a dynamic_work_group_memory with multiple nodes. | |
// Tests using a dynamic_local_accessor with multiple nodes. |
// Check that registering a dynamic object with a node from a graph that was | ||
// not passed to its constructor throws. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment doesn't make sense now since it is checking that it doesn't throw. The error for this was removed in #18199 .
impl
member variable. This brings it closer to the design of other sycl classes and avoids future ABI break issues.dynamic_work_group_memory
class whose specification has not been merged yet and is not yet officially supported.