-
Notifications
You must be signed in to change notification settings - Fork 927
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: Implement diagnostic(…);
directives and derivative_uniformity
triggering rule
#6148
WGSL: Implement diagnostic(…);
directives and derivative_uniformity
triggering rule
#6148
Conversation
diagnostic
directives and attributesdiagnostic
rules
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
634ddfa
to
21ab041
Compare
diagnostic
rulesdiagnostic(…);
directives
21ab041
to
73691d5
Compare
@jimblandy: This is ready for a full review! |
5e4efb2
to
a7a3ade
Compare
Just validated that tests written in the (revised) |
This comment was marked as resolved.
This comment was marked as resolved.
a1fe152
to
02daf28
Compare
diagnostic(…);
directivesdiagnostic(…);
directives and derivative_uniformity
triggering rule
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can see, this never actually populates naga::Module::diagnostic_filters
or diagnostic_filter_leaf
with what was parsed by the WGSL front end. The PR description says this is supposed to control how validation reports FunctionError::NonUniformControlFlow
, so I would have expected the diagnostics to have been passed through to the Module
.
If this is correct, then that also indicates some missing tests.
@jimblandy: Ah, it seems I'd missed a couple of things:
|
84991c9
to
2841f18
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, this looks good. Just a few comments.
This resolves ambiguity that will be introduced in the subsequent commit that adds `impl From<ConflictingDiagnosticRuleError> for naga::Error`.
2841f18
to
9f0ce65
Compare
- Remove `DISABLE_UNIFORMITY_REQ_FOR_FRAGMENT_STAGE`. - Add `CHANGELOG` entry. - Add coverage to `naga`'s `valid::analyzer::uniform_control_flow` test.
9f0ce65
to
3ee9dca
Compare
Connections
Resolution:
diagnostic(…)
) #5320.Dependencies:
rustfmt
in some places #6349.Description
Recommended review experience is commit-by-commit. Each individual commit should pass CI!
This change implements a meaningful first iteration of support for
diagnostic(…);
directives; to wit:diagnostic(…)
rules.derivative_uniformity
rule. The current analysis is incorrect, and blocks users in issues like Feature request: disable uniformity analysis on shader creation #3135. This can give them a way forward.Several things are out-of-scope:
There are more grammar rules where we should also
@diagnostic(…)
attributes, in order to conform fully with the WGSL spec. This PR does not attempt to handle all of these cases, to limit the complexity of this PR.The exhaustive list of standards-mandated parse sites for
@diagnostic(…)
not implemented in this PR is tracked in Support diagnostic filters in WGSL (i.e.,diagnostic(…)
) #5320.Naga's current diagnostic model for shader compilation is too limited for us to comply with the spec.-mandated behavior with warnings. Naga offers only a
Result
to indicate operation success, or a single fatal error message. This conflicts with theSeverity::Warning
model introduced in this PR, because standard WGSL compilation might report multiple diagnostics in cases where parsing the shader module…Because of this limitation, and because we want to limit complexity in this PR,
diagnostic(warn, …)
will not report a standard warning-level compilation item in cases that the standard dictates a warning-level compilation item. Instead, we will opt forlog::warn!(…)
entries. This is tracked as follow-up issues:New cases where the above is relevant:
Testing
Current test plan:
webgpu:shader,validation,parse,diagnostic:valid_locations:*
…:type="directive";location="module"
webgpu:shader,validation,parse,diagnostic:conflicting_directive:*
Port a meaningful subset of the above to our own Naga test suite, to prevent the most impactful regressions.Punted to test(naga): add coverage fordiagnostic
directive parsing #6457.Checklist
cargo fmt
.cargo clippy
. If applicable, add:--target wasm32-unknown-unknown
--target wasm32-unknown-emscripten
cargo xtask test
to run tests.CHANGELOG.md
. See simple instructions inside file.