Skip to content

Conversation

@luciechoi
Copy link
Contributor

@luciechoi luciechoi commented Nov 10, 2025

Update 11/03/2025
We would like to remove this test and add similar tests when porting vulkan conformance tests. Currently, there's not a good way to specify the subgroup size inside the tests.

Fixes #490

@luciechoi
Copy link
Contributor Author

cc: @s-perron

@luciechoi luciechoi force-pushed the maximal_reconvergence branch from 28cc66d to bfebf1e Compare November 11, 2025 00:35
@luciechoi luciechoi force-pushed the maximal_reconvergence branch from bfebf1e to d86c230 Compare November 11, 2025 00:41
Copy link
Contributor

@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.

I think the test needs to be updated again.

I'm also not sure what this is trying to test anymore. Before, the code in the if and else block were the "same", so a compiler might try to remove the if-statement:

if (c) dosomething();
else dosomething();

is equivalent to

dosomething()

for CPUs. In that vain, I could see some compiler optimizations being done that would merge the execution of the calls to WaveActiveMax(TID.x). Looking at this new test, each call is distinct. Can you add a comment explaining what you are trying to check in this case?

if (TID.x % 2 == 0) {
Out[TID.x] = WaveActiveSum(TID.x);
if (TID.x % 4 == 0) {
result += WaveActiveSum(div4);
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to do something that will work for all wave sizes. This does not work for wave sizes 1 and 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Steven, I think the minimum wave size we can get is 4 from the spec

But please let me know if there are preferred ways to test different wave size (and get same result!).

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if that is true in Vulkan.

https://docs.vulkan.org/spec/latest/chapters/interfaces.html#interfaces-builtin-variables-sgs

The minimum size is implementation defined by the minSubgroupSize, and it must be at least 1: https://docs.vulkan.org/spec/latest/chapters/devsandqueues.html#limits-minSubgroupSize

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(I guess it still doesn't work if the wave size is an odd number.. 5, 7)

Copy link
Contributor

Choose a reason for hiding this comment

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

But please let me know if there are preferred ways to test different wave size (and get same result!).

I'm not sure how to do that. We can work on it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

(I guess it still doesn't work if the wave size is an odd number.. 5, 7)

Wave size (& I'm pretty sure subgroup size in vulkan) will always be a power of 2.

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct it has to be a power of two in vulkan

@luciechoi luciechoi force-pushed the maximal_reconvergence branch from d542a75 to 50f92ef Compare November 11, 2025 18:29
@luciechoi
Copy link
Contributor Author

luciechoi commented Nov 11, 2025

Sure, added a comment. The test example is from the first scenario described in this article, where waves are expected to reconverge after the nested non-uniform branch with the flag (Block B).

Sorry, I understood your comment. Changed the test to have the same block, to trigger compiler optimization.

I think the test needs to be updated again.

I'm also not sure what this is trying to test anymore. Before, the code in the if and else block were the "same", so a compiler might try to remove the if-statement:

if (c) dosomething();
else dosomething();

is equivalent to

dosomething()

for CPUs. In that vain, I could see some compiler optimizations being done that would merge the execution of the calls to WaveActiveMax(TID.x). Looking at this new test, each call is distinct. Can you add a comment explaining what you are trying to check in this case?

@luciechoi luciechoi force-pushed the maximal_reconvergence branch 2 times, most recently from f55b82b to 681fc1f Compare November 11, 2025 19:58
@luciechoi luciechoi force-pushed the maximal_reconvergence branch from 681fc1f to 6a2444e Compare November 11, 2025 20:00
@luciechoi luciechoi force-pushed the maximal_reconvergence branch from d760594 to 235c407 Compare November 13, 2025 19:45
@luciechoi luciechoi changed the title Fix reconvergence test to be agnostic to wave size. Remove subgroup_uniform_control_flow test. Nov 13, 2025
@luciechoi
Copy link
Contributor Author

@s-perron @damyanp

(Updated the PR to remove the test as discussed today)

@s-perron s-perron merged commit 3ab7781 into llvm:main Nov 19, 2025
11 of 12 checks passed
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.

[WARP] Convergence tests failure

4 participants