summaryrefslogtreecommitdiff
path: root/libc/test/integration/startup/gpu/rpc_test.cpp
AgeCommit message (Collapse)Author
2025-09-22[libc] Remove separate RPC test handling (#160206)Joseph Huber
Summary: This was originally kept separate so it didn't pollute the name space, but now I'm thinking it's just easier to bundle it in with the default interface. This means that we'll have a bit of extra code for people using the server.h file to handle libc opcodes, but it's minimal (3 functions) and it simplifies this. I'm doing this because I'm hoping to move the GPU tester binary to liboffload which handles `libc` opcodes internally except these. This is the easier option compared to adding a hook to register custom handlers there.
2025-03-14[libc] Fix implicit conversion warnings in tests. (#131362)lntue
2024-12-02[libc][NFC] Rename RPC opcodes to better reflect their usageJoseph Huber
Summary: RPC_ is a generic prefix here, use LIBC_ to indicate that these are opcodes used to implement the C library
2024-11-22[libc] Move RPC interface to `libc/shared` to export it (#117034)Joseph Huber
Summary: Previous patches have made the `rpc.h` header independent of the `libc` internals. This allows us to include it directly rather than providing an indirect C API. This patch only does the work to move the header. A future patch will pull out the `rpc_server` interface and simply replace it with a single function that handles the opcodes.
2024-10-15[libc] Fix incorrect RPC usage in testsJoseph Huber
2024-02-29[libc] Revert https://github.com/llvm/llvm-project/pull/83199 since it broke ↵lntue
Fuchsia. (#83374) With some header fix forward for GPU builds.
2024-02-27[libc] Add "include/" to the LLVM include directories (#83199)Joseph Huber
Summary: Recent changes added an include path in the float128 type that used the internal `libc` path to find the macro. This doesn't work once it's installed because we need to search from the root of the install dir. This patch adds "include/" to the include path so that our inclusion of installed headers always match the internal use.
2023-09-26[libc] Mass replace enclosing namespace (#67032)Guillaume Chatelet
This is step 4 of https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079
2023-07-21[libc] Remove test RPC opcodes from the exported headerJoseph Huber
This patch does the noisy work of removing the test opcodes from the exported interface to an interface that is only visible in `libc`. The benefit of this is that we both test the exported RPC registration more directly, and we do not need to give this interface to users. I have decided to export any opcode that is not a "core" libc feature as having its MSB set in the opcode. We can think of these as non-libc "extensions". Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D154848
2023-06-15[libc] Export GPU extensions to `libc` for external useJoseph Huber
The GPU port of the LLVM C library needs to export a few extensions to the interface such that users can interface with it. This patch adds the necessary logic to define a GPU extension. Currently, this only exports a `rpc_reset_client` function. This allows us to use the server in D147054 to set up the RPC interface outside of `libc`. Depends on https://reviews.llvm.org/D147054 Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D152283
2023-05-08[libc] Make the opcode parameter a compile time constantJoseph Huber
Currently the opcode is only valid if it is the same between all of the ports. This is possible to violate if the opcode is places into a memory location and then read in a non-uniform manner by the warp / wavefront. Moving this to a compile time constant makes it impossible to break this invariant. Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D150115
2023-05-04[libc] Enable multiple threads to use RPC on the GPUJoseph Huber
The execution model of the GPU expects that groups of threads will execute in lock-step in SIMD fashion. It's both important for performance and correctness that we treat this as the smallest possible granularity for an RPC operation. Thus, we map multiple threads to a single larger buffer and ship that across the wire. This patch makes the necessary changes to support executing the RPC on the GPU with multiple threads. This requires some workarounds to mimic the model when handling the protocol from the CPU. I'm not completely happy with some of the workarounds required, but I think it should work. Uses some of the implementation details from D148191. Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D148943
2023-05-04[libc][rpc] Simplify mailbox state trackingJon Chesterfield
Removes the redundant Ack/Data bit manipulation. Represents the inbox/outbox state with one bit instead of two. This will be useful if we change to a packed representation and otherwise cuts the runtime state space from 16 to 4. Further simplification is possible, this patch is intentionally minimal. - can_{send,recv}_data are now in == out - {client,server}::try_open can be factored into Process:try_open This implements the state machine of D148191, modulo differences in atomic ordering and fences. Reviewed By: jhuber6 Differential Revision: https://reviews.llvm.org/D149788
2023-04-24[libc] Add more utility functions for the GPUJoseph Huber
This patch adds extra intrinsics for the GPU. Some of these are unused for now but will be used later. We use these currently to update the `RPC` handling. Currently, every thread can update the RPC client, which isn't correct. This patch adds code neccesary to allow a single thread to perfrom the write while the others wait. Feedback is welcome for the naming of these functions. I'm copying the OpenMP nomenclature where we call an AMD `wavefront` or NVIDIA `warp` a `lane`. Reviewed By: tra Differential Revision: https://reviews.llvm.org/D148810
2023-04-19[libc] Test the RPC interface with multiple blocksJoseph Huber
The RPC interface can support multiple independent clients. This support currently only supports many single-thread warps / workgroups coordinating over a single lock. This patch uses the support added in the previous patch to test the RPC interface with multiple blocks. Note that this does not work with multiple threads currently because of the effect of warps / workgroups executing in lockstep incorrectly. This will be added later. Depends on D148485 Reviewed By: lntue, sivachandra Differential Revision: https://reviews.llvm.org/D148486
2023-04-19[libc] Add a test to directly stimulate the RPC interfaceJoseph Huber
Currently, the RPC interface with the loader is only tested if the other tests fail. This test adds a direct test that runs a simple integer increment over the RPC handshake 10000 times. Depends on https://reviews.llvm.org/D148288 Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D148342