Add support for ZE_IPC_MEMORY_FLAG_BIAS_UNCACHED

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga
2021-07-02 09:20:44 +00:00
committed by Compute-Runtime-Automation
parent 64eb82efac
commit aa51c5ee76
2 changed files with 30 additions and 0 deletions

View File

@@ -42,6 +42,10 @@ void *DriverHandleImp::importFdHandle(ze_device_handle_t hDevice, ze_ipc_memory_
allocData.allocationFlagsProperty.flags.locallyUncachedResource = 1; allocData.allocationFlagsProperty.flags.locallyUncachedResource = 1;
} }
if (flags & ZE_IPC_MEMORY_FLAG_BIAS_UNCACHED) {
allocData.allocationFlagsProperty.flags.locallyUncachedResource = 1;
}
this->getSvmAllocsManager()->insertSVMAlloc(allocData); this->getSvmAllocsManager()->insertSVMAlloc(allocData);
if (pAlloc) { if (pAlloc) {

View File

@@ -2454,6 +2454,32 @@ TEST_F(ImportFdUncachedTests,
context->freeMem(ptr); context->freeMem(ptr);
} }
TEST_F(ImportFdUncachedTests,
givenCallToImportFdHandleWithUncachedIpcFlagsThenLocallyUncachedResourceIsSet) {
ze_ipc_memory_flags_t flags = ZE_IPC_MEMORY_FLAG_BIAS_UNCACHED;
uint64_t handle = 1;
void *ptr = driverHandle->importFdHandle(device->toHandle(), flags, handle, nullptr);
EXPECT_NE(nullptr, ptr);
auto allocData = driverHandle->svmAllocsManager->getSVMAlloc(ptr);
EXPECT_EQ(allocData->allocationFlagsProperty.flags.locallyUncachedResource, 1u);
context->freeMem(ptr);
}
TEST_F(ImportFdUncachedTests,
givenCallToImportFdHandleWithBothUncachedFlagsThenLocallyUncachedResourceIsSet) {
ze_ipc_memory_flags_t flags = ZE_DEVICE_MEM_ALLOC_FLAG_BIAS_UNCACHED | ZE_IPC_MEMORY_FLAG_BIAS_UNCACHED;
uint64_t handle = 1;
void *ptr = driverHandle->importFdHandle(device->toHandle(), flags, handle, nullptr);
EXPECT_NE(nullptr, ptr);
auto allocData = driverHandle->svmAllocsManager->getSVMAlloc(ptr);
EXPECT_EQ(allocData->allocationFlagsProperty.flags.locallyUncachedResource, 1u);
context->freeMem(ptr);
}
TEST_F(ImportFdUncachedTests, TEST_F(ImportFdUncachedTests,
givenCallToImportFdHandleWithoutUncachedFlagsThenLocallyUncachedResourceIsNotSet) { givenCallToImportFdHandleWithoutUncachedFlagsThenLocallyUncachedResourceIsNotSet) {
ze_ipc_memory_flags_t flags = {}; ze_ipc_memory_flags_t flags = {};