[flang] [llvm] [flang-rt] Implement basic support for I/O from OpenMP GPU Offloading (PR #181039)
Slava Zakharin via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 13 13:52:58 PST 2026
================
@@ -0,0 +1,99 @@
+//===-- lib/runtime/io-api-gpu.cpp ------------------------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// Implements the subset of the I/O statement API needed for basic
+// list-directed output (PRINT *) of intrinsic types for the GPU.
+//
+// The RPC interface forwards each runtime call from the client to the server
+// using a shared buffer. These calls are buffered on the server, so only the
+// return value from 'BeginExternalListOutput' and 'EndIoStatement' are
+// meaningful.
+
+#include "io-api-gpu.h"
+#include "flang/Runtime/io-api.h"
+
+#include <shared/rpc.h>
+#include <shared/rpc_dispatch.h>
+
+namespace Fortran::runtime::io {
+// A weak reference to the RPC client used to submit calls to the server.
+[[gnu::weak, gnu::visibility("protected")]] rpc::Client client asm(
+ "__llvm_rpc_client");
+
+RT_EXT_API_GROUP_BEGIN
+
+Cookie IODEF(BeginExternalListOutput)(
+ ExternalUnit unitNumber, const char *sourceFile, int sourceLine) {
+ return rpc::dispatch<BeginExternalListOutput_Opcode>(client,
+ IODEF(BeginExternalListOutput), unitNumber, sourceFile, sourceLine);
----------------
vzakhari wrote:
Please use `IONAME` instead of `IODEF` here and below. `IODEF` may expand to more than just a name.
In addition, does `IODEF(BeginExternalListOutput)` represent a self-reference to this calling function or is it something else?
https://github.com/llvm/llvm-project/pull/181039
More information about the llvm-commits
mailing list