-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL] Fix zero dimension accessors on FPGA in AOT mode #4458
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
…n aot compiling for FPGA we use address space global_device_space instead of just global_space. This seems to be confusing the specialization for the zero dimension accessor. Not overspecifying the address space seems to fix the problem with no other change in functionality.
ping to reviewers. |
Could you please add more details on why it helps and why it's correct? Maybe instead of converting everything to
|
@romanovvlad - it's in support of some new testing coming to SYCL_CTS. But I can add a test. As to why it is working, I honestly don't know. I agree with you that the original code seems fine. But it is not fine. When compiling with the global_device_space address space in the return type of these atomic values, the |
@GarveyJoe , I believe you implemented the original code for the USM address spaces, can you advise? We have a remote case where zero dimension accessors with access::atomic aren't getting the correct template specialization. It seems that when global_device_space is used as the address space in the return type, that the SFINAE fails and then the specialization isn't generated leading to problems when using the FPGA aot compiler. I frankly don't see what the root of the problem is, it looks like it should work to me. But it isn't. My simple solution here is to simply not use the address space when returning the type for atomic from the enable_if_t SFINAE, but keep it when we actually instantiate the type. That way the value with global_device_space gets to pun in place for global_space, which I now believe is the right intention. But I'm not sure. Should I instead write another conversion, this one from global space to something? (like global_device_space or global_host_space). That doesn't seem correct. Anyway, your insight would be very welcome. |
Correction, not Joe but me implemented the device/host address spaces. I'll take a look at the issue/patch when I refresh my memory. I remember, there were difficulties to make atomics working. |
/summary:run |
A test would be helpful to understand the issue you are facing. Is it some sort of substituted type causes a side-effect problem? |
Signed-off-by: Chris Perkins <[email protected]>
@MrSidims - I added a test, something I meant to do last week before I got pulled into something else. |
@MrSidims any chance to review this yet? The test should demonstrate the problem pretty well. It's definitely in a far corner. |
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.
// note: candidate function not viable: no known conversion from 'const sycl::accessor<int, 0, sycl::access::mode::atomic, sycl::access::target::global_buffer>' to 'atomic_t' (aka 'atomic<int>') for 1st argument
So it does look like, that existence of implicit conversion confuses SFINAE. Okay, since summary run was successful the patch is LGTM.
Not sure whether it's a good suggestion, but may be it worth to guard this change with ENABLE_USM macro.
Signed-off-by: Chris Perkins <[email protected]>
ping to reviewers - this should be ready for review. @MrSidims - guarding behind the ENABLE_USM_SPACE macro is a good idea. Done. |
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, yet it should be approved by RT team member
sycl/test/basic_tests/accessor/atomic_zero_dimension_accessor.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Chris Perkins <[email protected]>
Zero dimension accessors aren't working on FPGA with atomic data. When aot compiling for FPGA we use address space global_device_space instead of just global_space. This seems to be confusing the specialization for the zero dimension accessor. Not overspecifying the address space fixes the problem with no other change in functionality.