Skip to content

[SYCL][CUDA][libclc] Clone functions rather than aliasing in remangler #5921

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
Apr 6, 2022

Conversation

joeatodd
Copy link
Contributor

The libclc remangler handles function overloads with e.g. long long long and int, ensuring consistency with OpenCL C primitives. Previously, this was achieved by creating a GlobalAlias for each of the various overloads. However, the NVPTX target does not work with function aliases. Normally, an optimization pass removes these aliases, but the present approach prevents compiling with DPC++ for CUDA with -O0.

This PR changes the behaviour of the remangler to emit function clones (a copy of the function with a different name). There is a risk that this bloats the compiled code, but optimization should remove unneeded clones, as it did with unneeded aliases.

There is an additional barrier to -O0 compilation for NVPTX relating to nvvm_reflect, addressed here: #5900

Note: this PR is best reviewed as separate commits. The first commit makes the (small) functional change. The second commit is simply renaming all 'Alias*' variables to 'Clone*'.

@joeatodd joeatodd requested a review from bader as a code owner March 29, 2022 15:16
@joeatodd joeatodd requested a review from Naghasan March 29, 2022 15:16
@bader bader requested a review from a team March 29, 2022 15:23
@mlychkov
Copy link
Contributor

Is it possible to add a LIT test for libclc-remangler?

@joeatodd
Copy link
Contributor Author

Is it possible to add a LIT test for libclc-remangler?

Yes, good idea. I'll start working on this, but perhaps it ought to be a separate PR?

@mlychkov
Copy link
Contributor

Is it possible to add a LIT test for libclc-remangler?

Yes, good idea. I'll start working on this, but perhaps it ought to be a separate PR?

I'm ok with adding a LIT test in a separate patch. Thank you.

mlychkov
mlychkov previously approved these changes Mar 30, 2022
bader
bader previously approved these changes Mar 30, 2022
This works, I think, but we hit a new error relating to lack of DCE
after NVVM Reflect
@joeatodd joeatodd dismissed stale reviews from bader and mlychkov via 181c175 March 31, 2022 13:15
@joeatodd
Copy link
Contributor Author

joeatodd commented Apr 5, 2022

@bader ping - I rebased to retrigger broken CI but it dismissed approvals

@bader bader requested review from bader and mlychkov April 5, 2022 08:23
@bader
Copy link
Contributor

bader commented Apr 5, 2022

@bader ping - I rebased to retrigger broken CI but it dismissed approvals

Please, use GitHub UI to re-request review, otherwise, it's hard to find PRs where inputs are needed.

@joeatodd
Copy link
Contributor Author

joeatodd commented Apr 5, 2022

@bader ping - I rebased to retrigger broken CI but it dismissed approvals

Please, use GitHub UI to re-request review, otherwise, it's hard to find PRs where inputs are needed.

Apologies - I will do this in future 👍

@bader bader merged commit 7b2fb02 into intel:sycl Apr 6, 2022
@joeatodd joeatodd deleted the libclc-clone branch April 10, 2022 14:27
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.

3 participants