feat(hipblaslt): add PartitionedGemm to run one GEMM across DPX partitions #15976
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
yzhang93
JIRA ID : AIHPBLAS-5609
Stacked on #16104 (TensileLite: the shared
SliceAlignmentrule and--split-align, on top of the merged #15975--split-devicesclient andOutputPeerD); 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::PartitionedGemmandSplitDim(beta,hipblaslt-ext.hpp; theexperimentalnamespace marks the beta status in user code and in the exported symbols): one handle, stream and workspace per partition.SplitDim::M,NorBatch; the first partitions takesize / Nand the last takes the rest.size / Nis 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 stayssize / Nand a hint (HIPBLASLT_LOG_MASK=4) says what to pad. The rule is the sharedTensileLite::SliceAlignmentfrom #16104, which the--split-devicesclient uses too. Plain GEMM only; the user-args overloads are reserved and returnNOT_SUPPORTED. gfx1250 only:setProblemreturnsNOT_SUPPORTEDwhen a partition's device is another architecture.auto(round within 1%, otherwisesize / Nwith a hint); there is noofforforceand 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).setProblemtakesstd::vector<GemmInputs>, one per partition (asGroupedGemmdoes), 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.setProblemgives each partition the slice whose pages are on its device (works forhipMallocand VMM; this samples where the memory is, so it runs only when the partitions are on distinct devices, and in SPX partitionitakes sliceiwithout sampling; callsetProblemwhen a pointer or the shape changes, not on every launch), matches copies to partitions by device (inconsistent lists returnINVALID_VALUEwith an error log), and logs a hint (HIPBLASLT_LOG_MASK=4) when a slice stays remote. Streamimust be on handlei's device; streams may share a device (SPX).run()launches each partition's slice on its stream and returns, asGemm::rundoes 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 andhipblaslt-benchdo 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 ahipStreamWriteValue64on its stream after its slice;setProblemdecides 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.storePeerDargument ofsetProblemmakes every partition also write its slice into the other partition's D (2 partitions, replicated non-overlapping D), using the TensileLiteOutputPeerDkernels from #15975. The tuning cache gets an optionalpeerDcolumn. 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 beforeOutputPeerDgives 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.setProblemdoes not check peer access. Every slice a partition touches (and withstorePeerDthe 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. WithHIPBLASLT_LOG_MASK=4it 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 insidetesting_matmul(same data, CPU reference and checks). It skips unsupported configurations.partitioned_gemm_extinhipblaslt-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 byhipblaslt-bench --partitions. Sample31_hipblaslt_gemm_partitioned_ext(replicated by default,sharedfor one A and one B; it shows the join afterrun(); astorePeerDvariant is a TODO until the device library shipsOutputPeerDkernels), 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 2with-vfor 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/patchcan'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
Risk level
Low. The API is new and experimental; existing paths are untouched (
hipblaslt-benchbehaves as before unless--partitionsis given), and the only change in the existing dispatch code is a filter that applies only to problems with a peer D.