[llvm] [offload] Fix CUDA args size by subtracting tail padding (PR #172249)
Kevin Sala Penades via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 14 20:43:12 PST 2025
================
@@ -173,11 +174,29 @@ struct CUDAKernelTy : public GenericKernelTy {
}
private:
+ /// Initialize the size of the arguments.
+ Error initArgsSize() {
+ CUresult Res;
+ size_t ArgOffset, ArgSize;
+ size_t Arg = 0;
+
+ // Find the last argument to know the total size of the arguments.
+ while ((Res = cuFuncGetParamInfo(Func, Arg++, &ArgOffset, &ArgSize)) == CUDA_SUCCESS)
+ ArgsSize = ArgOffset + ArgSize;
+
+ if (Res != CUDA_ERROR_INVALID_VALUE)
----------------
kevinsala wrote:
`ArgsSize` initialized to zero in the declaration. But I will move the initialization here to be clearer.
https://github.com/llvm/llvm-project/pull/172249
More information about the llvm-commits
mailing list