Skip to content

Commit

Permalink
#0: fixed idle core assignment mismatch for sdpa decode in sharded lo…
Browse files Browse the repository at this point in the history
…w batch case
  • Loading branch information
caixunshiren committed Nov 7, 2024
1 parent 62255a8 commit e601275
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,10 @@ def test_sdpa_decode_paged_attention(
)
@pytest.mark.parametrize(
"b, nh, nkv, s, d, grid_size",
([16, 8, 1, 32768, 128, (8, 6)],), # Llama2-70B
(
[1, 8, 1, 32768, 128, (8, 8)],
[16, 8, 1, 32768, 128, (8, 8)],
), # Llama2-70B
)
def test_sdpa_decode_sharded(device, b, nh, nkv, s, d, dtype, grid_size, q_dtype):
ttnn.device.DisablePersistentKernelCache()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ operation::ProgramWithCallbacks sdpa_decode_multi_core(

for (int i = 0; i < num_cores_available; ++i) {
CoreCoord core;
if (i%num_cores_per_batch==0){
if (i%num_cores_per_batch==0 && reducer_idx<num_output_cores){
core = {reducer_idx % grid_size.x, reducer_idx / grid_size.x};
reducer_idx++;
}
Expand Down Expand Up @@ -182,6 +182,7 @@ operation::ProgramWithCallbacks sdpa_decode_multi_core(
log_debug("num_reducer_cores: {}", num_reducer_cores);
log_debug("num_output_cores: {}", num_output_cores);
log_debug("core_group: {}", core_group);
log_debug("core_group_idle: {}", core_group_idle);

// These tile capacity counts for CBs need to match the number of tiles expected by the kernel (softmax.cpp)
uint32_t q_tiles = PNHt * DHt;
Expand Down Expand Up @@ -630,7 +631,7 @@ operation::ProgramWithCallbacks sdpa_decode_multi_core(
CoreCoord core = core_group_idle[i];
log_debug("Setting core {} to idle", core);
// reader runtime args
std::vector<uint32_t> reader_rt_args = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
std::vector<uint32_t> reader_rt_args = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

// writer runtime args
std::vector<uint32_t> writer_rt_args = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
Expand Down

0 comments on commit e601275

Please sign in to comment.