← Back to Pull requests

feat(hipblaslt): add PartitionedGemm to run one GEMM across DPX partitions #15976

Closed
unknown closed this pull request without merging on Nov 20, 2026 03:25 UTC
View on GitHub
unknown unknown commented on Nov 16, 2026 08:02 UTC
Author

JIRA ID : AIHPBLAS-5609

Stacked on #16104 (TensileLite: the shared SliceAlignment rule and --split-align, on top of the merged #15975 --split-devices client and OutputPeerD); the base is its branch, and the diff here is only the hipBLASLt part. It replaces #15917 and #15918, which are closed.

Motivation


On a GPU in DPX/NPS2 mode each partition is a separate HIP device, so one GEMM uses only half the card. This adds a way to run one GEMM as slices on the partitions, one stream each, so a single problem uses the whole card. It also works in SPX mode, where every partition is on the same device; SPX gives the same result but is only meant for checking results without a DPX GPU, not for speed.

Technical Details


  • hipblaslt_ext::experimental::PartitionedGemm and SplitDim (beta, hipblaslt-ext.hpp; the experimental namespace marks the beta status in user code and in the exported symbols): one handle, stream and workspace per partition. SplitDim::M, N or Batch; the first partitions take size / N and the last takes the rest. size / N is rounded up so that every slice of every matrix the split cuts starts on a 256-byte boundary, when that changes the balance by at most 1%; otherwise it stays size / N and a hint (HIPBLASLT_LOG_MASK=4) says what to pad. The rule is the shared TensileLite::SliceAlignment from #16104, which the --split-devices client uses too. Plain GEMM only; the user-args overloads are reserved and return NOT_SUPPORTED. gfx1250 only: setProblem returns NOT_SUPPORTED when a partition's device is another architecture.

  • Alignment mode: the library always uses auto (round within 1%, otherwise size / N with a hint); there is no off or force and no switch to pick one, so a caller gets aligned slices by padding as the hint says. To compare aligned and misaligned slices of the same shape, use the TensileLite client's --split-align off|force (#16104).

  • setProblem takes std::vector<GemmInputs>, one per partition (as GroupedGemm does), with A, B, C, D, alpha and beta set; bias, scales, aux and amax must stay null. The same pointer in every element shares a matrix, different pointers are copies. The library never allocates, copies or places memory.

  • setProblem gives each partition the slice whose pages are on its device (works for hipMalloc and VMM; this samples where the memory is, so it runs only when the partitions are on distinct devices, and in SPX partition i takes slice i without sampling; call setProblem when a pointer or the shape changes, not on every launch), matches copies to partitions by device (inconsistent lists return INVALID_VALUE with an error log), and logs a hint (HIPBLASLT_LOG_MASK=4) when a slice stays remote. Stream i must be on handle i's device; streams may share a device (SPX).

  • run() launches each partition's slice on its stream and returns, as Gemm::run does for one stream. It does not join the partitions: work that needs the whole result must be ordered after every partition by the caller, with an event on each partition's stream that the other streams wait for, or a host synchronize. The sample and hipblaslt-bench do that themselves. The same holds under stream capture, where only each partition's kernels are recorded. A partition whose D slice is memory of another device (a shared D), or that also stores the peer D, publishes its writes with a hipStreamWriteValue64 on its stream after its slice; setProblem decides this from the device that owns the first and last element of the slice, so a D slice that crosses another device in between (possible with a VMM mapping) is the caller's to publish. A partition that writes only its own device's memory gets nothing extra. Shared A, B and C are the caller's: whoever wrote them last makes them visible to every partition's device.

  • The storePeerD argument of setProblem makes every partition also write its slice into the other partition's D (2 partitions, replicated non-overlapping D), using the TensileLite OutputPeerD kernels from #15975. The tuning cache gets an optional peerD column. A solution without a peer-D store is dropped from the heuristic and refused in the support and launch checks, so a device library built before OutputPeerD gives no solution instead of a silently missing write. The peer D is written with system-scope stores; ordering a later kernel that reads D after the run is up to the caller, including under graph capture.

  • setProblem does not check peer access. Every slice a partition touches (and with storePeerD the peer D) must be accessible from that partition's device, which the caller arranges (local memory, or peer or VMM access it has set up); otherwise the run faults, as with any GEMM given an inaccessible pointer. The library does not enable peer access. With HIPBLASLT_LOG_MASK=4 it logs a hint when a sampled address looks unreachable (the return value does not change), and logs where the partitions are: all on one device (SPX), the partitions of one GPU (same PCI domain, bus and device, different function), or different GPUs.

  • hipblaslt-bench --partitions N --split_dim M|N|B --part_place_a/b/c/d shared|replicated, implemented inside testing_matmul (same data, CPU reference and checks). It skips unsupported configurations.

  • Tests (partitioned_gemm_ext in hipblaslt-test). They use the two partitions of a DPX GPU when there is one and both partitions on one device otherwise (SPX, or unrelated cards); the tests that only mean something across two partitions skip without a DPX GPU. The same selection is used by hipblaslt-bench --partitions. Sample 31_hipblaslt_gemm_partitioned_ext (replicated by default, shared for one A and one B; it shows the join after run(); a storePeerD variant is a TODO until the device library ships OutputPeerD kernels), docs and changelog.
  • Test Plan


  • hipblaslt-test --gtest_filter='partitioned_gemm_ext*' on a 2-partition (DPX) device; the multi-GPU cases skip with fewer than 2 devices.

  • hipblaslt-bench --partitions 2 with -v for each split dimension and placement; the sample.
  • Test Result


    Results are in the JIRA ticket (AIHPBLAS-5609), not in this PR.

    Codecov


    This is a gfx1250-only feature, and no gfx1250 job uploads coverage, so codecov/patch can't recover until one does. The partitioned gtests skip on every other architecture, so a coverage lane that is not a gfx1250 machine does not run the new library code.

    Submission Checklist


  • Look over the contributing guidelines at https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.md#pull-requests.
  • Risk level


    Low. The API is new and experimental; existing paths are untouched (hipblaslt-bench behaves as before unless --partitions is given), and the only change in the existing dispatch code is a filter that applies only to problems with a peer D.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: yzhang93 Review duration: 5482m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #15976"
    general weight: 0.35
    Reviewers
    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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 20.5% · Safe to merge
    20.5%