Skip to content

Commit 164bbc1

Browse files
committed
cuda.core: emit -numba-debug to libNVVM, not --numba-debug
libNVVM accepts only single-dashed options, so every ProgramOptions(numba_debug=True) compile on the NVVM backend failed with NVVM_ERROR_INVALID_OPTION. numba-cuda emits -numba-debug for the same path. The NVRTC backend tolerates both spellings and is left alone. The guarding test probed libNVVM with the same wrong spelling, so it skipped on every configuration and never caught this. Probe and assert the spelling the code now emits, and drop the skip reason's claim that the option needs CTK 13.2: libNVVM rejects the double-dashed form at any version. Closes #2570 Signed-off-by: Vyron Vasileiadis <hi@fedonman.com>
1 parent 3bd069a commit 164bbc1

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

‎cuda_core/cuda/core/_program.pyx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ cdef inline object _prepare_nvvm_options_impl(object opts, bint as_bytes):
12331233
if opts.debug is not None and opts.debug:
12341234
options.append("-g")
12351235
if opts.numba_debug:
1236-
options.append("--numba-debug")
1236+
options.append("-numba-debug")
12371237
if opts.device_code_optimize is False:
12381238
options.append("-opt=0")
12391239
elif opts.device_code_optimize is True:

‎cuda_core/docs/source/release/1.2.0-notes.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ Fixes and enhancements
7373
Windows, both ``ctypes.CFUNCTYPE`` and ``ctypes.WINFUNCTYPE`` are accepted.
7474
(`#2439 <https://github.com/NVIDIA/cuda-python/issues/2439>`__)
7575

76+
- ``ProgramOptions(numba_debug=True)`` now works on the NVVM backend. The
77+
option was emitted as ``--numba-debug``, and libNVVM accepts only the
78+
single-dashed ``-numba-debug``, so every such compilation failed with
79+
``NVVM_ERROR_INVALID_OPTION``. The NVRTC backend, which tolerates both
80+
spellings, was unaffected.
81+
(`#2570 <https://github.com/NVIDIA/cuda-python/issues/2570>`__)
82+
7683
Deprecation Notices
7784
-------------------
7885

‎cuda_core/tests/test_program.py‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ def _check_nvvm_arch(arch: str) -> bool:
9393

9494

9595
def _check_nvvm_supports_numba_debug() -> bool:
96-
"""Check if the installed libNVVM recognizes --numba-debug (CTK 13.2+)."""
96+
"""Check if the installed libNVVM recognizes -numba-debug."""
9797
if not _has_check_nvvm_compiler_options():
9898
return False
9999
from cuda.bindings.utils import check_nvvm_compiler_options
100100

101-
return check_nvvm_compiler_options(["--numba-debug"])
101+
return check_nvvm_compiler_options(["-numba-debug"])
102102

103103

104104
@pytest.fixture(scope="session")
@@ -762,18 +762,19 @@ def test_program_options_as_bytes_nvvm_unsupported_option():
762762

763763
@nvvm_available
764764
def test_nvvm_program_options_as_bytes_numba_debug():
765-
"""numba_debug must be plumbed through to libNVVM as --numba-debug
766-
(see #1287)."""
765+
"""numba_debug must be plumbed through to libNVVM as -numba-debug
766+
(see #1287). libNVVM rejects the double-dashed form of every option."""
767767
options = ProgramOptions(arch="sm_80", debug=True, numba_debug=True)
768768
nvvm_bytes = options.as_bytes("nvvm")
769-
assert b"--numba-debug" in nvvm_bytes
769+
assert b"-numba-debug" in nvvm_bytes
770+
assert b"--numba-debug" not in nvvm_bytes
770771
assert b"-g" in nvvm_bytes
771772

772773

773774
@nvvm_available
774775
@pytest.mark.skipif(
775776
not _check_nvvm_supports_numba_debug(),
776-
reason="installed libNVVM does not recognize --numba-debug (needs CTK 13.2+)",
777+
reason="installed libNVVM does not recognize -numba-debug",
777778
)
778779
def test_nvvm_program_numba_debug(init_cuda, nvvm_ir):
779780
options = ProgramOptions(arch="sm_80", debug=True, numba_debug=True)

0 commit comments

Comments
 (0)