File size: 957 Bytes
b9db84c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// SPDX-License-Identifier: Apache-2.0
// Writes this core's NoC coordinates (noc0 x, y, noc1 x, y) as one 32-byte row-major page (page = core index):
// a host-side check of the logical -> NoC coordinate mapping used by the generic_op matmul (tt/mm_fused.py).
#include <stdint.h>
#include "api/dataflow/dataflow_api.h"

constexpr uint32_t cb = get_compile_time_arg_val(0);
constexpr auto t_args = TensorAccessorArgs<1>();

void kernel_main() {
    const uint32_t addr = get_arg_val<uint32_t>(0);
    const uint32_t page = get_arg_val<uint32_t>(1);
    const auto acc = TensorAccessor(t_args, addr, 32);
    cb_reserve_back(cb, 1);
    volatile tt_l1_ptr uint32_t* p = reinterpret_cast<volatile tt_l1_ptr uint32_t*>(get_write_ptr(cb));
    p[0] = my_x[0]; p[1] = my_y[0]; p[2] = my_x[1]; p[3] = my_y[1];
    p[4] = page; p[5] = 0xC0DE; p[6] = 0; p[7] = 0;
    noc_async_write(get_write_ptr(cb), acc.get_noc_addr(page), 32);
    noc_async_write_barrier();
}