← Back to Pull requests

feat(hip-kernel-provider): ASM SDPA forward mma_core_mode follows correct semantics #16141

Closed
unknown closed this pull request without merging on Nov 19, 2026 05:15 UTC
View on GitHub
unknown unknown commented on Nov 17, 2026 18:52 UTC
Author

Summary

The ASM SDPA forward engine declined every fp8 graph that set mma_core_mode, including the FP8_E4M3 that cuDNN's sdpa_fp8() writes. In cuDNN the mode names the matrix-multiply (MMA) path, not the element type. The engine now accepts FP8_E4M3 and FP8_E5M2 on its FP8_E4M3_FNUZ inputs; bf16 behavior is unchanged.

JIRA ID : ALMIOPEN-2765

Risk Assessment

3/5. One engine's applicability check changes. No kernel, launch or default changes, and no graph that was accepted before now declines. Three facts keep it above 2:

  • Graphs with an FP8 mode on FP8_E4M3_FNUZ inputs now reach the gfx942 fp8 kernel that ALMIOPEN-3125 reports gives wrong output. Graphs with UNSET already reached it. No in-tree producer sets an FP8 mode on FNUZ inputs.

  • No integration test runs the fp8 kernels. Every fp8 SdpaFwd bundle uses OCP fp8 tensors, which this engine declines, so only the unit test covers the new accepts.

  • gfx950 has not run yet (see ASIC Coverage).
  • Reviewer sign-off requested. On bf16 graphs the engine accepts BFLOAT16 as an equivalent of HALF; cuDNN rejects it (include/cudnn_frontend/node/sdpa_support_surface.h, cudnn-frontend v1.24.0). The behavior comes from #14518 and this PR keeps it. The KNOWN_DIVERGENCES.md entry is deferred to the hipDNN-level mma_core_mode validation ticket.

    ASIC Coverage

    Arch-scoped. The ASM engine has kernels for gfx942 and gfx950 only, and fp8 forward kernels for gfx942 only. gfx942 passed locally, and PR CI tests gfx94X. gfx950 needs one run before merge: PR CI builds gfx950 but does not test it, so this PR carries ci:gfx950, which adds gfx950 to both build and test. No RDNA or full sweep is needed, because no bundle changes and the engine has no kernels for other families.

    Testing Summary

  • Unit: two table-driven tests pass every DataType value as mma_core_mode to isApplicable and assert accept or decline, one test per input type.

  • Integration: the ASM SDPA quick and standard lanes run the SdpaFwd and SdpaBackward bundles on ASM_SDPA_ENGINE with support claims enforced. Saved expected results were not pulled, so the GPU reference checked every compared output.

  • Static: clang-tidy and pre-commit on the two changed files.
  • Testing Checklist

  • Unit tests - build/bin/hip_kernel_provider_tests --gtest_filter='TestSdpaFwdPlanBuilder.*' - Devices: gfx942 (MI300A) - Status: Passed (45 passed, 0 skipped)

  • ASM SDPA integration lanes - ctest --test-dir build/dnn-providers/hip-kernel-provider/src -R '^hip-kernel-provider-asm-sdpa-external-integration_(quick|standard)_suite$' -V - Devices: gfx942 (MI300A) - Status: Passed (quick: 76 passed, 144 skipped, 0 failed; standard: 287 passed, 1204 skipped, 0 failed; 0 broken claims)

  • clang-tidy - python3 projects/hipdnn/tools/ai/skills/hipdnn-tidy/scripts/tidy_changed.py --build-dir build --base origin/develop - Status: Passed

  • pre-commit - pre-commit run --files <the two changed files> - Status: Passed

  • gfx950 - TheRock multi-arch CI via ci:gfx950 - ASICs: gfx950 - Status: Pending

  • PR CI - GitHub PR checks - Status: Pending
  • Technical Changes

  • SdpaFwdPlanBuilder::isApplicable checks mma_core_mode against an allow-list keyed by input type. Any mode not listed declines, including enum values added later.
  • | Inputs | Accepted modes |
    |---|---|
    | bf16 | UNSET, HALF, BFLOAT16 (unchanged) |
    | FP8_E4M3_FNUZ | UNSET, FP8_E4M3 (new), FP8_E5M2 (new) |

  • The mode does not set the fp8 encoding. cudnn-frontend v1.24.0 sends FP8_E4M3 and FP8_E5M2 down one FP8 path and casts the softmax output to Q's type. The gfx942 kernels compute in E4M3 FNUZ only, which the existing input-type check enforces.

  • A decline logs the mode and input type: mma_core_mode must be UNSET, or HALF or BFLOAT16 for bf16 inputs, or FP8_E4M3 or FP8_E5M2 for FP8_E4M3_FNUZ inputs (Actual value: …, inputs: …).

  • IsApplicableBf16MmaCoreModePolicy (gfx942, gfx950) and IsApplicableFp8MmaCoreModePolicy (gfx942) replace the mode rows of IsApplicableSdpaVariations and the test IsApplicableRejectsFp8WithHalfMmaCoreMode.

  • Test bundles, generators and projects/hipdnn are unchanged. The bundles keep "unset", which every SDPA forward engine accepts.
  • Not in this PR:

  • The kernel-ingestor SDPA packs still describe the mode as "the MMA operand precision".

  • generate_sdpa_runtime_scale_test_bundle.py has no test.

  • rocKE bind_shared.py value_rejects declines HALF on bf16 requests.

  • The Types.hpp comment on FP8_E4M3 says it has no hipDNN backend mapping, but toHipdnnDataType maps it.

  • hipDNN-level validation of mma_core_mode in the frontend validate() or the backend finalize().
  • Diff: 592 lines (+444 / -148) across 7 files Reviewer: BrianHarrisonAMD Review duration: 2063m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 592 lines diff across 7 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.382
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #16141"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 50.0% (MEDIUM) · Higher = larger blast radius
    50.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.8% · Safe to merge
    19.8%