-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[SPIRV] Change how to detect OpenCL/Vulkan Env and update tests accordingly. #129689
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
asudarsa
merged 25 commits into
llvm:main
from
maarquitos14:maronas/use-spirv-friendly-call
Jun 3, 2025
Merged
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
bbf7b42
Dissociate Logical/Physical from OpenCL/Vulkan env.
f6bf74b
Extra change to complete dissociation.
maarquitos14 4c7bbc2
Use entry points to help determine the env.
maarquitos14 ecb4f79
Explicitly add vulkan to triple of failing tests.
maarquitos14 1a4e754
Fix clang-format issue.
maarquitos14 54adad6
Merge remote-tracking branch 'origin/main' into maronas/use-spirv-fri…
maarquitos14 314f4e0
Fix failing test.
maarquitos14 6d0cf9e
Fix debug build.
maarquitos14 0f95726
Fix failing tests.
maarquitos14 a42ecac
Fix test failure.
maarquitos14 3221f7e
Merge remote-tracking branch 'origin/main' into maronas/use-spirv-fri…
maarquitos14 0cb18d0
Address code review feedback.
maarquitos14 4d84546
Merge remote-tracking branch 'origin/main' into maronas/use-spirv-fri…
maarquitos14 7a0be57
Fix build issues.
maarquitos14 70835b9
Fix typo.
maarquitos14 afa72c1
Fix test failure.
maarquitos14 b7879b5
Merge remote-tracking branch 'origin/main' into maronas/use-spirv-fri…
maarquitos14 85d600f
Fix test failure.
maarquitos14 5513335
Merge remote-tracking branch 'origin/main' into maronas/use-spirv-fri…
maarquitos14 61f2abd
Address code review feedback.
maarquitos14 a36faa4
Address more code review feedback.
maarquitos14 fcc219a
Turn assertion into fatal error.
maarquitos14 42df23d
Replace is[Kernel|Shader]Env with is[Kernel|Shader].
maarquitos14 dd530b9
Merge remote-tracking branch 'origin/main' into maronas/use-spirv-fri…
maarquitos14 248c5e6
Fix test failure.
maarquitos14 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me clarify the terminology.
SPIR-V specification defines OpenCL/Vulkan as environments and Kernel/Shader as capabilities.
What exactly are we detecting here: environments or capabilities?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I don't see in the SPIR-V spec anything about environments being OpenCL/Vulkan. Anyway, I think what we are detecting here is capabilities because most uses of
isKernelEnv()/isShaderEnv()are used to check if a particular feature is allowed --e.g.Constantdecoration is only allowed ifKernelcapability is enabled. Fundamentally, we want to know if we're dealing with graphical shaders or compute kernels.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, make the method name clearer. E.g.
or
requiresKernelCapability().Right, SPIR-V spec only says that there are separate specifications:
OpenCL provides The OpenCL™ SPIR-V Environment Specification and Vulkan provides Vulkan Environment for SPIR-V. There are other execution environments supporting SPIR-V formats (e.g. Level Zero)
My understanding is that compiler performs additional checks for restrictions in the environment specification, which is specified as OS component of the target triple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would
isCompute()/isShader()work for you?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer using terminology from the spec to avoid ambiguity.
For instance, Vulkan uses "compute shader" term for shaders doing GPGPU computations (i.e. what we call just "Shader" in clang project) - https://vulkan-tutorial.com/Compute_Shader.
Is it okay to use
isKernel/isShader?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works for me. Let's see if any of the people that already approved disagrees: @Keenuts @VyacheslavLevytskyy @MrSidims. If no comments in the next 24 hours, I'll assume they agree and I'll go ahead and change them to
isKernel/isShader.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with
isKernel/isShader(I'd be againstisComputefor OpenCL as this could be confusing)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 42df23d.