[libc-commits] [libc] [libc] Rework the RPC interface to accept runtime wave sizes (PR #80914)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Feb 7 10:28:38 PST 2024


================
@@ -144,6 +139,17 @@ template <bool Invert, typename Packet> struct Process {
     atomic_thread_fence(cpp::MemoryOrder::ACQUIRE);
   }
 
+  /// The packet is a linearly allocated array of buffers used to communicate
+  /// with the other process. This function returns the appropriate slot in this
+  /// array such that the process can operate on an entire warp or wavefront at
+  /// once.
+  LIBC_INLINE Buffer *get_packet(uint32_t index) {
+    if constexpr (lane_size == DEFAULT_LANE_SIZE)
+      return &packet[index * gpu::get_lane_size()];
+    else
+      return &packet[index * lane_size];
----------------
jhuber6 wrote:

The server (running on the CPU) needs to pass it in manually according to whatever the runtime states it should be (i.e. 32). So we need the extra argument there for the server create the appropriately sized buffer since it would just be `1` in that case so they would have conflicting views of the buffer.

https://github.com/llvm/llvm-project/pull/80914


More information about the libc-commits mailing list