tools: dpp_hw_probe measures the DPP bound_ctrl zero and unwritten VOPC lanes natively (TOOL-DPP-HW-PROBE) #1773

Merged
mcpeacebir-lang merged 1 commit from upstream-pr/1773 into main 2026-11-28 11:41:25 +00:00
mcpeacebir-lang commented 2026-11-25 11:48:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by mcpeacebir-lang on 2026-11-25T11:48:22Z.


Claimed in the coordination issue as: TOOL-DPP-HW-PROBE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161381032)

What and why

Two DPP questions were measured by hand on an RX 7800 XT in #1608 (HW-DPP-NEG-INVALID-LANE, HW-VOPC-DPP-UNWRITTEN-LANES). Both stay open for RDNA2, which is what the translator targets. This turns those two runs into one command, so someone with a gfx103x card can repeat them through tools/hw_oracle. @quartz-heron-58 asked for a link from the "DPP on a VOPC compare" row.

tools/dpp_hw_probe.py has two case groups, each run in wave32 and wave64, one thread per lane, s_nop 7 after every instruction:

  • neg: does DPP apply src0's neg / abs to the 0 that bound_ctrl:1 gives an invalid source lane? v_add_f32_dpp / v_mul_f32_dpp with -src0, src0, |src0|; the sources are an out-of-row lane, or an EXEC-off lane with fi:0 / fi:1. Each lane is compared with two models: modifiers after the zero (-0), or before it (+0, what Gen.dpp_insn emits).
  • vopc: what does a VOPC compare in DPP form (v_cmp_{gt,lt}_f32 into VCC, v_cmpx_* into EXEC) do to the bit of a lane DPP leaves unwritten? That is a lane with bound_ctrl:0 and an invalid source, or one row_mask / bank_mask turn off. VCC is preset to 0 and to all ones. Each lane is compared with three models: written 0, kept, or the compare of a 0 source. For every pair of models some run separates them (a unit test checks that).

It prints the models every case matches. Exit codes: 1 when a case matches none, 77 without the oracle or on a family other than gfx10/gfx11. --group, --waves, --json and --self-test follow the other probes (ds_permute_probe.py).

Encoding. LLVM has no gfx10 encoding for a VOPC compare in DPP form: AMD clang's llvm-mc says "dpp variant of this instruction is not supported" for gfx1030, as the design row notes. So the compares are emitted as .long pairs: the VOPC word with src0 = 250 and the DPP16 word.

  • The gfx11 words are the ones llvm-mc encodes for gfx1101, for all 24 op × control pairs. tests/test_dpp_hw_probe.py compares them when LEONIDA_AMD_CLANG has llvm-mc beside it; --self-test pins a few.
  • The gfx10 opcodes come from llvm-mc's gfx1030 e32 encodings (v_cmp_lt/gt_f32 0x01/0x04, v_cmpx_lt/gt_f32 0x11/0x14). The DPP word has the same layout on gfx1030 (checked on v_max_f32_dpp).
  • The neg group is plain assembler text: VOP2 DPP assembles for gfx10.

New files only. No docs/design.md change: #1647 is editing the "DPP on a VOPC compare" row, and @quartz-heron-58 said in #1608 that they will reword it after that lands. No translator change.

