Skip to content

Commit

Permalink
Add validation of subgroup_uniformity diagnostic (#4066)
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-baker authored Dec 3, 2024
1 parent 3818ac8 commit ca6d65d
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/webgpu/shader/validation/parse/diagnostic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ShaderValidationTest } from '../shader_validation_test.js';

export const g = makeTestGroup(ShaderValidationTest);

const kSpecDiagnosticRules = ['derivative_uniformity'];
const kSpecDiagnosticRules = ['derivative_uniformity', 'subgroup_uniformity'];
const kSpecDiagnosticSeverities = ['off', 'info', 'warning', 'error'];
const kDiagnosticTypes = ['attribute', 'directive'];

Expand Down Expand Up @@ -124,9 +124,14 @@ g.test('warning_unknown_rule')
g.test('valid_locations')
.specURL('https://gpuweb.github.io/gpuweb/wgsl/#diagnostics')
.desc(`Tests valid locations`)
.params(u => u.combine('type', kDiagnosticTypes).combine('location', keysOf(kValidLocations)))
.params(u =>
u
.combine('type', kDiagnosticTypes)
.combine('location', keysOf(kValidLocations))
.combine('rule', kSpecDiagnosticRules)
)
.fn(t => {
const diag = generateDiagnostic(t.params.type, 'info', 'derivative_uniformity');
const diag = generateDiagnostic(t.params.type, 'info', t.params.rule);
const code = kValidLocations[t.params.location](diag);
let res = true;
if (t.params.type === 'directive') {
Expand All @@ -143,9 +148,14 @@ g.test('valid_locations')
g.test('invalid_locations')
.specURL('https://gpuweb.github.io/gpuweb/wgsl/#diagnostics')
.desc(`Tests invalid locations`)
.params(u => u.combine('type', kDiagnosticTypes).combine('location', keysOf(kInvalidLocations)))
.params(u =>
u
.combine('type', kDiagnosticTypes)
.combine('location', keysOf(kInvalidLocations))
.combine('rule', kSpecDiagnosticRules)
)
.fn(t => {
const diag = generateDiagnostic(t.params.type, 'info', 'derivative_uniformity');
const diag = generateDiagnostic(t.params.type, 'info', t.params.rule);
t.expectCompileResult(true, kInvalidLocations[t.params.location](''));
t.expectCompileResult(false, kInvalidLocations[t.params.location](diag));
});
Expand Down

0 comments on commit ca6d65d

Please sign in to comment.