Skip to content

[SYCL][L0] Add new environment variable to control the use of copy engine for in-order queues #4335

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 8 commits into from
Aug 18, 2021
Merged
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
14 changes: 13 additions & 1 deletion sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ static const bool UseCopyEngineForD2DCopy = [] {
return (CopyEngineForD2DCopy && (std::stoi(CopyEngineForD2DCopy) != 0));
}();

// This is an experimental option that allows the use of copy engine, if
// available in the device, in Level Zero plugin for copy operations submitted
// to an in-order queue. The default is 1.
static const bool UseCopyEngineForInOrderQueue = [] {
const char *CopyEngineForInOrderQueue =
std::getenv("SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE_FOR_IN_ORDER_QUEUE");
return (!CopyEngineForInOrderQueue ||
(std::stoi(CopyEngineForInOrderQueue) != 0));
}();

// This class encapsulates actions taken along with a call to Level Zero API.
class ZeCall {
private:
Expand Down Expand Up @@ -869,7 +879,9 @@ pi_result _pi_context::getAvailableCommandList(
if (auto Res = Queue->executeOpenCommandList())
return Res;
}
bool UseCopyEngine = PreferCopyEngine && Queue->Device->hasCopyEngine();
bool UseCopyEngine =
(!(Queue->isInOrderQueue()) || UseCopyEngineForInOrderQueue) &&
PreferCopyEngine && Queue->Device->hasCopyEngine();

// Create/Reuse the command list, because in Level Zero commands are added to
// the command lists, and later are then added to the command queue.
Expand Down