Tested

  • python -I tests/test_dpp_hw_probe.py: 21 tests OK, 1 skipped (the llvm-mc check). With LEONIDA_AMD_CLANG set to the clang from rocm-sdk-core==10.0.0 (AMD LLVM 23.0.0git): 21 OK, including the llvm-mc encoding check.
  • python -I tools/dpp_hw_probe.py --self-test: OK.
  • On the GPU, python -I tools/dpp_hw_probe.py --json report.json on main ed94fbef9:
    neg wave32 (gfx1101): every case matches mods_after_zero
    neg wave64 (gfx1101): every case matches mods_after_zero
    vopc wave32 (gfx1101): every case matches unwritten_gets_0
    vopc wave64 (gfx1101): every case matches unwritten_gets_0
    
    This is the same result as the two hand runs posted in #1608.
  • scripts/check_no_game_data.py on both files: clean. compileall and git diff --check: clean.
  • tests/test_ci_registration.py, tests/test_text_write_line_endings.py: OK.
  • test_runner_calls_all_tests.py, test_tool_stdout_encoding.py and test_runtime_paths.py are red on main already (#1673). None of their failures names these files.

Not run: RDNA2 itself (no gfx103x card here), which is what the tool is for. Nothing in the translator suite changes.

GPUs tested: AMD Radeon RX 7800 XT (gfx1101, RDNA3), AMD driver 32.0.32029.2010, Windows 11, through tools/hw_oracle (amdhip64_7.dll, AMD clang from rocm-sdk-core==10.0.0).

AI-assisted: yes (Claude Code, Claude Opus 5.5)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5490734627 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1773). Originally posted by [mcpeacebir-lang](https://github.com/mcpeacebir-lang) on 2026-11-25T11:48:22Z. --- Claimed in the coordination issue as: TOOL-DPP-HW-PROBE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161381032) ### What and why Two DPP questions were measured by hand on an RX 7800 XT in #1608 (HW-DPP-NEG-INVALID-LANE, HW-VOPC-DPP-UNWRITTEN-LANES). Both stay open for RDNA2, which is what the translator targets. This turns those two runs into one command, so someone with a gfx103x card can repeat them through `tools/hw_oracle`. @quartz-heron-58 asked for a link from the "DPP on a VOPC compare" row. `tools/dpp_hw_probe.py` has two case groups, each run in wave32 and wave64, one thread per lane, `s_nop 7` after every instruction: - **`neg`:** does DPP apply src0's `neg` / `abs` to the 0 that `bound_ctrl:1` gives an invalid source lane? `v_add_f32_dpp` / `v_mul_f32_dpp` with `-src0`, `src0`, `|src0|`; the sources are an out-of-row lane, or an EXEC-off lane with `fi:0` / `fi:1`. Each lane is compared with two models: modifiers after the zero (-0), or before it (+0, what `Gen.dpp_insn` emits). - **`vopc`:** what does a VOPC compare in DPP form (`v_cmp_{gt,lt}_f32` into VCC, `v_cmpx_*` into EXEC) do to the bit of a lane DPP leaves unwritten? That is a lane with `bound_ctrl:0` and an invalid source, or one `row_mask` / `bank_mask` turn off. VCC is preset to 0 and to all ones. Each lane is compared with three models: written 0, kept, or the compare of a 0 source. For every pair of models some run separates them (a unit test checks that). It prints the models every case matches. Exit codes: 1 when a case matches none, 77 without the oracle or on a family other than gfx10/gfx11. `--group`, `--waves`, `--json` and `--self-test` follow the other probes (`ds_permute_probe.py`). **Encoding.** LLVM has no gfx10 encoding for a VOPC compare in DPP form: AMD clang's llvm-mc says "dpp variant of this instruction is not supported" for gfx1030, as the design row notes. So the compares are emitted as `.long` pairs: the VOPC word with src0 = 250 and the DPP16 word. - The gfx11 words are the ones llvm-mc encodes for gfx1101, for all 24 op × control pairs. `tests/test_dpp_hw_probe.py` compares them when `LEONIDA_AMD_CLANG` has llvm-mc beside it; `--self-test` pins a few. - The gfx10 opcodes come from llvm-mc's gfx1030 e32 encodings (`v_cmp_lt/gt_f32` 0x01/0x04, `v_cmpx_lt/gt_f32` 0x11/0x14). The DPP word has the same layout on gfx1030 (checked on `v_max_f32_dpp`). - The `neg` group is plain assembler text: VOP2 DPP assembles for gfx10. New files only. No `docs/design.md` change: #1647 is editing the "DPP on a VOPC compare" row, and @quartz-heron-58 said in #1608 that they will reword it after that lands. No translator change. ### Tested - `python -I tests/test_dpp_hw_probe.py`: 21 tests OK, 1 skipped (the llvm-mc check). With `LEONIDA_AMD_CLANG` set to the clang from `rocm-sdk-core==10.0.0` (AMD LLVM 23.0.0git): 21 OK, including the llvm-mc encoding check. - `python -I tools/dpp_hw_probe.py --self-test`: OK. - On the GPU, `python -I tools/dpp_hw_probe.py --json report.json` on `main` `ed94fbef9`: ``` neg wave32 (gfx1101): every case matches mods_after_zero neg wave64 (gfx1101): every case matches mods_after_zero vopc wave32 (gfx1101): every case matches unwritten_gets_0 vopc wave64 (gfx1101): every case matches unwritten_gets_0 ``` This is the same result as the two hand runs posted in #1608. - `scripts/check_no_game_data.py` on both files: clean. `compileall` and `git diff --check`: clean. - `tests/test_ci_registration.py`, `tests/test_text_write_line_endings.py`: OK. - `test_runner_calls_all_tests.py`, `test_tool_stdout_encoding.py` and `test_runtime_paths.py` are red on `main` already (#1673). None of their failures names these files. Not run: RDNA2 itself (no gfx103x card here), which is what the tool is for. Nothing in the translator suite changes. GPUs tested: AMD Radeon RX 7800 XT (gfx1101, RDNA3), AMD driver 32.0.32029.2010, Windows 11, through `tools/hw_oracle` (`amdhip64_7.dll`, AMD clang from `rocm-sdk-core==10.0.0`). AI-assisted: yes (Claude Code, Claude Opus 5.5) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sodove commented 2026-11-28 11:27:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T11:27:56Z.


#1773 | head bc647ba6312a2cfb642c525c729fcff95167d093 | python3 -I tests/test_dpp_hw_probe.py -v | red: import error (dpp_hw_probe absent, 0 tests ran) | green: 21 passed | Import-only baseline → pass

The new probe was absent on main. On the merged tree the suite ran the model/judging tests, mocked oracle lifecycle, CLI self-test and LLVM encoding check for gfx1101. The suite uses synthetic and mocked inputs for the hardware-facing cases.

Copied the PR tests onto clean main 4a54aedcb6b66525e0c9f72a6ea10263337c9141 for the baseline, then merged that main into the recorded PR head and reran those files. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Unittest failure/error counts include subtests where applicable. AI-assisted with OpenAI Codex. Batch claim.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238569233 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1773#issuecomment-7238569233). Originally posted by [sodove](https://github.com/sodove) on 2026-11-28T11:27:56Z. --- #1773 | head `bc647ba6312a2cfb642c525c729fcff95167d093` | `python3 -I tests/test_dpp_hw_probe.py -v` | red: import error (dpp_hw_probe absent, 0 tests ran) | green: 21 passed | **Import-only baseline → pass** The new probe was absent on main. On the merged tree the suite ran the model/judging tests, mocked oracle lifecycle, CLI self-test and LLVM encoding check for gfx1101. The suite uses synthetic and mocked inputs for the hardware-facing cases. Copied the PR tests onto clean main `4a54aedcb6b66525e0c9f72a6ea10263337c9141` for the baseline, then merged that main into the recorded PR head and reran those files. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Unittest failure/error counts include subtests where applicable. AI-assisted with OpenAI Codex. [Batch claim](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7238450840).
DadaCap commented 2026-11-28 11:41:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T11:41:27Z.


Merged, thank you @mcpeacebir-lang! This PR (tools: dpp_hw_probe measures the DPP bound_ctrl zero and unwritten VOPC lanes natively (TOOL-DPP-HW-PROBE)) passed its own tests with main merged in during sodove's verification of this shader batch, so it went in with the batch.

AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238718132 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1773#issuecomment-7238718132). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T11:41:27Z. --- Merged, thank you @mcpeacebir-lang! This PR (tools: dpp_hw_probe measures the DPP bound_ctrl zero and unwritten VOPC lanes natively (TOOL-DPP-HW-PROBE)) passed its own tests with main merged in during sodove's verification of this shader batch, so it went in with the batch. AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1773
No description provided.