Skip to content

[SYCL] Implement sycl_ext_oneapi_address_cast #12382

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

Merged
merged 3 commits into from
Jan 16, 2024

Conversation

Pennycook
Copy link
Contributor

  • Adds support for OpGenericCastToPtr SPIR-V intrinsic.
  • Implements static_address_cast using OpGenericCastToPtr.
  • Implements dynamic_address_cast using OpGenericCastToPtrExplicit.
  • Adds tests for both new forms of address_cast.

- Adds support for OpGenericCastToPtr SPIR-V intrinsic.
- Implements static_address_cast using OpGenericCastToPtr.
- Implements dynamic_address_cast using OpGenericCastToPtrExplicit.
- Adds tests for both new forms of address_cast.

Signed-off-by: John Pennycook <[email protected]>
@Pennycook Pennycook requested review from a team as code owners January 12, 2024 15:58
@Pennycook Pennycook changed the title Add implementation of sycl_ext_oneapi_address_cast [SYCL] Implement sycl_ext_oneapi_address_cast Jan 12, 2024
Neither form of OpGenericCastToPtr is implemented for AMD.

Signed-off-by: John Pennycook <[email protected]>
Neither form of OpGenericCastToPtr is implemented for NVIDIA.

Signed-off-by: John Pennycook <[email protected]>
template <typename dataT>
extern __attribute__((opencl_global)) dataT *
__SYCL_GenericCastToPtr_ToGlobal(void *Ptr) noexcept {
return (__attribute__((opencl_global)) dataT *)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: no need for cast, the returned type should be already correctly typed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I just copied the existing definitions of __SYCL_GenericCastToPtrExplicit here.

I agree it makes sense to change this, but I'd prefer for it to be done as part of a follow-up PR. I don't really want to touch the existing definitions, in case something breaks unexpectedly.

Comment on lines +53 to +54
Success &= LocalPointer.get_raw() == nullptr;
Success &= PrivatePointer.get_raw() == nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmoadeli for your awareness, your patch is going to be required to enable this test on cuda and hip

Copy link
Contributor

@premanandrao premanandrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FE changes LGTM.

Copy link
Contributor

@smanna12 smanna12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CFE change looks good to me. Thanks

@Pennycook
Copy link
Contributor Author

@intel/llvm-gatekeepers, I think this can be merged now.

@aelovikov-intel aelovikov-intel merged commit 1237051 into intel:sycl Jan 16, 2024
@Pennycook Pennycook deleted the address_cast branch January 31, 2024 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants