Skip to content

Use stream-aware scratch buffer in CUDA DeformConv - #31642

Merged
Akshay Sonawane (apsonawane) merged 5 commits into
mainfrom
msrc/deformconv-colbuffer-stream-fix
Aug 7, 2026
Merged

Use stream-aware scratch buffer in CUDA DeformConv#31642
Akshay Sonawane (apsonawane) merged 5 commits into
mainfrom
msrc/deformconv-colbuffer-stream-fix

Conversation

@apsonawane

Copy link
Copy Markdown
Contributor

This pull request updates the scratch buffer allocation method in the DeformConv CUDA kernel implementation. The main change is a switch from using a generic allocator interface to a more specialized scratch buffer utility, which may improve performance and code clarity.

Memory allocation improvements:

  • Replaced the use of IAllocator::MakeUniquePtr<T> and manual allocator retrieval with GetScratchBuffer<T> for allocating the col_buffer in deform_conv.cc. This streamlines temporary buffer allocation and ensures the buffer is tied to the compute stream.

Replace untagged temp allocation for col_buffer with GetScratchBuffer(..., compute_stream) to preserve StreamAwareBFCArena cross-stream safety.
The CUDA plugin build uses the adapter OpKernelContext, which exposes
GetGPUComputeStream() rather than GetComputeStream(). Update the scratch buffer
allocation site to use the plugin-compatible stream accessor so the file builds
cleanly in the plugin configuration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use OpKernelContext::GetComputeStream() for the scratch buffer allocation in
the CUDA DeformConv object build. This build path does not expose
GetGPUComputeStream(), so the previous call caused a compilation failure.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
auto-merge was automatically disabled August 7, 2026 16:32

Pull request was closed

@apsonawane
Akshay Sonawane (apsonawane) merged commit d9b4c3f into main Aug 7, 2026
161 of 178 checks passed
@apsonawane
Akshay Sonawane (apsonawane) deleted the msrc/deformconv-colbuffer-stream-fix branch August 7, 2026 18:23
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