Skip to content
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

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

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 victor@codeplay.com

Signed-off-by: Victor Lomuller <victor@codeplay.com>
Define __SPIRV_BUILTIN_DECLARATIONS__ when passing
-fdeclare-spirv-builtins to clang.

Signed-off-by: Victor Lomuller <victor@codeplay.com>
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?

clang/lib/Sema/SPIRVBuiltins.td Outdated Show resolved Hide resolved
clang/lib/Sema/SPIRVBuiltins.td Outdated Show resolved Hide resolved
clang/lib/Sema/SPIRVBuiltins.td Outdated Show resolved Hide resolved
clang/lib/Sema/SPIRVBuiltins.td Outdated Show resolved Hide resolved
clang/lib/Sema/SPIRVBuiltins.td Outdated Show resolved Hide resolved
@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 <victor@codeplay.com>
Co-Authored-By: Alexey Bader <alexey.bader@intel.com>
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