Skip to content

perf(navi32): enable Origami catalogs for TN HHS/BBS types - #11305

Merged
vuksan314 merged 8 commits into
developfrom
vmijovic/navi32_tn_origami
Aug 31, 2026
Merged

vuksan314 merged 8 commits into
developfrom
vmijovic/navi32_tn_origami

Conversation

@vuksan314

@vuksan314 vuksan314 commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

JIRA ID : ROCM-1682

Enable Origami on Navi32 and add TN HHS(BBS)

performance vs current gridbased
| catalog | predictor | tiny | small | medium | large | ALL |
| old | GridBased | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 |
| new | Origami | 0.979 | 1.160 | 1.305 | 1.456 | 1.212 |

| catalog | predictor | gemv | skinny_M | skinny_N | rect | square | ALL |
| old | GridBased | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 |
| new | Origami | 1.338 | 1.176 | 1.184 | 1.182 | 1.189 | 1.212 |

…ne catalog

Three changes, all on the TN (Alik_Bljk) family for gfx1101:

1. LibraryType GridBased -> Prediction on all four TN catalogs. Origami is
   compiled into every hipBLASLt build but never selects while a GridBased
   table is present: Properties.py:68 ranks GridBasedMatching(3) above
   PredictionMatching(2). Enablement is this field, not a flag.

2. One lean 100-solution HHS catalog now backs BBS, AuxH and AuxB. The four
   TN ProblemTypes are separated by exactly two orthogonal edits to element
   [4] and nothing else -- the ISA, the grid and all 100 solution dicts are
   identical. The two edits are:
     plain -> Aux    UseE false -> true                  (1 field)
     HHS   -> BBS    7 dtype fields 4 -> 7, and
                     BiasDataTypeList [0,4] -> [0,7]     (8 fields)
   Rewriting only DataType/DataTypeA/DataTypeB and leaving DestDataType,
   MacDataTypeA/B and DataTypeE at 4 yields an HSS-like hybrid that still
   loads and builds, so all eight must move together.

3. gfx1101 registered in origami's arch switches (hardware.cpp) and given
   calibrated memory constants (hardware.hpp). The registration is not
   cosmetic: without a gfx1101 case, cus_per_multiProcessorCount falls to
   default and returns 1, so Origami reads multiProcessorCount (27 WGPs) as
   27 physical CUs instead of 54 and every occupancy and oversubscription
   term is computed against half the machine. has_MALL() has no default
   case at all, so an unlisted arch runs off the end of a non-void function.

   The constants themselves are measured on this part rather
   measured on this part rather than inherited from gfx1100. Navi 32 halves
   the bus (384-bit -> 192-bit)
   at essentially the same memory clock, and the model scales bandwidth by
   clock only, so the inherited values were ~2.4x optimistic on DRAM and
   ~2.7x on MALL.

Build gate, all four types: 100 solutions requested, 100 serialized, 0
assembler errors, 0 overflowedResources. Tensile regenerates the runtime key
from the edited ProblemType and emits BB_BB_...Type_BB and the _Aux_ segment,
which independently confirms the edits landed.

Correctness: hipblaslt-bench -v over 60 stratified shapes per ProblemType,
norm_error against per-row rtol. HHS, BBS and AuxB pass 60/60. AuxH passes
59/60; the one miss (10x46x1155, norm 5.71e-05 vs rtol 1e-06) reproduces
identically on the pre-existing per-ProblemType catalog, so it is a
tolerance artifact rather than a regression introduced here.

Measured on Radeon RX 7700 XT, 500 shapes x 3 reps, geomean of per-shape
us ratios against the catalog shipped on develop, A/A noise floor 2.6-2.7%:

              catalog only   + Origami
  TN HHS          1.160        1.212
  TN BBS          1.170        1.213

Aux timings not yet collected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@therock-pr-bot

therock-pr-bot Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

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: shared/origami/include/origami/hardware.hpp, shared/origami/python/src/origami/bindings.cpp, shared/origami/python/tests/helpers.py, shared/origami/src/origami/hardware.cpp; no test file found
🔎 pre-commit ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —
🤖 therock-pr-bot ✅ Pass —

