diff --git a/docs/fspx.md b/docs/fspx.md index 6fa4a4c8db..15048d2564 100644 --- a/docs/fspx.md +++ b/docs/fspx.md @@ -136,6 +136,14 @@ program whose kind 0 is too short for word 4 keeps the code heuristic. SGPRs (`s[0:1]`, `s4`..`s15`), `M0`, `VCC`, `EXEC` (including inactive lanes across 64 threads) and `SCC` (both 0 and 1) unchanged, and execution resumes cleanly at `+36` bytes. So they are hardware no-ops on RDNA2. - `tools/fspx_unpack.py` disassembles from the end of the prologue. + - **A 24-byte variant**: some programs of the pipeline library in `shaders.rpf` (`tools/shader_library.py`) carry + only the first two of those words, at words 0 and 3, and their code starts at word 6. `code_range` takes that + form only when both words are literal-bearing VOP3 opcode-0x180 words of the shape `tools/fspx_prologue_probe.py` + checks (second dword `& 0xFFFE0100 == 0x03FE0100`); a program whose words 0, 3 and 6 are all prologue words keeps + the 36-byte form. Counted on the 1.0.2.1 library with an opcode-only check (#583): 50 of 2,684 programs; read + from word 0 they never decode, and with the 24-byte start all 50 disassemble with 0 invalid words and 49 + translate and pass `spirv-val` (the other stops at `s_sethalt`). `tests/test_fspx_unpack.py` + (`test_short_prologue`) covers the form and the stricter check. - **Target.** The programs use `v_dot4_i32_i8` (1,458 times) and `v_dot4c_i32_i8` (25,813 times), which fits the provider's name (`FSR4_Int8`). `llvm-mc` (LLVM 23.1.5) decodes them for `gfx1011`, `gfx1012`, `gfx1030`, `gfx1031`, `gfx1033`, `gfx1034` and `gfx1036`, but not for `gfx1010`, `gfx1013` (the target `shader_disasm.py` uses for the diff --git a/tests/test_fspx_unpack.py b/tests/test_fspx_unpack.py index 946da380cf..8957bec272 100644 --- a/tests/test_fspx_unpack.py +++ b/tests/test_fspx_unpack.py @@ -144,6 +144,20 @@ def test_code_range(self): self.assertEqual(fspx_unpack.code_range(program(with_prologue=False)), (0, 12 + 4)) self.assertEqual(fspx_unpack.code_range(program(endpgm=False))[1], None) + def test_short_prologue(self): + # The 24-byte prologue of some pipeline-library programs: hash carriers at words 0 and 3 only, each a VOP3 + # opcode-0x180 word with a literal in the form tools/fspx_prologue_probe.py checks, then the code at word 6. + carrier = struct.pack("