From 5ae18e5f81a1bc183e9e5b7b2915d3abdf9f77d1 Mon Sep 17 00:00:00 2001 From: Joseph Lee Date: Mon, 20 Jul 2026 13:24:08 -0400 Subject: [PATCH 01/21] Define runtime transport layer interface for backline backends --- runtime/include/Transport.hpp | 190 ++++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 runtime/include/Transport.hpp diff --git a/runtime/include/Transport.hpp b/runtime/include/Transport.hpp new file mode 100644 index 0000000000..a601bc2a02 --- /dev/null +++ b/runtime/include/Transport.hpp @@ -0,0 +1,190 @@ +// Copyright 2026 Xanadu Quantum Technologies Inc. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once +#include +#include +#include + +namespace catalyst::transport { + +/** + * @brief Data-plane strategy: which engine issues the transfer. + */ +enum class DataPath : std::uint8_t { + CpuVerbs, // Plain ibverbs on CPU. + GpuEngine, // Gpu-initiated comms. + Other, +}; + +/** + * @brief Memory kind: selects the allocation and registration path. + */ +enum class MemKind : std::uint8_t { + CpuRam, + GpuHbm, + Ddr, + Other, +}; + +/** + * @brief Out-of-band connection parameters for bringing up a session. + */ +struct ConnectInfo { + std::string peer; + std::uint16_t oob_port; +}; + +/** + * @brief Locally allocated and registered memory region. + */ +struct MemRegion { + void *addr = nullptr; + std::uint64_t size = 0; + std::uint32_t lkey = 0; + std::uint32_t rkey = 0; + MemKind kind = MemKind::CpuRam; +}; + +/** + * @brief Handle to a peer's memory region, exchanged over the out-of-band channel. + */ +struct PeerRef { + std::uint32_t rkey = 0; + std::uint64_t remote_addr = 0; + std::uint64_t size = 0; +}; + +/** + * @brief Configuration for the data-movement channel a session uses. + */ +struct ChannelDesc { + DataPath data_path = DataPath::CpuVerbs; + bool persistent = true; +}; + +/** + * @brief Stateful transport session shared by the controller and coprocessor roles. + * + * Methods must be called in this order: + * 1. connect - bring up QPs + the out-of-band channel + * 2. alloc_memory - register the region (needs the connected context) + * 3. exchange_keys - swap region handles over the out-of-band channel + * 4. establish_channel - program the channel from the local + peer regions + * 5. (coprocessor) set_coprocessor_fn / (controller) set_max_in_flight - before start() + * 6. start / collect / stop + */ +class TransportSession { + public: + virtual ~TransportSession() = default; + + /** + * @brief Bring up the connection (out-of-band handshake and QP transition to RTS). + * + * @param info Peer address and out-of-band port. + * + * @return `int` + */ + virtual int connect(const ConnectInfo &info) = 0; + + /** + * @brief Allocate and register a memory region on the device. + * + * @param size Size of the region in bytes. + * @param kind Memory kind selecting the allocation and registration path. + * @param access Access flags for the registration. + * + * @return `MemRegion` The allocated and registered region. + */ + virtual MemRegion alloc_memory(std::size_t size, MemKind kind, std::uint32_t access) = 0; + + /** + * @brief Advertise a local region and receive the peer's region over the out-of-band channel. + * + * @param local The local region to advertise. + * + * @return `PeerRef` The peer's advertised region. + */ + virtual PeerRef exchange_keys(const MemRegion &local) = 0; + + /** + * @brief Program the data movement this session will run (single channel per session). + * + * @param desc Channel configuration. + * @param local The local memory region. + * @param peer The peer's memory region. + */ + virtual void establish_channel(const ChannelDesc &desc, const MemRegion &local, + const PeerRef &peer) = 0; + + /** + * @brief Launch the engine (non-blocking; runs until stop()). + */ + virtual void start() = 0; + + /** + * @brief Wait for a result and write it out. + * + * @param outputs Array of output buffers to write into. + * @param n Number of output buffers. + * + * @return `int` + */ + virtual int collect(void *const *outputs, std::size_t n) = 0; + + /** + * @brief Stop the engine and join. Idempotent. + */ + virtual void stop() = 0; +}; + +/** + * @brief Controller role: writes syndromes out and receives corrections. + */ +class ControllerSession : public TransportSession { + public: + /** + * @brief Set the sliding-window depth: how many syndromes to keep in flight. + * + * Call before start(). A value of 1 means strict one-in-flight. + * + * @param n Maximum number of syndromes in flight. + */ + virtual void set_max_in_flight(std::uint32_t n) = 0; +}; + +/** + * @brief Opaque function to run on the coprocessor. May include a persistent kernel on the GPU. + */ +using CoprocessorFn = std::size_t (*)(const void *in, std::size_t in_len, void *out, + std::size_t out_cap, void *ctx); + +/** + * @brief Coprocessor role: receives syndromes, decodes, and returns corrections. + */ +class CoprocessorSession : public TransportSession { + public: + /** + * @brief Bind the coprocessor function this session runs. + * + * Call before start(). `fn` is a local function pointer; `ctx` is passed + * back to `fn` on every invocation and may be null. + * + * @param fn The coprocessor function to run per received syndrome. + * @param ctx Opaque context passed to `fn` on each invocation; may be null. + */ + virtual void set_coprocessor_fn(CoprocessorFn fn, void *ctx) = 0; +}; + +} // namespace catalyst::transport From 5e7633379073f71d8ef7370f29a46a4711abef30 Mon Sep 17 00:00:00 2001 From: Joseph Lee Date: Mon, 20 Jul 2026 13:28:01 -0400 Subject: [PATCH 02/21] update changelog --- doc/releases/changelog-dev.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 532835a10e..3ccd5df3c2 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -12,6 +12,9 @@

Improvements 🛠

