← Back to Pull requests

FlyDSL persistent work-stealing grouped GEMM enablement (gfx950) #746

Open
unknown opened this pull request with 511 lines diff across 6 files
View on GitHub
unknown unknown commented on Sep 29, 2026 21:45 UTC
Author

Description

Fixes https://github.com/AMD-ROCm-Internal/frameworks-internal/issues/338

Adds grouped GEMM support to the FlyDSL backend on gfx950. Every expert runs in
a single persistent kernel launch: workgroups pull output tiles from a per-tile work queue using either a static grid stride or atomic work-stealing.

Supported precisions: BF16/FP16, tensor-wise FP8 (current and delayed scaling), and MXFP8. Supported formats: TN/NN/NT.

Usage

Opt in with NVTE_USE_GROUPED_GEMM_FLYDSL=1 (gfx950, flydsl installed). FlyDSL is then
selected in GroupedLinear the same way as the Triton grouped backend:
general_grouped_gemm_flydsl is a drop-in for general_grouped_gemm.

Anything the kernels can't serve falls back to the default grouped GEMM. That includes
bias, GELU, wgrad accumulation, fused/delayed wgrad, blockwise FP8, and features
not divisible by 128. Set NVTE_FLYDSL_GEMM_WARN_FALLBACK=1 to enable fallback warning messages.

Optional tuning:

  • NVTE_FLYDSL_GROUPED_SCHED=auto|static|worksteal: override the schedule choice.

  • NVTE_FLYDSL_WGRAD_MAX_BUCKETS: cap the number of wgrad launches.
  • Design notes

  • No host-side concatenation: activations, weights, and scales are read per expert in

  • place through per-expert base pointers.
  • wgrad is K-bucketed: experts are grouped by their padded token count, so one large

  • expert doesn't force every expert to pad to its size. When the weight gradients are one
    contiguous buffer, the kernel writes into it directly with no copy-out.
  • Shared implementation: one forward/dgrad runner and one wgrad runner cover all

  • dtypes. A small per-dtype record (_GroupedKernel) holds the parts that differ: how
    operands and scales are read, and how the kernel is launched.

    Other changes

  • Faster kernel launch: a cached flyc.compile path (compiled_launch) skips

  • FlyDSL's per-call setup, which matters at small M.
  • fx.Index → fx.Int64: fx.Index is deprecated per FlyDSL's kernel authoring

  • guide; fx.Int64 is the recommended type for index and offset values.
  • Shared helpers: placeholder_arg, get_num_cus, and compiled_launch now live in

  • gemm_common_utils.py instead of being copied into each kernel module.

    Testing

  • test_grouped_linear_accuracy_rocm_backends gains a flydsl backend: 868 cases,

  • 420 passed / 0 failed. The 448 skips are configs FlyDSL doesn't support (blockwise FP8, FP32, unquantized fused wgrad). A recorder checks that each expected
    phase actually ran on FlyDSL rather than silently falling back.
  • New test_grouped_linear_flydsl_fp8_scaling: a multi-step accuracy test for

  • current and delayed scaling. Delayed scaling uses unit scales on its first step, so
    the single-step test can't catch per-expert scale bugs; this test checks that the
    compared step uses real, per-expert scales.

    🤖 Generated with Claude Code

    Performance

    See: https://github.com/AMD-ROCm-Internal/frameworks-internal/issues/338#issuecomment-6327888906

    Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

  • Infra/Build change

  • Code refactoring
  • Changes

    Please list the changes introduced in this PR:

  • Change A

  • Change B
  • Checklist:

  • I have read and followed the contributing guidelines

  • The functionality is complete

  • I have commented my code, particularly in hard-to-understand areas

  • I have made corresponding changes to the documentation

  • My changes generate no new warnings

  • I have added tests that prove my fix is effective or that my feature works

  • New and existing unit tests pass locally with my changes
  • Diff: 511 lines (+383 / -128) across 6 files Reviewer: matthiasdiener Review duration: 68970m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.55) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.55 · 511 lines diff across 6 files
    0.55
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    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.373
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #746"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% 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: 54.6% (MEDIUM) · Higher = larger blast radius
    54.6%
    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: 44.7% · Lower = rushed or shallow review
    44.7%
    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: 30.2% · Safe to merge
    30.2%