Skip to content

Add tuned Equality library logic for five gfx1250 GEMM - #11746

Merged
jichangjichang merged 2 commits into
developfrom
users/jichang/logic_update_0907
Sep 7, 2026
Merged

jichangjichang merged 2 commits into
developfrom
users/jichang/logic_update_0907

Conversation

@jichangjichang

@jichangjichang jichangjichang commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

JIRA ID : AIHPBLAS-835

Motivation

Add tuned Equality library logic for five gfx1250 GEMM types (BBS, F8F8S, MXF8,
MXF4, NVF4). Building the device library with these yamls surfaced a latent
validator bug: a solution using SourceSwap (F4 32x16 WMMA) failed
MatrixInstruction validation and aborted TensileCreateLibrary with a blank
Validation failed: (index: 0). Both changes are needed for the new logic to
build.

Technical Details

Commit 1 — feat: 5 new Equality logic yamls
Under Logic/asm_full/gfx1250/gfx1250/Equality/:
BBS_BH, F8F8S_BH, F4BS_MXAE8B32_MXBE8B32 (MXF4), F8BS_MXAE8B32_MXBE8B32
(MXF8), F4BS_MXAF8B16_MXBF8B16 (NVF4).

Commit 2 — fix: honor SourceSwap in MatrixInst M/N validation
(SolutionStructs/Validators/MatrixInstruction.py). validateMIParameters
asserted MatrixInstM/N == MatrixInstruction[0]/[1] unconditionally. With
SourceSwap on a non-square instruction the M/N extents are transposed
(e.g. [32,16,128,1] with MatrixInstM=16, MatrixInstN=32). The validator is
dual-use: solution generation keeps the instruction order (M=mi4[0], N=mi4[1]) while the serialized logic yaml stores the swapped order — so pinning
a single orientation fixes one path and breaks the other. The fix accepts
either orientation under SourceSwap ({MatrixInstM, MatrixInstN} == {mi4[0], mi4[1]}), keeps the strict order otherwise, and adds elineno() messages so the
assert is no longer blank.

Test Plan

  • hipblaslt-test

Test Result

[----------] Global test environment tear-down
[==========] 61106 tests from 36 test suites ran. (653987 ms total)
[ PASSED ] 61085 tests.
hipBLASLt version: 100401
hipBLASLt git version: b91169d5c1b
command line: ./hipblaslt-test

Submission Checklist

  validateMIParameters asserted MatrixInstM/N against MatrixInstruction[0]/[1]
  unconditionally; with SourceSwap they are transposed (F4 32x16 WMMA)
  Add 5 tuned Equality logic yamls (BBS, F8F8S, F4BS MXAE8B32, F8BS MXAE8B32,
  F4BS MXAF8B16)
@therock-pr-bot

therock-pr-bot Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ⚠️ Warning Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/hipblaslt/tensilelite/Tensile/SolutionStructs/Validators/MatrixInstruction.py; no test file found
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

therock-pr-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Description

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@codecov

codecov Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...le/SolutionStructs/Validators/MatrixInstruction.py 57.14% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #11746   +/-   ##
========================================
  Coverage    70.24%   70.24%           
========================================
  Files         2809     2809           
  Lines       462408   462412    +4     
  Branches     68093    68094    +1     
