Skip to content

[SPIR-V] Add most SPIR-V definitions to clang builtin lookup #1374

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
Mar 24, 2020

Conversation

Naghasan
Copy link
Contributor

@Naghasan Naghasan commented Mar 23, 2020

This patch adds most of the SPIR-V kernel builtin definitions:

  • All builtins from the OpenCL SPIR-V extended set
  • Kernel core SPIR-V builtins not covered by LLVM instructions or instrinsinc, expect for Image, Pipe, Atomic, device side enqueue and vendor extension builtins

Signed-off-by: Victor Lomuller [email protected]

Signed-off-by: Victor Lomuller <[email protected]>
Define __SPIRV_BUILTIN_DECLARATIONS__ when passing
-fdeclare-spirv-builtins to clang.

Signed-off-by: Victor Lomuller <[email protected]>
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.

What about testing this patch?
If I understand correctly, this code is dead as it's not used in the SYCL headers. Right?

@Naghasan
Copy link
Contributor Author

What about testing this patch?
If I understand correctly, this code is dead as it's not used in the SYCL headers. Right?

This code is dead ATM, the next patch will enable the builtin lookup for device compilation + update the header. Has this brings quite a lot of code changes I broke the patch in 2 to allow focus on the parts.

I'll add some more focused testing, I don't think systematic testing of every builtin is interesting, it will be quite heavy otherwise. The test that matter for this is mainly to check that the lookup set it properly built which was enabled by the previous patch.

@Naghasan Naghasan force-pushed the victor/spirv-builtin-def branch from e61baca to 9c42725 Compare March 23, 2020 14:59

//===----------------------------------------------------------------------===//
// Definitions of types
//===----------------------------------------------------------------------===//

// OpenCL v1.0/1.2/2.0 s6.1.1: Built-in Scalar Data Types.
def Bool : IntType<"bool", QualType<"BoolTy">, 1>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

BTW @bader I added Bool to keep thing as they are ATM in the SYCL runtime. Although, as per mentioned in this PR #1287, I think lowering to boolean should be handled by the translator and the builtin definition should accept char or uchar and vector of them. One of the reason is that not all languages have the type bool.

Copy link
Contributor

Choose a reason for hiding this comment

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

Scalar bool must be supported.
The only problem is vector bool.

Added OpenCL SPIR-V extended set builtins bindings and
part of the core SPIR-V (mostly missing Images and Pipes)

Known vendor extensions are not implemented yet.

Signed-off-by: Victor Lomuller <[email protected]>
Co-Authored-By: Alexey Bader <[email protected]>
@bader bader merged commit 3ee80a5 into intel:sycl Mar 24, 2020
@Naghasan Naghasan deleted the victor/spirv-builtin-def branch March 24, 2020 17:57
aarongreig added a commit to aarongreig/intel-llvm that referenced this pull request Feb 24, 2025
This allows cuda and hip to stop reporting the relevant opencl extension
string, see issue intel#1374
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.

2 participants