Fix post-merge CI regressions in wave_diff, x64_recomp, and piecewise_parse #2895
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2895"
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 ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T15:55:10Z.
Summary
Fixes the CI regressions on
mainfollowing the batch merge of approved PRs (#1329,#1428,#1809,#2237) plus a latentpushf/lahfEFLAGS materialization bug exposed byx64_recompQEMU execution tests:tools/wave_diff.py(regression from#1809, broketests/test_wave_diff.pyandtests/test_wave_trace.py):WaveRef._check_vgpr_dst(self, op, dst)shadowedcpu_ref.Machine._check_vgpr_dst(self, dst)(called with 1 arg byCpuRef._write_vgpr), causingTypeError: WaveRef._check_vgpr_dst() missing 1 required positional argument: 'dst'.WaveRefhelper to_check_wave_vgpr_dstand updated its three internal call sites inWaveRef.step.tests/test_x64_recomp.py(regression from#1428):#1428fixed short-formxchg(0x90..0x97) to decode withOv Av(32-bit default in 64-bit mode, 64-bit only withREX.W), making41 90(REX.B, noREX.W) decode as 32-bitxchg r8d, eaxper the Intel SDM (verified withllvm-mc).DecodeTests.test_opcode_90_nop_pause_and_rex_xchgfor41 90and added49 90(REX.W | REX.B-> 64-bitxchg r8, rax).tests/test_x64_recomp_adcsbb.py(regression from#1329, broketests/test_x64_recomp_qemu_runner.pyand QEMU runs):xr.run_kernel(returns raw stdout bytes) toxr.run_result(returns parsed(int, tr)), matching every othertest_x64_recomp_*.pysuite.tools/x64_recomp.py(exposed by QEMU execution intests/test_x64_recomp_incdec.pyandtests/test_x64_recomp_adcsbb.py):pushfandlahfunconditionally calledself._mkflags(0), clobbering already-materializedCTX_EFLAGS(e.g.cmp; dec; jmp +0; pushf,neg; jmp +0; pushf,sbb; jmp +0; pushf) with un-inverted ARMCor stale NZCV._ensure_eflags(self, ins): skips_mkflagswhenCTX_EFLAGSis already materialized (prod is None,prod.mnem in ("popf", "sahf"), orprod.addr in self.mat), and otherwise passes the producer's kind (2forLOGIC_KIND,1forSUB_KIND,0forADD_KIND).tests/test_piecewise_parse.py(hash-seed flake from#2237):code_facts()comparedrepr(frozenset)forco_consts, which depends on CPython hash-table order under randomizedPYTHONHASHSEED._const_fact()to recursively canonicalizeCodeType,frozenset, andtupleconstants deterministically.Testing
python3 -I scripts/check_no_game_data.py tools/wave_diff.py tools/x64_recomp.py tests/test_x64_recomp.py tests/test_x64_recomp_adcsbb.py tests/test_piecewise_parse.py— passedpython3 -m compileall -q make_game.py tools tests— passedpython3 -I make_game.py --help— passednode --test tests/test_*.cjs— 110/110 passedLEONIDA_REQUIRE_SPIRV_TOOLS=1 python3 -I scripts/run_semantic_tests.py tests/semantic— 557 files, 6780 tests, 0 failedFull standalone Python suite (
scripts/run_standalone_tests.py, 654 files, including QEMU aarch64 execution fortest_x64_recomp_adcsbb.pyandtest_x64_recomp_incdec.py) — all 654 files passed (after fixingtest_piecewise_parse.pyand re-verifying across 8PYTHONHASHSEEDvalues + full 26-test suite)pytesttranslator tests — 2069 passed, 15 skippedGPUs tested: N/A (CPU-only Python/QEMU/JS tests on Linux x86_64)
AI-assisted: yes (Antigravity / Gemini; independently reviewed by a separate read-only reviewer agent)
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T16:09:50Z.
Post-merge CI reproduction with actual AArch64 execution at
9b7674d6+0ff8a532f, using Python 3.14 and QEMU 11.1.3. All 117 targeted test methods passed in seven files, including all 64 in the three x64 execution suites with the QEMU runner active. The same main baseline fails the wave tests, short-form XCHG expectation, QEMU fallback check and INC/DEC/NEG flag cases. The targeted piecewise code-object comparison passed for seeds 0, 1, 4 and 17 on the PR. Main failed at 4 and 17.One existing gap in the LAHF part of the description: a minimal synthetic integer comparison followed by LAHF is decoded but recorded as unhandled by the emitter on both main and this PR. Under QEMU it never reaches the result. The matched control without LAHF returns normally. The new LAHF flag-materialization call sits in _emit_alu, but the dispatcher does not route this mnemonic there.
I tried routing LAHF to that existing handler and setting the fixed bit 1 in the byte it returns. Borrow, equal and greater comparisons then matched native x64 in all six cases (each comparison both in the same block and across a jump). This was a local trial. The suite result above is for the unmodified PR head.
MEASURED with synthetic code. AI-assisted (Codex).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T16:12:56Z.
Checked head
9b7674d64merged into main0ff8a532f(clean merge), Windows 11, Python 3.14.0._check_vgpr_dst() missing 1 required positional argument)41 90)run_kernel)test_x64_recomp_*.pytest_piecewise_parseon this machine: 4 failures without this PR, 1 with it:WarningsTest.test_the_compiler_warns_once_too. That one fails without the PR too, so it is not new. It passes in CI; I have not looked for the cause (perhaps my Python 3.14).Not checked: the
pushf/lahfchange. There is no QEMU here, so the tests that run the translated code are skipped. The 41 90 / 49 90 expectations match REX.B without and with REX.W.Red and green for the four files that make main's CI red. Not a full review of the
x64_recomp.pypart.AI-assisted (Claude).
Imported from ubiquitarianism/leonida. Originally posted by Neutron-0 on 2026-12-01T16:53:46Z.
Verified on Windows 11, Python 3.13.5, no GPU and no game files.
The pull request's central fix is red on
mainand green on the head.tests/test_wave_diff.pyandtests/test_wave_trace.pyfail on the base0ff8a532fwith exactly the error the description names:On the head
9b7674d64both are green:Ran 16 tests ... OKandRan 10 tests ... OK. The shadowing ofcpu_ref.Machine._check_vgpr_dst(self, dst)byWaveRef._check_vgpr_dst(self, op, dst)is the cause, and the rename to_check_wave_vgpr_dstis the fix. The pull request does not touch these two test files, and it does not have to: the existing tests already fail onmainand pass with the change. That is the proof the repository's own rule asks for.This is also why
main's CI is red. TheCIrun onmainat0ff8a532ffails in the "Tests (standard library only)" step with:These are the same four files this pull request repairs (its
tests/test_x64_recomp.pyedit is the41 90/49 90case, andtests/test_x64_recomp_qemu_runner.pyis whattests/test_x64_recomp_adcsbb.pyswitches the QEMU fallback runner to match). A pull request that lands the four repairs unblocksmain's CI.The other two changes, measured.
tests/test_piecewise_parse.py: theco_constscomparison now goes through_const_fact(), which canonicalisesCodeType,frozensetandtupleconstants, so the hash-seed flake is gone. The file's 26 tests pass on the head underpython -I(the runner the repository documents). Note that underpytestone test in this file fails on the head and onmainwithAssertionError: <class '_frozen_importlib_external.SourceFileLoader'> is not <class 'support.PiecewiseLoader'>: that is an artifact of this machine's Anaconda Python 3.13.5 under pytest's import order, not of the change -python -I tests/test_piecewise_parse.pypasses all 26.tools/x64_recomp.py'spushf/lahffix (_ensure_eflags): this one needs QEMU for aarch64 execution to observe, and there is no QEMU on this machine, so thepushf/lahfhalf is not verified here.tests/test_x64_recomp_adcsbb.pyreportsOK (skipped=3)andtests/test_x64_recomp.pyOK (skipped=34)on the head, so the QEMU-gated tests did not run.One note on the claim. The description says the pull request "fixes the CI regressions on
main". On the head,tests/test_x64_recomp.pyandtests/test_x64_recomp_qemu_runner.pyare repaired by the edits totests/test_x64_recomp.pyandtests/test_x64_recomp_adcsbb.pyalone - the source they test (tools/x64_recomp.py) is not changed for thexchgcase, because #1428 already fixed the decoder and the test was the part left behind. That is correct as it stands, but it means thexchgpart of the pull request is a test repair, not a source fix, and the summary lists it next to two source fixes. Worth a line in the description so a reviewer knows thexchgitem needs no source change.Not checked: the QEMU execution paths (no QEMU here); a real shader translation (no game files).