[Mlir-commits] [mlir] 4109276 - Replace void* with std::byte* in AsyncRuntime

Eugene Zhulenev llvmlistbot at llvm.org
Tue Dec 20 19:17:40 PST 2022


Author: yijiagu
Date: 2022-12-20T19:17:35-08:00
New Revision: 4109276fb46ad36c320ebb738eadb4ab2ecc4763

URL: https://github.com/llvm/llvm-project/commit/4109276fb46ad36c320ebb738eadb4ab2ecc4763
DIFF: https://github.com/llvm/llvm-project/commit/4109276fb46ad36c320ebb738eadb4ab2ecc4763.diff

LOG: Replace void* with std::byte* in AsyncRuntime

Replace void* with std::byte* in AsyncRuntime to make it clear that these pointers point to a memory region.

Reviewed By: ezhulenev

Differential Revision: https://reviews.llvm.org/D140428

Added: 
    

Modified: 
    mlir/include/mlir/ExecutionEngine/AsyncRuntime.h
    mlir/lib/ExecutionEngine/AsyncRuntime.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/ExecutionEngine/AsyncRuntime.h b/mlir/include/mlir/ExecutionEngine/AsyncRuntime.h
index ba59c39fac569..3f65ec47841ef 100644
--- a/mlir/include/mlir/ExecutionEngine/AsyncRuntime.h
+++ b/mlir/include/mlir/ExecutionEngine/AsyncRuntime.h
@@ -14,6 +14,7 @@
 #ifndef MLIR_EXECUTIONENGINE_ASYNCRUNTIME_H_
 #define MLIR_EXECUTIONENGINE_ASYNCRUNTIME_H_
 
+#include <cstddef>
 #include <stdint.h>
 
 #ifdef mlir_async_runtime_EXPORTS
@@ -38,7 +39,7 @@ using AsyncGroup = struct AsyncGroup;
 using AsyncValue = struct AsyncValue;
 
 // Async value payload stored in a memory owned by the async.value.
-using ValueStorage = void *;
+using ValueStorage = std::byte *;
 
 // Async runtime uses LLVM coroutines to represent asynchronous tasks. Task
 // function is a coroutine handle and a resume function that continue coroutine

diff  --git a/mlir/lib/ExecutionEngine/AsyncRuntime.cpp b/mlir/lib/ExecutionEngine/AsyncRuntime.cpp
index 42ec1ce02005d..00cd27b25be80 100644
--- a/mlir/lib/ExecutionEngine/AsyncRuntime.cpp
+++ b/mlir/lib/ExecutionEngine/AsyncRuntime.cpp
@@ -199,7 +199,7 @@ struct AsyncValue : public RefCounted {
   std::atomic<State::StateEnum> state;
 
   // Use vector of bytes to store async value payload.
-  std::vector<int8_t> storage;
+  std::vector<std::byte> storage;
 
   // Pending awaiters are guarded by a mutex.
   std::mutex mu;


        


More information about the Mlir-commits mailing list