Skip to content

Cuda option to control initial graph capture - #2416

Open
Menkib64 wants to merge 2 commits into
LeelaChessZero:masterfrom
Menkib64:cuda_option_for_initial_graph_capture
Open

Cuda option to control initial graph capture#2416
Menkib64 wants to merge 2 commits into
LeelaChessZero:masterfrom
Menkib64:cuda_option_for_initial_graph_capture

Conversation

@Menkib64

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 29, 2026 14:44

Copilot AI 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.

Pull request overview

Adds a new capture_graphs_onload CUDA/cuDNN backend option that lets users skip the expensive constructor-time CUDA graph preallocation (graphs will still be captured lazily on first use via ComputeBlocking). Also tweaks the preallocation loop's starting index from 0 to 1, so the captured batch sizes are 1..GetMiniBatchSize() rather than 1..GetMiniBatchSize()+1.

Changes:

  • New capture_graphs_onload option (default true) gating the on-load graph preallocation block in both CUDA and cuDNN backends.
  • Loop start index changed from 0 to 1 to avoid over-capturing one extra batch size beyond GetMiniBatchSize().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/neural/backends/cuda/network_cuda.cc Add early return on capture_graphs_onload=false; fix preallocation loop range.
src/neural/backends/cuda/network_cudnn.cc Same change applied to cuDNN backend.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants