Skip to content

fix(cuda.core): write NVRTC source to a temp file when debug or lineinfo is enabled - #2679

Draft
lijinf2 wants to merge 3 commits into
NVIDIA:mainfrom
lijinf2:fix_2422
Draft

fix(cuda.core): write NVRTC source to a temp file when debug or lineinfo is enabled#2679
lijinf2 wants to merge 3 commits into
NVIDIA:mainfrom
lijinf2:fix_2422

Conversation

@lijinf2

@lijinf2 lijinf2 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Description

closes #2422

When Program compiles C++ with debug=True or lineinfo=True and the caller
does not pass name=, NVRTC recorded the label default_program. That path
does not exist on disk, so cuda-gdb reported No such file or directory.

This change writes the in-memory source to a unique temp file
(caller_py__kernel_XXXXXXXX.cu, mkstemp, mode 0600) and passes that real
path to nvrtcCreateProgram. ProgramOptions.name is left unchanged so the
program cache key is unaffected. An explicit name= still wins. Write
failures fall back to the old label-only behavior. The temp file is removed
on close() / deallocation.

No public API or signature changes.

Checklist

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

@copy-pr-bot

copy-pr-bot Bot commented Aug 20, 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 Aug 20, 2026
@lijinf2 lijinf2 self-assigned this Aug 20, 2026
@lijinf2 lijinf2 added the bug Something isn't working label Aug 20, 2026
@lijinf2 lijinf2 added this to the cuda.core 1.3.0 milestone Aug 20, 2026
Keep materialize/unlink next to the Program lifetime that owns the temp file,
instead of as module-level functions.
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.

cuda.core: materialize NVRTC source to a real path when debug info is enabled

1 participant