Record RADV's extrapolated perspective reads at a sample or offset as the device's answer

On the Radeon 780M (RADV, Mesa 26.2.6) runtime_lane::pull_model_interpolation read 1700
values off Metal's, up to about 1.0 in lane 3. The lowered pm_offset is straight-line code (a
uniform offset, its move and clamp, InterpolateAtOffset per input), so no control flow is at
fault. Every miss is a perspective input's read at a sample or an offset; the no-perspective
inputs' same reads were Metal's. A model with the lane's own geometry gives the driver's form:
the pixel center's value extrapolated along the quad's coarse derivatives,
f(center) + (f(tr) - f(tl)) * dx + (f(bl) - f(tl)) * dy. It reproduced all 52 one-sample offset
misses within 0.004 and all 1061 four-sample sample and sample_id misses within 0.005, where the
fine-derivative form was up to 0.98 off. Metal's value plus that form's error (first-order less
exact) matched each of RADV's within 0.2 of the lane's device bound.

Vulkan states no precision for interpolation, so under rule 1 the device's interpolation is the
answer: no form computes it otherwise. The fix records it.
- DriverWorkaround::PerspectiveReadsExtrapolated, a measured row keyed on RADV
  (driver_facts::DEFECTS, no vendor), as InterpolationNeedsTheWholeQuad is.
- PrecisionNote::ExtrapolatedInterpolation (extrapolated-interpolation). stage_io::plan records
  it structurally: an interpolant with the perspective qualifier read at a sample or an offset,
  or a perspective sample-qualified varying a looping function reads at each pass's sample
  (InterpolateAtSample), on a profile with that fact. A no-perspective read, the pixel-center
  form (offset 0), a center or centroid read and an absent interpolant record nothing.
- The pull-model lane: on such a device each perspective lane read at a sample or an offset is
  held to the device bound of Metal's value plus the extrapolation's error, computed from the
  lane's geometry (extrapolation_error), and the pipelines that read so, and those alone, must
  record the note.
- The engine tests over every committed profile assert the note where the RADV profile reads a
  perspective interpolant at a sample or offset, and nowhere else: pm_linear, a new fixture
  function reading the no-perspective interpolant alone at a sample and an offset, must not
  record it. The coverage-loop test asserts it for the looped perspective varyings on RADV.
- docs/API.md's device-interpolation entry and docs/FAST-PATHS.md's row no longer cover RADV's
  sample and offset reads with the 1.5e-4 figure. The new entry and row state the form and the
  measured size.
- SEMANTICS_VERSION 2000 (the RADV profile's pull-model and looping modules gain a note),
  ARTIFACT_FORMAT_VERSION 497 (the codec gains the note), api_signatures blessed. The refusal
  surface regenerated with no change.

The fixture's AIR companions for pm_linear come in the next commit, from the regen script on the
M3. The golden tables and the air_input snapshot are re-blessed on development.

(cherry picked from commit f4eb92a9bc4c099f9020fde2c2da40580514ec20)
This commit is contained in:
Anees Iqbal committed 2026-11-09 00:16:01 -08:00
1 parent 9619020361
commit 8bd103fc8e
22 files changed
+367 -43

No files matched your search

+14 -1
View File
@@ -3790,7 +3790,9 @@ bound.
`sample` or `no_perspective`, not `flat`) on a device not measured to interpolate as Metal does
(`DriverDeviation::MetalInterpolation`, which MoltenVK takes: Metal interpolates there). Vulkan
states no precision for interpolation, and RADV, ANV, lavapipe and NVIDIA's driver each round
most interpolated lanes otherwise than Metal, up to about `1.5e-4` apart (`3e-4` on lavapipe).
most interpolated lanes otherwise than Metal, up to about `1.5e-4` apart (`3e-4` on lavapipe) on
the probes. RADV's read of a perspective input at a sample or an offset is further off, and
records `extrapolated-interpolation`.
- `metal2vulkan-degrade-device-interpolation-offset` (precision).
`PrecisionNote::DeviceInterpolationOffset`: A fragment function reads an `interpolant` through
`interpolate_at_offset`, which Metal evaluates at the offset as given from the pixel's upper-left
@@ -3801,6 +3803,17 @@ bound.
`subPixelInterpolationOffsetBits` (at least sixteenths): within the range the read lies within
half a step of Metal's, past it at the range's nearer end. On MoltenVK Metal reads the offset
itself, so within the range (`[-1/16, 15/16]` from the corner on the M3 Max) the read is Metal's.
- `metal2vulkan-degrade-extrapolated-interpolation` (precision).
`PrecisionNote::ExtrapolatedInterpolation`: A fragment function reads a perspective input at a
sample or an offset (`interpolate_at_sample`, `interpolate_at_offset`, or a sample-qualified
varying a function looping over its covered samples reads at each pass's sample) on RADV
(`DriverWorkaround::PerspectiveReadsExtrapolated`), whose driver answers such a read with the
value at the pixel center extrapolated along the quad's coarse derivatives, where Metal
interpolates in perspective at the location itself. The answer is first-order, off by the
value's curvature across the distance, which grows with the triangle's spread of clip `w`: on a
triangle of `w` 1, 2 and 4 over a 6x6 target, up to about 1.0 in a lane whose vertices hand 3,
-2 and 0.5 (the Radeon 780M, Mesa 26.2.6). A no-perspective input is exact there and records
nothing. It is the device's own interpolation, which Vulkan states no precision for.
- `metal2vulkan-degrade-quads-split-by-clipping` (precision). `PrecisionNote::QuadsSplitByClipping`:
A fragment function runs a quad or simdgroup operation on a device that shades a triangle it clips
as several triangles (`DriverWorkaround::ClippedTrianglesSplitPixelFragments`): a quad a seam