Skip to content

Commit

Permalink
#14694: Stall unpacker till MMIO write to unpacker address completes
Browse files Browse the repository at this point in the history
  • Loading branch information
amahmudTT committed Nov 8, 2024
1 parent dbfbf55 commit eadfdb4
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
9 changes: 6 additions & 3 deletions llk_lib/llk_unpack_A.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ inline void _llk_unpack_A_(const std::uint32_t address, const bool transpose_of_
// Wait for free context
wait_for_next_context(2);

// Trisc::SEMPOST for context acquire
semaphore_post(semaphore::UNPACK_SYNC);

// Get tile address
if (0 == unp_cfg_context) {
if constexpr ((BType == BroadcastType::NONE) && (!acc_to_dest)) {
Expand Down Expand Up @@ -205,6 +202,12 @@ inline void _llk_unpack_A_(const std::uint32_t address, const bool transpose_of_
}
}

// Trisc::SEMPOST for context acquire
semaphore_post(semaphore::UNPACK_SYNC);

// Stall unpacker until pending CFG writes from Trisc have completed
TTI_STALLWAIT(p_stall::STALL_UNPACK, p_stall::TRISC_CFG);

// Run MOP
ckernel::ckernel_template::run(instrn_buffer);

Expand Down
3 changes: 3 additions & 0 deletions llk_lib/llk_unpack_AB.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ inline void _llk_unpack_AB_(
// Trisc::SEMPOST for context acquire
semaphore_post(semaphore::UNPACK_SYNC);

// Stall unpacker until pending CFG writes from Trisc have completed
TTI_STALLWAIT(p_stall::STALL_UNPACK, p_stall::TRISC_CFG);

// Run MOP
ckernel::ckernel_template::run(instrn_buffer);

Expand Down
9 changes: 6 additions & 3 deletions llk_lib/llk_unpack_reduce.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,19 @@ inline void _llk_unpack_reduce_(const std::uint32_t address) {
// Wait for free context
wait_for_next_context(2);

// Trisc::SEMPOST for context acquire
semaphore_post(semaphore::UNPACK_SYNC);

// Get tile address
if (0 == unp_cfg_context) {
cfg[THCON_SEC0_REG3_Base_address_ADDR32] = address;
} else {
cfg[THCON_SEC0_REG3_Base_cntx1_address_ADDR32] = address;
}

// Trisc::SEMPOST for context acquire
semaphore_post(semaphore::UNPACK_SYNC);

// Stall unpacker until pending CFG writes from Trisc have completed
TTI_STALLWAIT(p_stall::STALL_UNPACK, p_stall::TRISC_CFG);

// Run MOP
ckernel::ckernel_template::run(instrn_buffer);

Expand Down
9 changes: 6 additions & 3 deletions llk_lib/llk_unpack_tilize.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,19 @@ inline void _llk_unpack_tilize_(const std::uint32_t base_address, const std::uin
// Wait for free context
wait_for_next_context(2);

// Trisc::SEMPOST for context acquire
semaphore_post(semaphore::UNPACK_SYNC);

// Get tile address
if (0 == unp_cfg_context) {
cfg[THCON_SEC0_REG3_Base_address_ADDR32] = address;
} else {
cfg[THCON_SEC0_REG3_Base_cntx1_address_ADDR32] = address;
}

// Trisc::SEMPOST for context acquire
semaphore_post(semaphore::UNPACK_SYNC);

// Stall unpacker until pending CFG writes from Trisc have completed
TTI_STALLWAIT(p_stall::STALL_UNPACK, p_stall::TRISC_CFG);

// Run MOP
ckernel::ckernel_template::run(instrn_buffer);

Expand Down
9 changes: 6 additions & 3 deletions llk_lib/llk_unpack_untilize.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,19 @@ inline void _llk_unpack_untilize_pass_(const std::uint32_t base_address, const s
// Wait for free context
wait_for_next_context(2);

// Trisc::SEMPOST for context acquire
semaphore_post(semaphore::UNPACK_SYNC);

// Get tile address
if (0 == unp_cfg_context) {
cfg[THCON_SEC0_REG3_Base_address_ADDR32] = base_address;
} else {
cfg[THCON_SEC0_REG3_Base_cntx1_address_ADDR32] = base_address;
}

// Trisc::SEMPOST for context acquire
semaphore_post(semaphore::UNPACK_SYNC);

// Stall unpacker until pending CFG writes from Trisc have completed
TTI_STALLWAIT(p_stall::STALL_UNPACK, p_stall::TRISC_CFG);

std::uint32_t face_2xr_cnt = 0;
for (std::uint32_t r = 0; r < FACE_HEIGHT; r++) {
rem_blocks_in_row = block_tile_cols; // reset remaining blocks in row
Expand Down

0 comments on commit eadfdb4

Please sign in to comment.