Download code/hamer/kernels/mcbench/mc.cpp from changh95/hamer-p150: direct link, hf CLI and curl.
- Browser
- Download file 1.31 kB
-
https://huggingface.co/changh95/hamer-p150/resolve/main/code/hamer/kernels/mcbench/mc.cpp
- Command line
-
hf download hf://changh95/hamer-p150/code/hamer/kernels/mcbench/mc.cpp
-
curl -L -o mc.cpp https://huggingface.co/changh95/hamer-p150/resolve/main/code/hamer/kernels/mcbench/mc.cpp
1.31 kB
| // 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 | |
| void kernel_main() { | |
| if (!get_arg_val<uint32_t>(0)) { | |
| return; | |
| } | |
| const uint32_t sx = get_arg_val<uint32_t>(1), sy = get_arg_val<uint32_t>(2); | |
| const uint32_t ex = get_arg_val<uint32_t>(3), ey = get_arg_val<uint32_t>(4); | |
| const uint32_t nd = get_arg_val<uint32_t>(5), size = get_arg_val<uint32_t>(6), reps = get_arg_val<uint32_t>(7); | |
| const uint32_t lb = get_arg_val<uint32_t>(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); | |
| } | |
| noc_async_write_barrier(); | |
| } | |
| noc_async_write_barrier(); | |
| } | |