Repository navigation
test(shader): replay native interpolation rows - #1572
Closed
Sanjaysrinivas wants to merge 6 commits into
Closed
Sanjaysrinivas wants to merge 6 commits into
Sanjaysrinivas wants to merge 6 commits into
Conversation
This was referenced Oct 8, 2026
Sanjaysrinivas
force-pushed
the
test/shader-interpolation-native
branch
from
October 8, 2026 13:28
09df288 to
4c45ecb
Compare
Sanjaysrinivas
marked this pull request as ready for review
October 8, 2026 14:23
Sanjaysrinivas
force-pushed
the
test/shader-interpolation-native
branch
from
October 8, 2026 18:19
4c45ecb to
ede6c8f
Compare
…terp_p2_f16 Decode the three VOP3 16-bit interpolation instructions (attribute, channel and high-half select in the src0 field, the I/J VGPR in src1, P0 or the first step's result in src2) and translate them with a new GetInterpolationParameterF16 IR value. It reads the selected 16-bit half of each vertex's parameter through VK_KHR_fragment_shader_barycentric, so P10 and P20 are vertex differences rounded to f16; both steps are a multiply and an add, as in the f32 forms. An input in FP16_INTERP_MODE whose low half is defaulted is still declared at its slot when its high half is read, and the high half takes its default from USE_DEFAULT_ATTR1 and DEFAULT_VAL_ATTR1. Without barycentrics, on an input without FP16_INTERP_MODE or on a pass-through input the instructions throw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Prerequisite from boykopovar#697; retain original author and feature scope. (cherry picked from commit 73777c7)
Measured on RDNA2 in boykopovar#697: v_interp_p1ll_f16 and v_interp_p1lv_f16 are a fused multiply-add rounded once to f32, and v_interp_p2_f16 rounds the exact P20 * J + S2 once to f16. The separate multiply and add matched about 85% and 4% of the measured rows. Both steps now use FPInterpolateF32 and FPInterpolateF16: the f16 delta times the f32 coordinate is exact in f64, the sum is rounded to odd and then once to nearest even at the target precision, so no driver can split or reround it. Infinite and NaN operands take the unbounded f64 result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Prerequisite from boykopovar#697; retain original author and feature scope. (cherry picked from commit 6534b25)
Measured on RDNA2 in boykopovar#697: an invalid product or sum (inf * 0, inf - inf) gives the negative default NaN, 0xffc00000 or 0xfe00, and beats a NaN addend. A NaN delta, then a NaN coordinate, still wins, quieted; a NaN addend is returned quieted only when the product is valid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Prerequisite from boykopovar#697; retain original author and feature scope. (cherry picked from commit bd0a0e5)
Replay six published gfx1035 tuples through the interpolation arithmetic emitters with runtime buffer inputs. Rotate the rows for a second dispatch and check inputs and guards. This runs without fragment barycentrics. Oracle: boykopovar#697 (comment) Use exact expanded FP32 arguments to isolate arithmetic from guest half conversion, SPI, LDS and guest mode handling. No new opcode semantics or native RDNA2/PS5 execution are claimed.
Compile an isolated guest program for each of P1LL, P1LV and P2 with Float64 and fragment barycentrics, then independently omit each capability and require its specific rejection.
Distinguish the raster fixture that skips without barycentrics from the standalone arithmetic regression. Keep unverified SPI coefficients and guest floating-point modes explicit.
Sanjaysrinivas
force-pushed
the
test/shader-interpolation-native
branch
from
October 8, 2026 18:26
ede6c8f to
cd33096
Compare
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
Collaborator
|
Thanks for this. I'm closing it as superseded by the updated #697.
The one check #697 doesn't have is the Float64 capability gate in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Depends on: #697.
The F16 interpolation raster fixture skips on lavapipe because it requires fragment barycentrics. Add a separate compute execution test that replays the six published gfx1035 special-value results through the actual interpolation arithmetic emitters. Inputs come from storage-buffer loads; a second dispatch rotates the rows within each instruction family. The test checks literal output bits, unchanged inputs and trailing guards, without requiring fragment barycentrics.
Extend the existing positive
ShaderMemory.cppfragment compiles with independent Float64 and barycentric rejection checks for each ofV_INTERP_P1LL_F16,V_INTERP_P1LV_F16andV_INTERP_P2_F16.This branch contains three attributed prerequisite commits from #697, followed by two test commits and one documentation commit. Daan Dehing retains authorship of the implementation and its rounding/NaN corrections. The follow-up adds only test code, test linkage and a clarification to the existing technical-debt entry. Review the follow-up with:
Related open PRs and merge order
The overlap bot reports real textual conflicts with two independent contributions. Read-only
git merge-tree --write-treechecks confirmed the hunks below against #1524 head46c50453and #1547 head9032b654. The decoder/IR conflicts originate in the included #697 prerequisite; the documentation conflict is between adjacent technical-debt entries.SetRdnaRawWordsinRdnaVectorOpDecoder.cpp0x200–0x202and F16 opcodes0x342,0x343,0x35a. Preserve each branch's operand and modifier checks.GetInterpolationParameterinIrOpcode.hppand its metadata table; both add adjacent debt entriesGetInterpolationParameterF16alongsideInterpolateHostP1/InterpolateHostP2, with matching enum/metadata order. Keep both debt entries. Preserve the F16 capability rejections; the F32 geometry fallback does not establish F16 SPI behavior.Neither PR is a prerequisite for these tests: the fixture does not decode F32 VOP3 instructions or use the generated geometry stage. They are therefore related merge conflicts, not additional
Depends onentries. Rebase and preserve both contributions when either lands. The branch has been rebased ontomainat4ddbf049; the combined open-PR branches have not been compiled or executed, and these checks do not claim otherwise. The informational overlap notice can remain while those independent branches are open.The progress bot's three implemented instructions and percentage increase come from the included #697 implementation. The three follow-up commits add no unique opcodes and do not establish native RDNA2/PS5 execution or complete guest-mode support.
Evidence and scope
The oracle is the six raw tuples published by the gfx1035 tester. Expected results are literal hardware words, not values generated by another copy of the implementation. The source publishes these rows:
00007f8000007bffffc00000fc0000000000fe01ffc000007c007f7ffffffc00ffc0000000007f8000004f000000fe008000ff8000007fc00000fe00fe013f80000047800000fe01The compute fixture supplies exact already-expanded FP32 input bits, including NaN payloads. It tests interpolation arithmetic and P2 result packing; it bypasses guest decoding, half-input expansion, SPI coefficient generation, LDS access and fragment routing. The six rows contain P1LL and P2 cases; P1LV is covered here by compile/capability checks, not a newly published native arithmetic row. The half-expansion implementation and exhaustive tests remain in #1463 and #1505, so neither is a prerequisite for this isolated arithmetic fixture.
This adds regression coverage, not opcode coverage or a verified guest-mode contract. The implementation's existing technical-debt entry remains applicable. #981 and the mode-related hold on #697 remain unresolved; #1442 owns initial mode metadata, and #1252 owns native conversion/host float-control work. No competing implementation of those contributions is included.
Tested
Current rebase:
cd33096612973c547027db9b5587f6295e191b1aon main4ddbf0497dbdd16f885fb27d30941a772185370d. The CMake conflict keeps all upstream prepared-shader test includes and the interpolation arithmetic compiler linkage. The inherited rounding and NaN-priority patches are unchanged. Normal Release targets were rebuilt with GCC 13.3 on Ubuntu 24.04/WSL2, SPIRV-Tools integration disabled. Three focused CTest cases were repeated three times: shader-memory compilation/capability checks and interpolation arithmetic passed; the F16 raster fixture retained its barycentrics capability skip on lavapipe. Fresh full GitHub CI is pending; earlier CI and captured-module results below identify their original revisions.Earlier captured-module validation was based on
mainatfd5342b6d6e2ff572d51e23ee4559dba53887881, head4c45ecbb69f8f9fb1192fa31dc74bedf770942d0. Normal CMake Release targets were rebuilt after the rebase on Ubuntu 24.04 under WSL with GCC 13.3; no title or PS5 was run. SPIRV-Tools integration was disabled for this build, then the captured module was independently checked withspirv-val --target-env vulkan1.1.Before this rebase, head
09df288ealso passed the complete Linux CI job, Windows CI job, conventions and report checks. The refreshed head triggers new checks; those earlier results are not presented as completed CI for the new head.agc_shader_memoryagc_driver_interpolation_arithmetic, lavapipe / LLVM 20.1.2agc_driver_interpolation_f16raster fixturefragmentShaderBarycentric10de:2820, raw driver2585198592)1002:1900, raw driver8389003)ffc00000toffc00001in diagnostic copygot 0xffc00000, expected 0xffc00001Interpolatefunction from #697 commit6534b25c, keeping the other current emitter functionsgot 0x7fc00000, expected 0xffc00000Captured module SHA-256:
25f7a2a019457ae1de3de6f5d050706a372e7e1631802548e29e4e4889f1d5a1.The Windows checks replay the captured module through a small Vulkan storage-buffer runner; they are not a Windows build of the C++ fixture. The two native devices are local host GPUs, not RDNA2 or PS5 hardware. Across the three backends there are 36 output comparisons of the same six unique oracle rows; neither repeated dispatches nor the source comment's unpublished aggregate totals are counted as additional unique cases.
Focused reproduction after a normal test build:
cmake --build build --target agc_shader_memory_tests agc_driver_interpolation_arithmetic_tests agc_driver_interpolation_f16_tests ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest --test-dir build --output-on-failure -R '^(agc_shader_memory|agc_driver_interpolation_(arithmetic|f16))$'Validation logs and diagnostic runners are kept outside tracked source. The permanent C++ test is sufficient to replay the six rows on any supported Vulkan device with Float64.
Checklist
main; open contributions checked, with feat(shader): implement v_interp_p1ll_f16, v_interp_p1lv_f16 and v_interp_p2_f16 #697 explicitly included as the prerequisite