Replace void* with std::byte* in AsyncRuntime
authoryijiagu <yijiagu@google.com>
Wed, 21 Dec 2022 03:00:26 +0000 (19:00 -0800)
committerEugene Zhulenev <ezhulenev@google.com>
Wed, 21 Dec 2022 03:17:35 +0000 (19:17 -0800)
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

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

index ba59c39..3f65ec4 100644 (file)
@@ -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
index 42ec1ce..00cd27b 100644 (file)
@@ -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;