Skip to content

Commit

Permalink
Move ROCm torch branch check into get_cuda_compile_flag
Browse files Browse the repository at this point in the history
  • Loading branch information
hj-wei committed Dec 25, 2024
1 parent b86b380 commit 309a666
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions op_builder/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,11 @@ def cpu_arch(self):
return '-mcpu=native'
return '-march=native'

def is_cuda_enable(self):
def get_cuda_compile_flag(self):
try:
assert_no_cuda_mismatch(self.name)
return '-D__ENABLE_CUDA__'
if not self.is_rocm_pytorch():
assert_no_cuda_mismatch(self.name)
return "-D__ENABLE_CUDA__"
except MissingCUDAException:
print(f"{WARNING} {self.name} cuda is missing or is incompatible with installed torch, "
"only cpu ops can be compiled!")
Expand Down Expand Up @@ -839,9 +840,7 @@ def cxx_args(self):

CPU_ARCH = self.cpu_arch()
SIMD_WIDTH = self.simd_width()
CUDA_ENABLE = (
"-D__DISABLE_CUDA__" if self.is_rocm_pytorch() else self.is_cuda_enable()
)
CUDA_ENABLE = self.get_cuda_compile_flag()
args += [
CPU_ARCH,
'-fopenmp',
Expand Down

0 comments on commit 309a666

Please sign in to comment.