-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][HIP][libclc] Fix wrong address spaces for HIP #4966
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
|
||
#include <spirv/spirv.h> | ||
|
||
_CLC_DEF void _Z23__spirv_GroupWaitEventsjiP9ocl_event(unsigned int scope, |
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.
_CLC_DEF void _Z23__spirv_GroupWaitEventsjiP9ocl_event(unsigned int scope, | |
_CLC_DEF _CLC_OVERLOAD void __spirv_GroupWaitEvents(unsigned int scope, |
it is also missing the overload for private
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 tried adding that, but I can't get it to work (linker is not finding this).
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.
https://github.com/intel/llvm/blob/sycl/clang/lib/AST/ItaniumMangle.cpp#L2560 is causing different mangling.
In SYCL mode, Default will be 0, so no UAS0
will be added, by in CL mode, Default is 5
(private) causing the addition of UAS0
.
This could either be recovered by the remangler (a bit dirty but more scalable) or handled by manual mangling (not great).
|
||
_CLC_DEF void _Z23__spirv_GroupWaitEventsjiP9ocl_event(unsigned int scope, | ||
int num_events, | ||
event_t __attribute__((address_space(0)))* event_list) { |
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 think using __private
is better here.
OTOH, I don't fully understand the problem. If we compile this code with -cl-std=CL2.0, event_list
will point to generic address space.
What exactly is the problem 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.
0
is generic here (5
is private)
If we compile this code with -cl-std=CL2.0
there is a need for selective enabling of 2.0. The lib is tailored for 1.2 so that will probably not turned as expected (you suddenly make pointers to private pointers to generic).
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.
Oh... wait. Are we calling OpenCL 1.2 built-in here? Shouldn't we apply private address space attribute on SYCL side in this case and explicitly cast to correct AS?
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.
Well there is an overload for generic. Never mattered for PTX because the target address space for private and generic overlap.
The runtime header could be patch to call the privare overload (it will always be a pointer to private AFAIK).
But TBH, there is an issue in the device event design as the stored pointer is a dangling one #4959
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 runtime header could be patch to call the privare overload (it will always be a pointer to private AFAIK).
So, which way do you think is better to handle this issue: update the runtime to call correct overload overload or apply this patch?
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.
@Naghasan I think the question above was meant for you.
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.
oups sorry
So, which way do you think is better to handle this issue: update the runtime to call correct overload overload or apply this patch?
There is a need for a broader course of action regarding generic address space handling here, so as the patch is ready, I would say ship it. Once the generic is better handled, this will go away.
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
…ess spaces (#570) Remove xfail from tests fixed by: intel/llvm#4966
@t4c1, this patch breaks |
I looked into this, but I am not even sure what that test is supposed to be checking. It seems completely broken - for both CUDA and HIP backends it is only passing because the code does not compile and the test only checks with FileCheck and CHECK-NOT. |
I'm reverting this patch to fix pre-commit checks in CI blocking other PRs. |
…t_t address spaces (#570)" (#724) This reverts commit 367e10e. Reverting due to intel/llvm#4966 revert.
…ntel#4966)" (intel#5284)" This reverts commit 29047bc.
…ess spaces (intel/llvm-test-suite#570) Remove xfail from tests fixed by: intel#4966
…t_t address spaces (intel/llvm-test-suite#570)" (intel/llvm-test-suite#724) This reverts commit d2ed0fc. Reverting due to intel#4966 revert.
Fixes wrong address spaces for
event_t
. It should be private, but in SYCL it was defaulting to generic. On the other hand in libclc pointer toevent_t
was private, while it should be generic. (We don't see similar issues on NVPTX, as there private address space is in fact implemented as generic in IR).Change to test suite: intel/llvm-test-suite#570