Skip to content

[HIP] [OPUS] Add OPUS GEMM BlockScale_Mxfp8 GEMM for M <=1024 Shape. - #7387

Open
Fyzyukk wants to merge 28 commits into
ROCm:mainfrom
Fyzyukk:fyz/opusgemm_small_shape
Open

Fyzyukk wants to merge 28 commits into
ROCm:mainfrom
Fyzyukk:fyz/opusgemm_small_shape

Conversation

@Fyzyukk

@Fyzyukk Fyzyukk commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add an OPUS backend for blockscale mxfp8 GEMM with B preshuffle on gfx950, and improve performance for small shapes (M <= 1024). Enable the existing gemm_a8w8_blockscale_bpreshuffle interface to select tuned OPUS kernels.

Details

  • direct_b: Directly load b into vgpr and extend it to handle workloads with small M.
  • stage_b: Extend M-repeat computation to handle workloads with small M.
  • Support FP8 inputs, native E8M0 scales (1x128 for A and 128x128 for B), and BF16 output through the existing blockscale GEMM interface, reusing the scale bytes through their logical tensor views.

Speedup Distribution

634 gfx950/CU256 small-M shapes (M <= 1024); the tuned table selects OPUS for 425 shapes.

Speedup range Shapes
0–5% 108
5–10% 135
10–15% 100
15–20% 55
≥20% 27

codex and others added 8 commits October 31, 2026 12:39
Filter small-shape policy combinations while preserving existing registered
IDs, and append 180 BN256 and 36 compiler-allocated accumulator variants.
The opt-in accumulator path removes the per-panel VGPR constraint without
enabling manual A/C AGPR pinning.

Update 435 DSV4 gfx950 small-shape rows only when OPUS strictly beats the
original FlyDSL CSV. Preserve the other 199 small-shape rows, 421 large-shape
rows, and 196 gfx1250 rows byte for byte.

Validation: completed and verified all 634 shapes; all 3,332 wide/native
candidate and control pairs passed correctness; six shapes improved and
three newly beat the baseline. Ordinary code generation covers all 298
published small-shape kernel IDs with no missing BF16 dispatch entries.
CSV identity, Split-K, performance metadata and preservation checks passed;
git diff --check passed.
Fold b_direct and LDS-panel variants into the existing B-VGPR and m_repeat
pipelines. Route small-shape Split-K workspace through the existing
bpreshuffle entry and reuse the current bindings and reducer flow.

Share the three candidate-selection functions across small and large M,
simplify registration and declaration generation, and preserve the recorded
435 small-M and 338 large-M winners. Large-M candidate sets and ordering stay
unchanged.

Normalize tuned CSV metrics to four decimals while retaining the existing
FlyDSL mp_tuner result and CSV save flow.

Validation: recorded-winner, registry, and generated-declaration comparisons;
35 candidate tests, 11 interface tests, and 13 CSV infrastructure tests.
Merge small-shape operand and staged schedules into the existing b_vgpr and
m_repeat families, update generated launchers and existing CO references,
and retain candidate coverage and four-decimal tuned CSV values.

Reuse existing shape/resource rules before automatic workspace allocation
and leave tensor/layout validation in the checked C++ launchers. Keep the
original six-argument calls for non-workspace kernels and append workspace
only when needed.

Restore baseline test and README contents in the published tree.

Validation: 435 small-M and 338 large-M winners retained, all 773 candidate
lists identical, 35 candidate tests passed, and 15 kernels have identical
machine code. Workspace simplification passed 25 full GPU output checks,
26 invalid-argument checks, and 4 allocation-bound checks. Four baseline
bpreshuffle interface checks verify compatibility without test changes.
@Fyzyukk
Fyzyukk requested a review from a team November 3, 2026 09:24
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the gfx1201 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 7387 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

@github-actions github-actions Bot changed the title Add OPUS GEMM BlockScale_Mxfp8 GEMM for M <=1024 Shape. [HIP] [OPUS] [JIT] Add OPUS GEMM BlockScale_Mxfp8 GEMM for M <=1024 Shape. Nov 3, 2026
@aiter-bot

aiter-bot commented Nov 3, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision d4bed4246d99 · mode shadow

Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision.

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. Which architecture, dtype and shape boundaries select the changed kernel path, and what invariant prevents unsupported inputs from reaching it?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — missing ### Reviewed revision in the PR description
  • FAIL — missing ### Behavior and intent in the PR description
  • FAIL — missing ### Validation and unverified scope in the PR description
  • FAIL — missing ### PR-specific question in the PR description
  • FAIL — missing ### Changed op tests in the PR description
  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — Behavior and intent has no substantive answer
  • FAIL — Validation and unverified scope has no substantive answer
  • FAIL — PR-specific question has no substantive answer
  • FAIL — changed op test not explained in Changed op tests: op_tests/test_opus_a8w8_interface.py
  • FAIL — changed op test not explained in Changed op tests: op_tests/test_opus_co_integration.py
  • FAIL — Changed op tests must explain why each changed op test is necessary and non-redundant

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@github-actions github-actions Bot changed the title [HIP] [OPUS] [JIT] Add OPUS GEMM BlockScale_Mxfp8 GEMM for M <=1024 Shape. [HIP] [OPUS] Add OPUS GEMM BlockScale_Mxfp8 GEMM for M <=1024 Shape. Nov 3, 2026
@github-actions github-actions Bot removed the JIT label Nov 3, 2026
@zufayu
zufayu requested a review from demonsan November 4, 2026 01:31
Use the current runtime-K implementation with independent direct_b and staged_b pipelines, a shared small-candidate budget, and ordinary Split-K reduction. Refresh the model table with 425 small-shape Opus winners against the saved FlyDSL baseline and include MXFP8 selections in JIT builds.
@github-actions github-actions Bot changed the title [HIP] [OPUS] Add OPUS GEMM BlockScale_Mxfp8 GEMM for M <=1024 Shape. [HIP] [OPUS] [JIT] Add OPUS GEMM BlockScale_Mxfp8 GEMM for M <=1024 Shape. Nov 9, 2026
@github-actions github-actions Bot added the JIT label Nov 9, 2026
Keep the current unified Opus/FlyDSL tuning implementation, which already includes the upstream BMM seed and 1x32 tuning changes. Preserve the combined PR6696 large-shape and current small-shape CSV.
@github-actions github-actions Bot changed the title [HIP] [OPUS] [JIT] Add OPUS GEMM BlockScale_Mxfp8 GEMM for M <=1024 Shape. [HIP] [OPUS] Add OPUS GEMM BlockScale_Mxfp8 GEMM for M <=1024 Shape. Nov 9, 2026
@github-actions github-actions Bot removed the JIT label Nov 9, 2026
Drop the temporary explicit-candidate replay path and its special batching, retaining the unified PR6696 tuner flow and the small-pipeline candidate budget. Restore the shared argument struct to the existing AGPR traits header, and fix the Black and Ruff findings.
Pass actual M to staged_b host mode and LDS calculations. Reject Split-K workspaces beyond the existing reducer descriptor range in both shape selection and the generated launcher. Add gfx950 regression coverage for capacity boundaries, tuned dispatch, and workspace overflow.
Restore mandatory compilation of the gfx950 bpreshuffle family so fresh JIT code generation includes the kernels selected by the default MXFP8 tuned table.

Pass the resolved kernel instance into A8W8 contract validation and derive its workspace capability there instead of forwarding a separate boolean. Preserve caller-workspace presence checks and launch behavior.

Add production clean-codegen coverage and CPU tests for direct_b and staged_b workspace allocation, reuse, and rejection by non-workspace kids.
Remove unselected geometry and schedule groups from generation parameters while preserving surviving kernel IDs. Restore the two affected tuned rows to the original FlyDSL nb5 baseline and remove the two OPUS Python tests requested for this PR.
Pass the merged MXFP8 bpreshuffle tuning table to OPUS code generation.
Select the gfx950 bpreshuffle family from tuned rows, namespace defaults,
successful sidecars, and explicit requests instead of compiling the full
tuning sweep during every cold build.

Reduce a gfx950-only cold build from 9,494 to 952 steps while retaining
all 234 kernels selected by the current default table.

Validation:
- ROCm 7.2.4 Noble Clang 22 OPUS cold build for gfx942;gfx950: passed.
- All five host TUs with Python 3.12/GCC 13 headers: passed.
- Default-table dispatch coverage, CU defaults, explicit requests and
  sidecar preservation: passed.
Extract failed Ninja targets, compiler errors and build termination messages
in the always-run prebuild summary. Emit bounded, deduplicated GitHub error
annotations so the actual failure is visible outside the complete warning
dump. Leave successful-build summaries unchanged.

Upload the full prebuild log on failed source builds, using a separate
artifact name for each Python version and run attempt.

Validation: warning-only and failed compiler logs, duplicate/ANSI handling,
annotation escaping, success and failure CLI behavior, a real successful
OPUS build log, and workflow YAML parsing all passed.
@github-actions github-actions Bot changed the title [HIP] [OPUS] Add OPUS GEMM BlockScale_Mxfp8 GEMM for M <=1024 Shape. [HIP] [OPUS] [CI] Add OPUS GEMM BlockScale_Mxfp8 GEMM for M <=1024 Shape. Nov 14, 2026
Use opus::make_tuple explicitly in the gfx950 staged-B SFB layouts to avoid ADL ambiguity with std::make_tuple when building with Ubuntu 24.04 standard library headers.
Allow actions/upload-artifact to upload the explicitly selected .aiter-prebuild.log file after a failed wheel build.
Revert d225d88 to compile the full gfx950 bpreshuffle registry during default prebuilds. Keep the staged-B tuple lookup fix and wheel failure diagnostics.

Cold generation matches the original complete key set: 8,784 gfx950 bpreshuffle candidates per CU namespace and 9,519 dual-architecture build steps.
@github-actions github-actions Bot removed the JIT label Nov 14, 2026
Revert 39d0918 and 75c5ff8 so the CI summary and wheel workflow match their original versions. Retain the staged-B tuple fix and default full MXFP8 compilation.
@github-actions github-actions Bot changed the title [HIP] [OPUS] [CI] Add OPUS GEMM BlockScale_Mxfp8 GEMM for M <=1024 Shape. [HIP] [OPUS] Add OPUS GEMM BlockScale_Mxfp8 GEMM for M <=1024 Shape. Nov 14, 2026
@github-actions github-actions Bot removed the CI label Nov 14, 2026

This branch has not been deployed

No deployments
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.

4 participants