[libc-commits] [libc] [libc] Export the RPC interface from `libc` (PR #71432)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Mon Nov 6 16:12:44 PST 2023


================
@@ -1,15 +1,41 @@
+def RPCPortT : NamedType<"rpc_port_t">;
+def RPCPortPtrT : PtrType<RPCPortT>;
+def RPCBufferT : NamedType<"rpc_buffer_t">;
+def RPCBufferPtrT : PtrType<RPCBufferT>;
+def RPCCallbackT : NamedType<"rpc_callback_t">;
+
 def GPUExtensions : StandardSpec<"GPUExtensions"> {
   HeaderSpec RPC = HeaderSpec<
     "gpu/rpc.h",
     [], // Macros
-    [], // Types
+    [RPCPortT, RPCBufferT,  RPCCallbackT, SizeTType], // Types
     [], // Enumerations
     [
         FunctionSpec<
             "rpc_host_call",
             RetValSpec<VoidType>,
             [ArgSpec<VoidPtr>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
         >,
+        FunctionSpec<
+            "rpc_open_port",
+            RetValSpec<RPCPortT>,
+            [ArgSpec<UnsignedIntType>]
+        >,
+        FunctionSpec<
+            "rpc_send",
+            RetValSpec<VoidType>,
----------------
jhuber6 wrote:

I don't think that's necessary, there shouldn't be any failure modes once a port has been opened. Because we are executing in a unified address space, we don't need to worry about network effects like gRPC or similar. Internally we pretty much just spin until memory happens and then continue. We could potentially expand the internface to allow the lambda we're copying to fail, but I don't think there's any utility in that. If it's for consistently I could make it return an int and just hardwire it to zero.

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


More information about the libc-commits mailing list