[libc-commits] [libc] [libc] Rework the RPC interface to accept runtime wave sizes (PR #80914)
Jon Chesterfield via libc-commits
libc-commits at lists.llvm.org
Wed Feb 7 16:09:56 PST 2024
================
@@ -264,33 +277,35 @@ template <bool Invert, typename Packet> struct Process {
/// Invokes a function accross every active buffer across the total lane size.
template <uint32_t lane_size>
static LIBC_INLINE void invoke_rpc(cpp::function<void(Buffer *)> fn,
- Packet<lane_size> &packet) {
+ Buffer *slot, uint64_t mask) {
if constexpr (is_process_gpu()) {
- fn(&packet.payload.slot[gpu::get_lane_id()]);
+ fn(&slot[gpu::get_lane_id()]);
} else {
- for (uint32_t i = 0; i < lane_size; i += gpu::get_lane_size())
- if (packet.header.mask & 1ul << i)
- fn(&packet.payload.slot[i]);
+ auto sz = lane_size == VARIABLE_LANE_SIZE ? gpu::get_lane_size() : lane_size;
+ for (uint32_t i = 0; i < sz; i += gpu::get_lane_size())
+ if (mask & 1ul << i)
----------------
JonChesterfield wrote:
Yeah, I didn't remember the precedence and then misread the table at cppreference. Parens seem good here.
https://github.com/llvm/llvm-project/pull/80914
More information about the libc-commits
mailing list