mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 14:46:52 +08:00
Fix shared cross device capabilities support
Require KMD migration support for concurrent & atomic memory access between multiple devices for shared allocations. Related-To: LOCI-3457 Signed-off-by: Raiyan Latif <raiyan.latif@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
4fce3ede9b
commit
574c9ef06e
@@ -615,9 +615,15 @@ ze_result_t DeviceImp::getMemoryAccessProperties(ze_device_memory_access_propert
|
||||
|
||||
pMemAccessProperties->sharedCrossDeviceAllocCapabilities = {};
|
||||
if (this->getNEODevice()->getHardwareInfo().capabilityTable.p2pAccessSupported) {
|
||||
pMemAccessProperties->sharedCrossDeviceAllocCapabilities |= ZE_MEMORY_ACCESS_CAP_FLAG_RW | ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT;
|
||||
if (this->getNEODevice()->getHardwareInfo().capabilityTable.p2pAtomicAccessSupported) {
|
||||
pMemAccessProperties->sharedCrossDeviceAllocCapabilities |= ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC | ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT_ATOMIC;
|
||||
pMemAccessProperties->sharedCrossDeviceAllocCapabilities = ZE_MEMORY_ACCESS_CAP_FLAG_RW;
|
||||
|
||||
auto memoryManager = this->getDriverHandle()->getMemoryManager();
|
||||
if (memoryManager->isKmdMigrationAvailable(this->getRootDeviceIndex()) &&
|
||||
NEO::DebugManager.flags.EnableRecoverablePageFaults.get() == 1) {
|
||||
pMemAccessProperties->sharedCrossDeviceAllocCapabilities |= ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT;
|
||||
if (this->getNEODevice()->getHardwareInfo().capabilityTable.p2pAtomicAccessSupported) {
|
||||
pMemAccessProperties->sharedCrossDeviceAllocCapabilities |= ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC | ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT_ATOMIC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1986,6 +1986,14 @@ TEST_F(DeviceHas64BitAtomicTest, givenDeviceWithSupportForInteger64BitAtomicsThe
|
||||
|
||||
struct MockMemoryManagerMultiDevice : public MemoryManagerMock {
|
||||
MockMemoryManagerMultiDevice(NEO::ExecutionEnvironment &executionEnvironment) : MemoryManagerMock(const_cast<NEO::ExecutionEnvironment &>(executionEnvironment)) {}
|
||||
|
||||
bool isKmdMigrationAvailable(uint32_t rootDeviceIndex) override {
|
||||
if (DebugManager.flags.UseKmdMigration.get() != -1) {
|
||||
return DebugManager.flags.UseKmdMigration.get();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <int32_t enablePartitionWalker>
|
||||
@@ -2356,6 +2364,54 @@ TEST_F(MemoryAccessPropertieP2PAccess1Atomic0, WhenCallingGetMemoryAccessPropert
|
||||
auto result = device->getMemoryAccessProperties(&properties);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
ze_memory_access_cap_flags_t expectedSharedCrossDeviceAllocCapabilities =
|
||||
ZE_MEMORY_ACCESS_CAP_FLAG_RW;
|
||||
EXPECT_EQ(expectedSharedCrossDeviceAllocCapabilities, properties.sharedCrossDeviceAllocCapabilities);
|
||||
}
|
||||
|
||||
using MemoryAccessPropertieP2PAccess1Atomic0 = MultipleDevicesP2PFixture<1, 0, 0, 0>;
|
||||
TEST_F(MemoryAccessPropertieP2PAccess1Atomic0, WhenCallingGetMemoryAccessPropertiesWithDevicesHavingP2PWithoutRecoverablePageFaultsThenSupportIsReturned) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.EnableRecoverablePageFaults.set(0);
|
||||
DebugManager.flags.UseKmdMigration.set(1);
|
||||
|
||||
L0::Device *device = driverHandle->devices[0];
|
||||
ze_device_memory_access_properties_t properties;
|
||||
auto result = device->getMemoryAccessProperties(&properties);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
ze_memory_access_cap_flags_t expectedSharedCrossDeviceAllocCapabilities =
|
||||
ZE_MEMORY_ACCESS_CAP_FLAG_RW;
|
||||
EXPECT_EQ(expectedSharedCrossDeviceAllocCapabilities, properties.sharedCrossDeviceAllocCapabilities);
|
||||
}
|
||||
|
||||
using MemoryAccessPropertieP2PAccess1Atomic0 = MultipleDevicesP2PFixture<1, 0, 0, 0>;
|
||||
TEST_F(MemoryAccessPropertieP2PAccess1Atomic0, WhenCallingGetMemoryAccessPropertiesWithDevicesHavingP2PWithoutKmdMigrationThenSupportIsReturned) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.EnableRecoverablePageFaults.set(1);
|
||||
DebugManager.flags.UseKmdMigration.set(0);
|
||||
|
||||
L0::Device *device = driverHandle->devices[0];
|
||||
ze_device_memory_access_properties_t properties;
|
||||
auto result = device->getMemoryAccessProperties(&properties);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
ze_memory_access_cap_flags_t expectedSharedCrossDeviceAllocCapabilities =
|
||||
ZE_MEMORY_ACCESS_CAP_FLAG_RW;
|
||||
EXPECT_EQ(expectedSharedCrossDeviceAllocCapabilities, properties.sharedCrossDeviceAllocCapabilities);
|
||||
}
|
||||
|
||||
using MemoryAccessPropertieP2PAccess1Atomic0 = MultipleDevicesP2PFixture<1, 0, 0, 0>;
|
||||
TEST_F(MemoryAccessPropertieP2PAccess1Atomic0, WhenCallingGetMemoryAccessPropertiesWithDevicesHavingP2PAndConcurrentAccessSupportThenSupportIsReturned) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.EnableRecoverablePageFaults.set(1);
|
||||
DebugManager.flags.UseKmdMigration.set(1);
|
||||
|
||||
L0::Device *device = driverHandle->devices[0];
|
||||
ze_device_memory_access_properties_t properties;
|
||||
auto result = device->getMemoryAccessProperties(&properties);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
ze_memory_access_cap_flags_t expectedSharedCrossDeviceAllocCapabilities =
|
||||
ZE_MEMORY_ACCESS_CAP_FLAG_RW | ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT;
|
||||
EXPECT_EQ(expectedSharedCrossDeviceAllocCapabilities, properties.sharedCrossDeviceAllocCapabilities);
|
||||
@@ -2363,6 +2419,10 @@ TEST_F(MemoryAccessPropertieP2PAccess1Atomic0, WhenCallingGetMemoryAccessPropert
|
||||
|
||||
using MemoryAccessPropertieP2PAccess1Atomic1 = MultipleDevicesP2PFixture<1, 1, 0, 0>;
|
||||
TEST_F(MemoryAccessPropertieP2PAccess1Atomic1, WhenCallingGetMemoryAccessPropertiesWithDevicesHavingP2PAndAtomicAccessSupportThenSupportIsReturned) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.EnableRecoverablePageFaults.set(1);
|
||||
DebugManager.flags.UseKmdMigration.set(1);
|
||||
|
||||
L0::Device *device = driverHandle->devices[0];
|
||||
ze_device_memory_access_properties_t properties;
|
||||
auto result = device->getMemoryAccessProperties(&properties);
|
||||
|
||||
Reference in New Issue
Block a user