Download code/kernels/sp_desc/sm_writer.cpp from changh95/superpoint-p150: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/changh95/superpoint-p150/resolve/main/code/kernels/sp_desc/sm_writer.cpp
- Command line
-
hf download hf://changh95/superpoint-p150/code/kernels/sp_desc/sm_writer.cpp
-
curl -L -o sm_writer.cpp https://huggingface.co/changh95/superpoint-p150/resolve/main/code/kernels/sp_desc/sm_writer.cpp
1.06 kB
| // SPDX-FileCopyrightText: © 2026 Tenstorrent USA, Inc. | |
| // SPDX-License-Identifier: Apache-2.0 | |
| // | |
| // Score softmax core (SP_HEAD_SM=1), PROC 1: write each softmax tile row (3 tiles) to the s_sm tensor | |
| // (TILE [N, 65], pages = tiles, row-major tile order). RT args: dst_addr, nrows, first tile row. | |
| void kernel_main() { | |
| const uint32_t dst_addr = get_arg_val<uint32_t>(0); | |
| const uint32_t nrows = get_arg_val<uint32_t>(1); | |
| const uint32_t row0 = get_arg_val<uint32_t>(2); | |
| constexpr uint32_t cb_out = get_compile_time_arg_val(0); | |
| constexpr auto o_args = TensorAccessorArgs<1>(); | |
| const auto oacc = TensorAccessor(o_args, dst_addr, 2048); | |
| for (uint32_t i = 0; i < nrows; ++i) { | |
| cb_wait_front(cb_out, 3); | |
| const uint32_t l1 = get_read_ptr(cb_out); | |
| for (uint32_t j = 0; j < 3; ++j) { | |
| noc_async_write(l1 + j * 2048, oacc.get_noc_addr((row0 + i) * 3 + j), 2048); | |
| } | |
| noc_async_write_barrier(); | |
| cb_pop_front(cb_out, 3); | |
| } | |
| } | |