Skip to content

fix(cuda.core): warn instead of silently dropping numba_debug on link paths - #2658

Merged
rparolin merged 4 commits into
NVIDIA:mainfrom
rparolin:fix/linker-numba-debug-silent-drop
Aug 19, 2026
Merged

fix(cuda.core): warn instead of silently dropping numba_debug on link paths#2658
rparolin merged 4 commits into
NVIDIA:mainfrom
rparolin:fix/linker-numba-debug-silent-drop

Conversation

@rparolin

@rparolin rparolin commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Description

closes #2640

LinkerOptions carries a public numba_debug field that no linking backend reads. nvJitLink rejects the option under every spelling and the driver's cuLink API has no corresponding CUjit_option, so setting it does nothing and reports nothing.

It is not merely dead. _translate_program_options forwarded numba_debug from ProgramOptions into LinkerOptions on the code_type="ptx" path, so Program(ptx, "ptx", ProgramOptions(numba_debug=True)) silently discarded an option the user explicitly set.

This makes the drop audible without breaking any caller.

Surface Behavior
LinkerOptions(numba_debug=...) constructs as before; DeprecationWarning; value ignored
_prepare_nvjitlink_options / _prepare_driver_options untouched — the linker needs no knowledge of numba_debug to ignore it
Program(ptx, "ptx", ProgramOptions(numba_debug=True)) compiles as before; UserWarning; no longer forwarded
program-cache key numba_debug excluded — it cannot change PTX-path output, so it must not perturb the key
NVVM / NVRTC paths unchanged; option still emitted

Nothing raises and nothing is removed. This follows existing precedent: _prepare_driver_options already handles six options the cuLink backend cannot honor (ftz, prec_div, prec_sqrt, fma, kernels_used, variables_used) by warning rather than raising.

Two deliberate details

The warning categories differ. LinkerOptions.numba_debug gets a DeprecationWarning — the field is going away. The PTX path gets a UserWarning, because ProgramOptions.numba_debug is not deprecated: it is fully supported on NVVM/NVRTC and merely inapplicable to a linking backend. Marking it DeprecationWarning would tell users a supported option is being removed.

The gate polarities differ. The linker field gates on is not None — the field itself is doomed, so any explicit value earns the notice, including False. The PTX path gates on truthiness, matching _prepare_nvvm_options_impl, because numba_debug=False asks for nothing and there is no dropped intent to report.

Removal

LinkerOptions.numba_debug is deprecated here and removed in 2.0.0, per the support policy: breaking API changes are confined to major-version boundaries, with a deprecation notice at least one minor release ahead.

Nothing in this repo tracked a scheduled removal — the only prior public-attribute deprecation, Device.max_links, says "a future release" with no version, issue, or test behind it. This adds the tracking to the release checklist (.github/ISSUE_TEMPLATE/release_checklist.yml, with matching guidance in RELEASE-core.md): before cutting a release, sweep for deprecations whose stated removal version has arrived and remove any that are due.

The sweep greps deprecated:: rather than \.\. deprecated::, so it also catches the two Device.max_links sites, which spell the directive .. version-deprecated::. Whether that spelling is a real Sphinx directive is worth a separate look — if it is not, those two blocks are not rendering as deprecation notices at all.

Verification

Full cuda_core suite on CUDA 13: 3844 passed, 238 skipped, 4 xfailed, 127 subtests passed, verified against a rebuilt extension. pre-commit clean, including .pyi stub regeneration and mypy-cuda-core.

numba-cuda is unaffected — it drives libNVVM directly via its own cudadrv/nvvm.py and never routes numba_debug through a cuda.core PTX path.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Aug 18, 2026
@rparolin
rparolin requested review from leofang and mdboom August 18, 2026 00:46
@rparolin rparolin self-assigned this Aug 18, 2026
@github-actions

Copy link
Copy Markdown

@rparolin
rparolin marked this pull request as draft August 18, 2026 01:01
@copy-pr-bot

copy-pr-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

… paths

`LinkerOptions` carries a public `numba_debug` field that no linking
backend reads. nvJitLink rejects the option under every spelling and the
driver's cuLink API has no corresponding `CUjit_option`, so setting it
does nothing and reports nothing.

It is not merely dead: `_translate_program_options` forwarded
`numba_debug` from `ProgramOptions` into `LinkerOptions` on the
`code_type="ptx"` path, so `Program(ptx, "ptx",
ProgramOptions(numba_debug=True))` silently discarded an option the user
explicitly set.

Make the drop audible without breaking any caller:

- `LinkerOptions.numba_debug` is deprecated. Setting it emits a
  `DeprecationWarning` from `__post_init__` and the value is still
  ignored. The field stays, so no constructor signature changes.
- `_translate_program_options` no longer forwards it and emits a
  `UserWarning` saying it is ignored for `code_type="ptx"`. `UserWarning`
  rather than `DeprecationWarning` because `ProgramOptions.numba_debug`
  is not deprecated -- it is fully supported on NVVM and NVRTC and
  merely inapplicable to a linking backend.
- The option builders are untouched; the linker needs no knowledge of
  `numba_debug` to ignore it.
- `_LinkerBackend.validate` rejects nothing, and `numba_debug` stays out
  of `_LINKER_FIELD_GATES`: it cannot change PTX-path output, so it must
  not perturb the program-cache key.

The warning gates differ on purpose. The linker field uses `is not None`
-- the field itself is going away, so any explicit value earns the
notice, including `False`. The PTX path uses truthiness, matching
`_prepare_nvvm_options_impl`, because `False` asks for nothing.

Removal of `LinkerOptions.numba_debug` is deferred to 2.0.0: the support
policy confines breaking API changes to major-version boundaries and
requires a deprecation notice at least one minor release ahead. Nothing
in the repo tracks a scheduled removal -- the existing precedent
(`Device.max_links`) only says "a future release" -- so a version-gated
test fails the build once the version crosses 2.0.

The NVVM and NVRTC paths are unchanged and still emit the option.

Closes NVIDIA#2640

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@rparolin
rparolin force-pushed the fix/linker-numba-debug-silent-drop branch from b2a45ad to c063d2a Compare August 18, 2026 14:15
@rparolin rparolin changed the title fix(cuda.core): reject numba_debug on link paths instead of dropping it fix(cuda.core): warn instead of silently dropping numba_debug on link paths Aug 18, 2026
@rparolin
rparolin marked this pull request as ready for review August 18, 2026 14:50
@rparolin
rparolin enabled auto-merge (squash) August 18, 2026 14:50
@rparolin rparolin added bug Something isn't working P0 High priority - Must do! feature New feature or request labels Aug 18, 2026
@rparolin rparolin added this to the cuda.core 1.2.0 milestone Aug 18, 2026
Comment thread cuda_core/cuda/core/_linker.pyi
Comment thread cuda_core/cuda/core/_linker.pyx
Comment thread cuda_core/tests/test_linker.py Outdated
rparolin and others added 3 commits August 18, 2026 10:17
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
The version-gated `test_numba_debug_removal_is_due_at_2_0` fails the
build the moment `cuda.core.__version__` crosses 2.0. That bump lands on
an ordinary release-prep PR during code freeze, so the test turns red at
the worst possible time and is indistinguishable from a real regression
to anyone who did not write it.

Drop it, and put the reminder where release managers already look:

- Remove the test and the now-unused `import cuda.core`.
- Add a release-checklist item to sweep deprecations whose stated removal
  version has arrived, with matching guidance in RELEASE-core.md.

The sweep greps `deprecated::` rather than `\.\. deprecated::` so it also
catches the two `Device.max_links` sites, which spell the directive
`.. version-deprecated::`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the CI/CD CI/CD infrastructure label Aug 18, 2026
@rparolin
rparolin requested a review from mdboom August 18, 2026 17:51
@rparolin
rparolin merged commit 6134171 into NVIDIA:main Aug 19, 2026
110 checks passed
github-actions Bot pushed a commit that referenced this pull request Aug 20, 2026
Removed preview folders for the following PRs:
- PR #2658
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working CI/CD CI/CD infrastructure cuda.core Everything related to the cuda.core module feature New feature or request P0 High priority - Must do!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants