Fix IS_ROCM hardcoding and PYTORCH_ROCM_ARCH detection in setup.py - #3
Open
bjoernellens1 wants to merge 1 commit into
Open
Fix IS_ROCM hardcoding and PYTORCH_ROCM_ARCH detection in setup.py#3bjoernellens1 wants to merge 1 commit into
bjoernellens1 wants to merge 1 commit into
Conversation
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.
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.
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):
setup.pyhadIS_ROCM = Trueas 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.hipcc_flagshardcoded--offload-arch=gfx942(CDNA/Instinct) unconditionally, ignoringPYTORCH_ROCM_ARCHif set — so a build targeting a different arch (e.g. gfx1151) silently compiled for gfx942 instead.Fix
IS_ROCMnow derives fromtorch.version.hip is not None.PYTORCH_ROCM_ARCHfirst (splitting on,/;for multi-arch, taking the first), falling back to the existing hardcodedgfx942default 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
gfx1151, notgfx942) andimport nerfaccsucceedstest_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 optionalfvdbdependency)