From 164bbc174f7542a1f1d4bb71ead9db2f0dc2e735 Mon Sep 17 00:00:00 2001 From: Vyron Vasileiadis Date: Sun, 9 Aug 2026 12:32:21 +0300 Subject: [PATCH] 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 --- cuda_core/cuda/core/_program.pyx | 2 +- cuda_core/docs/source/release/1.2.0-notes.rst | 7 +++++++ cuda_core/tests/test_program.py | 13 +++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/cuda_core/cuda/core/_program.pyx b/cuda_core/cuda/core/_program.pyx index 7fb099b06d2..8cf8d1bb9e7 100644 --- a/cuda_core/cuda/core/_program.pyx +++ b/cuda_core/cuda/core/_program.pyx @@ -1233,7 +1233,7 @@ cdef inline object _prepare_nvvm_options_impl(object opts, bint as_bytes): if opts.debug is not None and opts.debug: options.append("-g") if opts.numba_debug: - options.append("--numba-debug") + options.append("-numba-debug") if opts.device_code_optimize is False: options.append("-opt=0") elif opts.device_code_optimize is True: diff --git a/cuda_core/docs/source/release/1.2.0-notes.rst b/cuda_core/docs/source/release/1.2.0-notes.rst index 120d2c2a253..1c706c68d07 100644 --- a/cuda_core/docs/source/release/1.2.0-notes.rst +++ b/cuda_core/docs/source/release/1.2.0-notes.rst @@ -73,6 +73,13 @@ Fixes and enhancements Windows, both ``ctypes.CFUNCTYPE`` and ``ctypes.WINFUNCTYPE`` are accepted. (`#2439 `__) +- ``ProgramOptions(numba_debug=True)`` now works on the NVVM backend. The + option was emitted as ``--numba-debug``, and libNVVM accepts only the + single-dashed ``-numba-debug``, so every such compilation failed with + ``NVVM_ERROR_INVALID_OPTION``. The NVRTC backend, which tolerates both + spellings, was unaffected. + (`#2570 `__) + Deprecation Notices ------------------- diff --git a/cuda_core/tests/test_program.py b/cuda_core/tests/test_program.py index 28465425c0e..c3c484ba413 100644 --- a/cuda_core/tests/test_program.py +++ b/cuda_core/tests/test_program.py @@ -93,12 +93,12 @@ def _check_nvvm_arch(arch: str) -> bool: def _check_nvvm_supports_numba_debug() -> bool: - """Check if the installed libNVVM recognizes --numba-debug (CTK 13.2+).""" + """Check if the installed libNVVM recognizes -numba-debug.""" if not _has_check_nvvm_compiler_options(): return False from cuda.bindings.utils import check_nvvm_compiler_options - return check_nvvm_compiler_options(["--numba-debug"]) + return check_nvvm_compiler_options(["-numba-debug"]) @pytest.fixture(scope="session") @@ -762,18 +762,19 @@ def test_program_options_as_bytes_nvvm_unsupported_option(): @nvvm_available def test_nvvm_program_options_as_bytes_numba_debug(): - """numba_debug must be plumbed through to libNVVM as --numba-debug - (see #1287).""" + """numba_debug must be plumbed through to libNVVM as -numba-debug + (see #1287). libNVVM rejects the double-dashed form of every option.""" options = ProgramOptions(arch="sm_80", debug=True, numba_debug=True) nvvm_bytes = options.as_bytes("nvvm") - assert b"--numba-debug" in nvvm_bytes + assert b"-numba-debug" in nvvm_bytes + assert b"--numba-debug" not in nvvm_bytes assert b"-g" in nvvm_bytes @nvvm_available @pytest.mark.skipif( not _check_nvvm_supports_numba_debug(), - reason="installed libNVVM does not recognize --numba-debug (needs CTK 13.2+)", + reason="installed libNVVM does not recognize -numba-debug", ) def test_nvvm_program_numba_debug(init_cuda, nvvm_ir): options = ProgramOptions(arch="sm_80", debug=True, numba_debug=True)