Skip to content

[BUG]: LinkerOptions(numba_debug=True) is silently dropped #2640

Description

@rparolin

Type of Bug

Silent incorrect behavior (no error raised)

Component

cuda.core

Describe the bug

LinkerOptions.numba_debug (cuda_core/cuda/core/_linker.pyx:309) is declared as a public field but is never emitted by either backend. Neither _prepare_nvjitlink_options nor _prepare_driver_options references it, so setting it has no effect and no error.

This is not merely a dead field. _translate_program_options (cuda_core/cuda/core/_program.pyx:745) actively forwards numba_debug from ProgramOptions into LinkerOptions:

return LinkerOptions(
    ...
    no_cache=options.no_cache,
    numba_debug = options.numba_debug
)

That translation runs on the code_type == "ptx" path of Program, so Program(ptx, "ptx", ProgramOptions(numba_debug=True)) also drops the option. It is a silent drop on a live code path, which conflicts with the repository's "no silent failures" guidance: an option the user explicitly set should either take effect or raise, not vanish.

Introduced in #2158 (792ab3c9fea), the same change that added numba_debug to ProgramOptions. The NVVM half of that feature was separately broken and is fixed in #2639; this linker half is untouched by that PR.

How to Reproduce

from cuda.core import LinkerOptions

o = LinkerOptions(arch="sm_80", debug=True, numba_debug=True)
print(o.numba_debug)                              # True
print(o._prepare_nvjitlink_options(as_bytes=True))
True
[b'-arch=sm_80', b'-g']

The field is True, but no corresponding option is emitted. grep -n numba cuda_core/cuda/core/_linker.pyx returns only the field declaration.

Expected behavior

One of:

  1. Emit the option on the paths that support it, matching the ProgramOptions NVVM fix in fix(cuda.core): emit -numba-debug with a single dash for NVVM #2639, or
  2. Raise if numba_debug is set on a backend that cannot honor it, consistent with how _prepare_nvvm_options_impl raises CUDAError for options the NVVM backend does not support, or
  3. Remove the field if it was never meant to be plumbed through the linker, and stop _translate_program_options from forwarding it.

Whichever is chosen, a user-set option should not disappear without a diagnostic.

Operating System

Linux, CUDA 13.3 (reproduced against main)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcuda.coreEverything related to the cuda.core module

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions