shader_ir: preserve symbolic branch and call targets #3215
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3215"
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 merzleckeier on 2026-12-02T19:43:34Z.
Claimed as SHADER-IR-BRANCH-LABEL-MODIFIERS, following the parser finding.
What and why
shader_ir.parse_line()scans operand text for modifiers. On scalar branches and calls this can consume symbolic target text such asdone,.done,glc, andvm. Keep that text in the operand list by skipping modifier extraction for those instructions. Numeric offsets still parse as immediates, and export instructions still parsedoneandvmas modifiers.Tested
mainparser (b41763227) and passed with the fix. Both parser test modules passed on Linux and with Windows CPython 3.12.10 under Wine 11.22 (44 tests each).llvm-mc -show-encodingaccepted all four hand-written target forms and the export modifier control forgfx1030.python -I scripts/run_semantic_tests.py tests/semantic -j 8 --timeout 300: 560 files, 6,791 tests, zero failed files.git diff --checkand the changed-filescripts/check_no_game_data.pyscan passed.GPUs tested: n/a (synthetic CPU-only parsing and translator tests).
AI-assisted: OpenAI Codex (GPT-6), with independent read-only review by GPT-6.2 Sol.
Checklist
main(b41763227).Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T20:36:37Z.
VERIFY-3215 — Windows nativo,
red then green(4 subcasos fallan sin el arreglo)(this PR)b41763227= currentmainRan
Negative control (
tools/shader_ir.pyreverted tomain, the PR's tests kept):The fix reads right and is scoped:
if rest and op not in ("s_branch", "s_call_b64") and not op.startswith("s_cbranch_")— scalar branches and calls have no trailing modifiers, so a word such asdone,glcorvmin the target position is the target, not a modifier. The second test the PR adds (test_export_still_parses_done_and_vm_modifiers) is the guard for the other side — the export syntax, where those same words are modifiers — and it passes on bothmainand this head, which is exactly what a guard should do.What I could not test: a real shader corpus through
shader_ir.py; the suite is unit-level (5 tests, no I/O). The four subcases ares_cbranch_scc1 done ; plain comment,s_branch .done,s_cbranch_execz glcands_call_b64 s[0:1], vm.Verdict: red then green on native Windows.
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-02T22:47:51Z.
Windows native verification (
red -> green) -- PASS on headd0fc19927(merged cleanly viagit merge --no-ffontomain16243cd6e).Checks (Windows 10 x64, Python 3.12)
python -I scripts/check_no_game_data.py-> PASSpython -I tests/test_shader_ir_parse.py -von merged headd0fc19927): Ran 5 tests in 0.001s / OKtools/shader_ir.pytomain16243cd6e, keeping the PR'stests/test_shader_ir_parse.py): Ran 5 tests in 0.002s / FAILED (failures=4)AI-assisted: yes (Antigravity -- Gemini 4 Neon).