Skip to content

Fix IS_ROCM hardcoding and PYTORCH_ROCM_ARCH detection in setup.py - #3

Open
bjoernellens1 wants to merge 1 commit into
AMD-Ecosystem:release/0.5.3from
bjoernellens1:release/0.5.3
Open

Fix IS_ROCM hardcoding and PYTORCH_ROCM_ARCH detection in setup.py#3
bjoernellens1 wants to merge 1 commit into
AMD-Ecosystem:release/0.5.3from
bjoernellens1:release/0.5.3

Conversation

@bjoernellens1

Copy link
Copy Markdown

Summary

Two build-time bugs found while porting this fork to gfx1151 (RDNA3.5, a consumer/APU target rather than the CDNA/Instinct hardware this port originally targeted):

  1. setup.py had IS_ROCM = True as a hardcoded module-level constant, not conditioned on the actual installed PyTorch build. This makes the package "compile as ROCm" even on a CUDA-only PyTorch install, rather than detecting the environment.
  2. hipcc_flags hardcoded --offload-arch=gfx942 (CDNA/Instinct) unconditionally, ignoring PYTORCH_ROCM_ARCH if set — so a build targeting a different arch (e.g. gfx1151) silently compiled for gfx942 instead.

Fix

  • IS_ROCM now derives from torch.version.hip is not None.
  • Arch selection checks PYTORCH_ROCM_ARCH first (splitting on ,/; for multi-arch, taking the first), falling back to the existing hardcoded gfx942 default only if the env var is unset — so existing CDNA-targeted builds are unaffected by default, but the arch is now actually overridable.

Test plan

  • Built with real GPU devices attached, targeting gfx1151 specifically — confirmed the correct arch flag is used (embedded fatbinary contains only gfx1151, not gfx942) and import nerfacc succeeds
  • Full test suite (test_camera.py, test_grid.py, test_pack.py, test_pdf.py, test_rendering.py, test_scan.py, test_vdb.py) passes 23/23 on gfx1151 (21/23 real exercised coverage; 2 short-circuit on an unrelated missing optional fvdb dependency)
  • Structural check for wave-size-sensitive code: no warp-level intrinsics anywhere in the HIP kernels this port touches, so no RDNA-vs-CDNA (wave32-vs-wave64) correctness risk was found for the paths this fix affects

Two bug-pattern fixes, same shape as bjoernellens1/gsplat's earlier
fixes for the identical problems:
- IS_ROCM was a hardcoded module-level True, meaning this always
  compiled with ROCm/HIP flags regardless of the actual installed
  PyTorch build. Now derived from torch.version.hip.
- hipcc_flags hardcoded --offload-arch=gfx942 (CDNA/Instinct only).
  Now checks PYTORCH_ROCM_ARCH first, falls back to gfx942 only if
  unset -- verified building correctly for gfx1151 (RDNA3.5) with the
  env var set, matching gsplat's release/1.5.3b2 commit 4515618's
  fix for the same issue.
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.

1 participant