Add shared support for WGSL immediate validation#4658
Open
shaoboyan091 wants to merge 1 commit into
Open
Conversation
This patch adds the shared CTS plumbing needed by the follow-up WGSL `immediate` address space validation tests. It adds `immediate_address_space` to the known WGSL language feature list, models `immediate` in the address space metadata, and treats it as a module-scope, unbound, read-only address space with host-shareable store types. The validation helpers emit the required WGSL `requires` directive and skip immediate tests when immediate data is not exposed by the browser. The skip checks `setImmediates`/`maxImmediateSize` because current Chrome Canary exposes the API before advertising the WGSL feature. This also removes two now-unnecessary address-space type assertions that became redundant once the shared metadata was typed by `AddressSpace`.
|
Results for build job (at 7a27097): -webgpu:shader,validation,decl,var:explicit_access_mode:* - 18 cases, 18 subcases (~1/case)
-webgpu:shader,validation,decl,var:implicit_access_mode:* - 6 cases, 6 subcases (~1/case)
-webgpu:shader,validation,decl,var:read_access:* - 13 cases, 13 subcases (~1/case)
-webgpu:shader,validation,decl,var:write_access:* - 13 cases, 13 subcases (~1/case)
+webgpu:shader,validation,decl,var:explicit_access_mode:* - 21 cases, 21 subcases (~1/case)
+webgpu:shader,validation,decl,var:implicit_access_mode:* - 7 cases, 7 subcases (~1/case)
+webgpu:shader,validation,decl,var:read_access:* - 15 cases, 15 subcases (~1/case)
+webgpu:shader,validation,decl,var:write_access:* - 15 cases, 15 subcases (~1/case)
-webgpu:shader,validation,parse,requires:wgsl_matches_api:* - 11 cases, 11 subcases (~1/case)
+webgpu:shader,validation,parse,requires:wgsl_matches_api:* - 12 cases, 12 subcases (~1/case)
-webgpu:shader,validation,types,pointer:let_ptr_explicit_type_matches_var:* - 26 cases, 26 subcases (~1/case)
-webgpu:shader,validation,types,pointer:let_ptr_reads:* - 26 cases, 26 subcases (~1/case)
-webgpu:shader,validation,types,pointer:let_ptr_writes:* - 26 cases, 26 subcases (~1/case)
+webgpu:shader,validation,types,pointer:let_ptr_explicit_type_matches_var:* - 30 cases, 30 subcases (~1/case)
+webgpu:shader,validation,types,pointer:let_ptr_reads:* - 30 cases, 30 subcases (~1/case)
+webgpu:shader,validation,types,pointer:let_ptr_writes:* - 30 cases, 30 subcases (~1/case)
-webgpu:shader,validation,types,pointer:ptr_address_space_never_uses_access_mode:* - 15 cases, 15 subcases (~1/case)
+webgpu:shader,validation,types,pointer:ptr_address_space_never_uses_access_mode:* - 18 cases, 18 subcases (~1/case)
-TOTAL: 281361 cases, 2323132 subcases
+TOTAL: 281385 cases, 2323156 subcases |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds shared infrastructure to the CTS WGSL shader validation layer for the new immediate address space, so follow-up PRs can add focused test coverage incrementally.
Changes:
- Adds
immediate_address_spaceto the known WGSL language features and associates it with the newimmediateaddress space metadata. - Extends address-space/type helpers to emit
requires <feature>;headers when needed and updates host-shareable/type generation rules forimmediate. - Tightens address-space typing (removing redundant casts) and introduces helpers intended to skip tests when
immediatedata support is unavailable.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/webgpu/shader/validation/types/pointer.spec.ts | Removes redundant AddressSpace casts; now iterates address spaces via typed metadata. |
| src/webgpu/shader/validation/decl/var.spec.ts | Removes redundant AddressSpace casts; now iterates address spaces via typed metadata. |
| src/webgpu/shader/validation/decl/util.ts | Adds WGSL requires header emission and new skip helpers for address-space support. |
| src/webgpu/shader/types.ts | Adds immediate address space + metadata, and updates type generation/host-shareable rules accordingly. |
| src/webgpu/capability_info.ts | Registers immediate_address_space as a known WGSL language feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const kNonHandleAddressSpaces = keysOf(kAddressSpaceInfo).filter( | ||
| as => as !== 'handle' | ||
| ) as AddressSpace[]; | ||
| const kNonHandleAddressSpaces = keysOf(kAddressSpaceInfo).filter(as => as !== 'handle'); |
| const kNonHandleAddressSpaces = keysOf(kAddressSpaceInfo).filter( | ||
| as => as !== 'handle' | ||
| ) as AddressSpace[]; | ||
| const kNonHandleAddressSpaces = keysOf(kAddressSpaceInfo).filter(as => as !== 'handle'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the base PR for follow-up WGSL
immediateaddress spacevalidation coverage.
It adds the shared CTS support needed by later test-suite PRs:
immediate_address_spaceto the known WGSL language featuresimmediatein the shared address space metadatastricter metadata typing
Follow-up PRs will add the declaration, type, expression, function, and
uniformity test coverage one commit at a time after this base PR lands.
Testing:
npm.cmd run typechecknpm.cmd run lint