Repository navigation
rdna2spirv: add binary64 round-to-integral VALU ops (SHADER-379) - #2273
Conversation
|
Tested Independent Vulkan check of I used the stock Vulkan harness to read one 64×64 target per draw. In operation order
Both draws matched all 4,096 pixels each, and all three shader modules passed SPIR-V validation. All six targeted CPU semantic tests passed. AI-assisted verification. |
ab28508 to
9205c00
Compare
|
Rebased onto current
Verified after the rebase: AI-assisted. |
|
Tested
AI-assisted (Claude Code). No game files. |
9205c00 to
c002e63
Compare
|
Rebased onto AI-assisted. |
|
Native RDNA2 hardware confirmation for these 4 instructions (measured on AMD Radeon(TM) Graphics (
(I narrowed #2952 to |
|
Thanks @timelery — that is exactly the measurement the row was missing. Recorded in Also noted the #2952 narrowing to AI-assisted. |
@timelery measured v_trunc/ceil/rndne/floor_f64 natively on gfx1036 (tools/hw_oracle, wave32 and wave64 identical): exact IEEE-754 rounding that keeps signed zeros and binary64 subnormals, NaNs unchanged under IEEE=0, the hex literal dword in bits 63:32, and omod ignored under denorm16_64=3 as for v_add_f64/v_sqrt_f64. The row said 'not measured here'.
9fb6c6f to
52384f9
Compare
|
Rebased onto The rebase resolves to the clean, fully-measured row (the text this branch already carried from the earlier rebase), so this PR's diff now also restores that one row on AI-assisted. |
|
Tested Runtime and test programs built from this head (MSVC 14.51, Ninja, RelWithDebInfo), native Windows
AI-assisted (Claude Code); I checked the results. |
Claimed in the coordination issue as SHADER-379 (#2078; original claim).
What and why
Translate
v_trunc_f64,v_ceil_f64,v_rndne_f64andv_floor_f64directly in binary64. The lowering preserves both destination words under EXEC, assembles register pairs low-word first, distinguishes a separate hex literal dword from inline constants, and uses the existing f64 result-modifier path for VOP3. This is an ISA coverage change, not a claim that the known retail corpus needed these instructions to translate. It does not change the existingv_add_f64/v_cvt_f32_f64paths in #2057.Tested
LLVM MC 21.1.8 accepted the hand-written VOP1 fixture and representative VOP3 modifier cases on both
gfx1013andgfx1030.The semantic fixture is rejected by baseline
4eb6155dand translates, executes with the expected words, and passesspirv-val(Vulkan 1.2) on this branch. The focused suite covers ties, values that distinguish f64 from f32, a high-word literal, operand modifiers, and inactive lanes.Translated SPIR-V on Windows, Radeon RX 580 (driver 31.0.21925.1001): 24,576/24,576 pixels exact across six synthetic draws. The stock harness requires 144 push-constant bytes; the local test runner used a 128-byte range after checking that all actual accesses were inside the first 128 bytes. No repository harness changes. This is a Vulkan output check, not a native RDNA2 hardware measurement.
Public RDNA2 XML: exact matches 484 → 488, unknown instructions 238 → 234. The full semantic suite passed (1,677 tests). Retail
gfx1013slice: 200/200 translated and 200/200spirv-val-valid both before and after. A scan over all 26,503 local retail listings found zero occurrences of these four instructions. The full before/after assembly and validation is running locally; only aggregate results will be reported.Rebased onto
mainec8ec4c9as9205c009after the f64 work landed there: main'sv_rcp_f64/v_rsq_f64/v_sqrt_f64design row and code paths are kept, this PR's rows and branch sit next to them, andshader_ir.pynow uses main's generalizedf64_literalmarking with this PR's four op prefixes added. After the rebase:compileallclean,tests/semantic4,143 tests OK,tests/test_f64_conversion.py/test_f64_output_modifiers.py/test_f64_transcendentals.pyOK. The translator changes are unchanged from the reviewedab285087modulo placement.Native RDNA2 hardware confirmation by
@timeleryongfx1036(Windows driver 32.0.21042.62,tools/hw_oracle, wave32 and wave64 identical): all four ops round exactly per IEEE-754 keeping signed zeros and binary64 subnormals, NaNs pass through under IEEE=0, the hex literal dword lands in bits 63:32, and omod is applied underdenorm16_64=0/ ignored underdenorm16_64=3as forv_add_f64/v_sqrt_f64. Recorded in the design.md row in9fb6c6f2.Independent post-rebase runs:
@bielfreedom(RX 9070 XT, RDNA4, Windows, validation on) — semantic suite 4,143 OK, GPU suite 0 failures, ctest 119/119.Independent Vulkan verification by
@tylerstraubon Linux / RTX 5090, driver 595.99.02: 8,192/8,192 pixels exact with the stock harness, including nonzero low words that distinguish f64 from f32. See the PR discussion.Checklist
docs/design.mdwith AMD ISA and LLVM evidence.AI-assisted (Codex).