Repository navigation
BUILD-828: decode literal words in unary binary64 shader operations - #2863
Conversation
GFX10 places the separate literal dword above 32 zero bits for a binary64 source. Use the same source interpretation for reciprocal, square root and exponent decomposition so literal and register-pair forms produce the same color.
|
Code read of AI-assisted review (Claude Code). |
|
Tested Independent synthetic Vulkan check of I drew the PR's unary binary64 literal fixture and a variant supplying the same operands through VGPR pairs. On the PR, both draws matched all 4,096 pixels exactly at The fragment modules passed Vulkan 1.2 SPIR-V validation, and all 12 focused AI-assisted verification. |
|
Tested The unary literal check fails on the base and passes on the head, confirming that the expected high dword reaches the translated binary64 operation. AI-assisted, synthetic inputs only. |
Kam471
left a comment
There was a problem hiding this comment.
Verified on the PR head: tests/semantic/test_vop3_const_mods.py -> 12 tests, 6 subtests, OK; six related f64 suites -> 60 tests / 116 subtests, 0 fail. On current main the same suites give 25 tests / 105 subtests with 4 subtest failures, so the fix is exercised. Independent literal decode checks out (0x40300000 -> 16.0, 0x3fd00000 -> 0.25, 0x40180000 -> 6.0 in bits 63:32 with a zero low word), and the translated SPIR-V evaluates to 1/16, 0.25, 0.5 and frexp(6) -> 0.5625; spirv-val --target-env vulkan1.2 exit 0. Main puts the literal in the low dword and returns 0/0 for frexp, reproducing the reported failures. Approve.
Non-blocking: the body's 59 tests / 110 subtests were not reproduced (I get 60/116 across the six suites; 25/105 on main for the five f64 suites); rcp/rsq/sqrt are asserted structurally only, with only frexp executed.
|
Tested at the head on Windows 11 / Python 3.13.0: The rule matches Nits: Approve. AI-assisted review, no game files, no GPU. |
The semantic interpreter executes the integer frexp paths but rejects the full fixture at OpTypeFloat 64. Describe the source-word assertions and the executed results separately so readers can reproduce each check.
|
I reproduced the interpreter limit on Windows. The full fixture assembled for gfx1013 and passed Vulkan 1.2 spirv-val, then The contract and PR description now distinguish the reciprocal, reciprocal-square-root and square-root source-word assertions from the executed frexp cases. For literal 6.0 the interpreter returned mantissa words I also checked the spelling edge on gfx1030: LLVM prints decimal input The four focused Python modules ( |
|
Tested 53ce204 merged onto main 1628210 on an RTX 5090 (driver 616.92), Windows 11, Vulkan SDK 1.4.363. The GPU test programs were built from the same tree:
AI-assisted (Claude Code). |
Keep the targeted regression and the intervening upstream changes together for review.
Keep the targeted regression and the intervening upstream changes together for review.
|
Tested
AI-assisted (Claude Code). Synthetic shaders only, no game files. |
|
Apple M2 / MoltenVK no-regression check of head
No code changes, no game data; counts only. AI-assisted. |
|
Tested Conditions: NVIDIA GeForce RTX 4090, driver 621.24, Vulkan 1.4.357 (subgroup size 32), Windows 11 Home 26H2 build 26300.10075; llvm-mc 21.1.8 (gfx1013), SPIRV-Tools v2026.4 (Vulkan SDK 1.4.363.0), Python 3.14.7. Commits: this PR Pass / fail / skip (build.py: translated / spirv-val valid, of all shaders):
* timeouts from a machine-wide start-up slowdown; main 7b7d73f times out on the same tests when rerun under the same conditions. The merged ctest failures are frexp literal: a throwaway check (llvm-mc gfx1013, the translator, spirv-val, Overlap with #3230: both PRs add a binary64 source-word helper and call it at the same two sites ( Scope: full Tested with AI assistance (Claude Code). |
|
Tested Setup: the PR diff applied to
No game files. AI-assisted (Claude Code); I ran the commands above and checked the numbers against the logs. |
|
Tested 32-bit literal, bits 63:32 (pass)
The whole binary64 word written by hand now reads as +0.0
Why
Fix: mark only values that fit a dword, by adding Overlap: #3642 edits the same AI-assisted (Claude Code). |
Claimed in the coordination issue as BUILD-828.
What and why
A pixel shader using 16.0 as a literal for a binary64 reciprocal, or 6.0 for a mantissa/exponent decomposition, read a tiny subnormal instead. The same values supplied through register pairs worked. The parser only marked literal dwords for addition and conversion, and the frexp paths separately decoded sources without inspecting this mark.
Recognize the literal form for the five unary operations on main and use one decoder for the low and high source words. Inline integers retain their sign-extended representation and inline floats keep their binary64 value. LLVM AMDGPU literal conversions
Tested
AI-assisted with Codex.
Checklist