-
Notifications
You must be signed in to change notification settings - Fork 790
[ESIMD] Implement stateless memory accesses enforcement #6287
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
Conversation
The driver option -fsycl-esimd-stateless-access makes the compiler to use stateless memory accesses for those ESIMD kernels and ESIMD intrinsics that use accessors. The option (if used) defines the macro ESIMD_FORCE_STATELESS_MEM_ACCESS to map the calls of API using accessors to calls of API using USM pointers. It also passes a switch to sycl-post-link to signal it that it should ignore the buffer_t attribute and use svmptr_t. Signed-off-by: Vyacheslav N Klochkov <[email protected]>
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
…ttern) Signed-off-by: Vyacheslav N Klochkov <[email protected]>
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
…S_MEM Some of intrinsics do not have USM equivalents for their accessros forms, i.e. get_surface_index, raw_send_load/store. Signed-off-by: Vyacheslav N Klochkov <[email protected]>
defm sycl_esimd_force_stateless_mem : BoolFOption<"sycl-esimd-force-stateless-mem", | ||
LangOpts<"SYCLESIMDForceStatelessMem">, DefaultFalse, | ||
PosFlag<SetTrue, [CC1Option, CoreOption], "Convert accesses via accessors to USM memory accesses in ESIMD kernels">, | ||
NegFlag<SetFalse>>; |
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.
Should also be a CoreOption
to be available on Windows command lines
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.
Mike, Thank you for reviewing the PR. Can you explain what you mean, or maybe add a 'suggestion'?
Isn't it already a CoreOption (see the line 2793)?
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.
The positive variant of the option is a CoreOption
but the negative isn't. I don't think the Flags from the Pos side are also applied to the Neg side unless BothFlags
is used to do so.
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.
I added the BothFlags to address this comment. Thank you!
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
@@ -2788,6 +2788,11 @@ def fintelfpga : Flag<["-"], "fintelfpga">, Group<f_Group>, | |||
Flags<[CC1Option, CoreOption]>, HelpText<"Perform ahead of time compilation for FPGA">; | |||
def fsycl_device_only : Flag<["-"], "fsycl-device-only">, Flags<[CoreOption]>, | |||
HelpText<"Compile SYCL kernels for device">; | |||
defm sycl_esimd_force_stateless_mem : BoolFOption<"sycl-esimd-force-stateless-mem", | |||
LangOpts<"SYCLESIMDForceStatelessMem">, DefaultFalse, | |||
PosFlag<SetTrue, [CC1Option, CoreOption], "Convert accesses via accessors to USM memory accesses in ESIMD kernels">, |
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.
It should be also marked experimental in help message. See other examples.
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.
It is marked as experimental. Thanks.
sycl/doc/UsersManual.md
Outdated
@@ -290,6 +290,28 @@ and not recommended to use in production environment. | |||
|
|||
NOTE: This flag is currently only supported with the CUDA and HIP targets. | |||
|
|||
|
|||
**`-f[no]-sycl-esimd-force-stateless-mem`** [EXPERIMENTAL] |
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.
**`-f[no]-sycl-esimd-force-stateless-mem`** [EXPERIMENTAL] | |
**`-f[no-]sycl-esimd-force-stateless-mem`** [EXPERIMENTAL] |
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.
Fixed.
sycl/doc/UsersManual.md
Outdated
"stateful" memory accesses via SYCL accessors to "stateless" accesses | ||
within ESIMD (Explicit SIMD) kernels by compiler. | ||
|
||
This option disables the intrinsics and methods accepting SYCL accessors |
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.
It disables in -f or -fno- form? Can you clarify here?
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.
-f option disables those intrinsics that cannot be converted automatically. I updated the text. Thank you.
does not have the limit of 4Gb per surface. | ||
Also, some of Intel GPUs or GPU run-time/drivers may support only | ||
"stateless" memory accesses. | ||
|
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.
Please add information about default value.
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.
Added. Thank you.
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
sycl/doc/UsersManual.md
Outdated
The stateless memory access enforcement is disabled by default. | ||
|
||
-fno-sycl-esimd-force-stateless-mem is used to tell compiler not to | ||
enforce usage of stateless memory accesses. |
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.
The stateless memory access enforcement is disabled by default. | |
-fno-sycl-esimd-force-stateless-mem is used to tell compiler not to | |
enforce usage of stateless memory accesses. | |
-fno-sycl-esimd-force-stateless-mem is used to tell compiler not to | |
enforce usage of stateless memory accesses. This is default behavior. |
nit: looks a bit clearer to me this way.
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.
Ok, Thank you. Fixed here: 11d9c6d
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
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.
LGTM
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.
FE changes look okay to me.
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.
FE changes LGTM
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.
FE changes and doc LGTM. Thank you
@hchilama - I had a comment from @mdtoguchi (#6287 (comment)), and I believe I addressed it in additional changes. |
The driver option -f[no-]sycl-esimd-force-stateless-mem is added.
-fsycl-esimd-force-stateless-mem enables the automatic conversion of stateful memory
accesses via SYCL accessors or surface-index to stateless within ESIMD kernels.
It also disables those ESIMD intrinsics that use stateful accesses that cannot be converted to stateless.
-fsycl-esimd-force-stateless-mem defines the macro __ESIMD_FORCE_STATELESS_MEM
to map the calls of ESIMD API using accessors to calls of API using pointers.
It also passes a switch to sycl-post-link to signal it that it should
ignore the buffer_t attribute and use svmptr_t.
-fno-sycl-esimd-force-stateless-mem is used to tell the compiler not to convert
stateful memory accesses to stateless. Default behavior.
Draft of the design document/proposal for this change-set: #6187