Skip to content

[SYCL] Ignore 'used' attribute when emitting sycl device code #1729

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 1 commit into from
May 21, 2020

Conversation

premanandrao
Copy link
Contributor

Signed-off-by: Premanand M Rao [email protected]

@bader
Copy link
Contributor

bader commented May 21, 2020

@premanandrao, what is the motivation for this change?
At some point I was thinking that we might use this attribute to implement SYCL_EXTERNAL macro to avoid adding another custom attribute.
Is it used in some legacy code, which we compile "as is" in SYCL mode?

@Fznamznon
Copy link
Contributor

@premanandrao, what is the motivation for this change?
At some point I was thinking that we might use this attribute to implement SYCL_EXTERNAL macro to avoid adding another custom attribute.
Is it used in some legacy code, which we compile "as is" in SYCL mode?

The original problem was with crash due to address space mismatch. But there was emission of some global variable with initializers forced by used attribute, I don't think that used attribute should force emission of device code unless SYCL spec requires it (and it doesn't).
I also don't think that it is a good idea to use used attrubute to implement SYCL_EXTERNAL because they may have different semantics.

@erichkeane
Copy link
Contributor

@premanandrao, what is the motivation for this change?
At some point I was thinking that we might use this attribute to implement SYCL_EXTERNAL macro to avoid adding another custom attribute.
Is it used in some legacy code, which we compile "as is" in SYCL mode?

The original problem was with crash due to address space mismatch. But there was emission of some global variable with initializers forced by used attribute, I don't think that used attribute should force emission of device code unless SYCL spec requires it (and it doesn't).
I also don't think that it is a good idea to use used attrubute to implement SYCL_EXTERNAL because they may have different semantics.

I agree that we shouldn't use 'used' as SYCL_EXTERNAL. It has the problem of being used in existing code, so we'll end up having some odd variety of non-SYCL_EXTERNAL code be valid/linkable/callable, simply because the user did attribute-used in the past.

I believe a new/novel attribute is the correct way to go here.

@premanandrao
Copy link
Contributor Author

I believe a new/novel attribute is the correct way to go here.

+1

@bader bader merged commit aa35161 into intel:sycl May 21, 2020
@premanandrao
Copy link
Contributor Author

Thanks @bader

Fznamznon pushed a commit to Fznamznon/llvm that referenced this pull request Nov 29, 2022
When an intrinsic function is called with `afn` flag, it's allowed to
substitute an approximate calculations. So the translator can emit
native versions of OpenCL extended instructions.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@6417ada
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