Repository navigation
Conversation
…does Measured natively on gfx1036 with the hardware oracle: a 32-bit literal in a 64-bit integer operand is sign-extended where the operand is i64 (s_ashr_i64, s_bfe_i64, s_flbit_i32_i64, v_ashrrev_i64, v_mad_i64_i32 S2) and zero-extended where it is b64/u64. The translator zero-extended every literal. New imm64() helper, design.md row, GPU test cs_w32_lit64 and its semantic fixture. AI-assisted.
# Conflicts: # runtime/test/shaders/check.py
…s f64 encoding Measured natively on gfx1036 with the hardware oracle (243 cases, wave32 and wave64): 0.5, 1.0, 2.0, 4.0, their negatives and 1/(2pi) in a 64-bit integer operand of the SALU/VALU b64/u64/i64 ops read the constant's f64 bits, as an f64 operand does (s_mov_b64 s[8:9], -2.0 gives 0xC0000000_00000000). The translator rejected them. New f64_inline() and INT64_SRCS, design.md row extended, GPU test cs_w32_f64inl and its semantic fixture. s_ff1_i32_b64 is left out (ItsNotRexed#1409 fixes its high word). AI-assisted.
# Conflicts: # docs/design.md
|
Tested f0ac4de on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass. The PR's diff applied cleanly to
|
|
Tested f0ac4de on NVIDIA GeForce RTX 3070 (Ampere, subgroup 32..32), driver 610.57.04 (Vulkan 1.4.341), Debian 13 (kernel 6.12.115): pass. Adds Linux to @Rainmaker33's Windows run; both new programs run natively at wave32 here. Base is
Negative control: this PR's AI-assisted: yes |
|
Tested f0ac4de on AMD Radeon RX 9060 XT (RDNA4), AMD driver 26.10.44 (LLPC, Vulkan driver 2.0.395), Windows 11 Pro 10.0.26300, subgroup 32..64: pass. This adds an AMD card with native 64-wide subgroups to the two NVIDIA runs above.
Test programs: an MSVC 14.44 build of 4947579, this PR's base; the PR changes no C++ or CMake. llvm-mc 21.1.8 (native), Vulkan SDK 1.4.363.0. This is the translated fixtures on RDNA4, not a native measurement of these operands. No game files. AI-assisted (Claude Code). |
|
Tested llvm-mc 21.1.8, Vulkan SDK 1.4.363.0. Test programs built with
No game data involved. AI-assisted (Claude Code): it ran everything above on this machine. |
|
Tested
AI-assisted run. |
|
Tested f0ac4de on an RX 9070 (RDNA4), AMD 26.11.1 (LLPC), Vulkan 1.4.359, Windows 11: pass Both new tests pass natively: AI-assisted |
|
Real-corpus check of
No regression, and no effect on reachable corpus code. AI-assisted (Claude Code). |
|
Rechecked in real wave64 with the hw_oracle fix in #2961: same words. AI-assisted. |
Conflicts: docs/design.md runtime/test/shaders/check.py scripts/run_gpu_tests.py tests/semantic/regen_fixtures.py AI-assisted.
|
Rechecked in game MODE (IEEE off, DX10_CLAMP on, f32 denorm flush): same words. AI-assisted. |
docs/design.md AI-assisted.
runtime/test/shaders/check.py scripts/run_gpu_tests.py tests/semantic/regen_fixtures.py AI-assisted.
|
Tested
No game files. AI-assisted (Claude Code). |
Requested by Lucas · project thread
Claimed in the coordination issue as: EGEN-HW-F64-INLINE (claim)
Depends on: #2060 (this branch is based on it; it extends that PR's "64-bit operand literals" row and sits next to its
imm64helper).What and why
The translator rejected a float inline constant (0.5, 1.0, 2.0, 4.0, their negatives, 1/(2π)) in a 64-bit integer operand:
s_mov_b64 s[8:9], -2.0raisedUnsupported: s_mov_b64 source, and the same for the 64-bit SALU/VALU ops below (... source,... operands,mask operand). I measured what RDNA2 does natively with the hardware oracle: the operand reads the constant's f64 encoding, the same 64 bits an f64 op reads, whatever the integer type (b64, u64 or i64).s_mov_b64 s[8:9], -2.0gives 0xC0000000_00000000,1.0gives 0x3FF00000_00000000,0.5gives 0x3FE00000_00000000.0.15915494309189532in a 64-bit operand.Fix (
tools/rdna2spirv.py):f64_inline(v): the f64 bits of the constant. 1/(2π) maps to 0x3FC45F306DC9C882 for either spelling.INT64_SRCS: the measured ops and their 64-bit source positions. At the top of_insn, a float constant in one of those positions becomes that 64-bit integer, and the existing integer paths take it from there (an f64 bit pattern always has a non-zero high word, so rdna2spirv: a 32-bit literal in an i64 operand is sign-extended, as on RDNA2 #2060's i64 sign-extension never applies).s_mov/not/and/or/xor/andn2/cselect/cmov/lshl/lshr/brev_b64,s_ashr_i64,s_bfe_u64/i64S0,s_bcnt1_i32_b64,s_flbit_i32_b64/i64,s_bitcmp1_b64S0,s_cmp_eq/lg_u64,v_lshlrev/lshrrev_b64andv_ashrrev_i64S1,v_mad_u64_u32/i64_i32S2.s_ff1_i32_b64. It reads only the low word of any 64-bit constant, which Tests: cs_imm_mask, constants as wave64 lane masks and as 64-bit data (s_ff0_i32_b64 of -1 included) #1409 fixes. Until that lands, a float constant there staysUnsupportedinstead of giving a wrong value.docs/design.md: the "64-bit operand literals" row from rdna2spirv: a 32-bit literal in an i64 operand is sign-extended, as on RDNA2 #2060 is extended with this rule and the measurement.Tested
tools/hw_oracleHIP launcher, rocm-sdk-core clang.int_hw_probe'sCasehelpers, in wave32 and wave64.s_ff1_i32_b64andv_add_f64), 243 cases.spirv_mini_interp) matches the hardware in all 225 cases it translates and runs. The other 18:s_ff1_i32_b64(left out, see above), andv_add_f64, which the translator already handled butspirv_mini_interpcannot run because it has no doubles. Before the change, every case exceptv_add_f64wasUnsupported.runtime/test/shaders/cs_w32_f64inl.asm.s_mov_b64-2.0 and 1/(2π),s_lshl_b641.0,s_bcnt1_i32_b64-4.0,s_ashr_i64-0.5,s_cmp_eq_u644.0,v_lshlrev_b640.5,v_mad_u64_u32-1.0). Registered in check.py andscripts/run_gpu_tests.py. The same shader is the semantic fixture tested bytests/semantic/test_f64_inline.py, against a plain-Python reference.run_gpu_tests.py --filter cs_w32_f64inlgivesPASS 3221225472 1841940610 4278190080 3 4227727360 1 1071644672 3220176896on the NVIDIA GeForce RTX 5080 (driver 616.92,device: NVIDIA GeForce RTX 5080 (subgroup 32..32)) and on the AMD Radeon RDNA2 iGPU (driver 26.10.1,device: AMD Radeon(TM) Graphics (subgroup 32..64)).main),test_f64_inlineerrors withUnsupported: s_mov_b64 source. With it, the test passes.f64_inlinereturn the f32 bits instead of the f64 bits (one line). The GPU test then fails on both GPUs (FAIL 0 1841940610 3 3 4294967295 0 0 0). I reverted the change afterwards.python -m unittest discover -s tests/semantic,python tests/semantic/regen_fixtures.py --check,python -I tests/test_shader_checks.pyandpython -m compileall -q tools testspass.AI-assisted.
Checklist
docs/design.md, with how it was confirmed.