Skip to content

[SYCL][PI][L0]Close and submit batch immediately when Queue is empty. #3552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -843,9 +843,23 @@ pi_result _pi_queue::executeCommandList(ze_command_list_handle_t ZeCommandList,
ze_fence_handle_t ZeFence,
pi_event Event, bool IsBlocking,
bool OKToBatchCommand) {
// If the current LastCommandEvent is the nullptr, then it means
// either that no command has ever been issued to the queue
// or it means that the LastCommandEvent has been signalled and
// therefore that this Queue is idle.
bool CurrentlyEmpty = this->LastCommandEvent == nullptr;

this->LastCommandEvent = Event;

if (OKToBatchCommand && this->isBatchingAllowed()) {
// Batch if allowed to, but don't batch if we know there are no kernels
// from this queue that are currently executing. This is intended to gets
// kernels started as soon as possible when there are no kernels from this
// queue awaiting execution, while allowing batching to occur when there
// are kernels already executing. Also, if we are using fixed size batching,
// as indicated by !UseDynamicBatching, then just ignore CurrentlyEmpty
// as we want to strictly follow the batching the user specified.
if (OKToBatchCommand && this->isBatchingAllowed() &&
(!UseDynamicBatching || !CurrentlyEmpty)) {
if (this->ZeOpenCommandList != nullptr &&
this->ZeOpenCommandList != ZeCommandList)
die("executeCommandList: ZeOpenCommandList should be equal to"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
// CKALL: Test Pass
// CKALL: Test Pass
// CKALL: Test Pass
// CKDYN: Lowering QueueBatchSize to 3
// CKDYN: Lowering QueueBatchSize to 2
// CKDYN-NOT: Lowering QueueBatchSize
// CKALL: Test Pass
// CKALL: Test Pass
Expand Down