Skip to content

Commit

Permalink
wgsl: @SiZe only allowed on creation-fixed types (#3296)
Browse files Browse the repository at this point in the history
Fixes #1715
  • Loading branch information
jrprice authored Jan 24, 2024
1 parent d961efb commit b7ccf04
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/webgpu/listing_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2001,6 +2001,7 @@
"webgpu:shader,validation,shader_io,size:size:*": { "subcaseMS": 1.218 },
"webgpu:shader,validation,shader_io,size:size_fp16:*": { "subcaseMS": 1.500 },
"webgpu:shader,validation,shader_io,size:size_non_struct:*": { "subcaseMS": 0.929 },
"webgpu:shader,validation,shader_io,size:size_creation_fixed_footprint:*": { "subcaseMS": 1.000 },
"webgpu:shader,validation,shader_io,workgroup_size:workgroup_size:*": { "subcaseMS": 1.227 },
"webgpu:shader,validation,shader_io,workgroup_size:workgroup_size_const:*": { "subcaseMS": 3.400 },
"webgpu:shader,validation,shader_io,workgroup_size:workgroup_size_fp16:*": { "subcaseMS": 0.700 },
Expand Down
20 changes: 19 additions & 1 deletion src/webgpu/shader/validation/shader_io/size.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const kSizeTests = {
};

g.test('size')
.desc(`Test validation of ize`)
.desc(`Test validation of size`)
.params(u => u.combine('attr', keysOf(kSizeTests)))
.fn(t => {
const code = `
Expand Down Expand Up @@ -210,3 +210,21 @@ g.test('size_non_struct')

t.expectCompileResult(data.pass, code);
});

g.test('size_creation_fixed_footprint')
.desc(`Test that @size is only valid on types that have creation-fixed footprint.`)
.params(u => u.combine('array_size', [', 4', '']))
.fn(t => {
const code = `
struct S {
@size(64) a: array<f32${t.params.array_size}>,
};
@group(0) @binding(0)
var<storage> a: S;
@workgroup_size(1)
@compute fn main() {
_ = a.a[0];
}`;
t.expectCompileResult(t.params.array_size !== '', code);
});

0 comments on commit b7ccf04

Please sign in to comment.