+* A new runtime transport layer for remote/local executors is introduced. + [(#3043)](https://github.com/PennyLaneAI/catalyst/pull/3043) + * A `BufferizableOpInterface` implementation is now added for `catalyst.launch_kernel` operation and it is now bufferizable. [(#3024)](https://github.com/PennyLaneAI/catalyst/pull/3024) From 279a2b4962f17582b83b933761aa1dcbb98ff467 Mon Sep 17 00:00:00 2001 From: Joseph Lee Date: Mon, 20 Jul 2026 14:35:20 -0400 Subject: [PATCH 03/21] comments --- runtime/include/Transport.hpp | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/runtime/include/Transport.hpp b/runtime/include/Transport.hpp index a601bc2a02..d8813d22cc 100644 --- a/runtime/include/Transport.hpp +++ b/runtime/include/Transport.hpp @@ -71,7 +71,6 @@ struct PeerRef { */ struct ChannelDesc { DataPath data_path = DataPath::CpuVerbs; - bool persistent = true; }; /** @@ -82,7 +81,7 @@ struct ChannelDesc { * 2. alloc_memory - register the region (needs the connected context) * 3. exchange_keys - swap region handles over the out-of-band channel * 4. establish_channel - program the channel from the local + peer regions - * 5. (coprocessor) set_coprocessor_fn / (controller) set_max_in_flight - before start() + * 5. (coprocessor) set_coprocessor_fn before start() * 6. start / collect / stop */ class TransportSession { @@ -150,19 +149,9 @@ class TransportSession { }; /** - * @brief Controller role: writes syndromes out and receives corrections. + * @brief Controller role: writes messages out and receives corrections. */ -class ControllerSession : public TransportSession { - public: - /** - * @brief Set the sliding-window depth: how many syndromes to keep in flight. - * - * Call before start(). A value of 1 means strict one-in-flight. - * - * @param n Maximum number of syndromes in flight. - */ - virtual void set_max_in_flight(std::uint32_t n) = 0; -}; +class ControllerSession : public TransportSession {}; /** * @brief Opaque function to run on the coprocessor. May include a persistent kernel on the GPU. @@ -171,7 +160,7 @@ using CoprocessorFn = std::size_t (*)(const void *in, std::size_t in_len, void * std::size_t out_cap, void *ctx); /** - * @brief Coprocessor role: receives syndromes, decodes, and returns corrections. + * @brief Coprocessor role: receives messages, process, and returns corrections. */ class CoprocessorSession : public TransportSession { public: @@ -181,7 +170,7 @@ class CoprocessorSession : public TransportSession { * Call before start(). `fn` is a local function pointer; `ctx` is passed * back to `fn` on every invocation and may be null. * - * @param fn The coprocessor function to run per received syndrome. + * @param fn The coprocessor function to run per received message. * @param ctx Opaque context passed to `fn` on each invocation; may be null. */ virtual void set_coprocessor_fn(CoprocessorFn fn, void *ctx) = 0; From a319b39d7fd8961170530a8856f4ed7c6a406de0 Mon Sep 17 00:00:00 2001 From: Joseph Lee Date: Mon, 20 Jul 2026 15:15:12 -0400 Subject: [PATCH 04/21] update changelog --- doc/releases/changelog-dev.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 3ccd5df3c2..42490dbf5d 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -461,6 +461,7 @@ JiaRung Jian, Jacob Kitchen, Korbinian Kottmann, Christina Lee, +Joseph Lee, Rylan Malarchick, Mehrdad Malekmohammadi, River McCubbin, From c523f677106b61d6236606df8bb68c25fe97a2c0 Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Mon, 20 Jul 2026 15:41:04 -0400 Subject: [PATCH 05/21] Transport Layer Loader is added --- runtime/CMakeLists.txt | 1 + runtime/include/Transport.hpp | 24 +- runtime/include/TransportBackend.h | 55 +++++ runtime/include/TransportCAPI.h | 107 +++++++++ runtime/lib/CMakeLists.txt | 4 + runtime/lib/transport/CMakeLists.txt | 19 ++ runtime/lib/transport/TransportCAPI.cpp | 281 ++++++++++++++++++++++++ 7 files changed, 489 insertions(+), 2 deletions(-) create mode 100644 runtime/include/TransportBackend.h create mode 100644 runtime/include/TransportCAPI.h create mode 100644 runtime/lib/transport/CMakeLists.txt create mode 100644 runtime/lib/transport/TransportCAPI.cpp diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 9fe951ed2a..8cf8c3a201 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -15,6 +15,7 @@ option(RUNTIME_ENABLE_WARNINGS "Enable -Wall and -Werror" ON) option(ENABLE_OPENQASM "Build OpenQasm backend device" OFF) option(ENABLE_OQD "Build OQD backend device" OFF) +option(ENABLE_TRANSPORT "Build the backend-agnostic transport loader (rt_transport)" OFF) set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) diff --git a/runtime/include/Transport.hpp b/runtime/include/Transport.hpp index d8813d22cc..241ec5bdf4 100644 --- a/runtime/include/Transport.hpp +++ b/runtime/include/Transport.hpp @@ -136,22 +136,42 @@ class TransportSession { * @brief Wait for a result and write it out. * * @param outputs Array of output buffers to write into. + * @param output_bytes Array of output buffer sizes. * @param n Number of output buffers. * * @return `int` */ - virtual int collect(void *const *outputs, std::size_t n) = 0; + virtual int collect(void *const *outputs, const std::size_t *output_bytes, std::size_t n) = 0; /** * @brief Stop the engine and join. Idempotent. */ virtual void stop() = 0; + + /** + * @brief Last round-trip time, in nanoseconds (for testing purposes). + * + * @return `std::uint64_t` + */ + virtual std::uint64_t last_rtt_ns() const { return 0; } }; /** * @brief Controller role: writes messages out and receives corrections. */ -class ControllerSession : public TransportSession {}; +class ControllerSession : public TransportSession { + public: + // Build the work item in slot `work_item_idx` from `schema`. + virtual void commit_work_item(std::uint32_t work_item_idx, std::uint64_t in_bytes, + std::uint64_t out_bytes) = 0; + + // Fire one round using work item `work_item_idx` and whatever payload is currently in + // data_slot(). Pairs with a subsequent collect(). Returns 0 on success. + virtual int kick(std::uint32_t work_item_idx = 0) = 0; + + // Current round's outbound slot in the transport-owned ring. + virtual void *data_slot() = 0; +}; /** * @brief Opaque function to run on the coprocessor. May include a persistent kernel on the GPU. diff --git a/runtime/include/TransportBackend.h b/runtime/include/TransportBackend.h new file mode 100644 index 0000000000..87974aba7d --- /dev/null +++ b/runtime/include/TransportBackend.h @@ -0,0 +1,55 @@ +// Copyright 2026 Xanadu Quantum Technologies Inc. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// The plugin ABI for out-of-tree transport backends. +// +// A transport backend is a shared library that implements a TransportSession role and exports a +// factory symbol. + +#pragma once +#ifndef TRANSPORTBACKEND_H +#define TRANSPORTBACKEND_H + +#include +#include + +#include "Transport.hpp" + +#define CATALYST_TRANSPORT_CONTROLLER_FACTORY_SYMBOL "CatalystTransportControllerFactory" + +// The factory signature backends must export with C linkage. +extern "C" { +using CatalystTransportControllerFactoryFn = catalyst::transport::ControllerSession *(const char *); +} + +// A helper template macro to generate the Factory function. +// e.g. GENERATE_TRANSPORT_CONTROLLER_FACTORY(CatalystTransportController, make_controller) +// where `make_controller(const std::string &config) -> ControllerSession*`. +#define GENERATE_TRANSPORT_CONTROLLER_FACTORY(IDENTIFIER, BUILDER) \ + extern "C" catalyst::transport::ControllerSession *IDENTIFIER##Factory(const char *config) \ + { \ + try { \ + return (BUILDER)(config ? std::string(config) : std::string()); \ + } \ + catch (const std::exception &e) { \ + std::fprintf(stderr, "[transport] controller factory failed: %s\n", e.what()); \ + return nullptr; \ + } \ + catch (...) { \ + std::fprintf(stderr, "[transport] controller factory failed: unknown exception\n"); \ + return nullptr; \ + } \ + } + +#endif // TRANSPORTBACKEND_H diff --git a/runtime/include/TransportCAPI.h b/runtime/include/TransportCAPI.h new file mode 100644 index 0000000000..2f0a4aa312 --- /dev/null +++ b/runtime/include/TransportCAPI.h @@ -0,0 +1,107 @@ +// Copyright 2026 Xanadu Quantum Technologies Inc. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// TransportCAPI.h - C entry points the Catalyst compiler emits to drive a transport session. +// +// The backend is a separate plugin `.so` the runtime dlopen's at session create (see +// TransportBackend.h) + +#pragma once +#ifndef TRANSPORTCAPI_H +#define TRANSPORTCAPI_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// Opaque transport session handle +typedef struct CatalystTransportSession CatalystTransportSession; + +// Return codes: 0 == success; negative == error +enum { + CATALYST_TRANSPORT_OK = 0, + CATALYST_TRANSPORT_ERR = -1, // Generic exception + CATALYST_TRANSPORT_ERR_MEMORY = -2, // Memory error + CATALYST_TRANSPORT_ERR_TIMEOUT = -3, // Timeout error + CATALYST_TRANSPORT_ERR_STUCK = -4, // Something got stuck +}; + +// DataPath enum (mirrors catalyst::transport::DataPath) +enum { + CATALYST_TRANSPORT_PATH_CPU_VERBS = 0, + CATALYST_TRANSPORT_PATH_GPU_ENGINE = 1, + CATALYST_TRANSPORT_PATH_OTHER = 2, +}; + +// MemKind enum (mirrors catalyst::transport::MemKind) +enum { + CATALYST_TRANSPORT_MEM_CPU_RAM = 0, + CATALYST_TRANSPORT_MEM_GPU_HBM = 1, + CATALYST_TRANSPORT_MEM_DDR = 2, + CATALYST_TRANSPORT_MEM_OTHER = 3, +}; + +// ibverbs access flags for the advertised reply region +enum { + CATALYST_TRANSPORT_ACCESS_REPLY = 7, +}; + +// Registered memory region handed back to the caller +typedef struct { + void *addr; + uint64_t size; + uint32_t lkey; + uint32_t rkey; + int32_t kind; // one of MemKind enum values +} CatalystTransportMemRegion; + +// Remote peer region descriptor +typedef struct { + uint32_t rkey; + uint64_t remote_addr; + uint64_t size; +} CatalystTransportPeerRef; + +// Create a controller session from a named backend plugin `.so` (dlopen'd by the runtime). +// `config` is the backend's "key=value;..." string. Returns NULL on failure. +CatalystTransportSession *__catalyst__transport__controller_create(const char *backend_lib, + const char *config); + +void __catalyst__transport__close(CatalystTransportSession *s); +int __catalyst__transport__connect(CatalystTransportSession *s, const char *peer, + uint16_t oob_port); +int __catalyst__transport__alloc_reply(CatalystTransportSession *s, uint64_t size, int32_t mem_kind, + uint32_t access, CatalystTransportMemRegion *out); + +int __catalyst__transport__exchange_keys(CatalystTransportSession *s, + CatalystTransportPeerRef *out); +int __catalyst__transport__establish_channel(CatalystTransportSession *s, int32_t data_path, + const CatalystTransportPeerRef *peer); +int __catalyst__transport__commit_work_item(CatalystTransportSession *s, uint32_t work_item_idx, + uint64_t in_bytes, uint64_t out_bytes); +void *__catalyst__transport__data_slot(CatalystTransportSession *s); +int __catalyst__transport__kick(CatalystTransportSession *s, uint32_t work_item_idx); +int __catalyst__transport__collect(CatalystTransportSession *s, void *correction, uint64_t bytes); +uint64_t __catalyst__transport__last_rtt_ns(CatalystTransportSession *s); +void __catalyst__transport__stop(CatalystTransportSession *s); +void __catalyst__transport__destroy(CatalystTransportSession *s); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // TRANSPORTCAPI_H diff --git a/runtime/lib/CMakeLists.txt b/runtime/lib/CMakeLists.txt index eb7a77b63d..64d07dcd95 100644 --- a/runtime/lib/CMakeLists.txt +++ b/runtime/lib/CMakeLists.txt @@ -68,3 +68,7 @@ add_subdirectory(QEC) if(ENABLE_OQD) add_subdirectory(OQDcapi) endif() + +if(ENABLE_TRANSPORT) +add_subdirectory(transport) +endif() diff --git a/runtime/lib/transport/CMakeLists.txt b/runtime/lib/transport/CMakeLists.txt new file mode 100644 index 0000000000..b2cb3a38c1 --- /dev/null +++ b/runtime/lib/transport/CMakeLists.txt @@ -0,0 +1,19 @@ +############################################### +# library rt_transport # +############################################### + +add_library(rt_transport SHARED TransportCAPI.cpp) + +target_include_directories(rt_transport + PUBLIC + ${runtime_includes} + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/lib/backend/common # DynamicLibraryLoader.hpp +) + +target_link_libraries(rt_transport PRIVATE + ${CMAKE_DL_LIBS} # dlopen/dlsym for backend plugins +) + +set_property(TARGET rt_transport PROPERTY POSITION_INDEPENDENT_CODE ON) diff --git a/runtime/lib/transport/TransportCAPI.cpp b/runtime/lib/transport/TransportCAPI.cpp new file mode 100644 index 0000000000..617f05e6c3 --- /dev/null +++ b/runtime/lib/transport/TransportCAPI.cpp @@ -0,0 +1,281 @@ +// Copyright 2026 Xanadu Quantum Technologies Inc. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "TransportCAPI.h" + +#include +#include +#include +#include +#include +#include + +#include "DynamicLibraryLoader.hpp" +#include "Transport.hpp" +#include "TransportBackend.h" + +using catalyst::transport::ChannelDesc; +using catalyst::transport::ConnectInfo; +using catalyst::transport::ControllerSession; +using catalyst::transport::DataPath; +using catalyst::transport::MemKind; +using catalyst::transport::MemRegion; +using catalyst::transport::PeerRef; + +// The opaque handle +struct CatalystTransportSession { + std::unique_ptr backend; + ControllerSession *sess = nullptr; // heap-allocated by the backend factory + MemRegion reply = {}; + bool have_reply = false; +}; + +namespace { + +MemKind to_mem_kind(std::int32_t k) +{ + switch (k) { + case CATALYST_TRANSPORT_MEM_CPU_RAM: + return MemKind::CpuRam; + case CATALYST_TRANSPORT_MEM_GPU_HBM: + return MemKind::GpuHbm; + case CATALYST_TRANSPORT_MEM_DDR: + return MemKind::Ddr; + case CATALYST_TRANSPORT_MEM_OTHER: + return MemKind::Other; + default: + return MemKind::Ddr; + } +} + +DataPath to_data_path(std::int32_t p) +{ + switch (p) { + case CATALYST_TRANSPORT_PATH_CPU_VERBS: + return DataPath::CpuVerbs; + case CATALYST_TRANSPORT_PATH_GPU_ENGINE: + return DataPath::GpuEngine; + case CATALYST_TRANSPORT_PATH_OTHER: + default: + return DataPath::Other; + } +} + +template int guard(Fn &&fn) +{ + try { + return fn(); + } + catch (const std::exception &e) { + std::cerr << "[transport] " << e.what() << "\n"; + return CATALYST_TRANSPORT_ERR; + } + catch (...) { + return CATALYST_TRANSPORT_ERR; + } +} + +} // namespace + +extern "C" { + +CatalystTransportSession *__catalyst__transport__controller_create(const char *backend_lib, + const char *config) +{ + try { + if (!backend_lib || !*backend_lib) { + std::cerr << "[transport] no backend library given\n"; + return nullptr; + } + auto h = std::make_unique(); + h->backend = std::make_unique(backend_lib); + auto *factory = h->backend->getSymbol( + CATALYST_TRANSPORT_CONTROLLER_FACTORY_SYMBOL); + h->sess = factory(config ? config : ""); + if (!h->sess) { + std::cerr << "[transport] backend factory returned null for config: " + << (config ? config : "") << "\n"; + return nullptr; + } + return h.release(); + } + catch (const std::exception &e) { + std::cerr << "[transport] controller_create: " << e.what() << "\n"; + return nullptr; + } + catch (...) { + return nullptr; + } +} + +int __catalyst__transport__connect(CatalystTransportSession *s, const char *peer, + std::uint16_t oob_port) +{ + if (!s || !s->sess) { + return CATALYST_TRANSPORT_ERR; + } + return guard([&] { + ConnectInfo info; + info.peer = peer ? peer : ""; + info.oob_port = oob_port; + return s->sess->connect(info); + }); +} + +int __catalyst__transport__alloc_reply(CatalystTransportSession *s, std::uint64_t size, + std::int32_t mem_kind, std::uint32_t access, + CatalystTransportMemRegion *out) +{ + if (!s || !s->sess) { + return CATALYST_TRANSPORT_ERR; + } + return guard([&] { + MemRegion r = s->sess->alloc_memory(size, to_mem_kind(mem_kind), access); + s->reply = r; + s->have_reply = true; + if (out) { + out->addr = r.addr; + out->size = r.size; + out->lkey = r.lkey; + out->rkey = r.rkey; + out->kind = mem_kind; + } + return CATALYST_TRANSPORT_OK; + }); +} + +int __catalyst__transport__exchange_keys(CatalystTransportSession *s, CatalystTransportPeerRef *out) +{ + if (!s || !s->sess) { + return CATALYST_TRANSPORT_ERR; + } + return guard([&] { + PeerRef p = s->sess->exchange_keys(s->have_reply ? s->reply : MemRegion{}); + if (out) { + out->rkey = p.rkey; + out->remote_addr = p.remote_addr; + out->size = p.size; + } + return CATALYST_TRANSPORT_OK; + }); +} + +int __catalyst__transport__establish_channel(CatalystTransportSession *s, std::int32_t data_path, + const CatalystTransportPeerRef *peer) +{ + if (!s || !s->sess || !peer) { + return CATALYST_TRANSPORT_ERR; + } + return guard([&] { + ChannelDesc desc; + desc.data_path = to_data_path(data_path); + PeerRef p; + p.rkey = peer->rkey; + p.remote_addr = peer->remote_addr; + p.size = peer->size; + s->sess->establish_channel(desc, s->have_reply ? s->reply : MemRegion{}, p); + return CATALYST_TRANSPORT_OK; + }); +} + +int __catalyst__transport__commit_work_item(CatalystTransportSession *s, + std::uint32_t work_item_idx, std::uint64_t in_bytes, + std::uint64_t out_bytes) +{ + if (!s || !s->sess) { + return CATALYST_TRANSPORT_ERR; + } + return guard([&] { + s->sess->commit_work_item(work_item_idx, in_bytes, out_bytes); + return CATALYST_TRANSPORT_OK; + }); +} + +void *__catalyst__transport__data_slot(CatalystTransportSession *s) +{ + if (!s || !s->sess) { + return nullptr; + } + + void *slot = nullptr; + try { + slot = s->sess->data_slot(); + } + catch (const std::exception &e) { + std::cerr << "[transport] data_slot: " << e.what() << "\n"; + return nullptr; + } + catch (...) { + return nullptr; + } + return slot; +} + +int __catalyst__transport__kick(CatalystTransportSession *s, std::uint32_t work_item_idx) +{ + if (!s || !s->sess) { + return CATALYST_TRANSPORT_ERR; + } + return guard([&] { return s->sess->kick(work_item_idx); }); +} + +int __catalyst__transport__collect(CatalystTransportSession *s, void *correction, + std::uint64_t bytes) +{ + if (!s || !s->sess) { + return CATALYST_TRANSPORT_ERR; + } + return guard([&] { + void *outputs[1] = {correction}; + std::size_t caps[1] = {static_cast(bytes)}; + return s->sess->collect(outputs, caps, 1); + }); +} + +std::uint64_t __catalyst__transport__last_rtt_ns(CatalystTransportSession *s) +{ + if (!s || !s->sess) { + return 0; + } + return s->sess->last_rtt_ns(); +} + +void __catalyst__transport__stop(CatalystTransportSession *s) +{ + if (s && s->sess) { + try { + s->sess->stop(); + } + catch (...) { + } + } +} + +void __catalyst__transport__destroy(CatalystTransportSession *s) +{ + if (!s) { + return; + } + delete s->sess; // owned by the backend factory + s->backend.reset(); + delete s; +} + +void __catalyst__transport__close(CatalystTransportSession *s) +{ + __catalyst__transport__stop(s); + __catalyst__transport__destroy(s); +} + +} // extern "C" From 8dccc6201341549f6eab86fbf504625e1af92826 Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Mon, 20 Jul 2026 16:19:33 -0400 Subject: [PATCH 06/21] update interface --- runtime/include/Transport.hpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/runtime/include/Transport.hpp b/runtime/include/Transport.hpp index d8813d22cc..241ec5bdf4 100644 --- a/runtime/include/Transport.hpp +++ b/runtime/include/Transport.hpp @@ -136,22 +136,42 @@ class TransportSession { * @brief Wait for a result and write it out. * * @param outputs Array of output buffers to write into. + * @param output_bytes Array of output buffer sizes. * @param n Number of output buffers. * * @return `int` */ - virtual int collect(void *const *outputs, std::size_t n) = 0; + virtual int collect(void *const *outputs, const std::size_t *output_bytes, std::size_t n) = 0; /** * @brief Stop the engine and join. Idempotent. */ virtual void stop() = 0; + + /** + * @brief Last round-trip time, in nanoseconds (for testing purposes). + * + * @return `std::uint64_t` + */ + virtual std::uint64_t last_rtt_ns() const { return 0; } }; /** * @brief Controller role: writes messages out and receives corrections. */ -class ControllerSession : public TransportSession {}; +class ControllerSession : public TransportSession { + public: + // Build the work item in slot `work_item_idx` from `schema`. + virtual void commit_work_item(std::uint32_t work_item_idx, std::uint64_t in_bytes, + std::uint64_t out_bytes) = 0; + + // Fire one round using work item `work_item_idx` and whatever payload is currently in + // data_slot(). Pairs with a subsequent collect(). Returns 0 on success. + virtual int kick(std::uint32_t work_item_idx = 0) = 0; + + // Current round's outbound slot in the transport-owned ring. + virtual void *data_slot() = 0; +}; /** * @brief Opaque function to run on the coprocessor. May include a persistent kernel on the GPU. From cdee60bc9d1099eeb026c0b27b1eb199b65bcf62 Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Mon, 20 Jul 2026 16:23:40 -0400 Subject: [PATCH 07/21] coprocessor backend interface is added --- runtime/include/TransportBackend.h | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/runtime/include/TransportBackend.h b/runtime/include/TransportBackend.h index 87974aba7d..734362510c 100644 --- a/runtime/include/TransportBackend.h +++ b/runtime/include/TransportBackend.h @@ -14,8 +14,8 @@ // The plugin ABI for out-of-tree transport backends. // -// A transport backend is a shared library that implements a TransportSession role and exports a -// factory symbol. +// A transport backend is a shared library that implements a TransportSession role (controller or +// coprocessor) and exports the matching factory symbol. #pragma once #ifndef TRANSPORTBACKEND_H @@ -27,10 +27,13 @@ #include "Transport.hpp" #define CATALYST_TRANSPORT_CONTROLLER_FACTORY_SYMBOL "CatalystTransportControllerFactory" +#define CATALYST_TRANSPORT_COPROCESSOR_FACTORY_SYMBOL "CatalystTransportCoprocessorFactory" -// The factory signature backends must export with C linkage. +// The factory signatures backends must export with C linkage. extern "C" { using CatalystTransportControllerFactoryFn = catalyst::transport::ControllerSession *(const char *); +using CatalystTransportCoprocessorFactoryFn = + catalyst::transport::CoprocessorSession *(const char *); } // A helper template macro to generate the Factory function. @@ -52,4 +55,22 @@ using CatalystTransportControllerFactoryFn = catalyst::transport::ControllerSess } \ } +// e.g. GENERATE_TRANSPORT_COPROCESSOR_FACTORY(CatalystTransportCoprocessor, make_coprocessor) +// where `make_coprocessor(const std::string &config) -> CoprocessorSession*`. +#define GENERATE_TRANSPORT_COPROCESSOR_FACTORY(IDENTIFIER, BUILDER) \ + extern "C" catalyst::transport::CoprocessorSession *IDENTIFIER##Factory(const char *config) \ + { \ + try { \ + return (BUILDER)(config ? std::string(config) : std::string()); \ + } \ + catch (const std::exception &e) { \ + std::fprintf(stderr, "[transport] coprocessor factory failed: %s\n", e.what()); \ + return nullptr; \ + } \ + catch (...) { \ + std::fprintf(stderr, "[transport] coprocessor factory failed: unknown exception\n"); \ + return nullptr; \ + } \ + } + #endif // TRANSPORTBACKEND_H From da41e922e25b95094421775cd8acfcef1f905bc5 Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Mon, 20 Jul 2026 16:24:55 -0400 Subject: [PATCH 08/21] chagne type --- runtime/include/Transport.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/include/Transport.hpp b/runtime/include/Transport.hpp index 241ec5bdf4..3a5ed0ce8d 100644 --- a/runtime/include/Transport.hpp +++ b/runtime/include/Transport.hpp @@ -141,7 +141,7 @@ class TransportSession { * * @return `int` */ - virtual int collect(void *const *outputs, const std::size_t *output_bytes, std::size_t n) = 0; + virtual int collect(void *const *outputs, const std::uint64_t *output_bytes, std::size_t n) = 0; /** * @brief Stop the engine and join. Idempotent. From 6e942a9fc3c257fafb5214c24efbc82067e56575 Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Mon, 20 Jul 2026 16:26:04 -0400 Subject: [PATCH 09/21] remove redundancy --- runtime/include/TransportCAPI.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/runtime/include/TransportCAPI.h b/runtime/include/TransportCAPI.h index 2f0a4aa312..4c806b4918 100644 --- a/runtime/include/TransportCAPI.h +++ b/runtime/include/TransportCAPI.h @@ -84,9 +84,6 @@ CatalystTransportSession *__catalyst__transport__controller_create(const char *b void __catalyst__transport__close(CatalystTransportSession *s); int __catalyst__transport__connect(CatalystTransportSession *s, const char *peer, uint16_t oob_port); -int __catalyst__transport__alloc_reply(CatalystTransportSession *s, uint64_t size, int32_t mem_kind, - uint32_t access, CatalystTransportMemRegion *out); - int __catalyst__transport__exchange_keys(CatalystTransportSession *s, CatalystTransportPeerRef *out); int __catalyst__transport__establish_channel(CatalystTransportSession *s, int32_t data_path, From 4408322703086dfd95173ec82f4e960281ef86f9 Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Mon, 20 Jul 2026 16:32:14 -0400 Subject: [PATCH 10/21] add start --- runtime/include/TransportCAPI.h | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/include/TransportCAPI.h b/runtime/include/TransportCAPI.h index 4c806b4918..e4a7b7e357 100644 --- a/runtime/include/TransportCAPI.h +++ b/runtime/include/TransportCAPI.h @@ -91,6 +91,7 @@ int __catalyst__transport__establish_channel(CatalystTransportSession *s, int32_ int __catalyst__transport__commit_work_item(CatalystTransportSession *s, uint32_t work_item_idx, uint64_t in_bytes, uint64_t out_bytes); void *__catalyst__transport__data_slot(CatalystTransportSession *s); +void __catalyst__transport__start(CatalystTransportSession *s); int __catalyst__transport__kick(CatalystTransportSession *s, uint32_t work_item_idx); int __catalyst__transport__collect(CatalystTransportSession *s, void *correction, uint64_t bytes); uint64_t __catalyst__transport__last_rtt_ns(CatalystTransportSession *s); From 5282f5a1d099dd02762d1cb4092def25f49a144d Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Mon, 20 Jul 2026 16:42:09 -0400 Subject: [PATCH 11/21] update comment --- runtime/include/Transport.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/include/Transport.hpp b/runtime/include/Transport.hpp index 3a5ed0ce8d..4ed87cbe32 100644 --- a/runtime/include/Transport.hpp +++ b/runtime/include/Transport.hpp @@ -161,7 +161,7 @@ class TransportSession { */ class ControllerSession : public TransportSession { public: - // Build the work item in slot `work_item_idx` from `schema`. + // Build the work item in slot `work_item_idx` from in_bytes and out_bytes. virtual void commit_work_item(std::uint32_t work_item_idx, std::uint64_t in_bytes, std::uint64_t out_bytes) = 0; From 32fc6f26d76efdda70104f22644617d97803cba7 Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Mon, 20 Jul 2026 16:47:25 -0400 Subject: [PATCH 12/21] update changelog --- doc/releases/changelog-dev.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 5f66384adf..f037e1bcbc 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -14,6 +14,7 @@ * A new runtime transport layer for remote/local executors is introduced. [(#3043)](https://github.com/PennyLaneAI/catalyst/pull/3043) + [(#3045)](https://github.com/PennyLaneAI/catalyst/pull/3045) * A `BufferizableOpInterface` implementation is now added for `catalyst.launch_kernel` operation and it is now bufferizable. [(#3024)](https://github.com/PennyLaneAI/catalyst/pull/3024) @@ -472,4 +473,5 @@ Mehrdad Malekmohammadi, River McCubbin, Shuli Shu, Paul Haochen Wang, -Jake Zaia. +Jake Zaia, +Hongsheng Zheng. From 2fc50c3cc371647c6a08847a04af96bfed3f0be9 Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Mon, 20 Jul 2026 17:15:48 -0400 Subject: [PATCH 13/21] update --- runtime/include/Transport.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/include/Transport.hpp b/runtime/include/Transport.hpp index 4ed87cbe32..ff5ee22dd5 100644 --- a/runtime/include/Transport.hpp +++ b/runtime/include/Transport.hpp @@ -167,7 +167,7 @@ class ControllerSession : public TransportSession { // Fire one round using work item `work_item_idx` and whatever payload is currently in // data_slot(). Pairs with a subsequent collect(). Returns 0 on success. - virtual int kick(std::uint32_t work_item_idx = 0) = 0; + virtual int kick(std::uint32_t work_item_idx) = 0; // Current round's outbound slot in the transport-owned ring. virtual void *data_slot() = 0; From 4d211cefd98b20d3eb441c6211d41074f4cea909 Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Mon, 20 Jul 2026 17:21:19 -0400 Subject: [PATCH 14/21] update --- runtime/lib/transport/TransportCAPI.cpp | 60 +++++++------------------ 1 file changed, 17 insertions(+), 43 deletions(-) diff --git a/runtime/lib/transport/TransportCAPI.cpp b/runtime/lib/transport/TransportCAPI.cpp index 617f05e6c3..311957985d 100644 --- a/runtime/lib/transport/TransportCAPI.cpp +++ b/runtime/lib/transport/TransportCAPI.cpp @@ -29,7 +29,6 @@ using catalyst::transport::ChannelDesc; using catalyst::transport::ConnectInfo; using catalyst::transport::ControllerSession; using catalyst::transport::DataPath; -using catalyst::transport::MemKind; using catalyst::transport::MemRegion; using catalyst::transport::PeerRef; @@ -37,28 +36,10 @@ using catalyst::transport::PeerRef; struct CatalystTransportSession { std::unique_ptr backend; ControllerSession *sess = nullptr; // heap-allocated by the backend factory - MemRegion reply = {}; - bool have_reply = false; }; namespace { -MemKind to_mem_kind(std::int32_t k) -{ - switch (k) { - case CATALYST_TRANSPORT_MEM_CPU_RAM: - return MemKind::CpuRam; - case CATALYST_TRANSPORT_MEM_GPU_HBM: - return MemKind::GpuHbm; - case CATALYST_TRANSPORT_MEM_DDR: - return MemKind::Ddr; - case CATALYST_TRANSPORT_MEM_OTHER: - return MemKind::Other; - default: - return MemKind::Ddr; - } -} - DataPath to_data_path(std::int32_t p) { switch (p) { @@ -133,35 +114,13 @@ int __catalyst__transport__connect(CatalystTransportSession *s, const char *peer }); } -int __catalyst__transport__alloc_reply(CatalystTransportSession *s, std::uint64_t size, - std::int32_t mem_kind, std::uint32_t access, - CatalystTransportMemRegion *out) -{ - if (!s || !s->sess) { - return CATALYST_TRANSPORT_ERR; - } - return guard([&] { - MemRegion r = s->sess->alloc_memory(size, to_mem_kind(mem_kind), access); - s->reply = r; - s->have_reply = true; - if (out) { - out->addr = r.addr; - out->size = r.size; - out->lkey = r.lkey; - out->rkey = r.rkey; - out->kind = mem_kind; - } - return CATALYST_TRANSPORT_OK; - }); -} - int __catalyst__transport__exchange_keys(CatalystTransportSession *s, CatalystTransportPeerRef *out) { if (!s || !s->sess) { return CATALYST_TRANSPORT_ERR; } return guard([&] { - PeerRef p = s->sess->exchange_keys(s->have_reply ? s->reply : MemRegion{}); + PeerRef p = s->sess->exchange_keys(MemRegion{}); if (out) { out->rkey = p.rkey; out->remote_addr = p.remote_addr; @@ -184,7 +143,7 @@ int __catalyst__transport__establish_channel(CatalystTransportSession *s, std::i p.rkey = peer->rkey; p.remote_addr = peer->remote_addr; p.size = peer->size; - s->sess->establish_channel(desc, s->have_reply ? s->reply : MemRegion{}, p); + s->sess->establish_channel(desc, MemRegion{}, p); return CATALYST_TRANSPORT_OK; }); } @@ -251,6 +210,21 @@ std::uint64_t __catalyst__transport__last_rtt_ns(CatalystTransportSession *s) return s->sess->last_rtt_ns(); } +void __catalyst__transport__start(CatalystTransportSession *s) +{ + if (!s || !s->sess) { + return; + } + try { + s->sess->start(); + } + catch (const std::exception &e) { + std::cerr << "[transport] start: " << e.what() << "\n"; + } + catch (...) { + } +} + void __catalyst__transport__stop(CatalystTransportSession *s) { if (s && s->sess) { From 060458b4319033542fdea882a3bb3ec07177732b Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Mon, 20 Jul 2026 17:33:30 -0400 Subject: [PATCH 15/21] remove redundancy --- runtime/include/TransportCAPI.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/runtime/include/TransportCAPI.h b/runtime/include/TransportCAPI.h index e4a7b7e357..c1fb6817a3 100644 --- a/runtime/include/TransportCAPI.h +++ b/runtime/include/TransportCAPI.h @@ -55,20 +55,6 @@ enum { CATALYST_TRANSPORT_MEM_OTHER = 3, }; -// ibverbs access flags for the advertised reply region -enum { - CATALYST_TRANSPORT_ACCESS_REPLY = 7, -}; - -// Registered memory region handed back to the caller -typedef struct { - void *addr; - uint64_t size; - uint32_t lkey; - uint32_t rkey; - int32_t kind; // one of MemKind enum values -} CatalystTransportMemRegion; - // Remote peer region descriptor typedef struct { uint32_t rkey; From 246a4b7b2e3df32296f85c87c72f1c5a7f0e2ae1 Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Mon, 20 Jul 2026 18:29:14 -0400 Subject: [PATCH 16/21] number of collection is always 1 --- runtime/include/Transport.hpp | 7 +++---- runtime/lib/transport/TransportCAPI.cpp | 6 +----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/runtime/include/Transport.hpp b/runtime/include/Transport.hpp index ff5ee22dd5..29c4cc81f1 100644 --- a/runtime/include/Transport.hpp +++ b/runtime/include/Transport.hpp @@ -135,13 +135,12 @@ class TransportSession { /** * @brief Wait for a result and write it out. * - * @param outputs Array of output buffers to write into. - * @param output_bytes Array of output buffer sizes. - * @param n Number of output buffers. + * @param correction Output buffer to write the result into. + * @param bytes Capacity of the output buffer, in bytes. * * @return `int` */ - virtual int collect(void *const *outputs, const std::uint64_t *output_bytes, std::size_t n) = 0; + virtual int collect(void *correction, std::uint64_t bytes) = 0; /** * @brief Stop the engine and join. Idempotent. diff --git a/runtime/lib/transport/TransportCAPI.cpp b/runtime/lib/transport/TransportCAPI.cpp index 311957985d..429541508a 100644 --- a/runtime/lib/transport/TransportCAPI.cpp +++ b/runtime/lib/transport/TransportCAPI.cpp @@ -195,11 +195,7 @@ int __catalyst__transport__collect(CatalystTransportSession *s, void *correction if (!s || !s->sess) { return CATALYST_TRANSPORT_ERR; } - return guard([&] { - void *outputs[1] = {correction}; - std::size_t caps[1] = {static_cast(bytes)}; - return s->sess->collect(outputs, caps, 1); - }); + return guard([&] { return s->sess->collect(correction, bytes); }); } std::uint64_t __catalyst__transport__last_rtt_ns(CatalystTransportSession *s) From 22cd621cba1e34fb6b67717587d48626849abbc1 Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Mon, 20 Jul 2026 18:32:57 -0400 Subject: [PATCH 17/21] update interface --- runtime/include/Transport.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/runtime/include/Transport.hpp b/runtime/include/Transport.hpp index 4ed87cbe32..29c4cc81f1 100644 --- a/runtime/include/Transport.hpp +++ b/runtime/include/Transport.hpp @@ -135,13 +135,12 @@ class TransportSession { /** * @brief Wait for a result and write it out. * - * @param outputs Array of output buffers to write into. - * @param output_bytes Array of output buffer sizes. - * @param n Number of output buffers. + * @param correction Output buffer to write the result into. + * @param bytes Capacity of the output buffer, in bytes. * * @return `int` */ - virtual int collect(void *const *outputs, const std::uint64_t *output_bytes, std::size_t n) = 0; + virtual int collect(void *correction, std::uint64_t bytes) = 0; /** * @brief Stop the engine and join. Idempotent. @@ -167,7 +166,7 @@ class ControllerSession : public TransportSession { // Fire one round using work item `work_item_idx` and whatever payload is currently in // data_slot(). Pairs with a subsequent collect(). Returns 0 on success. - virtual int kick(std::uint32_t work_item_idx = 0) = 0; + virtual int kick(std::uint32_t work_item_idx) = 0; // Current round's outbound slot in the transport-owned ring. virtual void *data_slot() = 0; From 76305703ada3b8660a444eee9e78ca72ae2063ac Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Tue, 21 Jul 2026 09:57:42 -0400 Subject: [PATCH 18/21] Update runtime/include/Transport.hpp Co-authored-by: Mehrdad Malek <39844030+mehrdad2m@users.noreply.github.com> --- runtime/include/Transport.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/include/Transport.hpp b/runtime/include/Transport.hpp index 29c4cc81f1..d90be2e428 100644 --- a/runtime/include/Transport.hpp +++ b/runtime/include/Transport.hpp @@ -135,7 +135,7 @@ class TransportSession { /** * @brief Wait for a result and write it out. * - * @param correction Output buffer to write the result into. + * @param replies Output buffer to write the result into. * @param bytes Capacity of the output buffer, in bytes. * * @return `int` From da12f304844939d1130d3dd2f84c72b56fa9c371 Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Tue, 21 Jul 2026 09:58:30 -0400 Subject: [PATCH 19/21] Apply suggestion from @mehrdad2m Co-authored-by: Mehrdad Malek <39844030+mehrdad2m@users.noreply.github.com> --- runtime/include/Transport.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/include/Transport.hpp b/runtime/include/Transport.hpp index d90be2e428..aecfdd68ba 100644 --- a/runtime/include/Transport.hpp +++ b/runtime/include/Transport.hpp @@ -140,7 +140,7 @@ class TransportSession { * * @return `int` */ - virtual int collect(void *correction, std::uint64_t bytes) = 0; + virtual int collect(void *replies, std::uint64_t bytes) = 0; /** * @brief Stop the engine and join. Idempotent. From 5490f086cb6607927479cbf53d4e87a73707ca5b Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Tue, 21 Jul 2026 09:58:37 -0400 Subject: [PATCH 20/21] Apply suggestion from @mehrdad2m Co-authored-by: Mehrdad Malek <39844030+mehrdad2m@users.noreply.github.com> --- runtime/include/Transport.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/include/Transport.hpp b/runtime/include/Transport.hpp index aecfdd68ba..085c3b0edb 100644 --- a/runtime/include/Transport.hpp +++ b/runtime/include/Transport.hpp @@ -156,7 +156,7 @@ class TransportSession { }; /** - * @brief Controller role: writes messages out and receives corrections. + * @brief Controller role: writes messages out and receives replies. */ class ControllerSession : public TransportSession { public: From 5d639c5c7696a96790f954088d63e93025b7d329 Mon Sep 17 00:00:00 2001 From: Hong-Sheng Zheng Date: Tue, 21 Jul 2026 09:58:43 -0400 Subject: [PATCH 21/21] Apply suggestion from @mehrdad2m Co-authored-by: Mehrdad Malek <39844030+mehrdad2m@users.noreply.github.com> --- runtime/include/Transport.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/include/Transport.hpp b/runtime/include/Transport.hpp index 085c3b0edb..7f8f7b07c0 100644 --- a/runtime/include/Transport.hpp +++ b/runtime/include/Transport.hpp @@ -179,7 +179,7 @@ using CoprocessorFn = std::size_t (*)(const void *in, std::size_t in_len, void * std::size_t out_cap, void *ctx); /** - * @brief Coprocessor role: receives messages, process, and returns corrections. + * @brief Coprocessor role: receives messages, process, and returns replies. */ class CoprocessorSession : public TransportSession { public: