Skip to content

buffer_view CTS#4652

Open
alan-baker wants to merge 6 commits into
gpuweb:mainfrom
alan-baker:buffer-view
Open

buffer_view CTS#4652
alan-baker wants to merge 6 commits into
gpuweb:mainfrom
alan-baker:buffer-view

Conversation

@alan-baker

@alan-baker alan-baker commented May 30, 2026

Copy link
Copy Markdown
Contributor

buffer_view validation and execution CTS tests.

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.
  • Test descriptions are accurate and complete.
  • Tests provide complete coverage (including validation control cases). Missing coverage MUST be covered by TODOs.
  • Tests avoid over-parameterization (see case count report).

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

@alan-baker alan-baker requested review from dneto0 and jrprice May 30, 2026 20:09
@github-actions

github-actions Bot commented May 30, 2026

Copy link
Copy Markdown

Results for build job (at fbf596a):

+webgpu:api,validation,dispatch:shader_required_buffer_size:* - 23 cases, 92 subcases (~4/case)
+webgpu:shader,execution,expression,call,builtin,bufferArrayView:array_length:* - 78 cases, 832 subcases (~11/case)
+webgpu:shader,execution,expression,call,builtin,bufferArrayView:array_length,functions:* - 78 cases, 1560 subcases (~20/case)
+webgpu:shader,execution,expression,call,builtin,bufferArrayView:read_layout:* - 35 cases, 604 subcases (~17/case)
+webgpu:shader,execution,expression,call,builtin,bufferArrayView:write_layout:* - 35 cases, 604 subcases (~17/case)
+webgpu:shader,execution,expression,call,builtin,bufferArrayView:read:* - 4 cases, 744 subcases (~186/case)
+webgpu:shader,execution,expression,call,builtin,bufferArrayView:write:* - 4 cases, 1224 subcases (~306/case)
+webgpu:shader,execution,expression,call,builtin,bufferLength:sized_buffer:* - 5 cases, 120 subcases (~24/case)
+webgpu:shader,execution,expression,call,builtin,bufferLength:unsized_buffer:* - 5 cases, 80 subcases (~16/case)
+webgpu:shader,execution,expression,call,builtin,bufferLength:max_size_buffer:* - 6 cases, 6 subcases (~1/case)
+webgpu:shader,execution,expression,call,builtin,bufferView:array_length:* - 78 cases, 832 subcases (~11/case)
+webgpu:shader,execution,expression,call,builtin,bufferView:array_length,functions:* - 78 cases, 2056 subcases (~26/case)
+webgpu:shader,execution,expression,call,builtin,bufferView:read_layout:* - 35 cases, 604 subcases (~17/case)
+webgpu:shader,execution,expression,call,builtin,bufferView:write_layout:* - 35 cases, 604 subcases (~17/case)
+webgpu:shader,execution,expression,call,builtin,bufferView:read:* - 4 cases, 856 subcases (~214/case)
+webgpu:shader,execution,expression,call,builtin,bufferView:write:* - 4 cases, 1224 subcases (~306/case)
-webgpu:shader,validation,decl,let:type:* - 21 cases, 21 subcases (~1/case)
-webgpu:shader,validation,decl,let:initializer:* - 10 cases, 10 subcases (~1/case)
 [snip - full report in action logs]
-TOTAL: 283187 cases, 2326095 subcases
+TOTAL: 284538 cases, 2342792 subcases

@alan-baker alan-baker marked this pull request as ready for review June 17, 2026 15:20

@dneto0 dneto0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

only partway reviewed

Comment thread src/webgpu/api/validation/dispatch.spec.ts
binding_type: 'read-only-storage',
requires: ['buffer_view'],
},
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs test cases for:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

uh, I think my request is nonsense because the size param has to be a const-expression. (!)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Alan reminded me that the case here is using an override expression for the function arguments; not for the declarations of the buffers

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated the spec after to discussion to only use minTypeSize. So updated the tests to reflect that. So offset and/or size are not considered now.

Comment thread src/webgpu/api/validation/dispatch.spec.ts
Comment thread src/webgpu/shader/execution/expression/call/builtin/buffer_view_utils.ts Outdated
Comment thread src/webgpu/shader/validation/decl/let.spec.ts Outdated
Comment thread src/webgpu/shader/validation/decl/let.spec.ts

@dneto0 dneto0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Finished reviewing. This is a very impressive suite. Thanks for creating it!

I also suggest adding additional validation test cases for arrayLength, i.e. in src/webgpu/shader/validation/expression/call/arrayLength. Sized and unsized buffer types should be tested.

Comment thread src/webgpu/shader/validation/types/buffer.spec.ts Outdated
Comment thread src/webgpu/shader/validation/types/buffer.spec.ts
binding_type: 'read-only-storage',
requires: ['buffer_view'],
},
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Alan reminded me that the case here is using an override expression for the function arguments; not for the declarations of the buffers

Comment thread src/webgpu/shader/validation/types/buffer.spec.ts
matches: ['ptrWorkgroupOverrideExpr'],
needsUnrestrictedPointerParameters: true,
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is a glorious set of tests. I love how explicit these are.

fn main() {
let val = ${testcase.f16 ? 'f16' : testcase.f32 ? 'f32' : 'u32'}(in);
let ptr = ${call_expr};
(*${t.params.assign === 'call' ? call_expr : 'ptr'})${testcase.access} = val;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Really great to see both 'let' and 'call' variations here!

}
`;

runReadWriteTest(false, t, wgsl, ele_ty, ty, t.params.aspace, t.params.offset, bufferSize);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Very impressed and happy with the creation and use of readWriteTest to clarify so much of the mechanics!

* Validation of buffer type and related builtin functions
* Tests for
  * bufferLength
  * bufferView
  * bufferArrayView
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.

3 participants