|
21 | 21 | #include "rpc_util.h" |
22 | 22 | #include "src/__support/CPP/algorithm.h" // max |
23 | 23 | #include "src/__support/CPP/atomic.h" |
24 | | -#include "src/__support/CPP/functional.h" |
25 | 24 | #include "src/__support/CPP/optional.h" |
26 | 25 | #include "src/__support/GPU/utils.h" |
27 | 26 | #include "src/__support/macros/config.h" |
@@ -266,22 +265,9 @@ template <bool Invert> struct Process { |
266 | 265 | }; |
267 | 266 |
|
268 | 267 | /// Invokes a function accross every active buffer across the total lane size. |
269 | | -static LIBC_INLINE void invoke_rpc(cpp::function<void(Buffer *)> fn, |
270 | | - uint32_t lane_size, uint64_t lane_mask, |
271 | | - Buffer *slot) { |
272 | | - if constexpr (is_process_gpu()) { |
273 | | - fn(&slot[gpu::get_lane_id()]); |
274 | | - } else { |
275 | | - for (uint32_t i = 0; i < lane_size; i += gpu::get_lane_size()) |
276 | | - if (lane_mask & (1ul << i)) |
277 | | - fn(&slot[i]); |
278 | | - } |
279 | | -} |
280 | | - |
281 | | -/// Alternate version that also provides the index of the current lane. |
282 | | -static LIBC_INLINE void invoke_rpc(cpp::function<void(Buffer *, uint32_t)> fn, |
283 | | - uint32_t lane_size, uint64_t lane_mask, |
284 | | - Buffer *slot) { |
| 268 | +template <typename F> |
| 269 | +LIBC_INLINE static void invoke_rpc(F &&fn, uint32_t lane_size, |
| 270 | + uint64_t lane_mask, Buffer *slot) { |
285 | 271 | if constexpr (is_process_gpu()) { |
286 | 272 | fn(&slot[gpu::get_lane_id()], gpu::get_lane_id()); |
287 | 273 | } else { |
@@ -444,7 +430,7 @@ template <bool T> |
444 | 430 | template <typename W> |
445 | 431 | LIBC_INLINE void Port<T>::recv_and_send(W work) { |
446 | 432 | recv(work); |
447 | | - send([](Buffer *) { /* no-op */ }); |
| 433 | + send([](Buffer *, uint32_t) { /* no-op */ }); |
448 | 434 | } |
449 | 435 |
|
450 | 436 | /// Helper routine to simplify the interface when sending from the GPU using |
|
0 commit comments