Skip to content

[SYCL] Don't zero-initialize MImageObj in 1.2.1 image #12012

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

Conversation

wenju-he
Copy link
Contributor

@wenju-he wenju-he commented Nov 27, 2023

image_accessor constructor was generating following IR in O0 mode:

store target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0) zeroinitializer, ptr addrspace(4) %MImageObj, align 8

As a target extension type, spirv.Image currently allows zeroinit.
However, OpConstantNull in spirv spec doesn't allow image type.
Therefore, we're not able to get sycl 1.2.1 image working in O0 mode.

This PR solves the issue by not initializing MImageObj.

image_accessor constructor was generating following IR in O0 mode:
```
store target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 1) zeroinitializer, ptr %0, align 8
```
As a target extension type, spirv.Image currently allows zeroinit.
However, OpConstantNull in spirv spec doesn't allows image type.
Therefore, we're not able to get sycl 1.2.1 image working in O0 mode.

This PR solves the issue by not initializing MImageObj.
@wenju-he wenju-he requested a review from a team as a code owner November 27, 2023 12:40
Copy link
Contributor

@asudarsa asudarsa left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks

@@ -924,7 +924,7 @@ class image_accessor

#ifdef __SYCL_DEVICE_ONLY__
// Default constructor for objects later initialized with __init member.
image_accessor() : MImageObj() {}
image_accessor() {}
Copy link
Contributor

Choose a reason for hiding this comment

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

tbh can be even removed/defaulted in this case

@asudarsa
Copy link
Contributor

@intel/llvm-gatekeepers Can we please merge this change?

Thanks

@steffenlarsen steffenlarsen merged commit dfd64b6 into intel:sycl Nov 30, 2023
@wenju-he wenju-he deleted the disable-image-zero-initialization branch December 1, 2023 01:47
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.

4 participants