[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:09:46 PST 2023


================
@@ -0,0 +1,26 @@
+//===---------- GPU implementation of the external RPC port interface -----===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/gpu/rpc_open_port.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/GPU/utils.h"
+#include "src/__support/RPC/rpc_client.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+static_assert(sizeof(rpc_port_t) == sizeof(rpc::Client::Port), "ABI mismatch");
----------------
jhuber6 wrote:

The point is that we can't export the original C++ definitions, this was something Siva was adamant about because we didn't want details from `libc` leaking from the headers. So basically `rpc_client.h` is exported, but in the implementation `.cpp` file we make sure that the definitions are compatible with what we expect. That ensures that if we change the interface this doens't silently break.

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


More information about the libc-commits mailing list