Skip to content

Comments

203 use const instead of const reference on device function parameters that are computed inside the kernel#204

Merged
morousg merged 3 commits intoLTS-C++17from
203-use-const-instead-of-const-on-device-function-parameters-that-are-computed-inside-the-kernel
Feb 18, 2026
Merged

203 use const instead of const reference on device function parameters that are computed inside the kernel#204
morousg merged 3 commits intoLTS-C++17from
203-use-const-instead-of-const-on-device-function-parameters-that-are-computed-inside-the-kernel

Conversation

@morousg
Copy link
Member

@morousg morousg commented Feb 18, 2026

No description provided.

…, instead of const reference, to be more consistent with the reality of the variables and values. If nvcc where very strict, or there where no inlining in one function, it would trigger local memory usage.
@morousg morousg self-assigned this Feb 18, 2026
Copilot AI review requested due to automatic review settings February 18, 2026 15:53
@morousg morousg changed the title 203 use const instead of const on device function parameters that are computed inside the kernel 203 use const instead of const reference on device function parameters that are computed inside the kernel Feb 18, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request changes function parameters from const T& (const reference) to const T (const value) for device function parameters in CUDA/HIP kernels. The motivation is to avoid local memory accesses on GPUs when passing small computed types like Point and Size, which are more efficiently passed by value on GPU architectures.

Changes:

  • Modified parameter passing convention from const reference to const value for small computed types (Point, Size, etc.) across device functions
  • Updated get_opt function in operation_tuple.h to use forwarding references for better flexibility
  • Consolidated multiple get function overloads in tuple.h into a single templated version using perfect forwarding
  • Removed an unused build_details function overload in data_parallel_patterns.h

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
operation_tuple.h Updated get_opt to use forwarding references; improved comment clarity
tuple.h Consolidated four get overloads into one using perfect forwarding
vector_operations.h Changed exec parameters for UnaryType and BinaryV operations to pass by value
parent_operations.h Updated macros to pass Point and InputType parameters by value
instantiable_operations.h Changed InputFoldType constructor and operator| parameters to pass by value
fused_operation.h Updated exec_helper methods to pass Point and InputType by value
batch_operations.h Changed exec and utility function parameters to pass by value, including ThreadFusionType
data_parallel_patterns.h Updated operate/execute methods; removed unused build_details overload
rect.h, rawptr.h, ptr_nd.h Changed Point and Size parameters in constructors/methods to pass by value
warping.h, saturate.h, resize.h, etc. Updated algorithm exec functions to pass small types by value
memory_operations.h Changed parameters including ThreadFusionType to pass by value

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

@morousg morousg merged commit b4c3bf1 into LTS-C++17 Feb 18, 2026
16 checks passed
@morousg morousg deleted the 203-use-const-instead-of-const-on-device-function-parameters-that-are-computed-inside-the-kernel branch February 18, 2026 16:10
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.

1 participant