Skip to content

Re-work on Linker dispatching logic #712

Closed

Description

@leofang

CUDA 12.0 is the first release where nvJitLink debuts. So far we have been operating under the assumption that nvJitLink is always available and can always generate a PTX (or CUBIN) that the driver can load. However, this assumption partially relies on another assumption that both nvJitLink and the driver are within the same major version 12.x.

By the time the next major release is out, there exists a possibility that the driver version (13.x) is newer than nvJitLink version (12.x). In this case, unless we need to link LTO IRs (which the driver cannot handle) we should prefer for the driver to handle the linking, instead of using nvJitLink. For linking LTO IRs, we must raise an exception.

We should also raise an exception if the user tries to link LTO IRs from different major versions. I believe it is not a supported use case. However, we currently do not have any introspection capability to check the LTO IR version.

Activity

  1. added this to the cuda.core parking lot milestone on Jun 17, 2025
  2. self-assigned this
    on Jun 17, 2025
  3. added
    enhancementAny code-related improvements
    P0High priority - Must do!
    cuda.coreEverything related to the cuda.core module
    on Jun 17, 2025
  4. removed their assignment
    on Jan 20, 2026
  5. added
    cuda.coreEverything related to the cuda.core module
    and removed
    cuda.coreEverything related to the cuda.core module
    on Apr 2, 2026
  6. removed this from the cuda.core backlog milestone on Apr 2, 2026
  7. moved this from Todo to In Progress in CCCLon Apr 14, 2026
  8. added this to the cuda.core v1.1.0 milestone on May 21, 2026
  9. rparolin commented on May 26, 2026

    @rparolin
    Collaborator

    @isVoid I moved this issue to you to take a look at. Let me know if you have any questions.
    cc: @leofang

  10. isVoid commented on May 26, 2026

    @isVoid
    Contributor

    Looking at @cpcloud 's PR 1911, the base solution there is sane. So I would plan to lift that PR to the most recent state as my first goal here. That PR should address the majority of this issue.

    One improvement I can think of is the lack of real CI environment testing setup to confirm the pass/expected failure of the setup. The tests in the PR is largely "smoke tests" assuming that all version detectors under the hood works as expected.

  11. isVoid commented on May 26, 2026

    @isVoid
    Contributor

    We should also raise an exception if the user tries to link LTO IRs from different major versions. I believe it is not a supported use case. However, we currently do not have any introspection capability to check the LTO IR version.

    As for this, it should be in a different PR. The current status isn't that bad. If you feed 13.0 LTOIR into 12.9 nvjitlink, an python exception is re-raised from nvjitlinkError.

      cuda.bindings.nvjitlink.nvJitLinkError: ERROR_INTERNAL (6)
      Linker error log: ERROR 4 in nvvmAddNVVMContainerToProgram, may need newer version of nvJitLink library
    

    We could provide more information on top of this to suggest that your nvjitlink version is 12.9 and the LTOIR is compiled from a 13.0 toolkit and prompt user to upgrade their nvjitlink version. An alternative is obviously preemptively check the version of the LTOIR and compare it with the toolchain in the environment before even launching nvjitlink. But I suspect it's probably not that much of a performance difference.

  12. moved this from In Progress to Done in CCCLon Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P0High priority - Must do!cuda.coreEverything related to the cuda.core moduleenhancementAny code-related improvements

Type

No type

Projects

  • Status
    Done

Relationships

None yet

Development

No branches or pull requests

Issue actions