Skip to content

[SYCL][SPIR-V] Make clang lookup for SPIR-V builtins #1345

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

Naghasan
Copy link
Contributor

@Naghasan Naghasan commented Mar 18, 2020

This patch (2 commits) add the initial infrastructure to enable lookup of SPIR-V builtins by clang following a similar model as done for OpenCL.

The first commit is to make the OpenCL lookup agnostic to the programming model used. The second enables the path for them and add a dummy instructions as example. Other builtins will follow after this.

Down the line, this will enforce a stable way to express SPIR-V builtins and make them closer to how the translator mangles them. This will help ensuring builtin for CUDA does not break easily. This will also support any changes suggested by the SPIRV-LLVM people on how to represent builtins.

Signed-off-by: Victor Lomuller victor@codeplay.com

@Naghasan Naghasan force-pushed the victor/spirv-builtin-agnostic-lookup branch from 4a91cf6 to b07b2a8 Compare March 19, 2020 12:16
@Ruyk Ruyk requested a review from bader March 19, 2020 13:55
@Ruyk Ruyk added cuda CUDA back-end libclc libclc project related issues labels Mar 19, 2020
Copy link
Contributor

@bader bader left a comment

Choose a reason for hiding this comment

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

Looks good.
A few minor comments.

@Naghasan Naghasan force-pushed the victor/spirv-builtin-agnostic-lookup branch 4 times, most recently from d020e7d to ce0d73f Compare March 20, 2020 13:27
Naghasan and others added 4 commits March 20, 2020 13:40
Rename the OpenCL Builtin lookup system to make it agnostic.
The Builtin emitter is now outputting the builtin information
into a class so that different programming models can be
produced and used.

Signed-off-by: Victor Lomuller <victor@codeplay.com>
Add flag -fdeclare-spirv-builtins to enable lookup of SPIR-V builtins.

If -fdeclare-spirv-builtins is passed to clang, the compiler will try
to lookup for the builtin described in SPIRVBuiltins.td for any match.
If a match is found, overloads are build for the match.

Signed-off-by: Victor Lomuller <victor@codeplay.com>
Co-Authored-By: Alexey Bader <alexey.bader@intel.com>
Signed-off-by: Victor Lomuller <victor@codeplay.com>
Signed-off-by: Victor Lomuller <victor@codeplay.com>
@Naghasan Naghasan force-pushed the victor/spirv-builtin-agnostic-lookup branch from ce0d73f to 2709339 Compare March 20, 2020 13:40
bader
bader previously approved these changes Mar 20, 2020
@bader
Copy link
Contributor

bader commented Mar 20, 2020

@Naghasan, could you update the Windows mangling in CodeGen test, please?

Signed-off-by: Victor Lomuller <victor@codeplay.com>
@Naghasan
Copy link
Contributor Author

@bader I tests updated

Copy link
Contributor

@bader bader left a comment

Choose a reason for hiding this comment

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

Thanks!

@bader bader merged commit 12d6901 into intel:sycl Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuda CUDA back-end libclc libclc project related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants