Skip to content

feat(rocke): add gfx1250 FP8 scaled WMMA slice - #11696

Merged
tenpercent merged 6 commits into
developfrom
users/mpodkory/rocke/aick-2056
Sep 15, 2026
Merged

tenpercent merged 6 commits into
developfrom
users/mpodkory/rocke/aick-2056

Conversation

@tenpercent

@tenpercent tenpercent commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

rocKE already provided gfx1250 K=64 FP8/BF8 WMMA and a block-scaled GEMM that applied FP16 or FP32 scales in software after the matrix instruction. This change adds the first native FP8 x FP8 SCALE and SCALE16 vertical slice, including the catalog contract, dual-engine lowering, packed E8M0 scale operands, an opt-in complete kernel path, and numerical regression coverage on gfx1250.

ISSUE ID : AICK-2281

Umbrella: AICK-2056.

Technical Details

  • Add gfx1250 K=128 FP8 x FP8 wmma_scale and wmma_scale16 catalog entries with the required fragment lengths.
  • Add Python and C IR builders for the five-input scaled MMA operations.
  • Add byte-identical Python and C++ LLVM 23 lowering for the SCALE and SCALE16 intrinsic ABIs.
  • Add matching Python and C++ HIP builtin lowering.
  • Reject scaled WMMA under LLVM 20 and LLVM 22.
  • Extend the gfx1250 block-scaled GEMM with opt-in SCALE and SCALE16 paths that consume packed E8M0 scales and pass them directly to the matrix instruction.
  • Preserve the existing K=64 unscaled path as the default.
  • Correct HIP zero extension to cast through the unsigned source type, preserving E8M0 values with the high bit set.
  • Add focused Python tests, C++ lowering tests, fragment-table checks, and Python/C parity configurations.
  • Extend the numerical verifier with native SCALE/SCALE16 cases and an independent float64 scaled-matmul reference rounded to BF16. Bounded inputs allow exact native-result comparisons; unwritten outputs and nonfinite values fail validation.
  • Add seven GPU test configurations covering neutral, independently varying A/B, mixed, and isolated scale groups; multi-tile K=256 cases through COMGR and HIP; and a legacy WMMA smoke case. ROCKE_REQUIRE_GFX1250=1 makes a missing target fail instead of skip. Torch is not required.

This is intentionally the FP8 x FP8 prerequisite slice. Broader FP4, FP6, BF6, conversion, and native type-combination coverage remains outside this PR.

Test Plan

  • Focused scaled-WMMA regression: 7 passed, 12 subtests passed.
  • Broader relevant suite: 47 passed, 1 deselected, 24 subtests passed.
  • C++ tests: 5/5 passed.
  • Python/C++ byte identity for all 16 gfx1250 lowering configurations under LLVM 20, 22, and 23.
  • SCALE and SCALE16 HIP source compiled for gfx1250.
  • HIP and direct COMGR objects contain the expected SCALE and SCALE16 instructions.
  • Pre-commit range checks, including the numerical-test commit.
  • Independent numerical-reference tests: 16 passed.
  • Numeric execution and scale-lane validation on gfx1250 hardware: 7 configurations passed, 25 comparisons with bad=0, zero skips.

Test Result

CPU, dual-engine, compiler, COMGR, and ISA-selection checks passed. GPU numerical validation passed on gfx1250 at commit 8a13045058e7e7464377bb5bffcfbaa9523813ad using the ROCm 10.0.0 release tests distribution, HIP 7.15.26333, and AMD clang/LLVM 23. Tools and HIP/COMGR libraries were explicitly pinned to that distribution.

The 25 comparisons cover SCALE and SCALE16 with every packed scale group, finite high-bit E8M0 values, independent A/B scaling, multi-tile K=256 accumulation, both COMGR and HIP compilation routes, and the legacy WMMA smoke case. GPU execution used ROCKE_BACKEND=python; C++ coverage remains the lowering tests and Python/C++ byte-identity checks above. This run does not establish C++ GPU numerical coverage or downstream provider integration.

To reproduce, activate a Python environment with NumPy, ml_dtypes, and pytest, set ROCM_PATH to the selected LLVM-23-capable installation, and run from dnn-providers/hip-kernel-provider/rocke/platform:

export ROCM_HOME="$ROCM_PATH" HIP_PATH="$ROCM_PATH"
export HIP_CLANG_PATH="$ROCM_PATH/llvm/bin"
export PATH="$ROCM_PATH/bin:$ROCM_PATH/llvm/bin:$PATH"
export LD_LIBRARY_PATH="$ROCM_PATH/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export ROCKE_HIP_LIB="$ROCM_PATH/lib/libamdhip64.so"
export ROCKE_COMGR_LIB="$ROCM_PATH/lib/libamd_comgr.so"
PYTHONPATH=python HIP_VISIBLE_DEVICES=0 ROCKE_BACKEND=python \
  ROCKE_LLVM_FLAVOR=llvm23 ROCKE_REQUIRE_GFX1250=1 \
  python -m pytest -q -s tests/instances/test_gfx1250_scaled_wmma_numeric.py

Submission Checklist

@therock-pr-bot

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

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass —
🚫 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 4, 2026

Copy link
Copy Markdown

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

@tenpercent

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

…ke/aick-2056

# Conflicts:
#	dnn-providers/hip-kernel-provider/rocke/platform/tests/core/future_intrinsic_lowering.cpp
#	dnn-providers/hip-kernel-provider/rocke/platform/tests/instances/parity/gfx1250_lowering_emit.py

Co-authored-by: tenpercent <4273004+tenpercent@users.noreply.github.com>

Copilot AI commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts and merged develop into this branch in 19c1c6f.

@tenpercent
tenpercent enabled auto-merge (squash) September 14, 2026 22:04
@tenpercent
tenpercent merged commit 45b754a into develop Sep 15, 2026
110 checks passed
@tenpercent
tenpercent deleted the users/mpodkory/rocke/aick-2056 branch September 15, 2026 01:01
@assistant-librarian

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

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