Skip to content

Fix struct_padding required size to include trailing padding#4613

Open
shaoboyan091 wants to merge 2 commits intogpuweb:mainfrom
shaoboyan091:immediate-cts-change
Open

Fix struct_padding required size to include trailing padding#4613
shaoboyan091 wants to merge 2 commits intogpuweb:mainfrom
shaoboyan091:immediate-cts-change

Conversation

@shaoboyan091
Copy link
Contributor

@shaoboyan091 shaoboyan091 commented Mar 16, 2026

Per community discussion (gpuweb/gpuweb#5563), the group decided that pipeline immediateSize validation counts trailing padding bytes in the struct layout. The struct Data { a: A, @align(32) b: B } has its last member end at byte 40, but the full struct size is 64 due to alignment rounding. Update kRequiredSize from 40 to 64 to match this stricter validation rule.

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.

Per community discussion (gpuweb/gpuweb#5563), the group decided
that pipeline immediateSize validation counts trailing padding
bytes in the struct layout. The struct Data { a: A, @align(32) b: B }
has its last member end at byte 40, but the full struct size is 64
due to alignment rounding. Update kRequiredSize from 40 to 64 to
match this stricter validation rule.
@github-actions
Copy link

github-actions bot commented Mar 16, 2026

Results for build job (at abc3273):

 Test case/subcase counts did not change.

@shaoboyan091 shaoboyan091 requested a review from Kangz March 16, 2026 11:59
@shaoboyan091
Copy link
Contributor Author

Trailing bytes related small fix for cts, PTAL, thanks!

Copy link
Collaborator

@Kangz Kangz left a comment

Choose a reason for hiding this comment

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

Actually this shouldn't be needed no? Only the pipeline layout validation requires 64, but not the immediates set on the encoder.

@shaoboyan091
Copy link
Contributor Author

Ah, good point. The layout size required 64 but setImmediates required 40. I'll make an update.

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.

2 participants