tools: cndmask_hw_probe measures v_cndmask_b32's abs/neg source modifiers natively (TOOL-CNDMASK-HW-PROBE) #1784
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1784"
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 mcpeacebir-lang on 2026-11-25T12:06:21Z.
Claimed in the coordination issue as: TOOL-CNDMASK-HW-PROBE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161775786)
What and why
The "
v_cndmask_b32source modifiers" row ofdocs/design.mdsaid the translator's rule was "Not measured on hardware for this instruction". The rule is that VOP3abs/negonv_cndmask_b32are sign-bit moves (Gen.src_u_sign_mods), so a signalling NaN stays signalling and a denormal is not flushed. I measured it on an RX 7800 XT for HW-CNDMASK-SIGN-MODS in #1608 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161680445), with a script outside the repository. This turns that run into a tool, so the row can cite it and someone with a gfx103x card can measure RDNA2 with one command.tools/cndmask_hw_probe.pyrunsv_cndmask_b32_e64throughtools/hw_oracle. Each kernel runs one lane.tests/semantic/test_cndmask_sign_mods.py.v,-v,|v|and-|v|, as the selected src0 and as the selected src1.ieee0/1 ×denorm320/3, in wave32 and wave64.v_add_f32(+min denormal, 0), which is flushed exactly whendenorm32 = 0;v_mul_f32(sNaN, 1.0), which is quieted exactly whenieee = 1.Exit codes:
--waves,--jsonand--self-testfollowds_permute_probe.pyanddpp_hw_probe.py(#1773).The row in
docs/design.mdnow gives the RDNA3 result and says RDNA2 is not measured. It keeps the two arguments the rule rested on before: thev_cmp_class_f32measurement and LLVM'sfoldFreeOpFromSelect.No translator change. New files plus one row of
docs/design.md.Tested
python -I tests/test_cndmask_hw_probe.py: 20 tests, 19 OK and 1 skipped (the llvm-mc check). WithLEONIDA_AMD_CLANGset to the clang fromrocm-sdk-core==10.0.0(AMD LLVM 23.0.0git), all 20 are OK. The llvm-mc check assembles every kernel body for gfx1030 (GFX10 spelling) and gfx1101, in wave32 and wave64.python -I tools/cndmask_hw_probe.py --self-test: OK.main0d80bc5df:scripts/check_no_game_data.py: clean.compileallandgit diff --check: clean.tests/test_ci_registration.py,tests/test_text_write_line_endings.pyand everytests/test_docs_*.py: OK.test_runner_calls_all_tests.py,test_tool_stdout_encoding.pyandtest_runtime_paths.pyare red onmainalready (#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 fromrocm-sdk-core==10.0.0).AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change; the existing row gains its hardware measurement)🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T10:11:11Z.
#1784 | head
45435f74b4e3aaaeb994cb88ed42a59296b6fd96|python3 -I tests/test_cndmask_hw_probe.py -v| red: import error before any test ran (new module absent) | green: 20 passed | Import-only red → passThe new probe module is absent on main, so the test file stopped at import. After merging, all 20 tests ran, including assembly with LLVM 21.1.8. This run used the synthetic test oracle.
Pinned main
33db04a7010e81c40a7a6a15624525aa0c4a3a58, merged into this PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T10:49:15Z.
Merged, thank you @mcpeacebir-lang!
What it does: tools: cndmask_hw_probe measures v_cndmask_b32's abs/neg source modifiers natively (TOOL-CNDMASK-HW-PROBE)
How it was checked: sodove tested this PR at head
45435f74bon main33db04a70: the PR's own test fails on main and passes with this PR merged in (his result is linked from the batch summary in #1608). We then re-ran the same test locally on Windows 11 and got the same verdict: on main, red (import error: probe module is new); with the PR, green (20 OK, 1 skip).On main the test fails only because the new probe module does not exist yet, which is expected for a new tool; its llvm-mc case was skipped on our machine (no AMD clang set up).
CI: the red jobs on this PR fail the same way on main, or on the older main it was built on (the
cs_dpp_cmp.asmtranslator fixture, since fixed on main, and the Windows runner's Visual Studio setup), so none comes from this change.Merged one by one with 20 other PRs of the same reviewed batch, pinned to the tested head.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.