Skip to content

Commit c26e977

Browse files
committed
Addressing comments to modify how environment variable is accessed
Signed-off-by: Arvind Sudarsanam <[email protected]>
1 parent 936b2da commit c26e977

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ static const pi_uint32 ZeSerialize = [] {
4646
return SerializeModeValue;
4747
}();
4848

49+
// This is an experimental option to test performance of device to device copy
50+
// operations on copy engines (versus compute engine)
51+
static const bool UseCopyEngineForD2DCopy = [] {
52+
const char *CopyEngineForD2DCopy =
53+
std::getenv("SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE_FOR_D2D_COPY");
54+
return (CopyEngineForD2DCopy && (std::stoi(CopyEngineForD2DCopy) != 0));
55+
}();
56+
4957
// This class encapsulates actions taken along with a call to Level Zero API.
5058
class ZeCall {
5159
private:
@@ -4946,17 +4954,6 @@ pi_result piEnqueueMemBufferWriteRect(
49464954
EventWaitList, Event);
49474955
}
49484956

4949-
// This is an experimental option to test performance of device to device copy
4950-
// operations on copy engines (versus compute engine)
4951-
static bool UseCopyEngineForD2DCopy(bool HasCopyEngine) {
4952-
if (HasCopyEngine) {
4953-
const char *CopyEngineForD2DCopy =
4954-
std::getenv("SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE_FOR_D2D_COPY");
4955-
return (CopyEngineForD2DCopy && (std::stoi(CopyEngineForD2DCopy) != 0));
4956-
}
4957-
return false;
4958-
}
4959-
49604957
pi_result piEnqueueMemBufferCopy(pi_queue Queue, pi_mem SrcBuffer,
49614958
pi_mem DstBuffer, size_t SrcOffset,
49624959
size_t DstOffset, size_t Size,
@@ -4970,8 +4967,7 @@ pi_result piEnqueueMemBufferCopy(pi_queue Queue, pi_mem SrcBuffer,
49704967
bool PreferCopyEngine = (SrcBuffer->OnHost || DstBuffer->OnHost);
49714968

49724969
// Temporary option added to use copy engine for D2D copy
4973-
// This is an experimental option and will be removed soon
4974-
PreferCopyEngine |= UseCopyEngineForD2DCopy(Queue->Device->hasCopyEngine());
4970+
PreferCopyEngine |= UseCopyEngineForD2DCopy;
49754971

49764972
return enqueueMemCopyHelper(
49774973
PI_COMMAND_TYPE_MEM_BUFFER_COPY, Queue,
@@ -6222,8 +6218,7 @@ pi_result piextUSMEnqueueMemcpy(pi_queue Queue, pi_bool Blocking, void *DstPtr,
62226218
!IsDevicePointer(Queue->Context, DstPtr);
62236219

62246220
// Temporary option added to use copy engine for D2D copy
6225-
// This is an experimental option and will be removed soon
6226-
PreferCopyEngine |= UseCopyEngineForD2DCopy(Queue->Device->hasCopyEngine());
6221+
PreferCopyEngine |= UseCopyEngineForD2DCopy;
62276222

62286223
return enqueueMemCopyHelper(
62296224
// TODO: do we need a new command type for this?

0 commit comments

Comments
 (0)