// SPDX-FileCopyrightText: © 2026 Tenstorrent Inc. // SPDX-License-Identifier: Apache-2.0 // multicast bandwidth micro-benchmark: senders mcast `size` bytes `reps` times into a rectangle // (no flags; data lands in a scratch CB at the same address on every core). // runtime: active, sx, sy, ex, ey (min/max corner), ndest, size, reps, loopback #include #include "api/dataflow/dataflow_api.h" void kernel_main() { if (!get_arg_val(0)) { return; } const uint32_t sx = get_arg_val(1), sy = get_arg_val(2); const uint32_t ex = get_arg_val(3), ey = get_arg_val(4); const uint32_t nd = get_arg_val(5), size = get_arg_val(6), reps = get_arg_val(7); const uint32_t lb = get_arg_val(8); const uint32_t buf = get_write_ptr(0); const uint64_t dst = noc_index == 1 ? get_noc_multicast_addr(ex, ey, sx, sy, buf) : get_noc_multicast_addr(sx, sy, ex, ey, buf); for (uint32_t r = 0; r < reps; ++r) { if (lb) { noc_async_write_multicast_loopback_src(buf, dst, size, nd); } else { noc_async_write_multicast(buf, dst, size, nd); } #ifdef MC_BARRIER_EACH noc_async_write_barrier(); #endif } noc_async_write_barrier(); }