🎉 All checks passed! This PR is ready for review.

📖 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 Aug 26, 2026 •

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

@codecov

codecov Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #11305      +/-   ##
===========================================
+ Coverage    69.39%   69.63%   +0.24%     
===========================================
  Files         2841     2802      -39     
  Lines       467531   461755    -5776     
  Branches     68912    68072     -840     
===========================================
- Hits        324434   321520    -2914     
+ Misses      119499   116938    -2561     
+ Partials     23598    23297     -301     
Flag Coverage Δ *Carryforward flag
TensileLite-CPP 38.33% <ø> (ø)
TensileLite-Unit 76.13% <ø> (ø)
hipBLAS 90.62% <ø> (ø) Carriedforward from fb65e7e
hipBLASLt 35.22% <ø> (ø)
hipCUB 82.68% <ø> (ø) Carriedforward from fb65e7e
hipDNN 86.94% <ø> (+0.07%) ⬆️ Carriedforward from fb65e7e
hipFFT 43.43% <ø> (-0.35%) ⬇️ Carriedforward from fb65e7e
hipRAND 76.12% <ø> (ø) Carriedforward from fb65e7e
hipSOLVER 69.03% <ø> (+0.11%) ⬆️ Carriedforward from fb65e7e
hipSPARSE 86.99% <ø> (ø) Carriedforward from fb65e7e
rocBLAS 48.25% <ø> (-0.03%) ⬇️ Carriedforward from fb65e7e
rocFFT 51.21% <ø> (+4.61%) ⬆️ Carriedforward from fb65e7e
rocRAND 57.04% <ø> (+0.13%) ⬆️ Carriedforward from fb65e7e
rocSOLVER 77.32% <ø> (+0.49%) ⬆️ Carriedforward from fb65e7e
rocSPARSE 74.59% <ø> (-0.01%) ⬇️ Carriedforward from fb65e7e
rocThrust 91.60% <ø> (+0.28%) ⬆️ Carriedforward from fb65e7e

*This pull request uses carry forward flags. Click here to find out more.
see 493 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.

@bethune-bryant

Copy link
Copy Markdown
Contributor

On the four TN catalogs (e.g. .../Logic/asm_full/navi32/GridBased/navi32_Cijk_Alik_Bljk_HHS_BH_Bias_HAS_SAV_UserArgs.yaml): these now declare LibraryType: Prediction but still live under the GridBased/ directory. It works since the loader keys on the field rather than the path, but the location is misleading.

(Posting as a general comment because the YAML diff is too large for an inline comment.)

vmijovic added 2 commits August 28, 2026 13:37
The C++ architecture_t gained gfx1101 but bindings.cpp was not updated, so
the Python package could not name the arch and Navi 32 calibration/tests on
the Python side had no way to construct a gfx1101 hardware_t.
…ami/

The four TN catalogs declare LibraryType: Prediction but lived under
navi32/GridBased/. The loader keys on the field rather than the path so it
worked, but the location was misleading. Origami/ is the existing convention
for Prediction logic (gfx950/gfx950/Origami/, gfx1250/gfx1250/Origami/).

Pure renames; file contents and names are unchanged.
Register gfx1101 in the HARDWARE fixture so test_ranking_regression.py
covers it alongside the other supported architectures, and add the
generated ranking baseline.

gfx1101 exposes WMMA for Half/BFloat16/Int8/Int4 only, so 8 of the 20
dtype/transpose combinations run and the remaining 12 skip. Fixture
values are those of the RX 7700 XT the gfx1101 constants were
microbenchmarked on: 54 CU, 4 MB L2, 2276 MHz.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vuksan314

Copy link
Copy Markdown
Contributor Author

