Skip to content

shader_ir: lit(..) is a literal dword on 64-bit sources; refuse lit() spellings gfx10 lacks - #5832

Closed
cynbun wants to merge 1 commit into
ProjectLeonida:mainfrom
cynbun:shader-ir-lit-literal
Closed

cynbun wants to merge 1 commit into
ProjectLeonida:mainfrom
cynbun:shader-ir-lit-literal

Conversation

@cynbun

@cynbun cynbun commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Item: lit() operand gap in tools/shader_ir.py (claimed in #5581: #5581 (comment)).

Depends on: #6808 (merged, 513294b). Rebased onto it: #6808 already reads lit(V) as the constant V, so this PR now only adds what #6808 doesn't do.

What #6808 leaves open

llvm-mc's assembler (23.1.3, -mcpu=gfx1030) encodes lit(V) as the literal dword V, even when V is also an inline constant. On a 64-bit float source, that literal dword is bits 63:32 and bits 31:0 are zero (the "f64 literal sources" row). The translator's f64 readers tell a literal from an inline constant in two ways:

  • parse_line's f64_literal (v_add_f64, v_cvt_f32_f64, v_rcp_f64, …) checks for a 0x spelling.
  • read_f64_words (v_cmp_*_f64), cmp_class_f64 and v_ldexp_f64 check the value, plus a literal mark that nothing set.

So on main:

text bytes (llvm-mc 23.1.3) main reads the bytes mean
v_add_f64 v[0:1], lit(1), v[2:3] 00 00 64 d5 ff 04 02 02 01 00 00 00 (lo 1, hi 0) = 2^-1074 (lo 0, hi 1) = 2^-1042
v_cmp_gt_f64_e32 vcc_lo, lit(1), v[2:3] ff 04 48 7c 01 00 00 00 inline 1 literal
v_ldexp_f64 v[4:5], lit(0x1), v6 (hex too) 04 00 68 d5 ff 0c 02 02 01 00 00 00 inline 1 literal

#6808 also reads lit(-1), lit(1.0) and lit(0x100000000) as an imm/fimm. llvm-mc encodes the first two as a literal of the operand's type, so their value depends on the operand. It rejects the third ("literal value out of range"). lit64() was already refused on main.

Scope: LLVM's disassembler prints lit() only in hex, and only where the literal and the inline constant give the same value (for an f64 source: 0, and the high words of the inline doubles). So this PR changes no translation of a disassembly listing. It covers hand-written text. No retail listing has lit( at all: @Kev-Ball's count over 26,503 gfx1013 listings, made with llvm-mc 23.1.5, which prints lit().

Change

  • tools/shader_ir.py: one _LIT, narrowed to an unsigned hex or decimal value of at most one dword. operand() marks the resulting imm "literal": True, and the mark survives -, |..|, -|..| and neg(..). lit(-1), lit(1.0), a value past one dword and lit64(..) stay special, which is Unsupported. parse_line treats the mark like a 0x spelling when it sets f64_literal.
  • tools/rdna2spirv.py: v_ldexp_f64 honours the mark. read_f64_words and cmp_class_f64 already did.
  • tools/fma_mix_literal_probe.py: the docstring no longer says the translator can't parse lit(). That stopped being true with shader_ir: read LLVM 23's lit(V) operand as the constant V #6808.
  • tests/test_shader_ir.py: shader_ir: read LLVM 23's lit(V) operand as the constant V #6808's test_llvm23_lit_is_the_constant now expects the same imm plus literal.
  • docs/design.md: new row "lit() literals" after "f64 literal sources".

Tests

  • tests/semantic/test_lit_literal.py with the hand-written fixture fixtures/lit_f64_inline_range.asm. Each line is assembled by llvm-mc 23.1.3 to the bytes in its comment.
    • Executed in the interpreter: v_cmp_gt_f64 with lit(1) and v_ldexp_f64 with lit(0x1). Expected words: 0x3f800000 0x41f00000 0x0 0x0. Main gives 0x0 0x3ff00000 0x0 0x0.
    • The source words of v_add_f64 lit(1), v_cvt_f32_f64 lit(64) and v_rcp_f64 lit(2) in the SPIR-V are (0, V). Main gives (V, 0).
    • The operand dicts, and the refused spellings.
  • On main (976b3ec), the new test fails: 14 failures over its 7 tests. With this PR it passes.
  • spirv-val --target-env vulkan1.2: the translated fixture and the three single-line modules are valid.
  • python -I scripts/run_semantic_tests.py tests/semantic: 448 files, 5963 tests. 2 files fail, test_image_atomics_guard and test_image_store_d16, and they fail the same way on main 976b3ec.
  • These pass: tests/test_shader_ir.py, tests/semantic/test_fma_mix_literal.py, tests/test_fma_mix_literal_probe.py, test_alu_ldexp_f64, test_cmp_f64, test_cmp_class_f64, test_alu_cmp_class_f16_f64.
  • CPU only. Not GPU-verified: the earlier GPU runs were of the old fixtures, which pass on main too.

Seen, not changed here

  • A plain 0x1 literal on v_cmp_*_f64 or v_ldexp_f64 (which the disassembler does print, as 0x1) is still read as the inline 1, because those readers decide by value. The corpus has no v_cmp*_f64 at all (the same count).

AI-assisted (Claude Code).

🤖 Generated with Claude Code

@Kev-Ball

Copy link
Copy Markdown

Checked the two retail reachability questions against all 26,503 stored gfx1013 disassembly listings from my Xbox 1.0.2.1 main shader archive. I found zero lit(...) or lit64(...) spellings. I also counted decoded v_cmp*_f64 instructions (including class compares) and found zero, so this corpus supplies no example of the small f64 compare literal mentioned under “Seen, not changed here.”

25,030 listings reported a clean disassembly and 1,473 reported at least one invalid word. These are counts over emitted listing text for the project's gfx1013 path, not a conclusion about undecoded words or other LLVM targets. CPU-only on CachyOS, AI-assisted.

@searyecheesepeaceful

Copy link
Copy Markdown

Tested 7c0aca1 on Intel UHD Graphics 630 (CFL GT2), Mesa ANV, subgroup 8..32: I translated the lit_literals and lit_f64_literals fixtures with the PR's tools, validated them with spirv-val (rc 0) and rendered them with vk_harness at 64x64. All 4096 pixels of ps_lit_literals are 0x40800000 0xc1000000 0x64 0x3f000000 and all 4096 pixels of ps_lit_f64_literals are 0x0 0xbf800000 0x3e800000 0xbf400000. test_shader_ir (37 tests), test_shader_meta (27), test_fma_mix_literal_probe (8), test_semantic_translator_use (3), test_vop3_const_mods (12), test_fma_mix_literal (7) and test_lit_literal (6) pass. I did not reproduce the failures on main or run the full tests/semantic suite.

AI-assisted.

@DenRakEiw

DenRakEiw commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Reviewed commit 7c0aca1cec28 (trial-merged cleanly onto origin/main at 561b65a83, git diff --check clean) on Windows 11 x64 (Python 3.12.10, Vulkan SDK 1.4.363.0):

  • Affected semantic and unit tests (python -m unittest tests/semantic/test_lit_literal.py tests/semantic/test_fma_mix_literal.py tests/semantic/test_valu_fma_mix.py tests/semantic/test_vop3_const_mods.py tests/test_shader_ir.py tests/test_shader_meta.py tests/test_shader_meta_operands.py tests/test_fma_mix_literal_probe.py tests/test_semantic_translator_use.py -v): 120/120 passed (including all 6 new cases in test_lit_literal.py).
  • SPIR-V assembly and validation (spirv-as --target-env vulkan1.2 + spirv-val --target-env vulkan1.2) on the translated ps_lit_literals (lit_literals.asm) and ps_lit_f64_literals (lit_f64_literals.asm) fixtures: both exited 0 with no warnings or errors.
  • Code inspection: shader_ir.operand() parses lit(0x...) / lit(...) up to 32-bit unsigned with VOP3 -/| sign-bit modifiers and marks literal: True, leaving lit64(...), floats, and >32-bit values as special; parse_line() and both 64-bit constant sites in rdna2spirv.py propagate literal so inline-range literal dwords (e.g. lit(0x0), lit(0x40100000)) remain high-word f64 literals rather than being treated as 64-bit inline integers.

AI-assisted (Gemini 4 Neon).

@cynbun

cynbun commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, @Kev-Ball, @gertify and @DenRakEiw.

@Kev-Ball's count. No retail listing carries lit(, so this PR fixes hand-written text, not a retail rejection. The PR didn't say otherwise, but it also didn't say so. New head 6d2754c52 adds one sentence to the docs/design.md "lit() literals" row, linking your count: on those listings the rule changes no translation, and it covers hand-written text such as the fixtures. The PR body has a new "Retail reachability" section. Its "Seen, not changed here" note now also says your count found no v_cmp*_f64 at all. No code changed.

One question about the count: which llvm-mc version wrote those listings? The build records it. I checked that llvm-mc 23.1.3 prints lit() with -mcpu=gfx1013 as well:

  • ff 02 00 06 00 00 80 3f → v_add_f32_e32 v0, lit(0x3f800000), v1
  • ff 5e 00 7e 00 00 10 40 → v_rcp_f64_e32 v[0:1], lit(0x40100000)

So if your listings come from a version that prints lit(), zero means the retail bytes have no literal that shadows an inline constant. If they come from an older version that printed these as plain 0x..., the zero only describes that text. I'd then reword the row to give the version.

@gertify (Intel UHD 630, ANV) and @DenRakEiw (Windows 11). Thanks. ANV matches the RTX 5080 words on all 4096 pixels for both fixtures, and your Windows unit run and spirv-val are clean.

Tests after the docs edit: python -I tests/test_docs_*.py (all 11) and tests/semantic/test_lit_literal.py pass.

AI-assisted (Claude Code).

@Kev-Ball

Copy link
Copy Markdown

@cynbun The listings were produced with llvm-mc 23.1.5, target gfx1013 on CachyOS. They're the same 26,503 listings as the #4686 census, whose run record includes the LLVM version. I also ran your two synthetic byte sequences through /usr/bin/llvm-mc --disassemble -triple=amdgcn-amd-amdhsa -mcpu=gfx1013 -show-encoding here. Version 23.1.5 prints lit(0x3f800000) for the f32 add and lit(0x40100000) for the f64 reciprocal.

That confirms the disassembler used for the retail count emits the spelling on both positive controls. The zero applies to decoded instructions; 1,473 listings had at least one invalid word. AI-assisted.

@cynbun

cynbun commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, @Kev-Ball. That settles it: llvm-mc 23.1.5 prints lit() on both of these byte sequences, so your zero is a real zero for decoded instructions.

New head 59330bf86 makes the docs/design.md row and the PR body's "Retail reachability" section say exactly that, citing your comment, including the caveat that 1,473 listings have at least one invalid word. Docs only; python -I tests/test_docs_*.py passes.

AI-assisted (Claude Code).

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 7c0aca1ce on Windows 11 / Python 3.13.

  • python tests/semantic/test_lit_literal.py: 6/6 OK.
  • Negative control: the same test copied onto main 561b65a83 gives 3 failures + 2 errors (Unsupported operand lit(0x3f800000), Unsupported v_rcp_f64 operand), as described.
  • pytest tests/test_shader_ir.py tests/test_shader_meta.py tests/test_fma_mix_literal_probe.py tests/test_semantic_translator_use.py -q: 75 passed, 79 subtests passed.
  • Checked operand parsing: lit(hex|decimal) becomes the same imm as a plain literal with literal: true; -lit, |lit|, -|lit| and neg(lit(...)) set the existing sign-bit flags; lit64, float spellings and values past 32 bits stay special. The f64 readers use the literal high word and the interpreter checks the expected words.

Verdict: LGTM. The GPU claim is external to the PR (no GPU fixture is added); the CPU/IR evidence is solid.

@larpinguser larpinguser left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

tools/shader_ir.py now parses LLVM's lit(0x...) operand as the literal imm (tagged literal so 64-bit sources distinguish it from an inline constant), with -lit, |lit|, -|lit|, neg(lit) as sign-bit modifiers; lit64(), floats and >32-bit values stay Unsupported. tools/rdna2spirv.py and tools/fma_mix_literal_probe.py are adjusted. Adds tests/semantic/test_lit_literal.py plus two llvm-mc fixtures and a docs/design.md row.

Why merge

Stops the translator rejecting hand-written/disassembled lit() operands (Unsupported operand lit(...)) that LLVM emits when a literal shadows an inline constant, without changing any retail translation.

Verdict: Approve

@larpinguser

Copy link
Copy Markdown

Summary

tools/shader_ir.py now parses LLVM's lit(0x...) operand as the literal imm (tagged literal so 64-bit sources distinguish it from an inline constant), with -lit, |lit|, -|lit|, neg(lit) as sign-bit modifiers; lit64(), floats and >32-bit values stay Unsupported. tools/rdna2spirv.py and tools/fma_mix_literal_probe.py are adjusted. Adds tests/semantic/test_lit_literal.py plus two llvm-mc fixtures and a docs/design.md row.

Why merge

Stops the translator rejecting hand-written/disassembled lit() operands (Unsupported operand lit(...)) that LLVM emits when a literal shadows an inline constant, without changing any retail translation.

Verdict: Approve

@duudiis

duudiis commented Nov 23, 2026

Copy link
Copy Markdown

Tested 653823d merged onto main 7ef2fdd on RTX 5070 (Blackwell), NVIDIA Windows driver 32.0.16.2124 (621.24), Windows 11 Pro 26300, CPython 3.11.0; no llvm-mc, no SPIRV-Tools, with the CI runtime-windows test programs of main 7b7d73f (the runner is newer than those programs): fail

The merge is clean in git, but main now has #6808 (513294b, "read LLVM 23's lit(V) operand as the constant V"), which rewrites every lit(..) at the top of shader_ir.operand(). The new lit() branch from this PR never runs after the merge, and the PR's second _LIT = re.compile(...) (line 30 on the merge) is redefined by #6808's _LIT at line 43. The PR's own parse tests fail on the merge as a result. GPU results show no regression, and both new fixtures render correctly, but they also render correctly on main without this PR.

  • python -I scripts/run_gpu_tests.py --build <runtime-windows> --disasm-dir tests/semantic/fixtures/disasm --assembler python: main 81/96 passed, 15 skipped (wave64: no 64-wide subgroup); merge 81/96 passed, 15 skipped. The per-test status is identical.
  • The same with LEONIDA_W64_EMULATE=1: main 96/96, merge 96/96.
  • PR fixtures on the GPU: I translated lit_literals.asm and lit_f64_literals.asm (plus exp mrt0 v0, v1, v2, v3 done vm / s_endpgm, as test_lit_literal.py does) with tools/rdna2spirv.py --assembler python --no-validate and drew them with the artifact's vk_harness.exe and the runner's vs_tri at 64x64. On the merge, all 4096 pixels are 0x40800000 0xc1000000 0x64 0x3f000000 and 0x0 0xbf800000 0x3e800000 0xbf400000, matching the PR body. On main 7ef2fdd with only the two fixtures copied in, the words are the same on all 4096 pixels.
  • .venv python -m pytest -q tests/semantic/test_lit_literal.py tests/semantic/test_fma_mix_literal.py tests/semantic/test_vop3_const_mods.py tests/test_shader_ir.py tests/test_shader_meta.py tests/test_fma_mix_literal_probe.py tests/test_semantic_translator_use.py on the merge: 4 failed, 104 passed. All 4 failures are in test_lit_literal.py::LitOperandParse:
    • test_lit_is_the_plain_literal: got {'k': 'imm', 'v': 1074790400}, want {'k': 'imm', 'v': 1074790400, 'literal': True}.
    • test_modifiers_are_sign_bit_flags: got {'k': 'imm', 'v': 1065353216, 'neg': True}, want the same with 'literal': True.
    • test_what_is_not_a_gfx10_literal_stays_unparsed: lit(0x100000000) got imm and lit(1.0) got fimm, both want special.
    • The 4 translation tests pass. On the PR head alone (base 1cc6e3c), test_lit_literal.py passes 6/6, so the failures come from the overlap with shader_ir: read LLVM 23's lit(V) operand as the constant V #6808.
  • Not run: spirv-val (no SPIRV-Tools here), and the full tests/semantic discover.

The PR needs a rebase onto #6808. As things stand, the remaining differences from main are the literal flag (main's f64 readers see only the 0x spelling, so a decimal lit(0) on an f64 source would read as the inline 0) and keeping lit64, oversized and float spellings unsupported.

AI-assisted (Claude Code).

…s none of

ItsNotRexed#6808 reads LLVM's lit(V) as the constant V. llvm-mc's assembler encodes lit(V) as
the literal dword V even when V is an inline constant, but the 64-bit float
readers tell a literal from an inline constant by value (v_cmp_*_f64, v_ldexp_f64)
or by a 0x spelling (parse_line's f64_literal), so a decimal lit(1) on v_add_f64,
or lit(0x1) on v_cmp_*_f64 / v_ldexp_f64, read as the inline integer 1 in bits
31:0 instead of the literal in bits 63:32.

operand() now marks the imm "literal", parse_line and v_ldexp_f64 honour the mark
(read_f64_words and cmp_class_f64 already did), and lit(-1), lit(1.0), a value
past one dword and lit64() stay "special" (Unsupported) instead of reading as an
imm/fimm whose meaning depends on the operand type. LLVM's disassembler prints
lit() only in hex and only where the literal and the inline constant give the
same value, so no translation of its listings changes.

tests/semantic/test_lit_literal.py (new fixture lit_f64_inline_range.asm) fails
on main and passes here; ItsNotRexed#6808's operand test now expects the mark.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cynbun
cynbun force-pushed the shader-ir-lit-literal branch from 653823d to 0ccb1a3 Compare November 23, 2026 17:30
@cynbun cynbun changed the title shader_ir: read LLVM's lit(…) operand as the literal it encodes shader_ir: lit(..) is a literal dword on 64-bit sources; refuse lit() spellings gfx10 lacks Nov 23, 2026
@cynbun

cynbun commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, @duudiis. You're right: after #6808, this PR's lit() branch was dead code, the second _LIT was redefined, and the fixtures render the same on main. I rebased onto main (976b3ec) and rewrote the PR on top of #6808. New head: 0ccb1a3e8, one commit. I also updated the title and the body.

What it adds over #6808. I checked your two points on main first.

  1. The literal mark. It matters for more than decimal lit(0). On an f64 source, lit(0) gives the same words whether it's read as the literal or as the inline 0: (0, 0) both ways. It does matter for 1..64. llvm-mc 23.1.3 assembles v_add_f64 v[0:1], lit(1), v[2:3] to 00 00 64 d5 ff 04 02 02 01 00 00 00, which is the double 2^-1042 (lo 0, hi 1). Main builds (lo 1, hi 0). v_cmp_*_f64 and v_ldexp_f64 decide by value only, so on main even lit(0x1) reads as the inline 1 there. operand() now marks the imm literal, and parse_line and v_ldexp_f64 honour the mark. read_f64_words and cmp_class_f64 already checked it.
  2. Unsupported spellings. lit64(..) was already refused on main, so this PR adds nothing there. lit(-1), lit(1.0) and lit(0x100000000) read as imm/fimm on main. They now stay special (Unsupported). llvm-mc encodes the first two as a literal of the operand's type and rejects the third. This is done inside shader_ir: read LLVM 23's lit(V) operand as the constant V #6808's single _LIT, narrowed to an unsigned hex or decimal value of at most one dword.

To be clear about the scope: LLVM's disassembler prints lit() only in hex, and only where the literal and the inline constant give the same value. So no translation of a disassembly listing changes, and retail has no lit( at all (@Kev-Ball's count). What's left is correctness for hand-written text. The body and the new docs/design.md row ("lit() literals") say so.

Tests. The old fixtures and their GPU results are dropped, because they pass on main too.

  • New: tests/semantic/test_lit_literal.py with the hand-written fixture lit_f64_inline_range.asm, assembled by llvm-mc 23.1.3.
    • Executed: v_cmp_gt_f64 with lit(1) and v_ldexp_f64 with lit(0x1). The words are 0x3f800000 0x41f00000 0 0. Main gives 0 0x3ff00000 0 0.
    • The SPIR-V source words of v_add_f64, v_cvt_f32_f64 and v_rcp_f64 are (0, V). Main gives (V, 0).
    • It also checks the operand dicts and the refused spellings.
  • Against main's tools/, the new test has 14 failures over its 7 tests. On this head it passes.
  • shader_ir: read LLVM 23's lit(V) operand as the constant V #6808's test_llvm23_lit_is_the_constant now expects the same imm plus literal.
  • spirv-val --target-env vulkan1.2 passes on the translated fixture and the three single-line modules.
  • python -I scripts/run_semantic_tests.py tests/semantic: 448 files, 5963 tests. 2 files fail (test_image_atomics_guard, test_image_store_d16), and they fail the same way on main 976b3ec.
  • tests/test_shader_ir.py, test_fma_mix_literal.py, test_fma_mix_literal_probe.py and the f64 compare/class/ldexp tests pass.
  • CPU only. There's no GPU run of the new fixture.

If you or the maintainers think hand-written-text correctness isn't worth a PR on its own, I'm fine with closing it in favour of #6808.

AI-assisted (Claude Code).

@Kev-Ball

Kev-Ball commented Nov 23, 2026 •

Copy link
Copy Markdown

I checked the rewritten fixture on 0ccb1a3e8 against its direct parent 976b3ec91. Using the PR’s lit_f64_inline_range.asm and the same export instructions as its semantic test, I fed the hand-written text directly to each translator so that the lit(1) spelling survived. Both resulting fragment modules assembled and passed spirv-val --target-env vulkan1.2.

I rendered each module with the same fullscreen vertex shader and vk_harness, then compared all four RGBA32F words at every pixel. On llvmpipe (LLVM 23.1.5, CachyOS), all 4,096 parent pixels gave 00000000 3ff00000 00000000 00000000; all 4,096 PR pixels gave the fixture’s expected 3f800000 41f00000 00000000 00000000. This confirms the new compare and ldexp case distinguishes the revisions on a Vulkan implementation outside the semantic interpreter. AI-assisted QA.

The same two modules also ran on the physical RTX 3080 Ti (620.73.04, CachyOS). All 4,096 pixels per revision matched the corresponding llvmpipe result above, including all four export words. The direct parent fails the rewritten fixture’s expected output, and the PR passes.

@hcampbell98

Copy link
Copy Markdown

Tested 0ccb1a3e8 merged with main dde82f27e on Linux (WSL2, CPU-only, Python 3.14.4 & 3.12.13): Pass

  • Diff & repo hygiene: git diff --check dde82f27e...HEAD clean; python3 -I scripts/check_no_game_data.py over changed files clean; python3 -m compileall -q tools tests OK.
  • Targeted & sibling tests: tests/semantic/test_lit_literal.py ran 7/7 OK on Python 3.14.4 (-I) and Python 3.12.13 (-I); pytest across test_lit_literal.py, test_fma_mix_literal.py, test_shader_ir.py, test_fma_mix_literal_probe.py, test_alu_ldexp_f64.py, test_cmp_f64.py, test_cmp_class_f64.py, and test_alu_cmp_class_f16_f64.py passed 91 passed, 357 subtests passed.
  • Repo & doc gates: test_semantic_translator_use.py (3/3), test_ci_registration.py (14/14), test_runner_calls_all_tests.py (3/3), test_design_contract_rows.py (4/4), and 9/11 tests/test_docs_*.py files passed (test_docs_cli_flags.py 1/4 on docs/embedded_shaders.md and test_docs_links.py 1/7 on docs/dev-tools.md / docs/gpu_test_results.md match pre-existing dde82f27e failures).
  • Negative controls: reverting tools/shader_ir.py and tools/rdna2spirv.py to dde82f27e produced 14 subfailures across tests/semantic/test_lit_literal.py and 4 subfailures in tests/test_shader_ir.py::OperandTests::test_llvm23_lit_is_the_constant.
  • Edge probes: -lit(1) and -lit(64) on v_add_f64 emit [(0, 1)] / [(0, 64)] high-word pairs with OpFNegate; operand("-|lit(0x3f800000)|") and operand("abs(neg(lit(0x3f800000)))") preserve literal: True; lit(0x100000000) and -lit(1.0) stay special and raise rdna2spirv.Unsupported.
  • Limits & non-blocking notes: CPU-only (llvm-mc, spirv-as, spirv-val, and GPU were not run here). Two adjacent observations from reading tools/: v_div_fixup_f64 (tools/rdna2spirv.py:9304-9312) and v_div_fmas_f64 (tools/rdna2spirv.py:9688-9696) still have imm readers without literal/f64_literal handling, and _LIT.search in tools/shader_ir.py:54-55 inherits #6808's unanchored substring match (so synthetic tokens like split(1) rewrite to raw 'sp1', though translation still raises rdna2spirv.Unsupported).

AI-assisted.

@SquishyGithub

Copy link
Copy Markdown

Tested 0ccb1a3e8 merged into main dde82f27e on NVIDIA GeForce RTX 3070 (Ampere), driver 620.70.06, Vulkan 1.4.357, subgroup 32..32, Linux (Bazzite 45; Fedora 45 distrobox, GCC 16.2.1, LLVM 23.1.5, SPIRV-Tools 2026.2, Python 3.15.2): pass

@thiefyzheng

Copy link
Copy Markdown

checked partial: at your head, tools/mode_round_probe.py --self-test → OK; fma_mix_literal_probe CPU reference printed its A–E shape table; the hardware-oracle leg is not run here (needs AMD clang in-container, LEONIDA_AMD_CLANG). AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.