Correctly use debug variable for enabling copy lists and queues

Change-Id: If7dd67e6d2f2aa49f15ca6ce0e6b2dac6ff8e04e
Signed-off: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga
2020-05-11 23:19:48 -07:00
committed by sys_ocldev
parent fe719f2665
commit 415954e7a7
4 changed files with 29 additions and 23 deletions

View File

@ -93,12 +93,18 @@ struct DeviceImp : public Device {
protected:
template <typename DescriptionType, typename ExpectedFlagType>
ze_result_t isCreatedCommandListCopyOnly(const DescriptionType *desc, bool *useBliter, ExpectedFlagType flag) {
*useBliter = false;
if (desc->flags & flag) {
auto hwInfo = neoDevice->getHardwareInfo();
if (hwInfo.capabilityTable.blitterOperationsSupported) {
*useBliter = NEO::DebugManager.flags.EnableCopyOnlyCommandListsAndCommandQueues.get();
if (NEO::DebugManager.flags.EnableCopyOnlyCommandListsAndCommandQueues.get() == -1) {
*useBliter = true;
} else {
*useBliter = NEO::DebugManager.flags.EnableCopyOnlyCommandListsAndCommandQueues.get();
}
return ZE_RESULT_SUCCESS;
}
return ZE_RESULT_ERROR_INVALID_ENUMERATION;
}
return ZE_RESULT_SUCCESS;

View File

@ -301,23 +301,7 @@ TEST_F(MultipleDevicesDifferentFamilyAndLocalMemorySupportTest, givenTwoDevicesF
EXPECT_FALSE(canAccess);
}
TEST_F(DeviceTest, givenHwInfoAndCopyOnlyFlagWhenCopyOnlyDebugFlagIsDefaultThenUseBliterIsFalse) {
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
hwInfo.capabilityTable.blitterOperationsSupported = true;
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, rootDeviceIndex);
Mock<L0::DeviceImp> l0Device(neoMockDevice, neoDevice->getExecutionEnvironment());
ze_command_list_desc_t desc = {};
desc.flags = ZE_COMMAND_LIST_FLAG_COPY_ONLY;
auto flag = ZE_COMMAND_LIST_FLAG_COPY_ONLY;
bool useBliter = true;
ze_result_t res = l0Device.isCreatedCommandListCopyOnly(&desc, &useBliter, flag);
EXPECT_FALSE(useBliter);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
TEST_F(DeviceTest, givenHwInfoAndCopyOnlyFlagWhenCopyOnlyDebugFlagIsEnabledThenUseBliterIsTrue) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.EnableCopyOnlyCommandListsAndCommandQueues.set(true);
TEST_F(DeviceTest, givenBlitterSupportAndCopyOnlyFlagWhenCopyOnlyDebugFlagIsDefaultThenUseBliterIsTrueAndSuccessIsReturned) {
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
hwInfo.capabilityTable.blitterOperationsSupported = true;
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, rootDeviceIndex);
@ -331,9 +315,25 @@ TEST_F(DeviceTest, givenHwInfoAndCopyOnlyFlagWhenCopyOnlyDebugFlagIsEnabledThenU
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
TEST_F(DeviceTest, givenHwInfoAndCopyOnlyFlagWhenCopyOnlyDebugFlagIsDisabledThenUseBliterIsFalse) {
TEST_F(DeviceTest, givenBlitterSupportAndCopyOnlyFlagWhenCopyOnlyDebugFlagIsSetToZeroThenUseBliterIsFalseAndSuccessIsReturned) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.EnableCopyOnlyCommandListsAndCommandQueues.set(false);
DebugManager.flags.EnableCopyOnlyCommandListsAndCommandQueues.set(0);
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
hwInfo.capabilityTable.blitterOperationsSupported = true;
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, rootDeviceIndex);
Mock<L0::DeviceImp> l0Device(neoMockDevice, neoDevice->getExecutionEnvironment());
ze_command_list_desc_t desc = {};
desc.flags = ZE_COMMAND_LIST_FLAG_COPY_ONLY;
auto flag = ZE_COMMAND_LIST_FLAG_COPY_ONLY;
bool useBliter = true;
ze_result_t res = l0Device.isCreatedCommandListCopyOnly(&desc, &useBliter, flag);
EXPECT_FALSE(useBliter);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
TEST_F(DeviceTest, givenBlitterSupportAndCopyOnlyFlagWhenCopyOnlyDebugFlagIsSetToOneThenUseBliterIsTrueAndSuccessIsReturned) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.EnableCopyOnlyCommandListsAndCommandQueues.set(1);
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
hwInfo.capabilityTable.blitterOperationsSupported = true;
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, rootDeviceIndex);
@ -343,7 +343,7 @@ TEST_F(DeviceTest, givenHwInfoAndCopyOnlyFlagWhenCopyOnlyDebugFlagIsDisabledThen
auto flag = ZE_COMMAND_LIST_FLAG_COPY_ONLY;
bool useBliter = false;
ze_result_t res = l0Device.isCreatedCommandListCopyOnly(&desc, &useBliter, flag);
EXPECT_FALSE(useBliter);
EXPECT_TRUE(useBliter);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}

View File

@ -113,7 +113,7 @@ ForceSamplerLowFilteringPrecision = 0
UseBindlessBuffers = 0
UseBindlessImages = 0
MakeAllBuffersResident = 0
EnableCopyOnlyCommandListsAndCommandQueues = 0
EnableCopyOnlyCommandListsAndCommandQueues = -1
DisableDeviceEnqueue = 0
EnableIntelVme = -1
EnableIntelAdvancedVme = -1

View File

@ -136,8 +136,8 @@ DECLARE_DEBUG_VARIABLE(bool, ForceSamplerLowFilteringPrecision, false, "Force Lo
DECLARE_DEBUG_VARIABLE(bool, UseBindlessBuffers, false, "Force compiler to use bindless buffer addressing instead of stateful one")
DECLARE_DEBUG_VARIABLE(bool, UseBindlessImages, false, "Force compiler to use bindless image addressing instead of stateful one")
DECLARE_DEBUG_VARIABLE(bool, MakeAllBuffersResident, false, "Make all buffers resident after creation")
DECLARE_DEBUG_VARIABLE(bool, EnableCopyOnlyCommandListsAndCommandQueues, false, "Enable copy only commandlists and commandQueues")
DECLARE_DEBUG_VARIABLE(bool, DisableDeviceEnqueue, false, "Disable support for device enqueue")
DECLARE_DEBUG_VARIABLE(int32_t, EnableCopyOnlyCommandListsAndCommandQueues, -1, "-1: default behavior, 0: disabled, 1: enabled, Enable copy only commandlists and commandQueues")
DECLARE_DEBUG_VARIABLE(int32_t, EnableIntelVme, -1, "-1: default, 0: disabled, 1: Enables cl_intel_motion_estimation extension")
DECLARE_DEBUG_VARIABLE(int32_t, EnableIntelAdvancedVme, -1, "-1: default, 0: disabled, 1: Enables cl_intel_advanced_motion_estimation extension")
DECLARE_DEBUG_VARIABLE(int32_t, EnableBlitterOperationsSupport, -1, "-1: default, 0: disable, 1: enable")