Skip to content

[BUG]: ProgramOptions(numba_debug=True) always fails on the NVVM backend #2570

Description

@fedonman

Is this a duplicate?

No.

Type of Bug

Runtime Error

Component

cuda.core

Describe the bug

ProgramOptions(numba_debug=True) never works on the NVVM backend. cuda.core emits the option to libNVVM as --numba-debug, and libNVVM accepts only the single-dashed -numba-debug, so every such compile raises NVVM_ERROR_INVALID_OPTION. libNVVM rejects the double-dashed form of every option, not just this one, so no toolkit version accepts the current spelling. The NVRTC backend tolerates both spellings and is unaffected.

This also hides itself: test_nvvm_program_numba_debug is gated on a probe that asks libNVVM about the same wrong spelling, so the test skips everywhere. It is one of the entries in #2077. The skip reason blames CTK 13.2, but the option is rejected on CTK 13.3 as well, so the toolkit version is not the cause.

Present in released cuda-core 1.1.0 and 1.1.1, and on main. Added in #2158, closing #1287.

How to Reproduce

from cuda.core import Device, Program, ProgramOptions
from cuda.core._program import _get_nvvm_module

nvvm = _get_nvvm_module()
ir = 'target triple = "nvptx64-unknown-cuda"\ntarget datalayout = "e-p:64:64:64-i64:64:64-n16:32:64"\ndefine void @simple() {\nentry:\n  ret void\n}\n!nvvmir.version = !{!1}\n!1 = !{i32 %d, i32 %d, i32 %d, i32 %d}\n' % nvvm.ir_version()

Device(0).set_current()
opts = ProgramOptions(arch="sm_89", debug=True, numba_debug=True)
print(opts.as_bytes("nvvm"))
Program(ir, "nvvm", opts).compile("ptx")
[b'-arch=compute_89', b'-g', b'--numba-debug']
Traceback (most recent call last):
  ...
cuda.bindings.nvvm.nvvmError: ERROR_INVALID_OPTION (7)
NVVM program log: libnvvm : error: --numba-debug is an unsupported option

Asking libNVVM directly which spelling it accepts:

$ python -c "from cuda.bindings.utils import check_nvvm_compiler_options as c; print([(o, c([o])) for o in [\"--numba-debug\", \"-numba-debug\"]])"
[('--numba-debug', False), ('-numba-debug', True)]

Expected behavior

ProgramOptions(numba_debug=True) should compile on the NVVM backend. The option should be emitted as -numba-debug, which is also what numba-cuda emits for the NVVM path.

Operating System

Ubuntu 24.04 on WSL2, CUDA 13.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNeeds the team's attention

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions