DynUNet: opt-in, ROCm-only GEMM decomposition for decoder ConvTranspose3d upsamples#2
Open
nilapate wants to merge 2 commits into
Open
DynUNet: opt-in, ROCm-only GEMM decomposition for decoder ConvTranspose3d upsamples#2nilapate wants to merge 2 commits into
nilapate wants to merge 2 commits into
Conversation
Add use_gemm_transpose param to DynUNet -> UnetUpBlock. When set (and on ROCm), decoder ConvTranspose3d upsamples with kernel_size == stride use an exact pixel-shuffle GEMM decomposition instead of the slow MIOpen/CK transpose kernel. - UnetUpBlock: gate = use_gemm_transpose and torch.version.hip is not None, computed once in __init__ (trace-time constant, no graph break under torch.compile). _transp_conv_gemm falls through to stock transp_conv for any shape violating the decomposition preconditions (k != s, dilation, output_padding, groups != 1, non-5D input, or an ADN sublayer on the transpose conv). - DynUNet: thread use_gemm_transpose (default False) through get_upsamples / get_module_list to the upsample blocks only; downsamples never see it. Default False -> every other DynUNet bundle is byte-for-byte unchanged. Activated per-model via the bundle's inference_rocm.json overlay. Verified: GEMM path == stock transpose conv to 8.8e-6 max abs (fp32); anchored Dice gate PASS all 9 rungs (spleen_deepedit bf16 CT_GEMM dice=0.9997). Signed-off-by: Patel, Nilaykumar K <nilapate@amd.com>
Add TestUpBlockGemmTranspose (block level) and TestDynUNetGemmTranspose (network level) covering the opt-in use_gemm_transpose path: decomposition == stock ConvTranspose3d, k!=s fall-through, forward equivalence with shared weights, ROCm-only runtime gate, and flag threading to all upsample blocks. Signed-off-by: Patel, Nilaykumar K <nilapate@amd.com>
soumitra-chatterjee-tech
approved these changes
Jul 3, 2026
|
|
||
|
|
||
| class TestUpBlockGemmTranspose(unittest.TestCase): | ||
| """AMD MI300X: the opt-in pixel-shuffle GEMM decomposition of the decoder |
There was a problem hiding this comment.
If this is not specific to MI300X, I would recommend you just mention AMD Instinct.
|
|
||
|
|
||
| class TestDynUNetGemmTranspose(unittest.TestCase): | ||
| """AMD MI300X: use_gemm_transpose must thread from DynUNet down to every |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When kernel_size == stride, a transposed conv admits an exact pixel-shuffle GEMM decomposition (single matmul), which runs faster on MI300X. New use_gemm_transpose flag (default False) threads from DynUNet to the upsample blocks; activates only when set and on ROCm. NVIDIA/CPU and all existing bundles are unchanged.
Change type and validation