Skip to content

Add inference_rocm.json overlay for spleen_deepedit (AMD MI300X)#2

Open
nilapate wants to merge 2 commits into
amd-integrationfrom
nilapate/spleen_deepedit_opt
Open

Add inference_rocm.json overlay for spleen_deepedit (AMD MI300X)#2
nilapate wants to merge 2 commits into
amd-integrationfrom
nilapate/spleen_deepedit_opt

Conversation

@nilapate

@nilapate nilapate commented Jul 3, 2026

Copy link
Copy Markdown

Description

Enables fast AMD MI300X inference for spleen_deepedit_annotation via inference_amd.json overlay:

  • DynUNet GEMM ConvTranspose3d decomposition (use_gemm_transpose=True)
  • channels_last_3d + bfloat16 AMP + torch.compile

Validation:

End-to-end monai.bundle run (base vs overlay): Dice 0.9999, argmax agreement 1.0000. GEMM flag confirmed active in all 5 upsample blocks.

Usage:

python -m monai.bundle run
--config_file "['configs/inference.json', 'configs/inference_rocm.json']"
--datalist "['<path-to-volume.nii.gz>']"

Status

Ready


Checklist:

  • Codeformat tests passed (./runtests.sh --codeformat)
  • In-line docstrings updated
  • version and changelog updated in metadata.json
  • Naming rules comply with CONTRIBUTING.md
  • Package versions correct in metadata.json
  • Descriptions consistent with content
  • Files >25MB excluded with download links in large_file.yml
  • No personal paths in config files

Enables the DynUNet GEMM ConvTranspose3d decomposition (use_gemm_transpose) plus
channels_last_3d, bf16 amp, and torch.compile for the spleen_deepedit_annotation
bundle. Mirrors the vista3d/swin_unetr rocm overlays.

Validated end-to-end via real `monai.bundle run` (base vs base+overlay):
Dice 0.9999, argmax agreement 1.0000; flag confirmed active in all 5 upsample blocks.

Signed-off-by: Patel, Nilaykumar K <nilapate@amd.com>
Add cudnn.deterministic=False to inference_rocm.json overlay after
set_determinism(seed=123).

Without this, set_determinism sets torch.backends.cudnn.deterministic=True,
which on ROCm forces MIOpen to use the deterministic naive convolution
solver (ConvDirectNaiveConvFwd) instead of the fast XDLOPS implicit-GEMM
solver → 2070 ms forward time (300× slower than the optimized 6.9 ms).

This mirrors the pattern already used in vista3d/swinunetr inference_rocm.json
overlays on the nilapate/rocm-inference-overlays branch.

Verified: bundle forward time drops from 2070 ms to 6.94 ms mean (17 images)
with this one-line fix. Dice equivalence: 0.9995 (bundle A/B test).

Signed-off-by: Patel, Nilaykumar K <nilapate@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants