Skip to content

Commit 31b7726

Browse files
authored
[SYCL][L0] Add new environment variable to control the use of copy engine for in-order queues (#4335)
1 parent a5d290d commit 31b7726

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ static const bool UseCopyEngineForD2DCopy = [] {
6060
return (CopyEngineForD2DCopy && (std::stoi(CopyEngineForD2DCopy) != 0));
6161
}();
6262

63+
// This is an experimental option that allows the use of copy engine, if
64+
// available in the device, in Level Zero plugin for copy operations submitted
65+
// to an in-order queue. The default is 1.
66+
static const bool UseCopyEngineForInOrderQueue = [] {
67+
const char *CopyEngineForInOrderQueue =
68+
std::getenv("SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE_FOR_IN_ORDER_QUEUE");
69+
return (!CopyEngineForInOrderQueue ||
70+
(std::stoi(CopyEngineForInOrderQueue) != 0));
71+
}();
72+
6373
// This class encapsulates actions taken along with a call to Level Zero API.
6474
class ZeCall {
6575
private:
@@ -869,7 +879,9 @@ pi_result _pi_context::getAvailableCommandList(
869879
if (auto Res = Queue->executeOpenCommandList())
870880
return Res;
871881
}
872-
bool UseCopyEngine = PreferCopyEngine && Queue->Device->hasCopyEngine();
882+
bool UseCopyEngine =
883+
(!(Queue->isInOrderQueue()) || UseCopyEngineForInOrderQueue) &&
884+
PreferCopyEngine && Queue->Device->hasCopyEngine();
873885

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

0 commit comments

Comments
 (0)