hamer-p150 / code /hamer /kernels /hgemv /prefetch.cpp
changh95's picture
Optimized build (2026-10-03): model call 3.49 ms, device 3.36 ms
58ba6df verified
Raw History Blame Contribute Delete
1.05 kB
// SPDX-FileCopyrightText: © 2026 Tenstorrent Inc.
// SPDX-License-Identifier: Apache-2.0
// Round 10: MANO-head cross-op weight prefetch (tt_kernels.hgemv(prefetch=...)). Runs on the cores of the NEXT hgemv
// (disjoint from this program's GEMV cores): each copies its packed weight column run (one contiguous DRAM run) into
// its shard of a persistent L1 buffer, which the next hgemv uses as its weight CB (HG_WL1). The next program starts
// only after this one has finished, so no further synchronization is needed.
// runtime: active, w_addr, bank, bank offset, dst (L1), bytes
#include <stdint.h>
#include "api/dataflow/dataflow_api.h"
void kernel_main() {
if (!get_arg_val<uint32_t>(0)) {
return;
}
const uint32_t w_addr = get_arg_val<uint32_t>(1), bank = get_arg_val<uint32_t>(2), off = get_arg_val<uint32_t>(3);
const uint32_t dst = get_arg_val<uint32_t>(4), bytes = get_arg_val<uint32_t>(5);
noc_async_read(get_noc_addr_from_bank_id<true>(bank, w_addr + off), dst, bytes);
noc_async_read_barrier();
}