Skip to content

Commit

Permalink
#0: squash later
Browse files Browse the repository at this point in the history
  • Loading branch information
tt-nshanker committed Jan 25, 2024
1 parent 48aedbf commit 33878e5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#endif

#include "compute_kernel_api/eltwise_unary/sfpu_split_includes.h"
#include "debug/dprint.h"

#define DEBUG_PRINT 0

Expand Down Expand Up @@ -47,20 +46,16 @@ inline void tilize_in(
uint32_t in_num_subblocks,
uint32_t out_cb_id
) {
PACK(( DPRINT << "Start tilize" << ENDL()));
tilize_init_short(in_cb_id, in_block_w);
for (uint32_t in_subblock = 0; in_subblock < in_num_subblocks; ++in_subblock) {
for (uint32_t h = 0; h < in_subblock_h; ++h) {
cb_wait_front(in_cb_id, in_block_w);
PACK(( DPRINT << "Going to reserve tilize in0 cb" << in_block_w << ENDL()));
cb_reserve_back(out_cb_id, in_block_w);
PACK(( DPRINT << "Reserved tilize in0 cb" << ENDL()));
tilize_block(in_cb_id, in_block_w, out_cb_id);
cb_push_back(out_cb_id, in_block_w);
cb_pop_front(in_cb_id, in_block_w);
}
}
PACK(( DPRINT << "Done tilize" << ENDL()));
tilize_uninit();
} // tilize_in()

Expand Down Expand Up @@ -175,9 +170,6 @@ void MAIN {
#endif

mm_block_init(mm_in0_cb_id, in1_cb_id, out_cb_id);
//PACK(( DPRINT << "in0_num_blocks_h=" << in0_num_blocks_h));
//PACK(( DPRINT << "in0_num_subblocks=" << in0_num_subblocks));
//PACK(( DPRINT << "in0_subblock_h=" << in0_subblock_h));
// in1 num blocks w is the outer loop. Output blocks are computed in col major order.
for(uint32_t in1_block_w_i = 0; in1_block_w_i < in1_num_blocks_w; ++in1_block_w_i) {

Expand Down Expand Up @@ -306,8 +298,7 @@ void MAIN {
}
}

cb_pop_front(in0_cb_id, in0_block_num_tiles);
PACK(( DPRINT << "Popped from tilize cb " << in0_block_num_tiles << ENDL()));
cb_pop_front(mm_in0_cb_id, in0_block_num_tiles);
cb_pop_front(in1_cb_id, in1_block_num_tiles);
} // for in0_num_blocks_w
if constexpr(matmul_partials_cb == mm_out_cb_id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ void kernel_main() {
reader_idx = 0;
for (uint32_t nbh = 0; nbh < act_num_blocks_h; nbh++) {
cb_reserve_back(cb_id_act_row_major_bfloat16, act_block_num_tiles);
DPRINT << "reserved space for one act block" << ENDL();
uint32_t l1_write_addr_act = get_write_ptr(cb_id_act_row_major_bfloat16);

constexpr uint32_t stride_h_bytes = (conv_act_size_w+2) * conv_act_c_read_bytes;
Expand All @@ -192,10 +191,8 @@ void kernel_main() {
// noc_async_read_inc_num_issued(num_issued_reads_per_block); // "false" on read
noc_async_read_barrier();
cb_push_back(cb_id_act_row_major_bfloat16, act_block_num_tiles);
//DPRINT << "pushed one act block" << ENDL();
// compute tilizes and pops cb_id_act and pushes to tilized_in0_cb_id
cb_wait_front(tilized_in0_cb_id, act_block_num_tiles);
//DPRINT << "Waited for tilized act block" << ENDL();

// Round robin self-mcast and receive tilized act matrix in cb_id_act
// Compute should function like regular mm
Expand Down Expand Up @@ -239,7 +236,6 @@ void kernel_main() {
}
cb_push_back(cb_id_act, act_block_num_tiles);
} // act_w_num_outer
cb_pop_front(tilized_in0_cb_id, act_block_num_tiles); // passing
cb_pop_front(tilized_in0_cb_id, act_block_num_tiles);
}
DPRINT << "done reader" << ENDL();
}
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,10 @@ operation::ProgramWithCallbacks multi_core_optimized_conv_sharded_v2_(const Tens
if (fully_buffer_weights) {
num_weight_cb_tiles *= window_outer;
} else if (per_core_weight_matrix_width_ntiles < 8) {
num_weight_cb_tiles = num_weight_cb_tiles;
num_weight_cb_tiles = num_weight_cb_tiles * 2;
}
if (conv_act_size_c / conv_act_c_blocks < 256) {
num_act_cb_tiles = num_act_cb_tiles; // double buffered
num_act_cb_tiles = num_act_cb_tiles * 2; // double buffered
}
cout << "here" << endl;
uint32_t writer_output_block_num_tiles = out_block_h_ntiles * weight_block_w_ntiles;
Expand Down

0 comments on commit 33878e5

Please sign in to comment.