Allow PyTorch to forward gcc-toolchain cxxcflag to CUDA toolchains (#30318)

This commit is contained in:
Brian Van Essen 2022-04-27 08:48:06 -07:00 committed by GitHub
parent c4ad003af2
commit 06e7249850
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -301,6 +301,10 @@ def enable_or_disable(variant, keyword='USE', var=None, newer=False):
in in
self.spec.variants['cuda_arch'].value) self.spec.variants['cuda_arch'].value)
env.set('TORCH_CUDA_ARCH_LIST', torch_cuda_arch) env.set('TORCH_CUDA_ARCH_LIST', torch_cuda_arch)
if self.spec.satisfies('%clang'):
for flag in self.spec.compiler_flags['cxxflags']:
if 'gcc-toolchain' in flag:
env.set('CMAKE_CUDA_FLAGS', '=-Xcompiler={0}'.format(flag))
enable_or_disable('rocm') enable_or_disable('rocm')