On the four TN catalogs (e.g. .../Logic/asm_full/navi32/GridBased/navi32_Cijk_Alik_Bljk_HHS_BH_Bias_HAS_SAV_UserArgs.yaml): these now declare LibraryType: Prediction but still live under the GridBased/ directory. It works since the loader keys on the field rather than the path, but the location is misleading.

(Posting as a general comment because the YAML diff is too large for an inline comment.)

created origami folder and moved logic files there

@bethune-bryant bethune-bryant left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me!

Thank you @vuksan314 !

@vuksan314
vuksan314 enabled auto-merge (squash) August 28, 2026 17:33
@bethune-bryant

Copy link
Copy Markdown
Contributor

Updated the branch to pick up develop (including #11442), which fixes the unrelated test_logic_yaml_sibling_device_names_consistent failure. Re-running Math CI.

@vuksan314
vuksan314 merged commit 2affbf4 into develop Aug 31, 2026
110 of 116 checks passed
@vuksan314
vuksan314 deleted the vmijovic/navi32_tn_origami branch August 31, 2026 21:06
@assistant-librarian

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

vuksan314 added a commit that referenced this pull request Oct 12, 2026
…13387)

JIRA ID: AIRADSW-483

## Motivation

On gfx1100 (Radeon RX 7900 XTX, "navi31"), hipBLASLt chooses the GEMM
kernel for fp16 and bf16 NN matrix multiplies from GridBased libraries.
A GridBased library is a lookup table that maps tuned problem sizes to
kernels; sizes it was not tuned for fall back to the nearest entry. The
NN tables are thin (471 rows each, against about 9 700 for TN), so most
NN sizes take a fallback kernel.

This PR replaces the four NN tables with Origami Prediction libraries,
the approach navi32 adopted in #11305. A Prediction library holds a
short list of kernels, and the Origami analytical model ranks them for
each problem at run time.

On fresh problem sizes held out of tuning, the new libraries are faster
in geomean (the mean of per-shape speedups) for every type:
- fp16 NN: 34% faster off the stock table, 17% faster on the stock
table's own rows.
- bf16 NN: 41% faster.
- Aux (UseE) NN: 13–17% faster.
- On a blind 194-shape benchmark set that was never used for tuning,
fp16 NN wins 19 of 20 categories: geomean 1.334, +1.54M GFLOPS net.

The exceptions are listed under Known limits. The TN libraries are not
touched by this PR.

## Technical Details

Directory:
`projects/hipblaslt/library/src/amd_detail/rocblaslt/src/Tensile/Logic/asm_full/navi31/`.
Each new file in `Origami/` replaces the `GridBased/` file of the same
name. Both files describe the same problem type, so they cannot be in
one library together. There are no code changes; the last commit adds
one CHANGELOG line.

| file (`navi31_Cijk_…_UserArgs.yaml`) | types | before | after |
|---|---|---|---|
| `Ailk_Bljk_HHS_BH_Bias_HAS_SAV` | fp16 in/out, fp32 compute | 70
kernels + 471-row table | 42 kernels |
| `Ailk_Bljk_BBS_BH_Bias_HAS_SAV` | bf16 | 73 kernels + 471-row table |
42 (port of HHS-NN) |
| `Ailk_Bljk_HHS_BH_Bias_AuxH_HAS_SAV` | fp16, also writes E | 70
kernels + 471-row table | 39 (port, StreamK→0) |
| `Ailk_Bljk_BBS_BH_Bias_AuxB_HAS_SAV` | bf16, also writes E | 73
kernels + 471-row table | 39 (port, StreamK→0) |

**Ports.**
- The bf16 and Aux files are the fp16 catalog with the whole problem
type copied from the stock file of the target type.
- Aux means UseE: the GEMM also writes the pre-activation output E. With
UseE, StreamK=3 kernels fail code generation on this tree, so those
members were converted to StreamK=0. One converted member duplicated an
existing one and was removed (40 → 39).
- The Aux files are based on the 40-kernel HHS-NN catalog with the
member-13 rollback. They do not include the narrow-N update, whose new
StreamK=3 kernel cannot be used with UseE.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.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.

2 participants