Skip to content

Commit

Permalink
Merge pull request #8157 from leofang/jitify_fix2
Browse files Browse the repository at this point in the history
Set `-arch` in the compiler options unconditionally
  • Loading branch information
takagi committed Feb 5, 2024
2 parents 666319b + 03c8f70 commit 085a34f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions cupy/cuda/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ def compile_using_nvrtc(source, options=(), arch=None, filename='kern.cu',
def _compile(
source, options, cu_path, name_expressions, log_stream, jitify):

if not runtime.is_hip:
arch_opt, method = _get_arch_for_options_for_nvrtc(arch)
options += (arch_opt,)
else:
method = 'ptx'

if jitify:
options, headers, include_names = _jitify_prep(
source, options, cu_path)
Expand All @@ -291,12 +297,6 @@ def _compile(
# tests cause an error if the following option is not included.
options += ('--device-as-default-execution-space',)

if not runtime.is_hip:
arch_opt, method = _get_arch_for_options_for_nvrtc(arch)
options += (arch_opt,)
else:
method = 'ptx'

prog = _NVRTCProgram(source, cu_path, headers, include_names,
name_expressions=name_expressions, method=method)
try:
Expand Down
4 changes: 3 additions & 1 deletion tests/cupy_tests/core_tests/test_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,9 @@ def test_dynamical_parallelism_compile_failure(self):
x = cupy.zeros((N,), dtype=cupy.float32)
use_ptx = os.environ.get(
'CUPY_COMPILE_WITH_PTX', False)
if self.backend == 'nvrtc' and (
if self.jitify:
error = cupy.cuda.compiler.JitifyException
elif self.backend == 'nvrtc' and (
use_ptx or
(cupy.cuda.driver._is_cuda_python()
and cupy.cuda.runtime.runtimeGetVersion() < 11010) or
Expand Down

0 comments on commit 085a34f

Please sign in to comment.