[Optimisation] Constant Memory Inlining #4431
Michoumichmich
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
Something I encounter often in SYCL and frustrates me a little is the following missed optimisation:
Let's consider we have a global constant array (of fixed size) that contains data used by many functions. In C++ or CUDA that array can be inlined with a
#pragma unroll
. If the unrolling does not happen, the data is still accessible (using CUDA's__constant__
).In SYCL you cannot benefit from such optimisations: you cannot "inline through a constant accessor". It can be done by if you omit the buffer&accessor and use directly the global array in your kernel and then
#pragma unroll
, but that's magic and undefined behaviour.I was wondering whether you had some ideas on how to solve that. Maybe some attribute like
can_inline
to allow the compiler to try to perform that optimisation? If everything is successfully inlined it means that we could get rid of the constant accessor (and avoid the data copy), but is that an allowed optimisation in the SYCL spec? Any feedback or idea would be niceBeta Was this translation helpful? Give feedback.
All reactions