Skip to content

Conversation

@alan-baker
Copy link
Contributor

  • Tests for subgroup_id and num_subgroups builtins
    • builtin validation
    • uniformity validation
    • execution tests

CTS for gpuweb/gpuweb#5416

Issue: #


Requirements for PR author:

  • All missing test coverage is tracked with "TODO" or .unimplemented().
  • New helpers are /** documented */ and new helper files are found in helper_index.txt.
  • Test behaves as expected in a WebGPU implementation. (If not passing, explain above.)
  • Test have be tested with compatibility mode validation enabled and behave as expected. (If not passing, explain above.)

Requirements for reviewer sign-off:

  • Tests are properly located in the test tree.
  • Test descriptions allow a reader to "read only the test plans and evaluate coverage completeness", and accurately reflect the test code.
  • Tests provide complete coverage (including validation control cases). Missing coverage MUST be covered by TODOs.
  • Helpers and types promote readability and maintainability.

When landing this PR, be sure to make any necessary issue status updates.

@alan-baker alan-baker requested review from dneto0 and jrprice October 28, 2025 02:08
* Tests for subgroup_id and num_subgroups builtins
  * builtin validation
  * uniformity validation
  * execution tests
Copy link
Contributor

@jrprice jrprice left a comment

Choose a reason for hiding this comment

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

LGTM.

Did a dry run on Dawn CQ and everything is passing except the uniformity changes, which I've put a Tint CL up to fix.

Copy link
Contributor

@dneto0 dneto0 left a comment

Choose a reason for hiding this comment

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

Nice overall.
Some requested changes, particularly the validation test should check that subgroup_id and num_subgroups are not supported (cause compile failure) when the language feature is not supported.

!t.params.use_struct,
'missing @builtin(position) in the vertex output when the vertex output is not a struct'
);
if (t.params.name === 'subgroup_id' || t.params.name === 'num_subgroups') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of skipping the test for these cases, fail the test when the builtin is one of these and the feature is not supported.

One way to do this is to extend the table to include an optional field about which language feature (if any) supports the builtin.

if (t.params.enable_extension) {
if (t.params.name.includes('subgroups')) {
code += 'enable subgroup;\n';
if (t.params.name.includes('subgroup')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

By extending the info in the table, this code can be made more generic.

module: t.device.createShaderModule({
code: wgsl,
}),
entryPoint: 'main',
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the entryPoint field is optional when there's only one entry point.

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.

4 participants