========================================
+ Hits        324780   324788    +8     
+ Misses      114064   114062    -2     
+ Partials     23564    23562    -2     
Flag Coverage Δ *Carryforward flag
TensileLite-CPP 46.29% <ø> (ø)
TensileLite-Unit 75.95% <57.14%> (-<0.01%) ⬇️
hipBLAS 90.62% <ø> (ø) Carriedforward from 7b4a377
hipBLASLt 35.27% <ø> (+0.03%) ⬆️
hipCUB 82.68% <ø> (ø) Carriedforward from 7b4a377
hipDNN 86.96% <ø> (ø) Carriedforward from 7b4a377
hipFFT 42.66% <ø> (ø) Carriedforward from 7b4a377
hipRAND 76.12% <ø> (ø) Carriedforward from 7b4a377
hipSOLVER 68.92% <ø> (ø) Carriedforward from 7b4a377
hipSPARSE 86.99% <ø> (ø) Carriedforward from 7b4a377
rocBLAS 48.31% <ø> (ø) Carriedforward from 7b4a377
rocFFT 47.78% <ø> (ø) Carriedforward from 7b4a377
rocRAND 56.92% <ø> (ø) Carriedforward from 7b4a377
rocSOLVER 76.83% <ø> (ø) Carriedforward from 7b4a377
rocSPARSE 74.61% <ø> (ø) Carriedforward from 7b4a377
rocThrust 91.60% <ø> (ø) Carriedforward from 7b4a377

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
...le/SolutionStructs/Validators/MatrixInstruction.py 91.62% <57.14%> (-1.46%) ⬇️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jichangjichang
jichangjichang enabled auto-merge (squash) September 7, 2026 11:28
@jichangjichang
jichangjichang merged commit 8e1782f into develop Sep 7, 2026
216 of 238 checks passed
@jichangjichang
jichangjichang deleted the users/jichang/logic_update_0907 branch September 7, 2026 21:34
assistant-librarian Bot pushed a commit to ROCm/hipBLASLt that referenced this pull request Sep 7, 2026
Add tuned Equality library logic for five gfx1250 GEMM
 (#11746)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

JIRA ID : AIHPBLAS-835
  ## Motivation
Add tuned Equality library logic for five gfx1250 GEMM types (BBS,
F8F8S, MXF8,
MXF4, NVF4). Building the device library with these yamls surfaced a
latent
  validator bug: a solution using SourceSwap (F4 32x16 WMMA) failed
MatrixInstruction validation and aborted `TensileCreateLibrary` with a
blank
`Validation failed: (index: 0)`. Both changes are needed for the new
logic to
  build.

  ## Technical Details
  **Commit 1 — feat: 5 new Equality logic yamls**
  Under `Logic/asm_full/gfx1250/gfx1250/Equality/`:
`BBS_BH`, `F8F8S_BH`, `F4BS_MXAE8B32_MXBE8B32` (MXF4),
`F8BS_MXAE8B32_MXBE8B32`
  (MXF8), `F4BS_MXAF8B16_MXBF8B16` (NVF4).

  **Commit 2 — fix: honor SourceSwap in MatrixInst M/N validation**
(`SolutionStructs/Validators/MatrixInstruction.py`).
`validateMIParameters`
asserted `MatrixInstM/N == MatrixInstruction[0]/[1]` unconditionally.
With
`SourceSwap` on a non-square instruction the M/N extents are transposed
(e.g. `[32,16,128,1]` with `MatrixInstM=16, MatrixInstN=32`). The
validator is
**dual-use**: solution generation keeps the instruction order
(`M=mi4[0],
N=mi4[1]`) while the serialized logic yaml stores the swapped order — so
pinning
a single orientation fixes one path and breaks the other. The fix
accepts
**either orientation** under SourceSwap (`{MatrixInstM, MatrixInstN} ==
{mi4[0],
mi4[1]}`), keeps the strict order otherwise, and adds `elineno()`
messages so the
  assert is no longer blank.

  ## Test Plan
  - hipblaslt-test

  ## Test Result
  - hipblaslt-test test pass

  ## Submission Checklist
- [ ] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
jichangjichang added a commit that referenced this pull request Sep 8, 2026
#11773)

JIRA ID : AIHPBLAS-835

  ## Motivation
  #11746 caused the issue. 
Building the gfx1250 device library and benchmarking F4 SourceSwap
solutions
failed on the MatrixInstruction validator. `validateMIParameters` is
dual-use:

  - **Solution generation** (`matrixInstructionToMIParameters`) sets
`MatrixInstM = mi[0]`, `MatrixInstN = mi[1]` in the instruction's native
    operand order (SourceSwap not applied).
- **Serialized LibraryLogic yaml** stores the SourceSwap-transposed
order,
    so `MatrixInstM`/`MatrixInstN` come in swapped.

The prior code asserted *only* the transposed orientation when
`SourceSwap`
was set. That broke the un-swapped path for non-square instructions such
as
  the F4 32×16 WMMA

  ## Technical Details
  When `SourceSwap` is set, compare `MatrixInstM`/`MatrixInstN` against
  `mi4[0]`/`mi4[1]` as an **unordered set** instead of asserting a fixed
  transposed mapping.
This accepts both conventions (native benchmark order and swapped logic
order) while still rejecting genuinely mismatched M/N. The
non-SourceSwap
  branch and the K/B asserts are unchanged.

  Test Plan

- Run the previously-failing F4 yamls through the full BenchmarkProblems
→
  LibraryLogic pipeline
  - Confirm zero Error processing permutation and a valid best solution.
  - Confirm non-SourceSwap and square-instruction paths still validate.

  Test Result

  Pass

  Submission Checklist

- [ ] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
@assistant-librarian

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

mengzcai added a commit that referenced this pull request Sep 14, 2026
JIRA ID : AIHPBLAS-835
## Motivation
`validateMIParameters` is dual-use but was fed MatrixInstM/N in two
conventions: the tuning path (`matrixInstructionToMIParameters`)
produced the physical instruction order, while serialized logic
solutions carry the effective (SourceSwap-transposed) order.
Related works:
#11746 , #11773 
<!-- Explain the purpose of this PR and the goals it aims to achieve.
-->

## Technical Details
- `matrixInstructionToMIParameters` gains `sourceSwap` (default False,
so existing callers are unchanged) and stores the *effective* extents
via `effectiveMatrixInstMN` as its final step. Internal derivations and
MIBlock keep the physical mi[0]/mi[1] for the opcode. Its three callers
pass SourceSwap.
- `validateMIParameters` derives the expected M/N from the physical
MatrixInstruction with the same helper and compares in effective space,
replacing both prior variants and again rejecting a genuinely transposed
M/N.
- No consumer change: Solution.py already re-derives M/N from MIBlock,
and physical-sensitive code reads MIBlock.
<!-- Explain the changes along with any relevant GitHub links. -->

## Test Plan
New GPU-less guard (`test_fp4_SourceSwap_nonsquare_guard.py`): runs the
`--cpu-only` benchmark flow on a config whose only candidates are 32x16
WMMA + SourceSwap:[true]. With no square / SS-false fallback a
regression rejects every candidate -> 0 valid solutions -> `printExit`
fails the run, the failure a mixed candidate list would silently mask.
gfx1250 is named explicitly (gfx1250v0 has no fp4 32x16 opcode). Plus a
negative control and existing SourceSwap:false paths as regression.
<!-- Explain any relevant testing done to verify this PR. -->

## Test Result
- `tox -e unit --
Tensile/Tests/unit/test_fp4_SourceSwap_nonsquare_guard.py` -> **1 passed
in ~3.8s**.
- Negative control (producer forced back to physical M/N) ->
`Tensile::FATAL: 0 valid solutions` -> **1 failed**.
- gfx1250 hardware tuning: passed
- gfx1250 build and hipblaslt-test passed

<!-- Briefly summarize test outcomes. -->

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.md#pull-requests.

---------

Co-authored-by: mengzcai <mengzcai@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants