Skip to content

fix(cuda_core): use nvJitLink-compatible 0/1 values for boolean linker options - #3128

Open
lijinf2 wants to merge 2 commits into
NVIDIA:mainfrom
lijinf2:fix/6621758-nvjitlink-bool-to-int-options
Open

lijinf2 wants to merge 2 commits into
NVIDIA:mainfrom
lijinf2:fix/6621758-nvjitlink-bool-to-int-options

Conversation

@lijinf2

@lijinf2 lijinf2 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes nvbug 6621758.

nvJitLink's input validation was tightened upstream (CUDA Toolkit 13.6) to strictly require 0/1 for boolean-valued options and non-negative integers for -split-compile/-split-compile-extended.

cuda_core's LinkerOptions._prepare_nvjitlink_options() was emitting Python-style true/false strings and raw f"{bool}" ("True"/"False"), which the newer nvJitLink rejects with ERROR_UNRECOGNIZED_OPTION.

This PR changes the nvJitLink backend option formatting to:

  • -ftz, -prec-div, -prec-sqrt, -fma: emit 1/0 instead of true/false
  • -split-compile, -split-compile-extended: coerce value with int(...) so a bool is sent as 1/0 rather than the literal string "True"/"False"

The NVRTC backend (--ftz=true/false) and NVVM backend (-ftz=1/0, already correct) are untouched. This only affects the nvJitLink-specific option formatting.

Backward compatibility

Verified directly on nvJitLink 13.2.51, 13.4.92 (both released), and a 13.6.0 nightly build:

Option 13.2 / 13.4 (released) 13.6 (nightly, new validation)
-ftz=true / -ftz=1 both OK true FAILS, 1 OK
-split-compile=True / =1 both OK True FAILS, 1 OK

Released toolkits accept both the old and new formats, so always emitting 1/0 is backward compatible and does not regress any currently supported CUDA 13.x toolkit, while fixing compatibility with newer/nightly toolkits.

Testing

  • Reproduced and verified fix against nightly CUDA 13.6 toolkit on real GPU hardware: test_linker.py + test_program.py (241 tests) and test_program_cache.py (237 tests) pass with zero failures.

@copy-pr-bot

copy-pr-bot Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Oct 16, 2026
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: a0e18f0e-604e-4c45-bd58-f07c376e04a5
📥 Commits

Reviewing files that changed from the base of the PR and between 0e5afde and c539cc2.

📒 Files selected for processing: 1
  • cuda_core/cuda/core/_linker.pyx
💤 Files with no reviewable changes: 1
  • cuda_core/cuda/core/_linker.pyx

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Boolean nvJitLink options now use 0 or 1 instead of false or true. Split-compilation option values are also converted to numeric format. These changes ensure the options are passed in the format expected by nvJitLink.

nvJitLink boolean options now serialize as 0 or 1. The linker converts split_compile and split_compile_extended values to integers before formatting. The test expectation for ftz now uses -ftz=1.

Changes: nvJitLink Option Serialization

Layer / File(s) Summary
Format nvJitLink options
cuda_core/cuda/core/_linker.pyx, cuda_core/tests/test_linker.py
The linker formats ftz, prec-div, prec-sqrt, and fma as 0 or 1. It converts split_compile and split_compile_extended values to integers before formatting. The test expects -ftz=1.

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to c539c

This change makes nvJitLink option values numeric so newer toolkit builds accept them. No concrete merge-blocking risk was found in the supplied context.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 36ecdafb-5184-41f1-a5f6-bad397b13885
📥 Commits

Reviewing files that changed from the base of the PR and between 2224499 and 0e5afde.

📒 Files selected for processing: 2
  • cuda_core/cuda/core/_linker.pyx
  • cuda_core/tests/test_linker.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Comment thread cuda_core/cuda/core/_linker.pyx
@lijinf2 lijinf2 self-assigned this Oct 16, 2026
@lijinf2 lijinf2 added the bug Something isn't working label Oct 16, 2026
@lijinf2 lijinf2 added this to the cuda.core 1.3.0 milestone Oct 16, 2026
@lijinf2

lijinf2 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test c539cc2

@github-actions

Copy link
Copy Markdown
Contributor

@leofang leofang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a breaking change on the nvJitLink side. We should move the bug to their module and ask them to triage/fix.

@lijinf2

lijinf2 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

I think this is a breaking change on the nvJitLink side. We should move the bug to their module and ask them to triage/fix.

Agreed, This does look like a behavior change on the nvJitLink side. The old true/false format stopped being accepted starting with a recent build. Let me reach out to the nvJitLink team to understand why and report back before we decide how to proceed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cuda.core Everything related to the cuda.core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants