Skip to content

Conversation

@cassiebeckley
Copy link
Collaborator

@cassiebeckley cassiebeckley commented Mar 26, 2025

If "SPV_KHR_quad_control" can be used, uses OpGroupNonUniformQuadAnyKHR and OpGroupNonUniformQuadAllKHR. If not, falls back to constructing the value using OpGroupNonUniformQuadBroadcast.

Fixes #7247

@cassiebeckley
Copy link
Collaborator Author

Depends on KhronosGroup/SPIRV-Tools#6068.

cassiebeckley added a commit to cassiebeckley/DirectXShaderCompiler that referenced this pull request Mar 27, 2025
spirv-val has added a validation that enforces a minimum version of
SPIR-V 1.3 when using VulkanMemoryModel, so I've updated the tests that
use it to use the correct target environment.

Needed for microsoft#7266.
cassiebeckley added a commit to cassiebeckley/DirectXShaderCompiler that referenced this pull request Mar 27, 2025
spirv-val has added a validation that enforces a minimum version of
SPIR-V 1.3 when using VulkanMemoryModel, so I've updated the tests that
use it to use the correct target environment.

Needed for microsoft#7266.
@cassiebeckley
Copy link
Collaborator Author

Depends on #7269.

cassiebeckley added a commit that referenced this pull request Mar 27, 2025
spirv-val has added a validation that enforces a minimum version of
SPIR-V 1.3 when using VulkanMemoryModel, so I've updated the tests that
use it to use the correct target environment.

Needed for #7266.
If `"SPV_KHR_quad_control"` can be used, uses
OpGroupNonUniformQuadAnyKHR and OpGroupNonUniformQuadAllKHR. If not,
falls back to constructing the value using
`OpGroupNonUniformQuadBroadcast`.

Fixes microsoft#7247
@cassiebeckley cassiebeckley marked this pull request as ready for review March 27, 2025 21:41
@cassiebeckley cassiebeckley requested a review from a team as a code owner March 27, 2025 21:41
@cassiebeckley cassiebeckley enabled auto-merge (squash) March 27, 2025 21:41
@cassiebeckley cassiebeckley disabled auto-merge March 28, 2025 16:59
QuadBroadcast -> QuadSwap correction
Copy link
Collaborator

@s-perron s-perron left a comment

Choose a reason for hiding this comment

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

LGTM I just want to see one extra test. Thanks.

docs/SPIR-V.rst Outdated
Comment on lines 4022 to 4025
``QuadAny`` and ``QuadAll`` will use the ``OpGroupNonUniformQuadAnyKHR`` and
``OpGroupNonUniformQuadAllKHR`` if the ``SPV_KHR_quad_control`` extension is
enabled. If it is not, they will fall back to constructing the value using
multiple calls to ``OpGroupNonUniformQuadBroadcast``.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
``QuadAny`` and ``QuadAll`` will use the ``OpGroupNonUniformQuadAnyKHR`` and
``OpGroupNonUniformQuadAllKHR`` if the ``SPV_KHR_quad_control`` extension is
enabled. If it is not, they will fall back to constructing the value using
multiple calls to ``OpGroupNonUniformQuadBroadcast``.
``QuadAny`` and ``QuadAll`` will use the ``OpGroupNonUniformQuadAnyKHR`` and
``OpGroupNonUniformQuadAllKHR`` instructions if the ``SPV_KHR_quad_control`` extension is
enabled. If it is not, they will fall back to constructing the value using
multiple calls to ``OpGroupNonUniformQuadBroadcast``.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@@ -0,0 +1,36 @@
// RUN: %dxc -T cs_6_0 -E main -fspv-target-env=vulkan1.1 -fcgl %s -spirv | FileCheck %s --check-prefixes=CHECK,QUAD
// RUN: %dxc -T cs_6_0 -E main -fspv-target-env=vulkan1.1 -fspv-extension=SPV_KHR_16bit_storage -fcgl %s -spirv | FileCheck %s --check-prefixes=CHECK,NOQUAD
Copy link
Collaborator

Choose a reason for hiding this comment

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

could we do a test with vulkan1.0 and check for the error? I think we can simply add another run command.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

Keenuts
Keenuts previously approved these changes Apr 1, 2025
@cassiebeckley cassiebeckley merged commit 6556410 into microsoft:main Apr 3, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in HLSL Roadmap Apr 3, 2025
@cassiebeckley cassiebeckley deleted the quad-any-all branch April 3, 2025 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[SPIR-V] QuadAny/QuadAll Unsupported in SPIR-V

3 participants