Repository navigation
Conversation
|
Tested baf99b3 on CPU only (no GPU, no game files), Linux (WSL2), Python 3.12.3: pass
Two things for the merge:
AI-assisted. |
2 tasks done
Contributor
Author
|
Rebased onto main aa2988c; conflict in tools/shader_ir.py (f64 literal opcode tuple: main added trunc/ceil/rndne/floor_f64, ours rcp/rsq/sqrt_f64), merged into one tuple; tests: full tests/semantic 6831 run (only the 10 failures that also fail on main), all *_f64 semantic files and test_spirv_interp_bits/f64_glsl OK. |
This was referenced Nov 23, 2026
2 tasks done
This was referenced Nov 23, 2026
…rce of v_rcp/rsq/sqrt_f64 is bits 63:32
test_valu_{rcp,rsq,sqrt,cvt_f32}_f64 now translate their cases and run them on tests/spirv_interp.py instead of a
self-built model. Doing so showed that a 32-bit literal on v_rcp_f64, v_rsq_f64 and v_sqrt_f64 was read as the low
dword of the operand; tools/shader_ir.py now flags it as the high dword like v_add_f64 and v_cvt_f32_f64.
The model-only mul/fma/fract/minmax/trig/frexp f64 files are removed: the ops are not translated (a refusal pin
replaces them), trig is not an RDNA2 instruction, and test_alu_frexp_f64.py already runs the frexp forms.
spirv_interp gains binary64 OpFDiv, OpFConvert and IEEE Sqrt/InverseSqrt edge cases.
This was referenced Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI-assisted.
Claim: batch A of the model-only semantic tests (coordination issue #3381,
claiming: tests/semantic batch A (float)); follow-up of the finding under #3472.Translator fix (found by the rewrite). A 32-bit literal on
v_rcp_f64,v_rsq_f64orv_sqrt_f64was read as the low dword of the binary64 operand. For a 64-bit float operand the literal supplies bits 63:32 (docs/design.md, "f64 literal sources"), andtools/shader_ir.pyonly flagged that forv_add_f64andv_cvt_f32_f64. Repro:v_sqrt_f64 v[4:5], 0x40100000(the word 4.0 is the high half of) translated to the square root of a 2^-1074-scale denormal; it must give 2.0. Same forv_rcp_f64(0.25 expected) andv_rsq_f64(0.5). One line: those three op names join the existing list inparse_line.What was wrong with the tests.
test_valu_{rcp,rsq,sqrt,cvt_f32}_f64.py,test_valu_{mul,fma,fract,minmax,trig}_f64.pyandtest_valu_frexp{,_mant,_exp_i32}_f64.py(1.1k to 1.8k lines each) never importedsupportorrdna2spirv; breaking the op intools/rdna2spirv.pyleft them green. Beyond that:test_valu_trig_f64.pymodelledv_trig_f64, which RDNA2 does not have; the translator refuses anything of the kind. Removed.test_valu_frexp_f64.pymodelled subnormals as normalised (mantissa in [0.5, 1)); docs/design.md (andtest_alu_frexp_f64.py, which does run the translator) have zero and denormals give signed zero and exponent 0. The three frexp files duplicatedtest_alu_frexp_f64.py, so they are removed, not rewritten.v_mul_f64,v_fma_f64,v_fract_f64,v_min_f64,v_max_f64,v_cvt_f64_{f32,i32,u32}are not translated at all (Unsupported), so their model tests could not have tested anything.test_valu_f64_unsupported.pypins the refusal (as tests: pin the dot2 refusal instead of a self-built oracle for a GFX11-only instruction #3342 does for dot2) and says what to do when one gets a lowering.v_ldexp_f64(rdna2spirv: lower v_ldexp_f64 bit-exactly via 32-bit integer ops (gfx1036-measured) #3543) andv_cvt_{i32,u32}_f64(feat(rdna2spirv): implement v_cvt_i32_f64 and v_cvt_u32_f64 #3325) are left out on purpose; their model-only files are untouched here.Fix.
test_valu_{rcp,rsq,sqrt,cvt_f32}_f64.pynow translate each case and run it ontests/spirv_interp.py(the interpreter that evaluates binary64): hand-written expected words (special values, ties, overflow, signed zeros, the literal-is-high-dword rule), abs/neg, mul:2/mul:4/div:2/clamp with omod-before-clamp cases, SGPR-pair / inline / literal sources, and seeded random operands against a plain-Python reference (rcp and rsq allow the hardware's 1 ulp). Helpers intests/semantic/f64_ref.py.tests/spirv_interp.pyneeded three additions:OpFDivon binary64 (signed infinity for x / +-0, instead of the binary32 rounding),OpFConvert, andSqrt/InverseSqrtreturning NaN / +-inf where Python'smath.sqrtraises.Tested. Python 3.12.16, Linux (WSL):
python -I -m unittest discover -s tests/semantic -p '*f64*'runs 173 tests, all pass; the wholetests/semanticsuite (6697 tests, OK, 4 skipped and 1 expected failure as on main), andtests/test_f64_conversion.py,test_f64_transcendentals.py,test_spirv_interp_bits.pypass.Negative control. With a mutated copy of
tools/(LEONIDA_TOOLS_DIR):v_sqrt_f64lowered as InverseSqrt: new file fails (59 failures), old file OK;v_rcp_f64as 2/x: 87, old OK;v_rsq_f64as Sqrt: 66, old OK;v_cvt_f32_f64converting a constant: 123, old OK; clamp bound 0.5 inclamp_mods_f64: 3 / 2 / 2 failures, old OK. Reverting theshader_ir.pyliteral fix: 6 failures in each of the three files.