char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Ryan Crpc: support apple RDMA as an RPC transport (#26421)b114b4739

char/aliceai-t5-moe
1016 B38 linesraw
1#pragma once
2
3#include <cstddef>
4#include <cstdint>
5#include <memory>
6
7struct socket_t;
8typedef std::shared_ptr<socket_t> socket_ptr;
9
10static constexpr size_t MAX_CHUNK_SIZE = 1024ull * 1024ull * 1024ull; // 1 GiB
11static constexpr size_t RPC_CONN_CAPS_SIZE = 24;
12
13struct socket_t {
14    ~socket_t();
15
16    bool send_data(const void * data, size_t size);
17    bool recv_data(void * data, size_t size);
18    // Must be called at every message boundary: the RDMA transport coalesces
19    // writes into fixed-size frames and posts the trailing partial frame only
20    // here. No-op on TCP.
21    bool flush();
22
23    socket_ptr accept();
24
25    void get_caps(uint8_t * local_caps);
26    void update_caps(const uint8_t * remote_caps);
27
28    static socket_ptr create_server(const char * host, int port);
29    static socket_ptr connect(const char * host, int port);
30
31private:
32    struct impl;
33    explicit socket_t(std::unique_ptr<impl> p);
34    std::unique_ptr<impl> pimpl;
35};
36
37bool rpc_transport_init();
38void rpc_transport_shutdown();