Skip to content

Conversation

@ErichDonGubler
Copy link
Member

@ErichDonGubler ErichDonGubler commented Dec 3, 2025

Recommended review experience is commit-by-commit.

Connections

Testing

CTS tests have been enabled that previously failed.

Squash or Rebase?

Rebase.

@jimblandy jimblandy changed the title Finish migration from maxInterStageShaderComponents to maxInterStageShaderVariables` Finish migration from maxInterStageShaderComponents to maxInterStageShaderVariables Dec 6, 2025
@ErichDonGubler ErichDonGubler force-pushed the max-inter-stage-shader-variables branch 6 times, most recently from b948e13 to 853e129 Compare December 18, 2025 19:06
@ErichDonGubler ErichDonGubler force-pushed the max-inter-stage-shader-variables branch from 853e129 to 3951f50 Compare December 19, 2025 06:13
@ErichDonGubler ErichDonGubler changed the title Finish migration from maxInterStageShaderComponents to maxInterStageShaderVariables Add maxInterStageShaderVariables validation Dec 19, 2025
@ErichDonGubler ErichDonGubler force-pushed the max-inter-stage-shader-variables branch from 3951f50 to 32215a3 Compare December 19, 2025 18:47
@ErichDonGubler ErichDonGubler changed the title Add maxInterStageShaderVariables validation Add maxInterStageShaderVariables validation (minus coverage of clip-distances) Dec 19, 2025
@ErichDonGubler ErichDonGubler force-pushed the max-inter-stage-shader-variables branch 2 times, most recently from 42456c9 to 3354ba5 Compare December 19, 2025 22:22
@ErichDonGubler ErichDonGubler changed the title Add maxInterStageShaderVariables validation (minus coverage of clip-distances) Migrate validation from maxInterStageShaderComponents to maxInterStageShaderVariables (minus coverage of clip-distances) Dec 19, 2025
@ErichDonGubler ErichDonGubler force-pushed the max-inter-stage-shader-variables branch 5 times, most recently from 6f1e549 to a9d5a27 Compare December 20, 2025 01:38
@ErichDonGubler ErichDonGubler force-pushed the max-inter-stage-shader-variables branch from a9d5a27 to 2c18228 Compare December 20, 2025 02:55
@ErichDonGubler
Copy link
Member Author

Oh, wow. When I'm running CTS for non-async render pipeline creation to validate this, tens of megabytes get allocated per second…until the DX12 backend very reasonably OOMs. 😐 I think I'm going to punt on getting full test coverage on this, and just cherry-pick a few ones I think are most important.

I don't plan on changing any end-state code at this point—just test coverage and commit structure—so I think this is ready for review.

@ErichDonGubler ErichDonGubler marked this pull request as ready for review December 22, 2025 19:27
@ErichDonGubler
Copy link
Member Author

@andyleiserson said he'd review this in an internal Mozilla meeting today. ❤️

SubgroupSize,

// Non-standard
// TODO: Is this list actually good?
Copy link
Member Author

@ErichDonGubler ErichDonGubler Dec 22, 2025

Choose a reason for hiding this comment

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

Wanted to explicitly call out a request for reviewer opinion here. Particularly important to get right is (1) what this set actually is, and (2) how much space each built-in should take up.

Based on the commentary on variants of naga::BuiltIn and some skimming of built-in implementation to (non-exhaustively) confirm things, I believe this is correct.

@ErichDonGubler ErichDonGubler force-pushed the max-inter-stage-shader-variables branch 4 times, most recently from 438f534 to 2ae309c Compare December 22, 2025 22:20
@ErichDonGubler
Copy link
Member Author

ErichDonGubler commented Dec 22, 2025

Hmm, I noticed that running the …,maxInterStageShaderVariables:createRenderPipeline,at_over:… in CTS locally led to OOM errors on Vulkan, and actual OOMs within a few minutes of (very slow) execution on DX12. I haven't tested macOS, but that's a barrier to running these tests for contributors that we shouldn't accept.

EDIT: Filed #8777.

Copy link
Contributor

@andyleiserson andyleiserson left a comment

Choose a reason for hiding this comment

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

:shipit:

max_compute_workgroup_size_z: 0,
max_compute_workgroups_per_dimension: 0,

// Value supported by Intel Celeron B830 on Windows (OpenGL 3.1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Value supported by Intel Celeron B830 on Windows (OpenGL 3.1)
// Intel Celeron B830 on Windows (OpenGL 3.1) supports up to 31 bytes (~8 variables)

(Or delete it entirely. It feels like a shame to lose the research but it may not be worth maintaining.)

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if this is bytes and words, or words and vec4s.

Copy link
Member Author

@ErichDonGubler ErichDonGubler Dec 23, 2025

Choose a reason for hiding this comment

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

@kpreid is the author of this code originally, so let's ping him and ask! Kevin, Do you recall what the actual capabilities are here? If we need to, then this is an interesting conflict with the spec., in which even compatibility mode only lowers the minimum support required to 15. I'm guessing that, as @andyleiserson suspects, we should only allow 8 variables here?

I'll file an issue and follow-up if there are changes we need to make here before releasing. I'm still gonna merge, tho. :shipit:

…erStage`

This will better prepare for the subsequent commit, which supplants
`naga::ShaderStage` as the source of truth in this code.
@ErichDonGubler ErichDonGubler force-pushed the max-inter-stage-shader-variables branch from 76bdf80 to d3eb071 Compare December 23, 2025 20:12
ErichDonGubler added a commit to erichdongubler-mozilla/wgpu that referenced this pull request Dec 23, 2025
@ErichDonGubler
Copy link
Member Author

I've added a CHANGELOG entry for this PR with e0d67c8.

…orValidation`

In order to prepare for spec.-compliant validation of shader I/O, we
need to create a new `enum` that will have the same set of _variants_ as
`naga::ShaderStage`, but will carry additional information relevant to
validation. As a preparatory step, create the new `enum` (called
`ShaderStageForValidation`), and use it as the source of truth for
details of the stage being validated. This yields several immediate
benefits, even before making adjustments for the new validation:

- Stage-specific stage is now properly encapsulated. `compare_function`,
  which was previously passed as a `Option`al sibling argument, is now
  properly associated with only the vertex shader stage.
  - This led to an odd discovery that `compare_function` was being
    provided to `check_stages` with other stages, but not actually
    actually checked. This seems like a rightfully squashed bug.
- Instead of passing a `wgpu_types::ShaderStages` (with a single bit)
  and `naga::ShaderStage` side-by-side, encapsulate both into conversion
  methods for an instance of `ShaderStageForValidation`, so errors are
  impossible to make.
…tion (minus `clip-distances`)

Notable public API additions:

- New `StageError` variants:
	- `VertexOutputLocationTooLarge`
	- `TooManyVertexOutputs`
- Add new `shader_io_deductions` submodule of `wgpu_core::validation` with:
	- A `ShaderIoDeduction` trait
	- `enum MaxVertexShaderOutputDeduction`
	- `MaxInterStageShaderVariablesDeductions` for them.
@ErichDonGubler ErichDonGubler force-pushed the max-inter-stage-shader-variables branch from 8694e44 to 83b6827 Compare December 23, 2025 20:55
@ErichDonGubler ErichDonGubler merged commit a2c8c0d into gfx-rs:trunk Dec 23, 2025
48 checks passed
ErichDonGubler added a commit that referenced this pull request Dec 23, 2025
@ErichDonGubler ErichDonGubler deleted the max-inter-stage-shader-variables branch December 23, 2025 21:09
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