Skip to content

Conversation

@ktro2828
Copy link
Contributor

@ktro2828 ktro2828 commented Jan 17, 2026

PR Type

  • Improvement

Related Links

Description

This pull request adds support for passing and managing CUDA streams in the image compression and rectification pipeline. The changes allow users to specify a CUDA stream for asynchronous operations, improving flexibility and integration with other GPU workloads. If no stream is provided, the code will create and manage its own non-blocking stream internally.

CUDA Stream Integration and Management

  • Added an optional cudaStream_t stream parameter (defaulting to nullptr) to factory and builder functions for compressors (create_compressor, make_nvjpeg_compressor, make_jetsonjpeg_compressor) and rectifiers (create_rectifier, make_npp_rectifier). This enables users to specify a CUDA stream for asynchronous processing. [1] [2] [3] [4]
  • Updated template overloads of create_compressor and create_rectifier to accept and forward the CUDA stream parameter, allowing postprocess callbacks to also leverage the specified stream. [1] [2] [3]

Internal Stream Ownership and Cleanup

  • Modified compressor (JetsonJPEGCompressor, NvJPEGCompressor) and rectifier (NppRectifier) implementations to track whether the stream is owned internally (own_stream_). If no stream is provided, a new non-blocking stream is created and destroyed by the object; otherwise, the provided stream is used without taking ownership. [1] [2] [3] [4] [5] [6] [7] [8] [9]

Header and Implementation Consistency

  • Updated all relevant headers and implementation files to include <cuda_runtime.h> and ensure function signatures and factory functions are consistent with the new stream parameter. [1] [2] [3] [4] [5]
  • Propagated the stream parameter through builder and factory functions so that the correct stream is used throughout the pipeline. [1] [2] [3]

These changes make the image processing pipeline more flexible and efficient for GPU-accelerated applications that require precise control over CUDA stream usage.

Review Procedure

Remarks

Pre-Review Checklist for the PR Author

PR Author should check the checkboxes below when creating the PR.

  • Assign PR to reviewer

Checklist for the PR Reviewer

Reviewers should check the checkboxes below before approval.

  • Commits are properly organized and messages are according to the guideline
  • (Optional) Unit tests have been written for new behavior
  • PR title describes the changes

Post-Review Checklist for the PR Author

PR Author should check the checkboxes below before merging.

  • All open points are addressed and tracked via issues or tickets

CI Checks

  • Build and test for PR: Required to pass before the merge.

…ctor

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
@ktro2828 ktro2828 changed the title refactor: allow to spefy cudaStream in builder function and constructor refactor: allow to specify cudaStream in builder function and constructor Jan 17, 2026
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