Skip to content

Commit

Permalink
#16353: Avoid readback of 0 bytes
Browse files Browse the repository at this point in the history
Attempting to do an interleaved read of 0 bytes can hit a noc sanitization check, so skip the command in that case.
  • Loading branch information
jbaumanTT committed Jan 2, 2025
1 parent 0f07b77 commit 365d3c7
Showing 1 changed file with 30 additions and 24 deletions.
54 changes: 30 additions & 24 deletions tt_metal/impl/dispatch/command_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1115,30 +1115,36 @@ void HWCommandQueue::enqueue_read_buffer(Buffer& buffer, void* dst, bool blockin
this->finish(sub_device_ids);
}
} else {
// this is a streaming command so we don't need to break down to multiple
auto command = EnqueueReadInterleavedBufferCommand(
this->id,
this->device,
this->noc_index,
buffer,
dst,
this->manager,
this->expected_num_workers_completed,
sub_device_ids,
src_page_index,
pages_to_read);

this->issued_completion_q_reads.push(std::make_shared<detail::CompletionReaderVariant>(
std::in_place_type<detail::ReadBufferDescriptor>,
buffer.buffer_layout(),
buffer.page_size(),
padded_page_size,
dst,
unpadded_dst_offset,
pages_to_read,
src_page_index));
this->enqueue_command(command, blocking, sub_device_ids);
this->increment_num_entries_in_completion_q();
if (pages_to_read > 0) {
// this is a streaming command so we don't need to break down to multiple
auto command = EnqueueReadInterleavedBufferCommand(
this->id,
this->device,
this->noc_index,
buffer,
dst,
this->manager,
this->expected_num_workers_completed,
sub_device_ids,
src_page_index,
pages_to_read);

this->issued_completion_q_reads.push(std::make_shared<detail::CompletionReaderVariant>(
std::in_place_type<detail::ReadBufferDescriptor>,
buffer.buffer_layout(),
buffer.page_size(),
padded_page_size,
dst,
unpadded_dst_offset,
pages_to_read,
src_page_index));
this->enqueue_command(command, blocking, sub_device_ids);
this->increment_num_entries_in_completion_q();
} else {
if (blocking) {
this->finish(sub_device_ids);
}
}
}
}

Expand Down

0 comments on commit 365d3c7

Please sign in to comment.