Repository navigation
Top 10 GTA VI Betrayals (#11 will shock you): 11 RDNA2 ops the translator refused - #1976
IAmNotSiob wants to merge 19 commits into
Conversation
…, f16 norm conversions, fma_legacy, f16 fmaak/fmamk)
|
Tested
|
|
Tested 99c2651 on NVIDIA GeForce GTX 1660 (Turing, TU116, subgroup 32..32), driver 620.73.04 (proprietary, Vulkan 1.4.357), Arch Linux (kernel 6.18): pass, no regression. Native build of runtime/ from this head (Ninja, RelWithDebInfo, clang 23.1.5), llvm-mc 23.1.5, SPIRV-Tools v2026.4.
The PR adds no GPU fixture, so the 11 ops are covered only by the semantic tests here. AI-assisted run (Claude). Synthetic programs only, no game files involved. |
…e/fract_f64, f64<->f32/i32/u32 conversions), GPU fixture cs_w32_f64_ops
…it (as ItsNotRexed#2057 does for v_add_f64)
# Conflicts: # tools/rdna2spirv.py
…ed result left by 16
|
thx @Youssefrah16 @Impre-visible :D fyi pushed 916f904: packed |
|
merged main again; main now has its own hw-verified v_cvt_norm_*_f16 (6958558), so i dropped those two from this pr and kept only the packed pknorm f16 forms. tests green ^^ |
|
@Vonsek's new #3896 ( On Linux with CPython 3.12.16, I ran each of those PRs' semantic tests with this PR's
#3917's The other 11 f64 ops here have no competing PR that I found. The three PRs conflict in AI-assisted (Devin). |
|
Native RDNA2 measurements for the f64 ops this PR adds, in case they help check it. I measured them for #3896 and #3917, which I'm closing as duplicates of this PR. Hardware: gfx1036, the Radeon iGPU of a Ryzen 9 9950X3D, driver 26.10.1,
Omod on f64 ALU ops. It is ignored while f64 denormals are kept, with MODE.IEEE on or off. It applies only with IEEE off and
Main's
Other forms:
With IEEE on, every row above is the same except those with a signalling NaN. There the hardware returns the sNaN quieted, |
Keep main's v_trunc/ceil/rndne/floor_f64 and v_cvt_pknorm_*_f16 (main refuses dst op_sel there, so drop this branch's op_sel dst test) and main's v_fmamk/fmaak_f16.
min/max select on the raw words: a NaN operand gives the other one, two NaNs give src0 unchanged (sNaN too), -0 < +0. abs/neg move the sign bit. omod is dropped for the f64 ops here (ignored while f64 denormals are kept); clamp stays.
|
Tested 966a7e2 on Windows 11 (MSVC BuildTools 2022, Ninja, RelWithDebInfo, -j 4; no Vulkan validation layer installed), one GPU at a time, device line confirmed: AMD Radeon RDNA2 iGPU (driver 26.10.1) and NVIDIA RTX 5080 (driver 616.92). Ran AI-assisted. |
…as -floor(-x) (AMD Windows flushed the denormal Ldexp and gave ceil(-0.75) = 1; found by @Vonsek)
|
thx @Vonsek, super useful :D pushed 72cda1f, same AMD-driver story as #2537's trig_preop:
|
|
Tested
The two commits differ only in GPU suite at this head (
CTest ( CPU tests ( One build note: MSVC Tools: llvm-mc 23.1.6 (conda-forge), Vulkan SDK 1.4.363.0, Python 3.11.9, AI-assisted. Synthetic test programs and counts only, no game files. Created with Perplexity |
|
Tested 72cda1f merged with main 2d3369a on Linux (Python 3.12.16) and Windows 11 (Python 3.13.1): fail, one regression in the semantic suite.
|
|
Tested 3caf7a6 merged with main 98fa503 (merged tree 2a0b88dc1d) on Windows 11, RTX 4080 SUPER + Intel UHD 770 (MSVC 14.51), Python 3.13.1: pass. Rebuilt the runtime from the merged tree (C++ changed).
|
…l_f64 of 1.0000000000000002 read as 1.0; found by @kapitche)
|
Tested 68d225a on RTX 5070, driver 616.86, Windows 10.0.26200: pass. Built The translator side ( |
|
Tested 68d225a on NVIDIA GeForce RTX 3060 Ti (Ampere), driver 610.88, Vulkan 1.4.341, Windows 11 (26200): pass. Test programs built from this commit (MSVC from VS 2026 + Ninja, including its runtime changes); llvm-mc 23.1.6 (conda-forge llvm-tools); SPIRV-Tools from Vulkan SDK 1.4.357.0.
This adds Ampere to the RTX 5070 run on this head. No game files. AI-assisted (Claude Code). |
|
Tested Worktree at the PR head, runtime built with Commands and results: The 47 skips are the usual device-dependent ones on a 32-lane-subgroup RTX 50 part (64-wide wave64/fragment-subgroup cases and the package/SDL-gated entries). Synthetic fixtures only, no game files. |
claimed in #1745.
tools/isa_coverage.pylists 246 RDNA2 instructions with no translator rule. these 11 are the ones that are plain ALU, stillUnsupportedon main (checked by translating each), and not in an open PR (thev_dot*ones are #1808's).the list
v_add_nc_i16minemain now has it (#2029), so this PR uses main's and keeps only the testv_sub_nc_i16v_sat_pk_u8_i16v_cvt_norm_i16_f16v_cvt_pknorm_i16_f32(clamp, ×32767, round to nearest even, NaN -> 0), low half, op_sel keptv_cvt_norm_u16_f16v_cvt_pknorm_i16_f16v_cvt_pknorm_u16_f16v_fma_legacy_f32v_mad_legacy_f32but with no flush and one roundingv_fmac_legacy_f32v_fmaak_f16S0*S1 + K, through the existing single-roundedv_fma_f16pathv_fmamk_f16S0*K + S1, same. print order matchesv_fma_f32's fmaak/fmamk handlingclamp/omod on the norm conversions and op_sel destination on the clamped i16 add/sub are refused, not guessed, as the neighbouring ops do.
tested
tests/semantic/test_top10_betrayals.py(new): every op against a plain-Python reference over edge values (±0, ±1, ±inf, NaN, 0x7fff/0x8000 overflow, an f16 denormal, fma cancellations). all OK, and each fails on main withUnsupportedtests/semanticfull suite: OKisa_coverage.pywith AMD's RDNA2 XML: handled-exact 476 -> 487, unknown 246 -> 235no GPU run (none of these touch the runtime). no game files.
TL;DR: 11 RDNA2 instructions the shader translator used to refuse now translate, each checked against a reference, so ISA coverage goes up 11. the title is clickbait, the code isn't. AI-assisted (Claude Code).
also in here (draft: collecting more wins before review)
d3d12_subgroup_testnever built without the Vulkan SDK on PATH. its shader-generation step was the only one not givenLEONIDA_SPIRV_TOOLS, sobuild.py'sspirv-ascall failed and stopped ninja. it now gets the tools path like the M1.5–M5 blocks, and is gated onspirv-as/spirv-vallike them. Windows 10 VM + RTX 6000 Ada:d3d12_subgroupbuilds and passes, fullctest116/116.DXGI
GetFullscreenStatenow reports whatSetFullscreenStateset (M7, alt-tab). measured on host DXGI (Win10 22H2, flip-discard):SetFullscreenState(TRUE)->GetFullscreenStateTRUE,FALSE-> FALSE; the layer always said FALSE. same probe: a minimised flip-model window still getsS_OKfromPresent(notDXGI_STATUS_OCCLUDED), so that part already matched and is left alone.dxgi_swapchain_testgets the round-trip and passes in a desktop session.15 f64 instructions (more of the isa_coverage unknown list;
v_mul_f64/v_fma_f64are the ones #503's review noted were missing):v_mul_f64,v_fma_f64,v_min_f64,v_max_f64,v_ldexp_f64,v_floor_f64,v_ceil_f64,v_trunc_f64,v_rndne_f64,v_fract_f64,v_cvt_f64_f32,v_cvt_f64_i32,v_cvt_f64_u32,v_cvt_i32_f64,v_cvt_u32_f64. same conventions as their f32 siblings andv_add_f64: f64 -> int truncates and saturates with NaN -> 0,fractkeeps results below 1.0, clamp/omod throughclamp_mods_f64; refused (not guessed) under a non-default MODE rounding.ldexpinto a denormal) on NVIDIA RTX 6000 Ada (615.71, Linux), all bit-exact against an exact-arithmetic Python reference (integral results keep the operand's sign:ceil(-0.75)is -0)cs_w32_f64_ops(8 words: fma, ldexp to the smallest denormal, both saturating conversions, ceil's -0, fract's below-one clamp), registered incheck.pyandrun_gpu_tests.py: PASSrun_gpu_tests.pyfull run: the same 12 failures as on main with the same (older) harness build, none new;pytest tests/test_shader_checks.py tests/test_run_gpu_tests.py92 passedisa_coverage on this branch (merged with current main): handled-exact 510, unknown 212 (476 and 246 on the main this PR started from).
self-review before undrafting
v_add_f64's literal handling, which fix(shader): place f64 literal words in the upper half (SHADER-366) #2057 shows is wrong (a 32-bit literal is the upper half of an f64). the new ops now take the samef64_literalbranch fix(shader): place f64 literal words in the upper half (SHADER-366) #2057 adds, so it does nothing until fix(shader): place f64 literal words in the upper half (SHADER-366) #2057 lands and is right after, and fix(shader): place f64 literal words in the upper half (SHADER-366) #2057 doesn't need to touch thesetests/semanticOK,tests/test_f64_*.pyOK, mergeableTL;DR: 26 RDNA2 instructions the translator refused now translate (11 integer/f16 checked on the CPU, 15 f64 checked bit-exact on a GPU, with a new GPU fixture). also a build fix that makes
d3d12_subgroup_testactually build without the SDK on PATH, andGetFullscreenStatenow matching host DXGI. ISA coverage 476 -> 510. AI-assisted (Claude Code).