From 1c243ece9c426c18f6f5cd68669a11f724d5b09c Mon Sep 17 00:00:00 2001 From: kchristin Date: Fri, 25 Oct 2024 22:40:20 +0300 Subject: [PATCH] Store argPtrs of cuda kernels in a std array instead of a vector --- include/clad/Differentiator/Differentiator.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/clad/Differentiator/Differentiator.h b/include/clad/Differentiator/Differentiator.h index bf139ae59..fd917b365 100644 --- a/include/clad/Differentiator/Differentiator.h +++ b/include/clad/Differentiator/Differentiator.h @@ -126,9 +126,8 @@ CUDA_HOST_DEVICE T push(tape& to, ArgsT... val) { #if defined(__CUDACC__) && !defined(__CUDA_ARCH__) if (CUDAkernel) { constexpr size_t totalArgs = sizeof...(args) + sizeof...(Rest); - std::vector argPtrs; - argPtrs.reserve(totalArgs); - (argPtrs.push_back(static_cast(&args)), ...); + std::array argPtrs = {static_cast(&args)..., + static_cast(nullptr)...}; void* null_param = nullptr; for (size_t i = sizeof...(args); i < totalArgs; ++i)