Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wgsl: @size only allowed on creation-fixed types #3296

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.`)
zoddicus marked this conversation as resolved.
Show resolved Hide resolved
.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);
});