Skip to content

Commit

Permalink
Fix tests related to subgroup uniformity diagnostics (#4038)
Browse files Browse the repository at this point in the history
* Change fragment builtin tests to avoid non-uniform branches around
  subgroup operations
* Add diagnostic filters to execution tests relying on non-uniformity
  • Loading branch information
alan-baker authored Nov 14, 2024
1 parent ec0b116 commit 9904b91
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/webgpu/listing_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -1567,6 +1567,7 @@
"webgpu:shader,execution,expression,call,builtin,subgroupBitwise:compute,split:*": { "subcaseMS": 1743.045 },
"webgpu:shader,execution,expression,call,builtin,subgroupBitwise:data_types:*": { "subcaseMS": 5081.792 },
"webgpu:shader,execution,expression,call,builtin,subgroupBitwise:fragment,all_active:*": { "subcaseMS": 9079.446 },
"webgpu:shader,execution,expression,call,builtin,subgroupBitwise:fragment,split:*": { "subcaseMS": 0.347 },
"webgpu:shader,execution,expression,call,builtin,subgroupBroadcast:data_types:*": { "subcaseMS": 252.374 },
"webgpu:shader,execution,expression,call,builtin,subgroupBroadcast:fragment:*": { "subcaseMS": 0.108 },
"webgpu:shader,execution,expression,call,builtin,subgroupBroadcast:workgroup_uniform_load:*": { "subcaseMS": 109.832 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ predication filters are skipped.
const wgsl = `
enable subgroups;
diagnostic(off, subgroup_uniformity);
diagnostic(off, subgroup_branching);
@group(0) @binding(0)
var<storage> inputs : u32; // unused
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,9 @@ predication filters are skipped.
const wgsl = `
enable subgroups;
diagnostic(off, subgroup_uniformity);
diagnostic(off, subgroup_branching);
@group(0) @binding(0)
var<storage> inputs : u32; // unused
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ g.test('compute,split')
const wgsl = `
enable subgroups;
diagnostic(off, subgroup_uniformity);
diagnostic(off, subgroup_branching);
@group(0) @binding(0)
var<storage> input : array<u32>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ g.test('compute,split')
const wgsl = `
enable subgroups;
diagnostic(off, subgroup_uniformity);
diagnostic(off, subgroup_branching);
@group(0) @binding(0)
var<storage> inputs : array<u32>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ g.test('compute,split')
const wgsl = `
enable subgroups;
diagnostic(off, subgroup_uniformity);
diagnostic(off, subgroup_branching);
@group(0) @binding(0)
var<storage> inputs : array<u32>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ g.test('compute,split')
const wgsl = `
enable subgroups;
diagnostic(off, subgroup_uniformity);
diagnostic(off, subgroup_branching);
@group(0) @binding(0)
var<storage, read_write> size : u32;
Expand Down Expand Up @@ -224,6 +227,8 @@ g.test('predicate')
const wgsl = `
enable subgroups;
diagnostic(off, subgroup_branching);
@group(0) @binding(0)
var<storage, read_write> size : u32;
Expand Down Expand Up @@ -313,6 +318,9 @@ g.test('predicate_and_control_flow')
const wgsl = `
enable subgroups;
diagnostic(off, subgroup_branching);
diagnostic(off, subgroup_uniformity);
@group(0) @binding(0)
var<storage, read_write> size : u32;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,9 @@ g.test('compute,split')
const wgsl = `
enable subgroups;
diagnostic(off, subgroup_uniformity);
diagnostic(off, subgroup_branching);
@group(0) @binding(0)
var<storage> inputs : array<u32>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ g.test('workgroup_uniform_load')
const wgsl = `
enable subgroups;
diagnostic(off, subgroup_branching);
var<workgroup> wgmem : u32;
@group(0) @binding(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@ g.test('compute,split')
const wgsl = `
enable subgroups;
diagnostic(off, subgroup_uniformity);
diagnostic(off, subgroup_branching);
@group(0) @binding(0)
var<storage> input : array<u32>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1691,11 +1691,8 @@ fn fsMain(
let countSubgroupSizeEqualI = ballotSubgroupSizeEqualI.x + ballotSubgroupSizeEqualI.y + ballotSubgroupSizeEqualI.z + ballotSubgroupSizeEqualI.w;
subgroupSizeBallotedInvocations += countSubgroupSizeEqualI;
// Validate that all active invocations see the same subgroup size, i.e. ballotedSubgroupSize
if (countSubgroupSizeEqualI == countActive) {
ballotedSubgroupSize = i;
} else if (countSubgroupSizeEqualI != 0) {
error++;
}
ballotedSubgroupSize = select(ballotedSubgroupSize, i, countSubgroupSizeEqualI == countActive);
error = select(error, error + 1, countSubgroupSizeEqualI != countActive && countSubgroupSizeEqualI != 0);
}
// Validate that all active invocations balloted in previous loop
if (subgroupSizeBallotedInvocations != countActive) {
Expand Down

0 comments on commit 9904b91

Please sign in to comment.