[llvm] [Offload] Ensure all `llvm::Error`s are handled (PR #137339)

Ross Brunton via llvm-commits llvm-commits at lists.llvm.org
Thu May 1 07:46:11 PDT 2025


================
@@ -308,9 +308,11 @@ ol_impl_result_t olMemAlloc_impl(ol_device_handle_t Device,
                                  void **AllocationOut) {
   auto Alloc =
       Device->Device->dataAlloc(Size, nullptr, convertOlToPluginAllocTy(Type));
-  if (!Alloc)
+  if (!Alloc) {
+    llvm::consumeError(Alloc.takeError());
     return {OL_ERRC_OUT_OF_RESOURCES,
             formatv("Could not create allocation on device {0}", Device).str()};
+  }
----------------
RossBrunton wrote:

I've pushed a change which makes all error handling go through `fromError`. This means that all the error codes from PI are useless at the moment, but once PI gets "proper" error codes it should work better.

Although that does bring up a question... Is it worth having `ol_impl_result_t` at all? @callumfare any objections to removing it and having the "impl" functions just return `llvm::Error` directly up until the C boundry?

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


More information about the llvm-commits mailing list