[libc] More efficiently send bytes via `send_n` and `recv_n`
authorJoseph Huber <jhuber6@vols.utk.edu>
Fri, 19 May 2023 16:17:42 +0000 (11:17 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Tue, 23 May 2023 15:59:47 +0000 (10:59 -0500)
commite826762a0826c11dc62696e46068c61c57a00aa9
tree28cbc96616a300499c7feb09418c4cb6fb94b1b9
parent29d3da3b86cc4e8d5025602e0d7a290609f44f45
[libc] More efficiently send bytes via `send_n` and `recv_n`

Currently we have the `send_n` and `recv_n` routines to stream data,
such as a string to print, to the other side. The first operation is to
send the size so the other side knows the number of bytes to recieve.
However, this wasted 56 bytes that could've been sent. This meant that
small values, like the arguments to a function to call on the host for
example, needed to perform an extra send. This patch sends the first 56
bytes in the first packet and continues if necessary.

Depends on D150992

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D151041
libc/src/__support/OSUtil/gpu/io.cpp
libc/src/__support/RPC/rpc.h
libc/src/__support/RPC/rpc_util.h
libc/utils/gpu/loader/Server.h