[clang] [llvm] [LLVMOffload] Add more error types + GetLastError/PeekAtLastError (PR #213389)

Kevin Sala Penades via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 07:21:22 PDT 2026


================
@@ -11,15 +11,31 @@
 
 #include <cstdint>
 
+#if defined(__GNUC__)
+#define LLVM_OFFLOAD_HIDDEN __attribute__((visibility("hidden")))
+#else
+#define LLVM_OFFLOAD_HIDDEN
+#endif
+
 enum Error_t : uint32_t {
   Success = 0,
   ErrorInvalidValue = 1,
   ErrorInvalidDevice = 2,
   ErrorUnknown = 3,
+  ErrorInvalidResourceHandle = 4,
+  ErrorInvalidConfiguration = 5,
 };
 
 const char *GetErrorName(Error_t Error);
 
 const char *GetErrorString(Error_t Error);
 
+Error_t GetLastError();
+
+Error_t PeekAtLastError();
+
+LLVM_OFFLOAD_HIDDEN Error_t SetLastError(Error_t Error);
----------------
kevinsala wrote:

The declarations on this header seem to be exposed to the user via `{cuda,hip}_runtime.h`. The user will technically have access to the declaration of this internal function, but not to its definition. I think we should keep the public API routines separated from the internal ones; i.e., no internal routines should appear in the `{cuda,hip}_runtime.h` headers.

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


More information about the llvm-commits mailing list