Auto-generated execution tests, found by mutation testing Mesa #4720
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.55) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.55 · 568 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.380
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #4720"
general
weight: 0.35
dneto0
Issue: #4299
@afd and I have been working on generating CTS tests through mutation testing, which we discussed some time ago in #4299. This draft proposes a first batch of five tests, so we can agree on their form before generating more.
Recap
The idea: we deliberately mutate (i.e. introduce a small bug into) part of a WebGPU implementation or a downstream driver, and run the CTS against the mutated version. If no test fails, the CTS has a gap: it doesn't detect that change. We then use a WGSL fuzzer to find a shader that does fail on the mutated code, and propose adding it as a test, so that the CTS will catch future bugs in that part of the code.
Each test is a small fuzzer-generated program that the unmodified compiler runs correctly and the mutated one does not. For these five tests:
1. We mutated Mesa's NIR shader compiler (through llvmpipe/lavapipe, run with Dawn) and ran the CTS against each mutant.
2. For mutants that no CTS test detected, we used the WGSL fuzzer WGSLsmith to find programs whose output changes when the mutant is present.
3. We reduced each program automatically, to what we hope is a reasonable size.
In the earlier discussion, @dneto0 made some helpful suggestions that we have incorporated here: the tests live in a separate bucket, organised by the implementation that was mutated, and each one has a machine-readable label saying what was mutated and where.
What the tests look like
The tests are in
src/webgpu/mutation/mesa/, in two files:no_input.spec.ts(shaders without an input buffer) anduniform_input.spec.ts(shaders that read a uniform buffer). Each test runs its shader once and compares the whole output buffer with the expected bytes. For example:As suggested:
webgpu:mutation,mesa,).kMutations: git commits and the mutated source location. (generatedFrommarks a file that Mesa generates during the build.) TheMutationtype is shared, insrc/webgpu/mutation/mutation_info.ts.| Test | Mutated Mesa source |
|---|---|
|
shader_10c2ef9c|nir_constant_expressions.c, line 50895 ||
shader_101299f4|nir_constant_expressions.c, line 48527 ||
shader_7ea91b04|nir_range_analysis.c, line 1178 ||
shader_429a8325|nir_constant_expressions.c, line 51437 ||
shader_7be24930|nir_opt_if.c, line 839 |Questions
webgpu:mutation,mesa,, as suggested by @dneto0. The alternative is a separate top-level tree,webgpu-mutation:*; the earlier discussion left this open.kMutationsformat useful? Each entry is written just above its test and collected in a table each file exports. Should it contain more or less detail, e.g. the mutation itself rather than just its line?new Float32Array([1, 1, 0, 0, 10, 10])for amat3x2<f32>), which is easier to read. Would you prefer the typed form?padding.spec.tsdoes? And if we move to typed values, should padding still be checked, or only the struct members?shader_<8 hex digits>), with a description naming the area of the mutation. Is there a naming scheme you'd prefer?+@afd