Proposal: native f64 adds where the host has doubles, and float literals in tb_cubeid #641
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-01T21:44:10Z.
Two translator changes that need agreeing first under CONTRIBUTING: one is about 500 lines, and the other changes the HLSL of every program, so every cached shader recompiles once. The PRs are ready as drafts and link here.
1. Native
v_add_f64on hosts with doublesv_add_f64is lowered to integer arithmetic (tb_f64_add), about 250 DXIL basic blocks per inlined add. 22 recorded ProjectScarlett compute programs have 24 to 72 adds each, and the two-lane form writes each one twice, so the adds are more than half of their DXIL. The three largest take 60 to 64 s in DXC at the runtime flags, pastCOMPUTE_TIMEOUT, so they fall back to-O0.The proposal is a
preciseHLSLdoubleadd where the result provably equals the card's:DoublePrecisionFloatShaderOps;<hash>_f64,<hash>_w32_f64), so a host without doubles never receives that translation and no other program's key changes.Measured:
check_translated.py, #614/#615, plus 448 edge-value pairs): 0 of 104,328 words differ on an RTX 5090 and on an AMD Raphael iGPU. Two broken variants used as negative controls differ in 415 to 16,063 words.lanes-selftest-texture-publication, as on main).2.
tb_cubeidcomputes in doublesselect(z < 0.0, 5.0, 4.0)has two untyped literals, so HLSL types itdouble. Every program usingv_cubeid_f32is marked as using doubles, and vkd3d-proton refuses those pipelines on a host without them. The fix isfliterals.push_helperswrites the cube helpers into every program, used or not, so this one-line fix changes every translation's HLSL. A follow-up could emit the cube helpers only when called; that also changes every program once.Question
Are these wanted, and when? If a full recompile is unwelcome now, the cube fix (and conditional helpers) could wait for the next change that touches every translation. The native adds change only the 22 programs.
🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by brcly on 2026-12-01T23:13:03Z.
@NickStallman both, now, please. Thanks for asking first.
with_host_f64to the privatenative_add_mode; I pusheda51a5147to your branch, which names it in plain text. I'll merge once CI is green.tb_cubeidfloat literals): yes, merging now. The full recompile is accepted. The follow-up that writes the cube helpers only into programs that call them is welcome as its own PR; if it lands soon, the next preparation pays for both recompiles at once.Imported from brcly/TuxBox. Originally posted by brcly on 2026-12-02T21:35:41Z.
Both parts are merged: #642 (native f64 adds) and #643 (
tb_cubeidfloat literals). Thanks!