[llvm] [offload] Fix CUDA args size by subtracting tail padding (PR #172249)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 14 20:30:35 PST 2025


================
@@ -1430,16 +1449,22 @@ Error CUDAKernelTy::launchImpl(GenericDeviceTy &GenericDevice,
                                AsyncInfoWrapperTy &AsyncInfoWrapper) const {
   CUDADeviceTy &CUDADevice = static_cast<CUDADeviceTy &>(GenericDevice);
 
+  // The args size passed in LaunchParams may have tail padding, which is not
+  // accepted by the CUDA driver.
+  if (ArgsSize > LaunchParams.Size)
+    return Plugin::error(ErrorCode::INVALID_BINARY, "mismatch in kernel arguments");
----------------
jhuber6 wrote:

Is it an invalid binary? I think it's invalid arguments. Do we not have that?

https://github.com/llvm/llvm-project/pull/172249


More information about the llvm-commits mailing list