Correctly pass descriptors to L0 device and host alloc functions

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga
2020-11-10 00:46:39 -08:00
committed by Compute-Runtime-Automation
parent 22a56655d7
commit 9473abc86a
15 changed files with 76 additions and 50 deletions

View File

@@ -28,7 +28,7 @@ zeMemAllocDevice(
size_t alignment,
ze_device_handle_t hDevice,
void **pptr) {
return L0::Context::fromHandle(hContext)->allocDeviceMem(hDevice, 0, size, alignment, pptr);
return L0::Context::fromHandle(hContext)->allocDeviceMem(hDevice, deviceDesc, size, alignment, pptr);
}
ZE_APIEXPORT ze_result_t ZE_APICALL
@@ -38,7 +38,7 @@ zeMemAllocHost(
size_t size,
size_t alignment,
void **pptr) {
return L0::Context::fromHandle(hContext)->allocHostMem(0, size, alignment, pptr);
return L0::Context::fromHandle(hContext)->allocHostMem(hostDesc, size, alignment, pptr);
}
ZE_APIEXPORT ze_result_t ZE_APICALL

View File

@@ -23,12 +23,12 @@ struct Context : _ze_context_handle_t {
virtual ze_result_t destroy() = 0;
virtual ze_result_t getStatus() = 0;
virtual DriverHandle *getDriverHandle() = 0;
virtual ze_result_t allocHostMem(ze_host_mem_alloc_flags_t flags,
virtual ze_result_t allocHostMem(const ze_host_mem_alloc_desc_t *hostDesc,
size_t size,
size_t alignment,
void **ptr) = 0;
virtual ze_result_t allocDeviceMem(ze_device_handle_t hDevice,
ze_device_mem_alloc_flags_t flags,
const ze_device_mem_alloc_desc_t *deviceDesc,
size_t size,
size_t alignment, void **ptr) = 0;
virtual ze_result_t allocSharedMem(ze_device_handle_t hDevice,

View File

@@ -40,24 +40,24 @@ ContextImp::ContextImp(DriverHandle *driverHandle) {
this->driverHandle = driverHandle;
}
ze_result_t ContextImp::allocHostMem(ze_host_mem_alloc_flags_t flags,
ze_result_t ContextImp::allocHostMem(const ze_host_mem_alloc_desc_t *hostDesc,
size_t size,
size_t alignment,
void **ptr) {
DEBUG_BREAK_IF(nullptr == this->driverHandle);
return this->driverHandle->allocHostMem(flags,
return this->driverHandle->allocHostMem(hostDesc,
size,
alignment,
ptr);
}
ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice,
ze_device_mem_alloc_flags_t flags,
const ze_device_mem_alloc_desc_t *deviceDesc,
size_t size,
size_t alignment, void **ptr) {
DEBUG_BREAK_IF(nullptr == this->driverHandle);
return this->driverHandle->allocDeviceMem(hDevice,
flags,
deviceDesc,
size,
alignment,
ptr);

View File

@@ -18,12 +18,12 @@ struct ContextImp : Context {
ze_result_t destroy() override;
ze_result_t getStatus() override;
DriverHandle *getDriverHandle() override;
ze_result_t allocHostMem(ze_host_mem_alloc_flags_t flags,
ze_result_t allocHostMem(const ze_host_mem_alloc_desc_t *hostDesc,
size_t size,
size_t alignment,
void **ptr) override;
ze_result_t allocDeviceMem(ze_device_handle_t hDevice,
ze_device_mem_alloc_flags_t flags,
const ze_device_mem_alloc_desc_t *deviceDesc,
size_t size,
size_t alignment, void **ptr) override;
ze_result_t allocSharedMem(ze_device_handle_t hDevice,

View File

@@ -36,9 +36,9 @@ struct DriverHandle : _ze_driver_handle_t {
ze_memory_allocation_properties_t *pMemAllocProperties,
ze_device_handle_t *phDevice) = 0;
virtual ze_result_t allocHostMem(ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) = 0;
virtual ze_result_t allocHostMem(const ze_host_mem_alloc_desc_t *hostDesc, size_t size, size_t alignment, void **ptr) = 0;
virtual ze_result_t allocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t flags, size_t size,
virtual ze_result_t allocDeviceMem(ze_device_handle_t hDevice, const ze_device_mem_alloc_desc_t *deviceDesc, size_t size,
size_t alignment, void **ptr) = 0;
virtual ze_result_t allocSharedMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t deviceFlags,

View File

@@ -28,9 +28,9 @@ struct DriverHandleImp : public DriverHandle {
ze_memory_allocation_properties_t *pMemAllocProperties,
ze_device_handle_t *phDevice) override;
ze_result_t allocHostMem(ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) override;
ze_result_t allocHostMem(const ze_host_mem_alloc_desc_t *hostDesc, size_t size, size_t alignment, void **ptr) override;
ze_result_t allocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t flags, size_t size,
ze_result_t allocDeviceMem(ze_device_handle_t hDevice, const ze_device_mem_alloc_desc_t *deviceDesc, size_t size,
size_t alignment, void **ptr) override;
ze_result_t allocSharedMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t deviceFlags,

View File

@@ -99,7 +99,7 @@ ze_result_t DriverHandleImp::getMemAddressRange(const void *ptr, void **pBase, s
return ZE_RESULT_ERROR_UNKNOWN;
}
ze_result_t DriverHandleImp::allocHostMem(ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment,
ze_result_t DriverHandleImp::allocHostMem(const ze_host_mem_alloc_desc_t *hostDesc, size_t size, size_t alignment,
void **ptr) {
if (size > this->devices[0]->getDeviceInfo().maxMemAllocSize) {
*ptr = nullptr;
@@ -119,7 +119,7 @@ ze_result_t DriverHandleImp::allocHostMem(ze_host_mem_alloc_flags_t flags, size_
return ZE_RESULT_SUCCESS;
}
ze_result_t DriverHandleImp::allocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t flags,
ze_result_t DriverHandleImp::allocDeviceMem(ze_device_handle_t hDevice, const ze_device_mem_alloc_desc_t *deviceDesc,
size_t size, size_t alignment, void **ptr) {
if (size > this->devices[0]->getNEODevice()->getHardwareCapabilities().maxMemAllocSize) {
*ptr = nullptr;

View File

@@ -41,7 +41,7 @@ struct Mock<Context> : public Context {
(override));
MOCK_METHOD(ze_result_t,
allocHostMem,
(ze_host_mem_alloc_flags_t flags,
(const ze_host_mem_alloc_desc_t *hostDesc,
size_t size,
size_t alignment,
void **ptr),
@@ -49,7 +49,7 @@ struct Mock<Context> : public Context {
MOCK_METHOD(ze_result_t,
allocDeviceMem,
(ze_device_handle_t hDevice,
ze_device_mem_alloc_flags_t flags,
const ze_device_mem_alloc_desc_t *deviceDesc,
size_t size,
size_t alignment,
void **ptr),

View File

@@ -54,7 +54,7 @@ ze_result_t Mock<DriverHandle>::doGetDevice(uint32_t *pCount, ze_device_handle_t
return ZE_RESULT_SUCCESS;
}
ze_result_t Mock<DriverHandle>::doAllocHostMem(ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment,
ze_result_t Mock<DriverHandle>::doAllocHostMem(const ze_host_mem_alloc_desc_t *hostDesc, size_t size, size_t alignment,
void **ptr) {
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, NEO::mockDeviceBitfield);
@@ -69,7 +69,8 @@ ze_result_t Mock<DriverHandle>::doAllocHostMem(ze_host_mem_alloc_flags_t flags,
return ZE_RESULT_SUCCESS;
}
ze_result_t Mock<DriverHandle>::doAllocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) {
ze_result_t Mock<DriverHandle>::doAllocDeviceMem(ze_device_handle_t hDevice, const ze_device_mem_alloc_desc_t *deviceDesc,
size_t size, size_t alignment, void **ptr) {
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, NEO::mockDeviceBitfield);
auto allocation = svmAllocsManager->createUnifiedMemoryAllocation(0u, size, unifiedMemoryProperties);

View File

@@ -99,7 +99,7 @@ struct Mock<DriverHandle> : public DriverHandleImp {
(override));
MOCK_METHOD(ze_result_t,
allocHostMem,
(ze_host_mem_alloc_flags_t flags,
(const ze_host_mem_alloc_desc_t *hostDesc,
size_t size,
size_t alignment,
void **ptr),
@@ -107,7 +107,7 @@ struct Mock<DriverHandle> : public DriverHandleImp {
MOCK_METHOD(ze_result_t,
allocDeviceMem,
(ze_device_handle_t hDevice,
ze_device_mem_alloc_flags_t flags,
const ze_device_mem_alloc_desc_t *deviceDesc,
size_t size,
size_t alignment,
void **ptr),
@@ -139,12 +139,12 @@ struct Mock<DriverHandle> : public DriverHandleImp {
ze_device_handle_t *phDevices);
NEO::MemoryManager *doGetMemoryManager();
NEO::SVMAllocsManager *doGetSvmAllocManager();
ze_result_t doAllocHostMem(ze_host_mem_alloc_flags_t flags,
ze_result_t doAllocHostMem(const ze_host_mem_alloc_desc_t *hostDesc,
size_t size,
size_t alignment,
void **ptr);
ze_result_t doAllocDeviceMem(ze_device_handle_t hDevice,
ze_device_mem_alloc_flags_t flags,
const ze_device_mem_alloc_desc_t *deviceDesc,
size_t size,
size_t alignment,
void **ptr);

View File

@@ -142,8 +142,9 @@ TEST_F(CommandListCreate, givenValidPtrThenAppendMemAdviseReturnsSuccess) {
size_t alignment = 1u;
void *ptr = nullptr;
ze_device_mem_alloc_desc_t deviceDesc = {};
auto res = driverHandle->allocDeviceMem(device->toHandle(),
0u,
&deviceDesc,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
EXPECT_NE(nullptr, ptr);
@@ -164,8 +165,9 @@ TEST_F(CommandListCreate, givenValidPtrThenAppendMemoryPrefetchReturnsSuccess) {
size_t alignment = 1u;
void *ptr = nullptr;
ze_device_mem_alloc_desc_t deviceDesc = {};
auto res = driverHandle->allocDeviceMem(device->toHandle(),
0u,
&deviceDesc,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
EXPECT_NE(nullptr, ptr);
@@ -417,7 +419,8 @@ HWTEST_F(CommandListCreate, givenCommandListWithInvalidWaitEventArgWhenAppendQue
event.signalScope = ZE_EVENT_SCOPE_FLAG_HOST;
void *alloc;
auto result = driverHandle->allocDeviceMem(device, ZE_DEVICE_MEM_ALLOC_FLAG_FORCE_UINT32, 128, 1, &alloc);
ze_device_mem_alloc_desc_t deviceDesc = {};
auto result = driverHandle->allocDeviceMem(device, &deviceDesc, 128, 1, &alloc);
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
auto eventHandle = event.toHandle();
@@ -483,7 +486,8 @@ HWTEST2_F(AppendQueryKernelTimestamps, givenCommandListWhenAppendQueryKernelTime
event.signalScope = ZE_EVENT_SCOPE_FLAG_HOST;
void *alloc;
auto result = driverHandle->allocDeviceMem(device, ZE_DEVICE_MEM_ALLOC_FLAG_FORCE_UINT32, 128, 1, &alloc);
ze_device_mem_alloc_desc_t deviceDesc = {};
auto result = driverHandle->allocDeviceMem(device, &deviceDesc, 128, 1, &alloc);
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
ze_event_handle_t events[2] = {event.toHandle(), event.toHandle()};
@@ -524,10 +528,11 @@ HWTEST2_F(AppendQueryKernelTimestamps, givenCommandListWhenAppendQueryKernelTime
event.signalScope = ZE_EVENT_SCOPE_FLAG_HOST;
void *alloc;
auto result = driverHandle->allocDeviceMem(device, ZE_DEVICE_MEM_ALLOC_FLAG_FORCE_UINT32, 128, 1, &alloc);
ze_device_mem_alloc_desc_t deviceDesc = {};
auto result = driverHandle->allocDeviceMem(device, &deviceDesc, 128, 1, &alloc);
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
void *offsetAlloc;
result = driverHandle->allocDeviceMem(device, ZE_DEVICE_MEM_ALLOC_FLAG_FORCE_UINT32, 128, 1, &offsetAlloc);
result = driverHandle->allocDeviceMem(device, &deviceDesc, 128, 1, &offsetAlloc);
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
ze_event_handle_t events[2] = {event.toHandle(), event.toHandle()};
@@ -580,7 +585,8 @@ HWTEST2_F(AppendQueryKernelTimestamps, givenCommandListWhenAppendQueryKernelTime
event.signalScope = ZE_EVENT_SCOPE_FLAG_HOST;
void *alloc;
auto result = driverHandle->allocDeviceMem(device, ZE_DEVICE_MEM_ALLOC_FLAG_FORCE_UINT32, 128, 1, &alloc);
ze_device_mem_alloc_desc_t deviceDesc = {};
auto result = driverHandle->allocDeviceMem(device, &deviceDesc, 128, 1, &alloc);
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
size_t eventCount = device->getNEODevice()->getDeviceInfo().maxWorkItemSizes[0] * 2u;
std::unique_ptr<ze_event_handle_t[]> events = std::make_unique<ze_event_handle_t[]>(eventCount);
@@ -681,7 +687,8 @@ HWTEST2_F(AppendQueryKernelTimestamps, givenCommandListWhenAppendQueryKernelTime
event.signalScope = ZE_EVENT_SCOPE_FLAG_HOST;
void *alloc;
auto result = driverHandle->allocDeviceMem(&mockDevice, ZE_DEVICE_MEM_ALLOC_FLAG_FORCE_UINT32, 128, 1, &alloc);
ze_device_mem_alloc_desc_t deviceDesc = {};
auto result = driverHandle->allocDeviceMem(&mockDevice, &deviceDesc, 128, 1, &alloc);
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
result = commandList.appendQueryKernelTimestamps(2u, events, alloc, nullptr, nullptr, 0u, nullptr);
@@ -765,7 +772,8 @@ HWTEST2_F(AppendQueryKernelTimestamps, givenCommandListWhenAppendQueryKernelTime
event.signalScope = ZE_EVENT_SCOPE_FLAG_HOST;
void *alloc;
auto result = driverHandle->allocDeviceMem(&mockDevice, ZE_DEVICE_MEM_ALLOC_FLAG_FORCE_UINT32, 128, 1, &alloc);
ze_device_mem_alloc_desc_t deviceDesc = {};
auto result = driverHandle->allocDeviceMem(&mockDevice, &deviceDesc, 128, 1, &alloc);
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
result = commandList.appendQueryKernelTimestamps(2u, events, alloc, nullptr, nullptr, 0u, nullptr);

View File

@@ -445,7 +445,8 @@ HWTEST_F(CommandListAppendLaunchKernel, givenIndirectDispatchWhenAppendingThenWo
std::unique_ptr<L0::CommandList> commandList(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, returnValue));
void *alloc = nullptr;
auto result = device->getDriverHandle()->allocDeviceMem(device->toHandle(), 0u, 16384u, 4096u, &alloc);
ze_device_mem_alloc_desc_t deviceDesc = {};
auto result = device->getDriverHandle()->allocDeviceMem(device->toHandle(), &deviceDesc, 16384u, 4096u, &alloc);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
result = commandList->appendLaunchKernelIndirect(kernel.toHandle(),
@@ -867,8 +868,9 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenAppendLaunchMult
auto commandList = std::unique_ptr<L0::CommandList>(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, returnValue));
const ze_kernel_handle_t launchFn = kernel->toHandle();
uint32_t *numLaunchArgs;
ze_device_mem_alloc_desc_t deviceDesc = {};
auto result = device->getDriverHandle()->allocDeviceMem(
device->toHandle(), 0u, 16384u, 4096u, reinterpret_cast<void **>(&numLaunchArgs));
device->toHandle(), &deviceDesc, 16384u, 4096u, reinterpret_cast<void **>(&numLaunchArgs));
result = commandList->appendLaunchMultipleKernelsIndirect(1, &launchFn, numLaunchArgs, nullptr, nullptr, 0, nullptr);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
*numLaunchArgs = 0;
@@ -895,8 +897,9 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenAppendLaunchMult
const ze_kernel_handle_t launchFn[3] = {kernel->toHandle(), kernel->toHandle(), kernel->toHandle()};
uint32_t *numLaunchArgs;
const uint32_t numKernels = 3;
ze_device_mem_alloc_desc_t deviceDesc = {};
auto result = device->getDriverHandle()->allocDeviceMem(
device->toHandle(), 0u, 16384u, 4096u, reinterpret_cast<void **>(&numLaunchArgs));
device->toHandle(), &deviceDesc, 16384u, 4096u, reinterpret_cast<void **>(&numLaunchArgs));
result = commandList->appendLaunchMultipleKernelsIndirect(numKernels, launchFn, numLaunchArgs, nullptr, nullptr, 0, nullptr);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
*numLaunchArgs = 2;

View File

@@ -270,7 +270,8 @@ HWTEST_F(CommandQueueIndirectAllocations, givenCommandQueueWhenExecutingCommandL
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, returnValue));
void *deviceAlloc = nullptr;
auto result = device->getDriverHandle()->allocDeviceMem(device->toHandle(), 0u, 16384u, 4096u, &deviceAlloc);
ze_device_mem_alloc_desc_t deviceDesc = {};
auto result = device->getDriverHandle()->allocDeviceMem(device->toHandle(), &deviceDesc, 16384u, 4096u, &deviceAlloc);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
auto gpuAlloc = device->getDriverHandle()->getSvmAllocsManager()->getSVMAllocs()->get(deviceAlloc)->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());

View File

@@ -22,8 +22,9 @@ TEST_F(MemoryTest, givenDevicePointerThenDriverGetAllocPropertiesReturnsDeviceHa
size_t alignment = 1u;
void *ptr = nullptr;
ze_device_mem_alloc_desc_t deviceDesc = {};
ze_result_t result = driverHandle->allocDeviceMem(device->toHandle(),
0u,
&deviceDesc,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, ptr);
@@ -48,8 +49,9 @@ TEST_F(DeviceMemorySizeTest, givenSizeGreaterThanLimitThenDeviceAllocationFails)
size_t alignment = 1u;
void *ptr = nullptr;
ze_device_mem_alloc_desc_t deviceDesc = {};
ze_result_t result = driverHandle->allocDeviceMem(nullptr,
0u,
&deviceDesc,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_SIZE, result);
}
@@ -84,7 +86,8 @@ TEST_F(MemoryTest, givenHostPointerThenDriverGetAllocPropertiesReturnsNullDevice
size_t alignment = 1u;
void *ptr = nullptr;
ze_result_t result = driverHandle->allocHostMem(0u,
ze_host_mem_alloc_desc_t hostDesc = {};
ze_result_t result = driverHandle->allocHostMem(&hostDesc,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, ptr);
@@ -188,8 +191,9 @@ struct MemoryBitfieldTest : testing::Test {
};
TEST_F(MemoryBitfieldTest, givenDeviceWithValidBitfieldWhenAllocatingDeviceMemoryThenPassProperBitfield) {
ze_device_mem_alloc_desc_t deviceDesc = {};
auto result = driverHandle->allocDeviceMem(device->toHandle(),
0u,
&deviceDesc,
size, alignment, &ptr);
EXPECT_EQ(neoDevice->getDeviceBitfield(), memoryManager->recentlyPassedDeviceBitfield);
@@ -307,7 +311,8 @@ TEST_F(AllocHostMemoryTest,
memoryManager->allocateGraphicsMemoryWithPropertiesCount = 0;
ze_result_t result = driverHandle->allocHostMem(0u,
ze_host_mem_alloc_desc_t hostDesc = {};
ze_result_t result = driverHandle->allocHostMem(&hostDesc,
4096u, 0u, &ptr);
EXPECT_EQ(memoryManager->allocateGraphicsMemoryWithPropertiesCount, numRootDevices);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
@@ -325,7 +330,8 @@ TEST_F(AllocHostMemoryTest,
memoryManager->allocateGraphicsMemoryWithPropertiesCount = 0;
ze_result_t result = driverHandle->allocHostMem(0u,
ze_host_mem_alloc_desc_t hostDesc = {};
ze_result_t result = driverHandle->allocHostMem(&hostDesc,
4096u, 0u, &ptr);
EXPECT_EQ(memoryManager->allocateGraphicsMemoryWithPropertiesCount, 1u);
EXPECT_EQ(ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY, result);
@@ -341,7 +347,8 @@ TEST_F(AllocHostMemoryTest,
memoryManager->allocateGraphicsMemoryWithPropertiesCount = 0;
ze_result_t result = driverHandle->allocHostMem(0u,
ze_host_mem_alloc_desc_t hostDesc = {};
ze_result_t result = driverHandle->allocHostMem(&hostDesc,
4096u, 0u, &ptr);
EXPECT_EQ(memoryManager->allocateGraphicsMemoryWithPropertiesCount, numRootDevices);
EXPECT_EQ(ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY, result);
@@ -371,7 +378,8 @@ TEST_F(ContextMemoryTest, whenAllocatingHostAllocationFromContextThenAllocationS
size_t alignment = 1u;
void *ptr = nullptr;
ze_result_t result = context->allocHostMem(0u,
ze_host_mem_alloc_desc_t hostDesc = {};
ze_result_t result = context->allocHostMem(&hostDesc,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, ptr);
@@ -385,8 +393,9 @@ TEST_F(ContextMemoryTest, whenAllocatingDeviceAllocationFromContextThenAllocatio
size_t alignment = 1u;
void *ptr = nullptr;
ze_device_mem_alloc_desc_t deviceDesc = {};
ze_result_t result = context->allocDeviceMem(device->toHandle(),
0u,
&deviceDesc,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, ptr);
@@ -400,8 +409,9 @@ TEST_F(ContextMemoryTest, whenRetrievingAddressRangeForDeviceAllocationThenRange
size_t alignment = 1u;
void *allocPtr = nullptr;
ze_device_mem_alloc_desc_t deviceDesc = {};
ze_result_t result = context->allocDeviceMem(device->toHandle(),
0u,
&deviceDesc,
allocSize, alignment, &allocPtr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, allocPtr);

View File

@@ -86,8 +86,9 @@ HWTEST2_F(ModuleTest, givenNonPatchedTokenThenSurfaceBaseAddressIsCorrectlySet,
auto kernelImp = reinterpret_cast<L0::KernelImp *>(L0::Kernel::fromHandle(kernelHandle));
void *devicePtr = nullptr;
ze_device_mem_alloc_desc_t deviceDesc = {};
res = device->getDriverHandle()->allocDeviceMem(device->toHandle(),
0u,
&deviceDesc,
16384u,
0u,
&devicePtr);
@@ -356,7 +357,8 @@ class DeviceModuleSetArgBufferTest : public ModuleFixture, public ::testing::Tes
ze_result_t res = module.get()->createKernel(&kernelDesc, kernelHandle);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
res = driverHandle->allocHostMem(0u, 4096u, rootDeviceIndex, ptr);
ze_host_mem_alloc_desc_t hostDesc = {};
res = driverHandle->allocHostMem(&hostDesc, 4096u, rootDeviceIndex, ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
};
@@ -417,7 +419,8 @@ class MultiDeviceModuleSetArgBufferTest : public MultiDeviceModuleFixture, publi
ze_result_t res = modules[rootDeviceIndex].get()->createKernel(&kernelDesc, kernelHandle);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
res = driverHandle->allocHostMem(0u, 4096u, rootDeviceIndex, ptr);
ze_host_mem_alloc_desc_t hostDesc = {};
res = driverHandle->allocHostMem(&hostDesc, 4096u, rootDeviceIndex, ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
};