fix: inline float constants in 64-bit scalar operands are the f64 value (s_mov_b64 s[0:1], 1.0) #239
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!239
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/239/head"
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?
@lcg007xd-c on GitHub · 2026-11-25 20:48 UTC · original
lcg007xd-c:fix/salu64-inline-f64→main· +55 −0 · 2 files · 1 commits · merged 2026-11-25 21:07 UTCChange
In the reference interpreter,
Wave.read_scalar(code, literal, width=2)returned the float32 pattern of the inline float constants (codes 240-248), zero-extended, for 64-bit scalar sources. That is a silent wrong value onmain(4f2cf5c):Sources:
llvm-mc -triple=amdgcn -mcpu=gfx1030 -show-encodingassembless_mov_b64 s[0:1], 0x3ff0000000000000to the 4-byte[0xf2,0x04,0x80,0xbe], which is inline code 242 (1.0). Code compiled by LLVM depends on this rule to load f64 constants.Now a 64-bit read of codes 240-248 returns the double (
rdna2_exec_cmp64.INLINE_DOUBLES, already used for the f64 compares). This affects every 64-bit SALU source that goes throughread_scalar:s_mov_b64,s_cmov_b64,s_cselect_b64,s_{and,or,xor,…}_b64,s_cmp_eq/lg_u64,s_bitcmp*_b64S0, the 64-bitsaveexecforms. 32-bit reads keep the float32 pattern.HLSL: no change.
rdna2_hlsl_ops.source_highalready raisesUntranslatablefor an inline float in a 64-bit operand, so the recompiler refuses these instructions instead of producing the old wrong value; a test pins that. Translating them is left for a follow-up with GPU parity tests.Also not touched: the interpreter's 64-bit VALU integer sources (
v_lshlrev_b64,v_cmp_*_u64…) still refuse an inline float (read64withis_float=False), while HLSL'srdna2_hlsl_wide._wordsalready uses the double there.Linked issue: none. The same rule was settled in VIctory (Marvisak/VIctory#1577, "expand 64-bit inline constants as signed ints and binary64 floats"); no code is taken from it.
Verification
Linux (Arch, Python 3.14.10), no C++ runtime, no GPU (runtime and GPU tests skip):
The 6 failures are the same as on
mainon this machine, all unrelated: 2 intest_jour_j.py(manifest name case on Linux, #237) and 4 intest_rdna2_exec_fma.py(NaN quieting on Python 3.14, #238).Not run: the Windows CI job and the GPU/WARP tests (no HLSL change).
Oracle and test data
tests/test_rdna2_exec_inline64.py(12 tests):s_mov_b64with each of the 9 codes against the f64 patterns written by hand (1/(2π) from the ISA table);s_or_b64,s_cmp_eq_u64ands_cselect_b64with inline floats; 32-bits_mov_b32still gets0x3F800000and0x3E22F983; the HLSL recompiler raisesUntranslatablefors_mov_b64 s[40:41], 1.0.main(the two that pass are the 32-bit control and the HLSL refusal).Checklist
E_NOTIMPL), never a fake success. (HLSL keeps refusing these operands by name.)test_readme_sync.pychecks it). (No README change: no new encodings, still1300+.)Made with AI assistance (Claude Code).
🤖 Generated with Claude Code