Repository navigation
tools: valu_literal64_probe measures how a 32-bit VALU literal is extended in a 64-bit integer operand (HW-VALU-LITERAL64-EXT) - #1800
Open
mcpeacebir-lang wants to merge 1 commit into
Conversation
…ended in a 64-bit integer operand (HW-VALU-LITERAL64-EXT) The "32-bit literal source of a signed 64-bit vector op" row of docs/design.md said its rule (sign-extend in an i64 operand, zero-extend in a u64/b64 one, Gen.valu_imm_i64) was not measured on hardware. tools/valu_literal64_probe.py runs 21 op forms (v_cmp/v_cmpx lt/gt i64/u64, v_ashrrev_i64, v_lshrrev_b64, v_lshlrev_b64, v_mad_i64_i32, v_mad_u64_u32) x the literals 0xffffff9c, 0x80000000 and 0x7fffffff through tools/hw_oracle in wave32 and wave64. On an RX 7800 XT (gfx1101) every result follows the row's rule; the row now says so and that RDNA2 is not measured. tests/test_valu_literal64_probe.py is CPU-only; its assembler check runs when LEONIDA_AMD_CLANG has llvm-mc beside it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Tested
AI-assisted; synthetic fixtures only, no game data. |
mcpeacebir-lang
force-pushed
the
claude/valu-literal64-probe
branch
from
November 26, 2026 16:18
98d9e14 to
ea765a7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: HW-VALU-LITERAL64-EXT (#1608 (comment)). Result: #1608 (comment)
What and why
The "32-bit literal source of a signed 64-bit vector op" row of
docs/design.mdends with "Not measured on hardware". It gives the translator's rule for a 32-bit VALU literal in a 64-bit integer operand: sign-extend in an i64 operand, zero-extend in a u64/b64 one (Gen.valu_imm_i64, SHADER-VALU-LITERAL-SEXT). That rule comes from LLVM's assembler documentation. A literal is one dword, so where the hardware takes the high dword from is what decides it.I measured it on an RX 7800 XT and posted the result in #1608. Every result follows the row. This pull request 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/valu_literal64_probe.pyruns throughtools/hw_oracle:v_cmp_{lt,gt}_{i64,u64}: e64 with the literal as src0 and as src1, and e32;v_cmpx_{lt,gt}_{i64,u64};v_ashrrev_i64,v_lshrrev_b64andv_lshlrev_b64;v_mad_i64_i32andv_mad_u64_u32.0xffffff9c,0x80000000and0x7fffffff. The last one is a control that both models agree on.Exit codes:
--waves,--jsonand--self-testfollowcndmask_hw_probe.py(#1784) anddpp_hw_probe.py(#1773).The row now gives the gfx1101 measurement and says RDNA2 is not measured. No translator change. New files plus one row of
docs/design.md.Tested
python -I tests/test_valu_literal64_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. It also checks that each literal is encoded as that one dword.python -I tools/valu_literal64_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 (ci: fix the three repository checks that fail on main #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