[llvm] [Offload] Fix return error with a condition (PR #152876)

Kevin Sala Penades via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 9 12:18:53 PDT 2025


https://github.com/kevinsala created https://github.com/llvm/llvm-project/pull/152876

None

>From 9f65b67364bb4001adfaf2664c4b92b6ab761c3c Mon Sep 17 00:00:00 2001
From: Kevin Sala <salapenades1 at llnl.gov>
Date: Sat, 9 Aug 2025 12:03:09 -0700
Subject: [PATCH] [Offload] Fix return error with a condition

---
 offload/plugins-nextgen/cuda/src/rtl.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/offload/plugins-nextgen/cuda/src/rtl.cpp b/offload/plugins-nextgen/cuda/src/rtl.cpp
index f3f3783b3ce7c..e94f3f6af7dd4 100644
--- a/offload/plugins-nextgen/cuda/src/rtl.cpp
+++ b/offload/plugins-nextgen/cuda/src/rtl.cpp
@@ -1317,9 +1317,10 @@ Error CUDAKernelTy::launchImpl(GenericDeviceTy &GenericDevice,
   if (MaxDynCGroupMem >= MaxDynCGroupMemLimit) {
     CUresult AttrResult = cuFuncSetAttribute(
         Func, CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES, MaxDynCGroupMem);
-    return Plugin::check(
-        AttrResult,
-        "Error in cuLaunchKernel while setting the memory limits: %s");
+    if (auto Err = Plugin::check(
+            AttrResult,
+            "Error in cuLaunchKernel while setting the memory limits: %s"))
+      return Err;
     MaxDynCGroupMemLimit = MaxDynCGroupMem;
   }
 



More information about the llvm-commits mailing list