Make Linker.backend a classmethod#1910
Open
cpcloud wants to merge 4 commits intoNVIDIA:mainfrom
Open
Conversation
|
dbe6176 to
215418a
Compare
leofang
requested changes
Apr 21, 2026
Member
leofang
left a comment
There was a problem hiding this comment.
Thanks, Phillip! Implementation-wise LGTM. Left a few suggestions.
Allows querying the linking backend without constructing a Linker instance — useful for dispatching on input format (PTX vs. LTOIR) before linking. Updates existing call sites (Program init, test_linker) to use the new invocation form Linker.backend().
Covers classmethod invocation (Linker.backend() without an instance), memoisation flag handling, probe-on-first-use, and non-property attribute semantics.
Breaking change: Linker.backend is now a classmethod, so call sites must use parens: Linker.backend().
215418a to
12d291b
Compare
rparolin
approved these changes
May 1, 2026
leofang
reviewed
May 1, 2026
Member
leofang
left a comment
There was a problem hiding this comment.
Given that we just recently went to the opposite direction (converting some methods to properties, #1945 & #1986), it'd be better to have @mdboom or @Andy-Jost to chime in from the design consistency perspective. It might be possible that we need to re-evaluate if #714 is really necessary.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Linker.backendfrom an instance property to a classmethod so callers can query the linking backend without constructing aLinker_decide_nvjitlink_or_driver()(existing memoised probe) and maps the return value to"nvJitLink"or"driver"_program.pyxand existing test assertion to use parensDevice()/cuInitrequired)0.8.0-notes.rstdocumenting the breaking changeBreaking change:
linker.backend(attribute access) now returns a bound method, not a string. All call sites must useLinker.backend(). Only 2 in-repo call sites affected; numba-cuda (the requester) will adoptLinker.backend()from day one.Test plan
test_linker_initpasses with updated paren callCloses #714
🤖 Generated with Claude Code