-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Add group local memory call lowering pass #3329
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
[SYCL] Add group local memory call lowering pass #3329
Conversation
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 needed, what problem does this patch solve?
- Why this is part of post-link?
- Please add tests
053ff77
to
3e2f205
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.
@mlychkov, please, resolve merge conflicts.
llvm/test/Transforms/LowerWGLocalMemoryCall/group_local_memory.ll
Outdated
Show resolved
Hide resolved
llvm/test/Transforms/LowerWGLocalMemoryCall/group_local_memory.ll
Outdated
Show resolved
Hide resolved
The following call is included into device code for work group by SYCL headers to declare static local memory allocation in SYCL kernel: '__attribute__((opencl_local)) uint8_t *Ptr = __sycl_allocateLocalMemory(sizeof(T), alignof(T))'. Then during compilation it should be transformed somewhere to equivalent of the following code: '__local alignas(alignof(T)) uint8_t Mem[sizeof(T)]; __local uint8_t *Ptr = &Mem;' Add a pass that handles creation of fixed-size allocations in local address space at the kernel scope. Signed-off-by: Mikhail Lychkov <[email protected]>
3e2f205
to
162cc19
Compare
Signed-off-by: Mikhail Lychkov <[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.
Thanks for moving. Few more comments.
Do you have end-to-end test, BTW or this is WIP? It is necessary for such functionality.
End-to-end test for this feature is added by Semenov Sergey: intel/llvm-test-suite#176. |
Signed-off-by: Mikhail Lychkov <[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, although I'm not sure if it works for NVPTX target.
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, but the main LIT test for this change seems to be failing
Signed-off-by: Mikhail Lychkov <[email protected]>
4f34903
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.
@kbobrovs Could you please review last changes? |
@mlychkov @bader The calling convention assertion https://github.com/intel/llvm/pull/3329/files#diff-a107684934906a250c3dc947338a6a685dc924e9246d6a33adc0b82f9b9de756R66-R68 fails for NVPTX (the default C convention is returned instead of the expected SPIR_FUNC/SPIR_KERNEL), but the E2E test passes after commenting the assertion out. |
I suggest removing the assert then. |
Signed-off-by: Mikhail Lychkov <[email protected]>
8350829
@kbobrovs, ping. |
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.
Approved. As agreed with @mlychkov, TODO + issue will follow.
The following call is included into device code for work group
by SYCL headers to declare static local memory allocation in SYCL kernel:
'attribute((opencl_local)) uint8_t *Ptr = __sycl_allocateLocalMemory(sizeof(T), alignof(T))'.
Then during compilation it should be transformed somewhere to
equivalent of the following code:
'__local alignas(alignof(T)) uint8_t Mem[sizeof(T)];
__local uint8_t *Ptr = &Mem;'
Add a pass that handles creation of fixed-size allocations in local
address space at the kernel scope.
Signed-off-by: Mikhail Lychkov [email protected]