Add WaveGetLaneCount tests - #1541
Merged
Merged
Conversation
llvm-beanz
reviewed
Sep 28, 2026
| [numthreads(1, 1, 1)] | ||
| void main() { | ||
| uint LaneCount = WaveGetLaneCount(); | ||
| Out[0] = LaneCount >= 4 && LaneCount <= 128 ? 1 : 0; |
Contributor
There was a problem hiding this comment.
Suggested change
| Out[0] = LaneCount >= 4 && LaneCount <= 128 ? 1 : 0; | |
| Out[0] = LaneCount >= 4 && LaneCount <= 128 && countbits(LaneCount) == 1 ? 1 : 0; |
We could be a bit extra here, and also use countbits to make sure this is a power of two (also required).
llvm-beanz
approved these changes
Sep 28, 2026
llvm-beanz
left a comment
Contributor
There was a problem hiding this comment.
take or leave my suggestion
spall
reviewed
Sep 29, 2026
| # XFAIL: Clang && Vulkan | ||
|
|
||
| # RUN: split-file %s %t | ||
| # RUN: %dxc_target -T cs_6_5 -Fo %t.o %t/source.hlsl |
Contributor
There was a problem hiding this comment.
this is supported from sm 6.0 and later; is there a reason you chose to use 6.5?
Contributor
Author
There was a problem hiding this comment.
No particular reason, maybe because some of the other offload tests are 6.5 / copy paste.
Dropped it to 6.0.
spall
approved these changes
Sep 29, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds offload tests for the WaveGetLaneCount builtin function.
There is currently a clang-vk failure, but since the rest of it was already implemented, we test for all other targets.
Also I thought about checking for powers of 2, but even if the DirectX / Vulkan backends specify wave size will always be a power of 2, the HLSL doc says we must expect 4 <= return <= 128.
For the unknown backend that has a non-power-of-two wave size, we leave that check off of this test.
Fixes #898
Assisted by: Github Copilot