Skip to content

Conversation

@davebayer
Copy link
Contributor

I wanted to improve nvrtcc for quite some time, I wanted to add support for linking device libraries, so we can test CUDA device runtime functionality.

First I started improving the current implementation, but then got an idea: is there a possibility that we could just use nvcc but hijack the compilation at the right moment to invoke nvrtc instead of nvcc's device compilation?

Actually, I made it work! When compiling CUDA device code, nvcc uses host compiler to preprocess the source files and passes it to cicc which compiles the CUDA code and generates PTX output.

The idea is that we give nvcc a custom cicc binary that overwrites the generated PTX file with the PTX file compiled with nvrtc.

This approach has many advantages, because we basically need't to rewrite the whole compilation pipeline. And on top of that we can only overwrite the PTX and still use all of the other functionality provided by cicc.

So.. we can just simply call all of the kernels from host code (!!!) because nvcc does all of the necessary linking and other magic for us. That means that we can use the nvrtcc with ordinary .cu files (with proper guards for host code) and we can start testing other configurations than just 1 thread and 1 block with nvrtc.

The implementation is not complete yet, I'm still missing some options, but I am curious what do you think about this!

@davebayer davebayer requested review from a team as code owners December 30, 2025 15:52
@github-project-automation github-project-automation bot moved this to Todo in CCCL Dec 30, 2025
@cccl-authenticator-app cccl-authenticator-app bot moved this from Todo to In Review in CCCL Dec 30, 2025
@NVIDIA NVIDIA deleted a comment from copy-pr-bot bot Dec 30, 2025
@davebayer davebayer self-assigned this Jan 6, 2026
@davebayer davebayer marked this pull request as draft January 11, 2026 21:26
@cccl-authenticator-app cccl-authenticator-app bot moved this from In Review to In Progress in CCCL Jan 11, 2026
@NVIDIA NVIDIA deleted a comment from copy-pr-bot bot Jan 11, 2026
@NVIDIA NVIDIA deleted a comment from copy-pr-bot bot Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant