Add debug flag to override zeDeviceCanAccessPeer return value.

Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
Michal Mrozek
2022-10-20 12:56:29 +00:00
committed by Compute-Runtime-Automation
parent 22dbae1771
commit 3384b2fed0
4 changed files with 24 additions and 1 deletions

View File

@ -72,6 +72,11 @@ ze_result_t DeviceImp::canAccessPeer(ze_device_handle_t hPeerDevice, ze_bool_t *
DeviceImp *pPeerDevice = static_cast<DeviceImp *>(Device::fromHandle(hPeerDevice));
uint32_t peerRootDeviceIndex = pPeerDevice->getNEODevice()->getRootDeviceIndex();
if (NEO::DebugManager.flags.ForceZeDeviceCanAccessPerReturnValue.get() != -1) {
*value = !!NEO::DebugManager.flags.ForceZeDeviceCanAccessPerReturnValue.get();
return ZE_RESULT_SUCCESS;
}
if (this->crossAccessEnabledDevices.find(peerRootDeviceIndex) != this->crossAccessEnabledDevices.end()) {
*value = this->crossAccessEnabledDevices[peerRootDeviceIndex];
} else if (this->getNEODevice()->getRootDeviceIndex() == peerRootDeviceIndex) {

View File

@ -2369,6 +2369,22 @@ TEST_F(MultipleDevicesDisabledImplicitScalingTest, givenTwoRootDevicesFromSameFa
EXPECT_TRUE(canAccess);
}
TEST_F(MultipleDevicesDisabledImplicitScalingTest, givenTwoRootDevicesFromSameFamilyThenCanAccessPeerReturnsValueBasingOnDebugVariable) {
DebugManagerStateRestore restorer;
DebugManager.flags.ForceZeDeviceCanAccessPerReturnValue.set(0);
L0::Device *device0 = driverHandle->devices[0];
L0::Device *device1 = driverHandle->devices[1];
ze_bool_t canAccess = false;
ze_result_t res = device0->canAccessPeer(device1->toHandle(), &canAccess);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
EXPECT_FALSE(canAccess);
DebugManager.flags.ForceZeDeviceCanAccessPerReturnValue.set(1);
res = device0->canAccessPeer(device1->toHandle(), &canAccess);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
EXPECT_TRUE(canAccess);
}
TEST_F(MultipleDevicesDisabledImplicitScalingTest, givenCanAccessPeerCalledTwiceThenCanAccessPeerReturnsSameValueEachTime) {
L0::Device *device0 = driverHandle->devices[0];
L0::Device *device1 = driverHandle->devices[1];

View File

@ -221,6 +221,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, PlaformSupportEvictIfNecessaryFlag, -1, "-1: def
DECLARE_DEBUG_VARIABLE(int32_t, ForceEvictOnlyIfNecessaryFlag, -1, "-1: default - driver selects when to use, 0: force never use this flag, 1: force always use this flag")
DECLARE_DEBUG_VARIABLE(int32_t, ForceStatelessMocsEncryptionBit, -1, "-1: default - 1: set encryption bit")
DECLARE_DEBUG_VARIABLE(int32_t, CopyHostPtrOnCpu, -1, "-1: default, 0: disable, 1:enable, In clCreateBuffer with CL_MEM_COPY_HOST_PTR, copy memory using locked ptr on cpu")
DECLARE_DEBUG_VARIABLE(int32_t, ForceZeDeviceCanAccessPerReturnValue, -1, "-1: default, 0: zeDeviceCanAccessPeer always return false 1: zeDeviceCanAccessPeer always return true")
/*LOGGING FLAGS*/
DECLARE_DEBUG_VARIABLE(int32_t, PrintDriverDiagnostics, -1, "prints driver diagnostics messages to standard output, value corresponds to hint level")

View File

@ -472,4 +472,5 @@ ExperimentalD2HCpuCopyThreshold = -1
CopyHostPtrOnCpu = -1
PrintCompletionFenceUsage = 0
SetAmountOfReusableAllocations = -1
ExperimentalSmallBufferPoolAllocator = -1
ExperimentalSmallBufferPoolAllocator = -1
ForceZeDeviceCanAccessPerReturnValue = -1