Revert "Check for context in appendMemoryCopy"
This reverts commit afd0784c16
.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
parent
1894d2da5b
commit
5a29cf8508
|
@ -12,7 +12,6 @@
|
|||
#include "shared/source/memory_manager/prefetch_manager.h"
|
||||
#include "shared/source/unified_memory/unified_memory.h"
|
||||
|
||||
#include "level_zero/core/source/context/context.h"
|
||||
#include <level_zero/ze_api.h>
|
||||
#include <level_zero/zet_api.h>
|
||||
|
||||
|
@ -27,7 +26,6 @@ struct EventPool;
|
|||
struct Event;
|
||||
struct Kernel;
|
||||
struct CommandQueue;
|
||||
struct Context;
|
||||
|
||||
struct CmdListKernelLaunchParams {
|
||||
bool isIndirect = false;
|
||||
|
@ -297,7 +295,7 @@ struct CommandList : _ze_command_list_handle_t {
|
|||
return this->isTbxMode && !this->isSyncModeQueue;
|
||||
}
|
||||
|
||||
Context *context = nullptr;
|
||||
ze_context_handle_t hContext = nullptr;
|
||||
std::vector<Kernel *> printfKernelContainer;
|
||||
CommandQueue *cmdQImmediate = nullptr;
|
||||
NEO::CommandStreamReceiver *csr = nullptr;
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "shared/source/helpers/vec.h"
|
||||
#include "shared/source/kernel/kernel_arg_descriptor.h"
|
||||
#include "shared/source/memory_manager/memory_pool.h"
|
||||
#include "shared/source/memory_manager/unified_memory_manager.h"
|
||||
|
||||
#include "level_zero/core/source/builtin/builtin_functions_lib.h"
|
||||
#include "level_zero/core/source/cmdlist/cmdlist_imp.h"
|
||||
|
@ -41,7 +40,6 @@ struct AlignedAllocationData {
|
|||
size_t offset = 0u;
|
||||
NEO::GraphicsAllocation *alloc = nullptr;
|
||||
bool needsFlush = false;
|
||||
NEO::SvmAllocationData *allocData = nullptr;
|
||||
};
|
||||
|
||||
struct CmdListFillKernelArguments {
|
||||
|
|
|
@ -1198,13 +1198,6 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
|
|||
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
}
|
||||
|
||||
if ((dstAllocationStruct.allocData && dstAllocationStruct.allocData->context != this->context) ||
|
||||
(srcAllocationStruct.allocData && srcAllocationStruct.allocData->context != this->context)) {
|
||||
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"Destination and source pointers need to be part of the same context as the list %s\n", "");
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (size >= 4ull * MemoryConstants::gigaByte) {
|
||||
isStateless = true;
|
||||
}
|
||||
|
@ -1963,7 +1956,7 @@ inline AlignedAllocationData CommandListCoreFamily<gfxCoreFamily>::getAlignedAll
|
|||
}
|
||||
}
|
||||
|
||||
return {alignedPtr, offset, alloc, hostPointerNeedsFlush, allocData};
|
||||
return {alignedPtr, offset, alloc, hostPointerNeedsFlush};
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
|
|
|
@ -90,8 +90,7 @@ ze_result_t ContextImp::allocHostMem(const ze_host_mem_alloc_desc_t *hostDesc,
|
|||
}
|
||||
|
||||
auto usmPtr = this->driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size,
|
||||
unifiedMemoryProperties,
|
||||
this);
|
||||
unifiedMemoryProperties);
|
||||
if (usmPtr == nullptr) {
|
||||
return ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
@ -183,7 +182,7 @@ ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice,
|
|||
}
|
||||
|
||||
void *usmPtr =
|
||||
this->driverHandle->svmAllocsManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties, this);
|
||||
this->driverHandle->svmAllocsManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
if (usmPtr == nullptr) {
|
||||
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
}
|
||||
|
@ -284,8 +283,7 @@ ze_result_t ContextImp::allocSharedMem(ze_device_handle_t hDevice,
|
|||
|
||||
auto usmPtr = this->driverHandle->svmAllocsManager->createSharedUnifiedMemoryAllocation(size,
|
||||
unifiedMemoryProperties,
|
||||
static_cast<void *>(neoDevice->getSpecializedDevice<L0::Device>()),
|
||||
this);
|
||||
static_cast<void *>(neoDevice->getSpecializedDevice<L0::Device>()));
|
||||
if (usmPtr == nullptr) {
|
||||
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
}
|
||||
|
@ -505,10 +503,6 @@ ze_result_t ContextImp::openIpcMemHandle(ze_device_handle_t hDevice,
|
|||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
auto alloc = driverHandle->svmAllocsManager->getSVMAlloc(*ptr);
|
||||
UNRECOVERABLE_IF(alloc == nullptr);
|
||||
alloc->context = static_cast<void *>(this);
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -535,10 +529,6 @@ ze_result_t ContextImp::openIpcMemHandles(ze_device_handle_t hDevice,
|
|||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
auto alloc = driverHandle->svmAllocsManager->getSVMAlloc(*pptr);
|
||||
UNRECOVERABLE_IF(alloc == nullptr);
|
||||
alloc->context = static_cast<void *>(this);
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -767,7 +757,7 @@ ze_result_t ContextImp::createCommandList(ze_device_handle_t hDevice,
|
|||
ze_command_list_handle_t *commandList) {
|
||||
auto ret = L0::Device::fromHandle(hDevice)->createCommandList(desc, commandList);
|
||||
if (*commandList) {
|
||||
L0::CommandList::fromHandle(*commandList)->context = this;
|
||||
L0::CommandList::fromHandle(*commandList)->hContext = this->toHandle();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -777,7 +767,7 @@ ze_result_t ContextImp::createCommandListImmediate(ze_device_handle_t hDevice,
|
|||
ze_command_list_handle_t *commandList) {
|
||||
auto ret = L0::Device::fromHandle(hDevice)->createCommandListImmediate(desc, commandList);
|
||||
if (*commandList) {
|
||||
L0::CommandList::fromHandle(*commandList)->context = this;
|
||||
L0::CommandList::fromHandle(*commandList)->hContext = this->toHandle();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ struct BcsSplit {
|
|||
cmdList->appendEventForProfilingAllWalkers(Event::fromHandle(hSignalEvent), true, true);
|
||||
}
|
||||
|
||||
auto markerEventIndex = this->events.obtainForSplit(cmdList->context, MemoryConstants::pageSize64k / sizeof(typename CommandListCoreFamilyImmediate<gfxCoreFamily>::GfxFamily::TimestampPacketType));
|
||||
auto markerEventIndex = this->events.obtainForSplit(Context::fromHandle(cmdList->hContext), MemoryConstants::pageSize64k / sizeof(typename CommandListCoreFamilyImmediate<gfxCoreFamily>::GfxFamily::TimestampPacketType));
|
||||
auto subcopyEventIndex = markerEventIndex * this->cmdQs.size();
|
||||
StackVec<ze_event_handle_t, 4> eventHandles;
|
||||
|
||||
|
|
|
@ -119,7 +119,6 @@ ze_result_t DeviceImp::submitCopyForP2P(ze_device_handle_t hPeerDevice, ze_bool_
|
|||
contextImp->allocDeviceMem(this->toHandle(), &deviceDesc, 8, 1, &memory);
|
||||
contextImp->allocDeviceMem(hPeerDevice, &peerDeviceDesc, 8, 1, &peerMemory);
|
||||
|
||||
L0::CommandList::fromHandle(commandList)->context = contextImp;
|
||||
auto ret = L0::CommandList::fromHandle(commandList)->appendMemoryCopy(peerMemory, memory, 8, nullptr, 0, nullptr);
|
||||
L0::CommandList::fromHandle(commandList)->close();
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ TEST_F(AUBHelloWorldL0, whenAppendMemoryCopyIsCalledThenMemoryIsProperlyCopied)
|
|||
context->rootDeviceIndices,
|
||||
context->deviceBitfields);
|
||||
|
||||
auto srcMemory = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
|
||||
auto dstMemory = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
|
||||
auto srcMemory = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
auto dstMemory = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
|
||||
memset(srcMemory, val, size);
|
||||
commandList->appendMemoryCopy(dstMemory, srcMemory, size, 0, 0, nullptr);
|
||||
|
|
|
@ -73,10 +73,10 @@ HWTEST_F(L0BindlessAub, DISABLED_GivenBindlessKernelWhenExecutedThenOutputIsCorr
|
|||
context->rootDeviceIndices,
|
||||
context->deviceBitfields);
|
||||
|
||||
auto bufferSrc = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties, nullptr);
|
||||
auto bufferSrc = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties);
|
||||
memset(bufferSrc, 55, bufferSize);
|
||||
|
||||
auto bufferDst = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties, nullptr);
|
||||
auto bufferDst = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties);
|
||||
memset(bufferDst, 0, bufferSize);
|
||||
|
||||
auto simulatedCsr = AUBFixtureL0::getSimulatedCsr<FamilyType>();
|
||||
|
|
|
@ -60,9 +60,9 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenGlobalWorkSizeIsPr
|
|||
context->rootDeviceIndices,
|
||||
context->deviceBitfields);
|
||||
|
||||
auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties, nullptr);
|
||||
auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties);
|
||||
|
||||
auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
|
||||
auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
|
||||
memset(outBuffer, 0, size);
|
||||
|
||||
|
@ -104,9 +104,9 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenGroupCountIsProper
|
|||
context->rootDeviceIndices,
|
||||
context->deviceBitfields);
|
||||
|
||||
auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties, nullptr);
|
||||
auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties);
|
||||
|
||||
auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
|
||||
auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
|
||||
memset(outBuffer, 0, size);
|
||||
|
||||
|
@ -179,9 +179,9 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenWorkDimIsProperlyP
|
|||
|
||||
uint8_t size = sizeof(uint32_t);
|
||||
|
||||
auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties, nullptr);
|
||||
auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties);
|
||||
|
||||
auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
|
||||
auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
|
||||
memset(outBuffer, 0, size);
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ HWTEST2_F(DebuggerSingleAddressSpaceAub, GivenSingleAddressSpaceWhenCmdListIsExe
|
|||
context->rootDeviceIndices,
|
||||
context->deviceBitfields);
|
||||
|
||||
auto bufferDst = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties, nullptr);
|
||||
auto bufferDst = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties);
|
||||
memset(bufferDst, 0, bufferSize);
|
||||
|
||||
auto simulatedCsr = AUBFixtureL0::getSimulatedCsr<FamilyType>();
|
||||
|
|
|
@ -47,7 +47,7 @@ ze_result_t Mock<DriverHandle>::allocDeviceMem(ze_device_handle_t hDevice, const
|
|||
size_t size, size_t alignment, void **ptr) {
|
||||
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
auto allocation = svmAllocsManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
|
||||
auto allocation = svmAllocsManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
|
||||
if (allocation == nullptr) {
|
||||
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
|
|
|
@ -29,35 +29,15 @@ namespace ult {
|
|||
|
||||
using ContextCommandListCreate = Test<DeviceFixture>;
|
||||
|
||||
TEST_F(ContextCommandListCreate, whenCreatingCommandListFromContextWithWrongOrdinalThenErrorIsReturned) {
|
||||
ze_command_list_desc_t desc = {};
|
||||
ze_command_list_handle_t hCommandList = {};
|
||||
desc.commandQueueGroupOrdinal = std::numeric_limits<uint32_t>::max();
|
||||
|
||||
ze_result_t result = context->createCommandList(device, &desc, &hCommandList);
|
||||
EXPECT_NE(ZE_RESULT_SUCCESS, result);
|
||||
}
|
||||
|
||||
TEST_F(ContextCommandListCreate, whenCreatingImmediateCommandListFromContextWithWrongOrdinalThenErrorIsReturned) {
|
||||
ze_command_queue_desc_t desc = {};
|
||||
ze_command_list_handle_t hCommandList = {};
|
||||
desc.ordinal = std::numeric_limits<uint32_t>::max();
|
||||
|
||||
ze_result_t result = context->createCommandListImmediate(device, &desc, &hCommandList);
|
||||
EXPECT_NE(ZE_RESULT_SUCCESS, result);
|
||||
}
|
||||
|
||||
TEST_F(ContextCommandListCreate, whenCreatingCommandListFromContextThenSuccessIsReturned) {
|
||||
ze_command_list_desc_t desc = {};
|
||||
ze_command_list_handle_t hCommandList = {};
|
||||
|
||||
ze_result_t result = context->createCommandList(device, &desc, &hCommandList);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_EQ(CommandList::fromHandle(hCommandList)->context, context);
|
||||
EXPECT_EQ(Context::fromHandle(CommandList::fromHandle(hCommandList)->hContext), context);
|
||||
|
||||
L0::CommandList *commandList = L0::CommandList::fromHandle(hCommandList);
|
||||
EXPECT_NE(commandList->context, nullptr);
|
||||
|
||||
commandList->destroy();
|
||||
}
|
||||
|
||||
|
@ -77,11 +57,9 @@ TEST_F(ContextCommandListCreate, whenCreatingCommandListImmediateFromContextThen
|
|||
|
||||
ze_result_t result = context->createCommandListImmediate(device, &desc, &hCommandList);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_EQ(CommandList::fromHandle(hCommandList)->context, context);
|
||||
EXPECT_EQ(Context::fromHandle(CommandList::fromHandle(hCommandList)->hContext), context);
|
||||
|
||||
L0::CommandList *commandList = L0::CommandList::fromHandle(hCommandList);
|
||||
EXPECT_NE(commandList->context, nullptr);
|
||||
|
||||
commandList->destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -616,7 +616,6 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInExternalHostAl
|
|||
HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmHostAllocationThenBuiltinFlagAndDestinationAllocSystemIsSet, IsAtLeastSkl) {
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
|
||||
commandList->context = context;
|
||||
|
||||
constexpr size_t allocSize = 4096;
|
||||
void *dstBuffer = nullptr;
|
||||
|
@ -637,7 +636,6 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmHostAllocat
|
|||
HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmDeviceAllocationThenBuiltinFlagIsSetAndDestinationAllocSystemNotSet, IsAtLeastSkl) {
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
|
||||
commandList->context = context;
|
||||
|
||||
constexpr size_t size = 4096u;
|
||||
constexpr size_t alignment = 4096u;
|
||||
|
@ -648,9 +646,6 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmDeviceAlloc
|
|||
&deviceDesc,
|
||||
size, alignment, &dstBuffer);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
auto alloc = driverHandle->svmAllocsManager->getSVMAlloc(dstBuffer);
|
||||
EXPECT_NE(alloc, nullptr);
|
||||
EXPECT_EQ(alloc->context, context);
|
||||
|
||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||
|
||||
|
@ -662,62 +657,6 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmDeviceAlloc
|
|||
context->freeMem(dstBuffer);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmDeviceAllocationWithDifferentContextThanCommandListThenInvalidArgumentIsReturned, IsAtLeastSkl) {
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
|
||||
std::unique_ptr<L0::ContextImp> context1 = std::make_unique<L0::ContextImp>(driverHandle.get());
|
||||
commandList->context = context1.get();
|
||||
|
||||
constexpr size_t size = 4096u;
|
||||
constexpr size_t alignment = 4096u;
|
||||
void *dstBuffer = nullptr;
|
||||
|
||||
ze_device_mem_alloc_desc_t deviceDesc = {};
|
||||
auto result = context->allocDeviceMem(device->toHandle(),
|
||||
&deviceDesc,
|
||||
size, alignment, &dstBuffer);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
auto alloc = driverHandle->svmAllocsManager->getSVMAlloc(dstBuffer);
|
||||
EXPECT_NE(alloc, nullptr);
|
||||
EXPECT_EQ(alloc->context, context);
|
||||
|
||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||
|
||||
ze_result_t res = commandList->appendMemoryCopy(dstBuffer, srcPtr, 8, nullptr, 0, nullptr);
|
||||
EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_ARGUMENT);
|
||||
|
||||
res = commandList->appendMemoryCopy(srcPtr, dstBuffer, 8, nullptr, 0, nullptr);
|
||||
EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_ARGUMENT);
|
||||
|
||||
context->freeMem(dstBuffer);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmHostAllocationWithDifferentContextThanCommandListThenInvalidArgumentIsReturned, IsAtLeastSkl) {
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
|
||||
std::unique_ptr<L0::ContextImp> context1 = std::make_unique<L0::ContextImp>(driverHandle.get());
|
||||
commandList->context = context1.get();
|
||||
|
||||
constexpr size_t size = 4096u;
|
||||
constexpr size_t alignment = 4096u;
|
||||
void *dstBuffer = nullptr;
|
||||
|
||||
ze_host_mem_alloc_desc_t hostDesc = {};
|
||||
auto result = context->allocHostMem(&hostDesc,
|
||||
size, alignment, &dstBuffer);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||
|
||||
ze_result_t res = commandList->appendMemoryCopy(dstBuffer, srcPtr, 8, nullptr, 0, nullptr);
|
||||
EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_ARGUMENT);
|
||||
|
||||
res = commandList->appendMemoryCopy(srcPtr, dstBuffer, 8, nullptr, 0, nullptr);
|
||||
EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_ARGUMENT);
|
||||
|
||||
context->freeMem(dstBuffer);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryFillInUsmHostThenBuiltinFlagAndDestinationAllocSystemIsSet, IsAtLeastSkl) {
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
|
||||
|
|
|
@ -2241,7 +2241,7 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndUsmSrcHostPtrW
|
|||
void *usmSrcPtr;
|
||||
ze_host_mem_alloc_desc_t hostDesc = {};
|
||||
context->allocHostMem(&hostDesc, 1024, 1u, &usmSrcPtr);
|
||||
cmdList.context = context;
|
||||
|
||||
cmdList.appendMemoryCopy(devicePtr, usmSrcPtr, 1024, nullptr, 0, nullptr);
|
||||
EXPECT_GE(cmdList.appendMemoryCopyKernelWithGACalled, 1u);
|
||||
context->freeMem(usmSrcPtr);
|
||||
|
@ -2253,7 +2253,7 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndUsmDstHostPtrW
|
|||
void *usmHostDstPtr;
|
||||
ze_host_mem_alloc_desc_t hostDesc = {};
|
||||
context->allocHostMem(&hostDesc, 1024, 1u, &usmHostDstPtr);
|
||||
cmdList.context = context;
|
||||
|
||||
cmdList.appendMemoryCopy(usmHostDstPtr, nonUsmHostPtr, 1024, nullptr, 0, nullptr);
|
||||
EXPECT_GE(cmdList.appendMemoryCopyKernelWithGACalled, 1u);
|
||||
context->freeMem(usmHostDstPtr);
|
||||
|
@ -2265,7 +2265,7 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndUsmSrcHostPtrW
|
|||
void *usmHostSrcPtr;
|
||||
ze_host_mem_alloc_desc_t hostDesc = {};
|
||||
context->allocHostMem(&hostDesc, 1024, 1u, &usmHostSrcPtr);
|
||||
cmdList.context = context;
|
||||
|
||||
cmdList.appendMemoryCopy(nonUsmHostPtr, usmHostSrcPtr, 1024, nullptr, 0, nullptr);
|
||||
EXPECT_GE(cmdList.appendMemoryCopyKernelWithGACalled, 1u);
|
||||
context->freeMem(usmHostSrcPtr);
|
||||
|
@ -2274,7 +2274,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndUsmSrcHostPtrW
|
|||
HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndNonUsmSrcHostPtrWhenSizeTooLargeThenUseGpuMemcpy, IsAtLeastSkl) {
|
||||
MockAppendMemoryLockedCopyTestImmediateCmdList<gfxCoreFamily> cmdList;
|
||||
cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
|
||||
cmdList.context = context;
|
||||
cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 3 * MemoryConstants::megaByte, nullptr, 0, nullptr);
|
||||
EXPECT_GE(cmdList.appendMemoryCopyKernelWithGACalled, 1u);
|
||||
}
|
||||
|
@ -2282,7 +2281,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndNonUsmSrcHostP
|
|||
HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndNonUsmDstHostPtrWhenSizeTooLargeThenUseGpuMemcpy, IsAtLeastSkl) {
|
||||
MockAppendMemoryLockedCopyTestImmediateCmdList<gfxCoreFamily> cmdList;
|
||||
cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
|
||||
cmdList.context = context;
|
||||
cmdList.appendMemoryCopy(nonUsmHostPtr, devicePtr, 2 * MemoryConstants::kiloByte, nullptr, 0, nullptr);
|
||||
EXPECT_GE(cmdList.appendMemoryCopyKernelWithGACalled, 1u);
|
||||
}
|
||||
|
@ -2292,7 +2290,7 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndD2HCopyWhenSiz
|
|||
MockAppendMemoryLockedCopyTestImmediateCmdList<gfxCoreFamily> cmdList;
|
||||
cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
|
||||
cmdList.csr = device->getNEODevice()->getInternalEngine().commandStreamReceiver;
|
||||
cmdList.context = context;
|
||||
|
||||
cmdList.appendMemoryCopy(nonUsmHostPtr, devicePtr, 2 * MemoryConstants::kiloByte, nullptr, 0, nullptr);
|
||||
EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGACalled, 0u);
|
||||
}
|
||||
|
@ -2302,7 +2300,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndH2DCopyWhenSiz
|
|||
MockAppendMemoryLockedCopyTestImmediateCmdList<gfxCoreFamily> cmdList;
|
||||
cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
|
||||
cmdList.csr = device->getNEODevice()->getInternalEngine().commandStreamReceiver;
|
||||
cmdList.context = context;
|
||||
cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 3 * MemoryConstants::megaByte, nullptr, 0, nullptr);
|
||||
EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGACalled, 0u);
|
||||
}
|
||||
|
@ -2322,7 +2319,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndCpuMemcpyWithD
|
|||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||
auto event = std::unique_ptr<Event>(Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
|
||||
auto phEvent = event->toHandle();
|
||||
cmdList.context = context;
|
||||
cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 2 * MemoryConstants::kiloByte, nullptr, 1, &phEvent);
|
||||
EXPECT_EQ(cmdList.appendBarrierCalled, 1u);
|
||||
}
|
||||
|
@ -2331,7 +2327,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndCpuMemcpyWitho
|
|||
MockAppendMemoryLockedCopyTestImmediateCmdList<gfxCoreFamily> cmdList;
|
||||
cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
|
||||
cmdList.csr = device->getNEODevice()->getInternalEngine().commandStreamReceiver;
|
||||
cmdList.context = context;
|
||||
cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 2 * MemoryConstants::kiloByte, nullptr, 0, nullptr);
|
||||
EXPECT_EQ(cmdList.appendBarrierCalled, 0u);
|
||||
}
|
||||
|
@ -2355,7 +2350,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndTimestampFlagS
|
|||
|
||||
auto event = std::unique_ptr<Event>(Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
|
||||
auto phEvent = event->toHandle();
|
||||
cmdList.context = context;
|
||||
cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 2 * MemoryConstants::kiloByte, phEvent, 0, nullptr);
|
||||
ze_kernel_timestamp_result_t resultTimestamp = {};
|
||||
auto result = event->queryKernelTimestamp(&resultTimestamp);
|
||||
|
@ -2388,7 +2382,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndTimestampFlagN
|
|||
|
||||
auto event = std::unique_ptr<Event>(Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
|
||||
auto phEvent = event->toHandle();
|
||||
cmdList.context = context;
|
||||
cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 2 * MemoryConstants::kiloByte, phEvent, 0, nullptr);
|
||||
ze_kernel_timestamp_result_t resultTimestamp = {};
|
||||
auto result = event->queryKernelTimestamp(&resultTimestamp);
|
||||
|
|
|
@ -150,13 +150,13 @@ TEST_F(MultiDeviceContextTests,
|
|||
|
||||
struct SVMAllocsManagerContextMock : public NEO::SVMAllocsManager {
|
||||
SVMAllocsManagerContextMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {}
|
||||
void *createHostUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties &memoryProperties, void *context) override {
|
||||
void *createHostUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties &memoryProperties) override {
|
||||
EXPECT_EQ(expectedRootDeviceIndexes.size(), memoryProperties.rootDeviceIndices.size());
|
||||
EXPECT_NE(std::find(memoryProperties.rootDeviceIndices.begin(), memoryProperties.rootDeviceIndices.end(), expectedRootDeviceIndexes[0]),
|
||||
memoryProperties.rootDeviceIndices.end());
|
||||
EXPECT_NE(std::find(memoryProperties.rootDeviceIndices.begin(), memoryProperties.rootDeviceIndices.end(), expectedRootDeviceIndexes[1]),
|
||||
memoryProperties.rootDeviceIndices.end());
|
||||
return NEO::SVMAllocsManager::createHostUnifiedMemoryAllocation(size, memoryProperties, context);
|
||||
return NEO::SVMAllocsManager::createHostUnifiedMemoryAllocation(size, memoryProperties);
|
||||
}
|
||||
|
||||
std::vector<uint32_t> expectedRootDeviceIndexes;
|
||||
|
@ -746,7 +746,7 @@ HWTEST_F(ContextMakeMemoryResidentAndMigrationTests,
|
|||
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, mockDeviceBitfield}};
|
||||
|
||||
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
auto sharedPtr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, device, nullptr);
|
||||
auto sharedPtr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, device);
|
||||
EXPECT_NE(nullptr, sharedPtr);
|
||||
|
||||
auto allocation = svmManager->getSVMAlloc(sharedPtr);
|
||||
|
|
|
@ -809,15 +809,13 @@ TEST_F(MemoryTest, whenAllocatingDeviceMemoryAsRayTracingAllocationAddressIsIn48
|
|||
struct SVMAllocsManagerSharedAllocZexPointerMock : public NEO::SVMAllocsManager {
|
||||
SVMAllocsManagerSharedAllocZexPointerMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {}
|
||||
void *createHostUnifiedMemoryAllocation(size_t size,
|
||||
const UnifiedMemoryProperties &memoryProperties,
|
||||
void *context) override {
|
||||
const UnifiedMemoryProperties &memoryProperties) override {
|
||||
hostUnifiedMemoryAllocationTimes++;
|
||||
return alignedMalloc(4096u, 4096u);
|
||||
}
|
||||
void *createSharedUnifiedMemoryAllocation(size_t size,
|
||||
const UnifiedMemoryProperties &svmProperties,
|
||||
void *cmdQ,
|
||||
void *context) override {
|
||||
void *cmdQ) override {
|
||||
|
||||
sharedUnifiedMemoryAllocationTimes++;
|
||||
return alignedMalloc(4096u, 4096u);
|
||||
|
@ -1075,8 +1073,7 @@ TEST_F(FreeExtTests,
|
|||
struct SVMAllocsManagerOutOFMemoryMock : public NEO::SVMAllocsManager {
|
||||
SVMAllocsManagerOutOFMemoryMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {}
|
||||
void *createUnifiedMemoryAllocation(size_t size,
|
||||
const UnifiedMemoryProperties &svmProperties,
|
||||
void *context) override {
|
||||
const UnifiedMemoryProperties &svmProperties) override {
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
@ -1132,23 +1129,19 @@ TEST_F(OutOfMemoryTests,
|
|||
|
||||
struct SVMAllocsManagerRelaxedSizeMock : public NEO::SVMAllocsManager {
|
||||
SVMAllocsManagerRelaxedSizeMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {}
|
||||
|
||||
void *createUnifiedMemoryAllocation(size_t size,
|
||||
const UnifiedMemoryProperties &svmProperties,
|
||||
void *context) override {
|
||||
const UnifiedMemoryProperties &svmProperties) override {
|
||||
return alignedMalloc(4096u, 4096u);
|
||||
}
|
||||
|
||||
void *createSharedUnifiedMemoryAllocation(size_t size,
|
||||
const UnifiedMemoryProperties &svmProperties,
|
||||
void *cmdQ,
|
||||
void *context) override {
|
||||
void *cmdQ) override {
|
||||
return alignedMalloc(4096u, 4096u);
|
||||
}
|
||||
|
||||
void *createHostUnifiedMemoryAllocation(size_t size,
|
||||
const UnifiedMemoryProperties &memoryProperties,
|
||||
void *context) override {
|
||||
const UnifiedMemoryProperties &memoryProperties) override {
|
||||
return alignedMalloc(4096u, 4096u);
|
||||
}
|
||||
};
|
||||
|
@ -3822,8 +3815,7 @@ struct SVMAllocsManagerSharedAllocFailMock : public NEO::SVMAllocsManager {
|
|||
SVMAllocsManagerSharedAllocFailMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {}
|
||||
void *createSharedUnifiedMemoryAllocation(size_t size,
|
||||
const UnifiedMemoryProperties &svmProperties,
|
||||
void *cmdQ,
|
||||
void *context) override {
|
||||
void *cmdQ) override {
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
@ -3876,8 +3868,7 @@ TEST_F(SharedAllocFailTests, whenAllocatinSharedMemoryAndAllocationFailsThenOutO
|
|||
struct SVMAllocsManagerSharedAllocMultiDeviceMock : public NEO::SVMAllocsManager {
|
||||
SVMAllocsManagerSharedAllocMultiDeviceMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {}
|
||||
void *createHostUnifiedMemoryAllocation(size_t size,
|
||||
const UnifiedMemoryProperties &memoryProperties,
|
||||
void *context) override {
|
||||
const UnifiedMemoryProperties &memoryProperties) override {
|
||||
createHostUnifiedMemoryAllocationTimes++;
|
||||
return alignedMalloc(4096u, 4096u);
|
||||
}
|
||||
|
|
|
@ -409,7 +409,6 @@ HWTEST2_F(CommandListStatePrefetchXeHpcCore, givenAppendMemoryPrefetchForKmdMigr
|
|||
|
||||
ze_command_list_handle_t commandListHandle = CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Copy, returnValue)->toHandle();
|
||||
auto commandList = CommandList::fromHandle(commandListHandle);
|
||||
commandList->context = context;
|
||||
auto commandQueue = CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, commandList->isCopyOnly(), false, returnValue);
|
||||
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
|
@ -944,7 +943,6 @@ HWTEST2_F(CommandListAppendLaunchKernelXeHpcCore,
|
|||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
result = commandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
commandList->context = context;
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
|
@ -1080,7 +1078,6 @@ struct CommandListAppendLaunchMultiKernelEventFixture : public LocalMemoryModule
|
|||
|
||||
constexpr size_t offset = 32;
|
||||
void *copyPtr = reinterpret_cast<uint8_t *>(ptr) + offset;
|
||||
commandList->context = input.context;
|
||||
result = commandList->appendMemoryCopy(copyPtr, srcPtr, size - offset, event.get(), 0, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
|
@ -1141,7 +1138,6 @@ struct CommandListAppendLaunchMultiKernelEventFixture : public LocalMemoryModule
|
|||
|
||||
constexpr size_t offset = 32;
|
||||
void *copyPtr = reinterpret_cast<uint8_t *>(ptr) + offset;
|
||||
commandList->context = input.context;
|
||||
result = commandList->appendMemoryCopy(copyPtr, srcPtr, size - offset, event.get(), 0, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
|
|
|
@ -301,7 +301,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
|
|||
NEO::EngineGroupType::Copy,
|
||||
returnValue));
|
||||
ASSERT_NE(nullptr, commandList0);
|
||||
commandList0->context = context;
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
|
||||
|
@ -353,7 +352,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
|
|||
NEO::EngineGroupType::Copy,
|
||||
returnValue));
|
||||
ASSERT_NE(nullptr, commandList0);
|
||||
commandList0->context = context;
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
|
||||
|
@ -403,7 +401,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
|
|||
NEO::EngineGroupType::Copy,
|
||||
returnValue));
|
||||
ASSERT_NE(nullptr, commandList0);
|
||||
commandList0->context = context;
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
|
||||
|
@ -421,6 +418,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
|
|||
context->allocDeviceMem(device->toHandle(),
|
||||
&deviceDesc,
|
||||
size, alignment, &dstPtr);
|
||||
|
||||
auto result = commandList0->appendMemoryCopy(dstPtr, srcPtr, size, nullptr, 0, nullptr);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
|
||||
|
@ -455,7 +453,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
|
|||
NEO::EngineGroupType::Copy,
|
||||
returnValue));
|
||||
ASSERT_NE(nullptr, commandList0);
|
||||
commandList0->context = context;
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
|
||||
|
@ -505,7 +502,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
|
|||
NEO::EngineGroupType::Copy,
|
||||
returnValue));
|
||||
ASSERT_NE(nullptr, commandList0);
|
||||
commandList0->context = context;
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
|
||||
|
@ -558,7 +554,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
|
|||
NEO::EngineGroupType::Copy,
|
||||
returnValue));
|
||||
ASSERT_NE(nullptr, commandList0);
|
||||
commandList0->context = context;
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
|
||||
|
@ -628,7 +623,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
|
|||
NEO::EngineGroupType::Copy,
|
||||
returnValue));
|
||||
ASSERT_NE(nullptr, commandList0);
|
||||
commandList0->context = context;
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
|
||||
|
@ -640,21 +634,21 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
|
|||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.subcopy.size(), 0u);
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 0u);
|
||||
|
||||
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(commandList0->context, 10);
|
||||
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 10);
|
||||
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.pools.size(), 1u);
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.marker.size(), 1u);
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.subcopy.size(), 4u);
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 5u);
|
||||
|
||||
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(commandList0->context, 10);
|
||||
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 10);
|
||||
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.pools.size(), 1u);
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.marker.size(), 2u);
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.subcopy.size(), 8u);
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 10u);
|
||||
|
||||
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(commandList0->context, 10);
|
||||
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 10);
|
||||
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.pools.size(), 2u);
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.marker.size(), 3u);
|
||||
|
@ -685,7 +679,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
|
|||
NEO::EngineGroupType::Copy,
|
||||
returnValue));
|
||||
ASSERT_NE(nullptr, commandList0);
|
||||
commandList0->context = context;
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
|
||||
|
@ -697,14 +690,14 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
|
|||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.subcopy.size(), 0u);
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 0u);
|
||||
|
||||
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(commandList0->context, 10);
|
||||
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 10);
|
||||
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.pools.size(), 1u);
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.marker.size(), 1u);
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.subcopy.size(), 4u);
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 5u);
|
||||
|
||||
auto ret = static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.obtainForSplit(commandList0->context, 10);
|
||||
auto ret = static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.obtainForSplit(Context::fromHandle(commandList0->hContext), 10);
|
||||
|
||||
EXPECT_EQ(ret, 1u);
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.pools.size(), 1u);
|
||||
|
@ -714,7 +707,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
|
|||
|
||||
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.marker[1]->hostSignal();
|
||||
|
||||
ret = static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.obtainForSplit(commandList0->context, 10);
|
||||
ret = static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.obtainForSplit(Context::fromHandle(commandList0->hContext), 10);
|
||||
|
||||
EXPECT_EQ(ret, 1u);
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.pools.size(), 1u);
|
||||
|
@ -746,7 +739,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
|
|||
NEO::EngineGroupType::Copy,
|
||||
returnValue));
|
||||
ASSERT_NE(nullptr, commandList0);
|
||||
commandList0->context = context;
|
||||
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
|
||||
|
|
|
@ -3875,7 +3875,7 @@ CL_API_ENTRY void *CL_API_CALL clHostMemAllocINTEL(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return neoContext->getSVMAllocsManager()->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, neoContext);
|
||||
return neoContext->getSVMAllocsManager()->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
}
|
||||
|
||||
CL_API_ENTRY void *CL_API_CALL clDeviceMemAllocINTEL(
|
||||
|
@ -3923,7 +3923,7 @@ CL_API_ENTRY void *CL_API_CALL clDeviceMemAllocINTEL(
|
|||
|
||||
unifiedMemoryProperties.device = &neoDevice->getDevice();
|
||||
|
||||
return neoContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(size, unifiedMemoryProperties, neoContext);
|
||||
return neoContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
}
|
||||
|
||||
CL_API_ENTRY void *CL_API_CALL clSharedMemAllocINTEL(
|
||||
|
@ -3976,7 +3976,7 @@ CL_API_ENTRY void *CL_API_CALL clSharedMemAllocINTEL(
|
|||
err.set(CL_INVALID_BUFFER_SIZE);
|
||||
return nullptr;
|
||||
}
|
||||
auto ptr = neoContext->getSVMAllocsManager()->createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, neoContext->getSpecialQueue(neoDevice->getRootDeviceIndex()), neoContext);
|
||||
auto ptr = neoContext->getSVMAllocsManager()->createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, neoContext->getSpecialQueue(neoDevice->getRootDeviceIndex()));
|
||||
if (!ptr) {
|
||||
err.set(CL_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
|
|
@ -1668,7 +1668,7 @@ HWTEST_F(EnqueueSvmTest, whenInternalAllocationsAreMadeResidentThenOnlyNonSvmAll
|
|||
auto allocationSize = 4096u;
|
||||
auto svmManager = this->context->getSVMAllocsManager();
|
||||
EXPECT_NE(0u, svmManager->getNumAllocs());
|
||||
auto unifiedMemoryPtr = svmManager->createUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, nullptr);
|
||||
auto unifiedMemoryPtr = svmManager->createUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties);
|
||||
EXPECT_NE(nullptr, unifiedMemoryPtr);
|
||||
EXPECT_EQ(2u, svmManager->getNumAllocs());
|
||||
|
||||
|
@ -1692,7 +1692,7 @@ HWTEST_F(EnqueueSvmTest, whenInternalAllocationsAreAddedToResidencyContainerThen
|
|||
auto allocationSize = 4096u;
|
||||
auto svmManager = this->context->getSVMAllocsManager();
|
||||
EXPECT_NE(0u, svmManager->getNumAllocs());
|
||||
auto unifiedMemoryPtr = svmManager->createUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, nullptr);
|
||||
auto unifiedMemoryPtr = svmManager->createUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties);
|
||||
EXPECT_NE(nullptr, unifiedMemoryPtr);
|
||||
EXPECT_EQ(2u, svmManager->getNumAllocs());
|
||||
|
||||
|
@ -1716,7 +1716,7 @@ HWTEST_F(EnqueueSvmTest, whenInternalAllocationIsTriedToBeAddedTwiceToResidencyC
|
|||
auto allocationSize = 4096u;
|
||||
auto svmManager = this->context->getSVMAllocsManager();
|
||||
EXPECT_NE(0u, svmManager->getNumAllocs());
|
||||
auto unifiedMemoryPtr = svmManager->createUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, nullptr);
|
||||
auto unifiedMemoryPtr = svmManager->createUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties);
|
||||
EXPECT_NE(nullptr, unifiedMemoryPtr);
|
||||
EXPECT_EQ(2u, svmManager->getNumAllocs());
|
||||
|
||||
|
@ -1764,7 +1764,7 @@ HWTEST_F(createHostUnifiedMemoryAllocationTest,
|
|||
|
||||
EXPECT_EQ(0u, svmManager->getNumAllocs());
|
||||
auto unifiedMemoryPtr = svmManager->createHostUnifiedMemoryAllocation(allocationSize,
|
||||
unifiedMemoryProperties, nullptr);
|
||||
unifiedMemoryProperties);
|
||||
EXPECT_NE(nullptr, unifiedMemoryPtr);
|
||||
EXPECT_EQ(1u, svmManager->getNumAllocs());
|
||||
|
||||
|
|
|
@ -476,11 +476,11 @@ TEST_F(KernelArgBufferTest, givenKernelExecInfoWithIndirectStatelessAccessWhenHa
|
|||
|
||||
auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, mockKernel.getContext().getRootDeviceIndices(), mockKernel.getContext().getDeviceBitfields());
|
||||
deviceProperties.device = &pClDevice->getDevice();
|
||||
auto unifiedDeviceMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties, nullptr);
|
||||
auto unifiedDeviceMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties);
|
||||
EXPECT_FALSE(mockKernel.hasIndirectStatelessAccessToHostMemory());
|
||||
|
||||
auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, mockKernel.getContext().getRootDeviceIndices(), mockKernel.getContext().getDeviceBitfields());
|
||||
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties, nullptr);
|
||||
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties);
|
||||
EXPECT_TRUE(mockKernel.hasIndirectStatelessAccessToHostMemory());
|
||||
|
||||
svmAllocationsManager->freeSVMAlloc(unifiedDeviceMemoryAllocation);
|
||||
|
|
|
@ -1200,7 +1200,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenItUsesIndirectUnifiedMemoryDeviceAl
|
|||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto properties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
properties.device = pDevice;
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, properties, nullptr);
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, properties);
|
||||
|
||||
mockKernel.mockKernel->makeResident(this->pDevice->getGpgpuCommandStreamReceiver());
|
||||
|
||||
|
@ -1227,8 +1227,8 @@ HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectHostMemoryWhenMakeResident
|
|||
auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
deviceProperties.device = pDevice;
|
||||
auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
auto unifiedDeviceMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties, nullptr);
|
||||
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties, nullptr);
|
||||
auto unifiedDeviceMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties);
|
||||
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties);
|
||||
|
||||
mockKernel.mockKernel->makeResident(this->pDevice->getGpgpuCommandStreamReceiver());
|
||||
EXPECT_EQ(0u, commandStreamReceiver.getResidencyAllocations().size());
|
||||
|
@ -1249,8 +1249,8 @@ HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectSharedMemoryWhenMakeReside
|
|||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
auto unifiedSharedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr);
|
||||
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties, nullptr);
|
||||
auto unifiedSharedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
|
||||
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties);
|
||||
|
||||
mockKernel.mockKernel->makeResident(this->pDevice->getGpgpuCommandStreamReceiver());
|
||||
EXPECT_EQ(0u, commandStreamReceiver.getResidencyAllocations().size());
|
||||
|
@ -1273,7 +1273,7 @@ HWTEST_F(KernelResidencyTest, givenDeviceUnifiedMemoryAndPageFaultManagerWhenMak
|
|||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
deviceProperties.device = pDevice;
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties, nullptr);
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties);
|
||||
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
|
||||
|
||||
EXPECT_EQ(0u, mockKernel.mockKernel->kernelUnifiedMemoryGfxAllocations.size());
|
||||
|
@ -1300,7 +1300,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndPageFaultManagerWhenMak
|
|||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr);
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
|
||||
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
|
||||
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
|
||||
|
||||
|
@ -1334,7 +1334,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndNotRequiredMemSyncWhenM
|
|||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr);
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
|
||||
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
|
||||
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
|
||||
|
||||
|
@ -1372,7 +1372,7 @@ HWTEST_F(KernelResidencyTest, givenSvmArgWhenKernelDoesNotRequireUnifiedMemorySy
|
|||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr);
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
|
||||
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
|
||||
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
|
||||
|
||||
|
@ -1401,7 +1401,7 @@ HWTEST_F(KernelResidencyTest, givenSvmArgWhenKernelRequireUnifiedMemorySyncThenS
|
|||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr);
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
|
||||
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
|
||||
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
|
||||
|
||||
|
@ -1431,7 +1431,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryRequiredMemSyncWhenMakeRes
|
|||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr);
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
|
||||
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
|
||||
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
|
||||
|
||||
|
@ -1465,7 +1465,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAllocPageFaultManagerAndIn
|
|||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr);
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
|
||||
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
|
||||
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 0);
|
||||
|
@ -1494,7 +1494,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenSetKernelExecInfoWithUnifiedMemoryI
|
|||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
deviceProperties.device = pDevice;
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties, nullptr);
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties);
|
||||
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
|
||||
|
||||
EXPECT_EQ(0u, mockKernel.mockKernel->kernelUnifiedMemoryGfxAllocations.size());
|
||||
|
@ -1520,9 +1520,9 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithUnifiedMemor
|
|||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
deviceProperties.device = pDevice;
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties, nullptr);
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties);
|
||||
|
||||
auto unifiedMemoryAllocation2 = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties, nullptr);
|
||||
auto unifiedMemoryAllocation2 = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties);
|
||||
|
||||
auto status = clSetKernelExecInfo(mockKernel.mockMultiDeviceKernel, CL_KERNEL_EXEC_INFO_USM_PTRS_INTEL, sizeof(unifiedMemoryAllocation), &unifiedMemoryAllocation);
|
||||
EXPECT_EQ(CL_SUCCESS, status);
|
||||
|
@ -1943,7 +1943,7 @@ HWTEST_F(KernelResidencyTest, givenSimpleKernelWhenExecEnvDoesNotHavePageFaultMa
|
|||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr);
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
|
||||
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
|
||||
mockPageFaultManager->insertAllocation(reinterpret_cast<void *>(unifiedMemoryGraphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->getGpuAddress()), 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
|
||||
|
||||
|
@ -1970,7 +1970,7 @@ HWTEST_F(KernelResidencyTest, givenSimpleKernelWhenIsUnifiedMemorySyncRequiredIs
|
|||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), nullptr);
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
|
||||
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
|
||||
mockPageFaultManager->insertAllocation(reinterpret_cast<void *>(unifiedMemoryGraphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->getGpuAddress()), 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
|
||||
|
||||
|
|
|
@ -554,7 +554,7 @@ HWTEST_F(UsmDestructionTests, givenSharedUsmAllocationWhenBlockingFreeIsCalledTh
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
|
||||
|
||||
auto svmAllocationsManager = mockContext.getSVMAllocsManager();
|
||||
auto sharedMemory = svmAllocationsManager->createUnifiedAllocationWithDeviceStorage(4096u, {}, unifiedMemoryProperties, nullptr);
|
||||
auto sharedMemory = svmAllocationsManager->createUnifiedAllocationWithDeviceStorage(4096u, {}, unifiedMemoryProperties);
|
||||
ASSERT_NE(nullptr, sharedMemory);
|
||||
|
||||
auto svmEntry = svmAllocationsManager->getSVMAlloc(sharedMemory);
|
||||
|
@ -588,7 +588,7 @@ HWTEST_F(UsmDestructionTests, givenUsmAllocationWhenBlockingFreeIsCalledThenWait
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
|
||||
|
||||
auto svmAllocationsManager = mockContext.getSVMAllocsManager();
|
||||
auto hostMemory = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr);
|
||||
auto hostMemory = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
ASSERT_NE(nullptr, hostMemory);
|
||||
|
||||
auto svmEntry = svmAllocationsManager->getSVMAlloc(hostMemory);
|
||||
|
|
|
@ -169,7 +169,7 @@ TEST_F(SVMMemoryAllocatorTest, whenCouldNotAllocateInMemoryManagerThenCreateUnif
|
|||
auto device = mockContext.getDevice(0u);
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
unifiedMemoryProperties.device = &device->getDevice();
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs());
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
|
@ -211,7 +211,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenDeviceAllocationIsCreatedThenItIsStoredW
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
unifiedMemoryProperties.allocationFlags.allocFlags.allocWriteCombined = true;
|
||||
auto allocationSize = 4000u;
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4000u, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4000u, unifiedMemoryProperties);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
EXPECT_EQ(nullptr, allocation->cpuAllocation);
|
||||
|
@ -237,7 +237,7 @@ TEST_F(SVMMemoryAllocatorTest, givenNoWriteCombinedFlagwhenDeviceAllocationIsCre
|
|||
unifiedMemoryProperties.device = &device->getDevice();
|
||||
unifiedMemoryProperties.allocationFlags.allocFlags.allocWriteCombined = false;
|
||||
auto allocationSize = 4096u;
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
EXPECT_EQ(nullptr, allocation->cpuAllocation);
|
||||
|
@ -255,7 +255,7 @@ TEST_F(SVMMemoryAllocatorTest, givenNoWriteCombinedFlagwhenDeviceAllocationIsCre
|
|||
TEST_F(SVMMemoryAllocatorTest, whenHostAllocationIsCreatedThenItIsStoredWithProperTypeInAllocationMap) {
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
auto allocationSize = 4096u;
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
EXPECT_EQ(nullptr, allocation->cpuAllocation);
|
||||
|
@ -279,7 +279,7 @@ TEST_F(SVMMemoryAllocatorTest, whenCouldNotAllocateInMemoryManagerThenCreateShar
|
|||
svmManager->memoryManager = &failMemoryManager;
|
||||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs());
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
|
@ -290,7 +290,7 @@ TEST_F(SVMMemoryAllocatorTest, whenSharedAllocationIsCreatedThenItIsStoredWithPr
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
auto allocationSize = 4096u;
|
||||
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
EXPECT_EQ(nullptr, allocation->cpuAllocation);
|
||||
|
@ -316,7 +316,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithDebugFlagSe
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
unifiedMemoryProperties.device = &device->getDevice();
|
||||
auto allocationSize = 4096u;
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());
|
||||
|
@ -346,7 +346,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithLocalMemory
|
|||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
auto allocationSize = 4096u;
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(mockRootDeviceIndex);
|
||||
|
@ -368,7 +368,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithLocalMemory
|
|||
svmManager->freeSVMAlloc(ptr);
|
||||
}
|
||||
|
||||
TEST_F(SVMMemoryAllocatorTest, givenDeviceAllocationsDebugFlagWhenDeviceMemoryIsAllocatedThenOneStorageIsProduced) {
|
||||
TEST_F(SVMMemoryAllocatorTest, givenSharedAllocationsDebugFlagWhenDeviceMemoryIsAllocatedThenOneStorageIsProduced) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.AllocateSharedAllocationsWithCpuAndGpuStorage.set(true);
|
||||
|
||||
|
@ -377,7 +377,7 @@ TEST_F(SVMMemoryAllocatorTest, givenDeviceAllocationsDebugFlagWhenDeviceMemoryIs
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
unifiedMemoryProperties.device = &device->getDevice();
|
||||
auto allocationSize = 4096u;
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
EXPECT_EQ(nullptr, allocation->cpuAllocation);
|
||||
|
@ -392,19 +392,6 @@ TEST_F(SVMMemoryAllocatorTest, givenDeviceAllocationsDebugFlagWhenDeviceMemoryIs
|
|||
svmManager->freeSVMAlloc(ptr);
|
||||
}
|
||||
|
||||
TEST_F(SVMMemoryAllocatorTest, givenCallToHostAllocationMemoryThenMemoryIsAllocated) {
|
||||
DebugManagerStateRestore restore;
|
||||
|
||||
MockContext mockContext;
|
||||
auto device = mockContext.getDevice(0u);
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
unifiedMemoryProperties.device = &device->getDevice();
|
||||
auto allocationSize = 4096u;
|
||||
auto ptr = svmManager->createHostUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, nullptr);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
}
|
||||
|
||||
TEST(SvmAllocationPropertiesTests, givenDifferentMemFlagsWhenGettingSvmAllocationPropertiesThenPropertiesAreCorrectlySet) {
|
||||
SVMAllocsManager::SvmAllocationProperties allocationProperties = MemObjHelper::getSvmAllocationProperties(0);
|
||||
EXPECT_FALSE(allocationProperties.coherent);
|
||||
|
@ -567,7 +554,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithMultipleBitsSetWhenSharedUnifiedM
|
|||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
svmManager->multiOsContextSupport = true;
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
|
||||
EXPECT_FALSE(memoryManager->multiOsContextCapablePassed);
|
||||
EXPECT_TRUE(memoryManager->multiStorageResourcePassed);
|
||||
|
@ -582,7 +569,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithSingleBitSetWh
|
|||
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x8)}};
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
|
||||
EXPECT_FALSE(memoryManager->multiOsContextCapablePassed);
|
||||
EXPECT_FALSE(memoryManager->multiStorageResourcePassed);
|
||||
|
@ -604,7 +591,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithMultipleBitsSetWhenMultiOsContext
|
|||
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xf)}};
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
svmManager->multiOsContextSupport = true;
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
|
||||
EXPECT_FALSE(memoryManager->multiOsContextCapablePassed);
|
||||
EXPECT_TRUE(memoryManager->multiStorageResourcePassed);
|
||||
|
@ -628,7 +615,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithMultipleBitsSetWhenMultiOsContext
|
|||
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xE)}};
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
svmManager->multiOsContextSupport = false;
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
|
||||
auto expectedSubDevices = unifiedMemoryProperties.subdeviceBitfields.at(mockRootDeviceIndex);
|
||||
expectedSubDevices.reset();
|
||||
|
@ -653,7 +640,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithMultipleBitsSetWhenMultiOsContext
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
unifiedMemoryProperties.device = &device->getDevice();
|
||||
svmManager->multiOsContextSupport = true;
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
|
||||
EXPECT_FALSE(memoryManager->multiOsContextCapablePassed);
|
||||
EXPECT_TRUE(memoryManager->multiStorageResourcePassed);
|
||||
|
@ -673,7 +660,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithTwoBitsSetWhenMultiOsContextFlagT
|
|||
auto device = mockContext.getDevice(0u);
|
||||
unifiedMemoryProperties.device = &device->getDevice();
|
||||
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
|
||||
EXPECT_FALSE(memoryManager->multiOsContextCapablePassed);
|
||||
EXPECT_FALSE(memoryManager->multiStorageResourcePassed);
|
||||
|
@ -698,7 +685,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithSingleBitsSetWhenMultiOsContextFl
|
|||
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}};
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
svmManager->multiOsContextSupport = true;
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
|
||||
EXPECT_FALSE(memoryManager->multiOsContextCapablePassed);
|
||||
EXPECT_FALSE(memoryManager->multiStorageResourcePassed);
|
||||
|
@ -719,7 +706,7 @@ TEST(UnifiedMemoryTest, givenInternalAllocationWhenItIsMadeResidentThenNewTracki
|
|||
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}};
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
|
||||
ASSERT_NE(nullptr, ptr);
|
||||
auto graphicsAllocation = unifiedMemoryManager->getSVMAlloc(ptr);
|
||||
|
@ -753,7 +740,7 @@ TEST(UnifiedMemoryTest, givenInternalAllocationWhenItIsMadeResidentThenSubsequen
|
|||
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}};
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
ASSERT_NE(nullptr, ptr);
|
||||
|
||||
auto graphicsAllocation = unifiedMemoryManager->getSVMAlloc(ptr);
|
||||
|
@ -791,7 +778,7 @@ TEST(UnifiedMemoryTest, givenInternalAllocationWhenNewAllocationIsCreatedThenItI
|
|||
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}};
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
ASSERT_NE(nullptr, ptr);
|
||||
|
||||
auto graphicsAllocation = unifiedMemoryManager->getSVMAlloc(ptr);
|
||||
|
@ -802,7 +789,7 @@ TEST(UnifiedMemoryTest, givenInternalAllocationWhenNewAllocationIsCreatedThenItI
|
|||
// force to non resident
|
||||
graphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->updateResidencyTaskCount(GraphicsAllocation::objectNotResident, commandStreamReceiver.getOsContext().getContextId());
|
||||
|
||||
auto ptr2 = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr2 = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
auto graphicsAllocation2 = unifiedMemoryManager->getSVMAlloc(ptr);
|
||||
|
||||
EXPECT_FALSE(graphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->isResident(commandStreamReceiver.getOsContext().getContextId()));
|
||||
|
@ -831,7 +818,7 @@ TEST(UnifiedMemoryTest, givenInternalAllocationsWhenTheyArePreparedForFreeingThe
|
|||
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}};
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
ASSERT_NE(nullptr, ptr);
|
||||
|
||||
auto graphicsAllocation = unifiedMemoryManager->getSVMAlloc(ptr);
|
||||
|
@ -856,7 +843,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithSingleBitSetWh
|
|||
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x8)}};
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
|
||||
EXPECT_FALSE(memoryManager->multiOsContextCapablePassed);
|
||||
EXPECT_FALSE(memoryManager->multiStorageResourcePassed);
|
||||
|
@ -871,7 +858,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithMultiDeviceBit
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
svmManager->multiOsContextSupport = true;
|
||||
auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties);
|
||||
|
||||
EXPECT_FALSE(memoryManager->multiOsContextCapablePassed);
|
||||
EXPECT_TRUE(memoryManager->multiStorageResourcePassed);
|
||||
|
@ -889,7 +876,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithMultiDeviceBit
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
svmManager->multiOsContextSupport = false;
|
||||
auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties);
|
||||
|
||||
auto expectedSubDevices = unifiedMemoryProperties.subdeviceBitfields.at(mockRootDeviceIndex);
|
||||
expectedSubDevices.reset();
|
||||
|
@ -908,7 +895,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithSingleDeviceBi
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
svmManager->multiOsContextSupport = true;
|
||||
auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties);
|
||||
|
||||
EXPECT_FALSE(memoryManager->multiOsContextCapablePassed);
|
||||
EXPECT_FALSE(memoryManager->multiStorageResourcePassed);
|
||||
|
@ -924,7 +911,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest,
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
svmManager->multiOsContextSupport = true;
|
||||
auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties);
|
||||
|
||||
EXPECT_FALSE(memoryManager->multiOsContextCapablePassed);
|
||||
EXPECT_FALSE(memoryManager->multiStorageResourcePassed);
|
||||
|
@ -940,7 +927,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest,
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
svmManager->multiOsContextSupport = true;
|
||||
auto ptr = svmManager->createHostUnifiedMemoryAllocation(1u, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createHostUnifiedMemoryAllocation(1u, unifiedMemoryProperties);
|
||||
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
EXPECT_EQ(MemoryConstants::pageSize, allocation->gpuAllocations.getDefaultGraphicsAllocation()->getUnderlyingBufferSize());
|
||||
|
@ -955,7 +942,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest,
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
svmManager->multiOsContextSupport = false;
|
||||
auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties);
|
||||
|
||||
EXPECT_FALSE(memoryManager->multiOsContextCapablePassed);
|
||||
EXPECT_FALSE(memoryManager->multiStorageResourcePassed);
|
||||
|
@ -971,7 +958,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest,
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
svmManager->multiOsContextSupport = true;
|
||||
auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties);
|
||||
|
||||
EXPECT_FALSE(memoryManager->multiOsContextCapablePassed);
|
||||
EXPECT_TRUE(memoryManager->multiStorageResourcePassed);
|
||||
|
@ -1007,7 +994,7 @@ TEST_F(ShareableUnifiedMemoryManagerPropertiesTest, givenShareableUnifiedPropert
|
|||
unifiedMemoryProperties.device = &device->getDevice();
|
||||
unifiedMemoryProperties.allocationFlags.flags.shareable = 1;
|
||||
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
|
||||
EXPECT_TRUE(memoryManager->shareablePassed);
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
|
@ -1338,7 +1325,7 @@ HWTEST_F(UnifiedSharedMemoryHWTest, givenDeviceUsmAllocationWhenWriteBufferThenC
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY,
|
||||
mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
|
||||
unifiedMemoryProperties.device = &mockContext.getDevice(0)->getDevice();
|
||||
auto deviceMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr);
|
||||
auto deviceMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(deviceMemory);
|
||||
GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex());
|
||||
|
||||
|
@ -1369,7 +1356,7 @@ HWTEST_F(UnifiedSharedMemoryHWTest, givenDeviceUsmAllocationWhenReadBufferThenCp
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY,
|
||||
mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
|
||||
unifiedMemoryProperties.device = &mockContext.getDevice(0)->getDevice();
|
||||
auto deviceMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr);
|
||||
auto deviceMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(deviceMemory);
|
||||
GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex());
|
||||
|
||||
|
@ -1399,7 +1386,7 @@ HWTEST_F(UnifiedSharedMemoryHWTest, givenDeviceUsmAllocationWhenReadBufferThenCp
|
|||
HWTEST_F(UnifiedSharedMemoryHWTest, givenSharedUsmAllocationWhenWriteBufferThenCpuPtrIsNotUsed) {
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY,
|
||||
mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
|
||||
auto sharedMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr);
|
||||
auto sharedMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(sharedMemory);
|
||||
GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex());
|
||||
|
||||
|
@ -1429,7 +1416,7 @@ HWTEST_F(UnifiedSharedMemoryHWTest, givenSharedUsmAllocationWhenWriteBufferThenC
|
|||
HWTEST_F(UnifiedSharedMemoryHWTest, givenSharedUsmAllocationWhenReadBufferThenCpuPtrIsNotUsed) {
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY,
|
||||
mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
|
||||
auto sharedMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr);
|
||||
auto sharedMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(sharedMemory);
|
||||
GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex());
|
||||
|
||||
|
|
|
@ -162,13 +162,12 @@ void *SVMAllocsManager::createSVMAlloc(size_t size, const SvmAllocationPropertie
|
|||
return createZeroCopySvmAllocation(size, svmProperties, rootDeviceIndices, subdeviceBitfields);
|
||||
} else {
|
||||
UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::NOT_SPECIFIED, rootDeviceIndices, subdeviceBitfields);
|
||||
return createUnifiedAllocationWithDeviceStorage(size, svmProperties, unifiedMemoryProperties, nullptr);
|
||||
return createUnifiedAllocationWithDeviceStorage(size, svmProperties, unifiedMemoryProperties);
|
||||
}
|
||||
}
|
||||
|
||||
void *SVMAllocsManager::createHostUnifiedMemoryAllocation(size_t size,
|
||||
const UnifiedMemoryProperties &memoryProperties,
|
||||
void *context) {
|
||||
const UnifiedMemoryProperties &memoryProperties) {
|
||||
size_t pageSizeForAlignment = MemoryConstants::pageSize;
|
||||
size_t alignedSize = alignUp<size_t>(size, pageSizeForAlignment);
|
||||
|
||||
|
@ -209,7 +208,6 @@ void *SVMAllocsManager::createHostUnifiedMemoryAllocation(size_t size,
|
|||
allocData.device = nullptr;
|
||||
allocData.pageSizeForAlignment = pageSizeForAlignment;
|
||||
allocData.setAllocId(this->allocationsCounter++);
|
||||
allocData.context = context;
|
||||
|
||||
std::unique_lock<std::shared_mutex> lock(mtx);
|
||||
this->SVMAllocs.insert(allocData);
|
||||
|
@ -218,8 +216,7 @@ void *SVMAllocsManager::createHostUnifiedMemoryAllocation(size_t size,
|
|||
}
|
||||
|
||||
void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size,
|
||||
const UnifiedMemoryProperties &memoryProperties,
|
||||
void *context) {
|
||||
const UnifiedMemoryProperties &memoryProperties) {
|
||||
auto rootDeviceIndex = memoryProperties.device
|
||||
? memoryProperties.device->getRootDeviceIndex()
|
||||
: *memoryProperties.rootDeviceIndices.begin();
|
||||
|
@ -288,7 +285,6 @@ void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size,
|
|||
allocData.allocationFlagsProperty = memoryProperties.allocationFlags;
|
||||
allocData.device = memoryProperties.device;
|
||||
allocData.setAllocId(this->allocationsCounter++);
|
||||
allocData.context = context;
|
||||
|
||||
std::unique_lock<std::shared_mutex> lock(mtx);
|
||||
this->SVMAllocs.insert(allocData);
|
||||
|
@ -297,10 +293,9 @@ void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size,
|
|||
|
||||
void *SVMAllocsManager::createSharedUnifiedMemoryAllocation(size_t size,
|
||||
const UnifiedMemoryProperties &memoryProperties,
|
||||
void *cmdQ,
|
||||
void *context) {
|
||||
void *cmdQ) {
|
||||
if (memoryProperties.rootDeviceIndices.size() > 1 && memoryProperties.device == nullptr) {
|
||||
return createHostUnifiedMemoryAllocation(size, memoryProperties, context);
|
||||
return createHostUnifiedMemoryAllocation(size, memoryProperties);
|
||||
}
|
||||
|
||||
auto supportDualStorageSharedMemory = memoryManager->isLocalMemorySupported(*memoryProperties.rootDeviceIndices.begin());
|
||||
|
@ -314,12 +309,12 @@ void *SVMAllocsManager::createSharedUnifiedMemoryAllocation(size_t size,
|
|||
void *unifiedMemoryPointer = nullptr;
|
||||
|
||||
if (useKmdMigration) {
|
||||
unifiedMemoryPointer = createUnifiedKmdMigratedAllocation(size, {}, memoryProperties, context);
|
||||
unifiedMemoryPointer = createUnifiedKmdMigratedAllocation(size, {}, memoryProperties);
|
||||
if (!unifiedMemoryPointer) {
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
unifiedMemoryPointer = createUnifiedAllocationWithDeviceStorage(size, {}, memoryProperties, context);
|
||||
unifiedMemoryPointer = createUnifiedAllocationWithDeviceStorage(size, {}, memoryProperties);
|
||||
if (!unifiedMemoryPointer) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -332,14 +327,13 @@ void *SVMAllocsManager::createSharedUnifiedMemoryAllocation(size_t size,
|
|||
auto unifiedMemoryAllocation = this->getSVMAlloc(unifiedMemoryPointer);
|
||||
unifiedMemoryAllocation->memoryType = memoryProperties.memoryType;
|
||||
unifiedMemoryAllocation->allocationFlagsProperty = memoryProperties.allocationFlags;
|
||||
unifiedMemoryAllocation->context = context;
|
||||
|
||||
return unifiedMemoryPointer;
|
||||
}
|
||||
return createUnifiedMemoryAllocation(size, memoryProperties, context);
|
||||
return createUnifiedMemoryAllocation(size, memoryProperties);
|
||||
}
|
||||
|
||||
void *SVMAllocsManager::createUnifiedKmdMigratedAllocation(size_t size, const SvmAllocationProperties &svmProperties, const UnifiedMemoryProperties &unifiedMemoryProperties, void *context) {
|
||||
void *SVMAllocsManager::createUnifiedKmdMigratedAllocation(size_t size, const SvmAllocationProperties &svmProperties, const UnifiedMemoryProperties &unifiedMemoryProperties) {
|
||||
|
||||
auto rootDeviceIndex = unifiedMemoryProperties.device
|
||||
? unifiedMemoryProperties.device->getRootDeviceIndex()
|
||||
|
@ -372,7 +366,6 @@ void *SVMAllocsManager::createUnifiedKmdMigratedAllocation(size_t size, const Sv
|
|||
allocData.device = unifiedMemoryProperties.device;
|
||||
allocData.size = size;
|
||||
allocData.pageSizeForAlignment = pageSizeForAlignment;
|
||||
allocData.context = context;
|
||||
allocData.setAllocId(this->allocationsCounter++);
|
||||
|
||||
std::unique_lock<std::shared_mutex> lock(mtx);
|
||||
|
@ -479,7 +472,7 @@ void *SVMAllocsManager::createZeroCopySvmAllocation(size_t size, const SvmAlloca
|
|||
return usmPtr;
|
||||
}
|
||||
|
||||
void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, const SvmAllocationProperties &svmProperties, const UnifiedMemoryProperties &unifiedMemoryProperties, void *context) {
|
||||
void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, const SvmAllocationProperties &svmProperties, const UnifiedMemoryProperties &unifiedMemoryProperties) {
|
||||
auto rootDeviceIndex = unifiedMemoryProperties.device
|
||||
? unifiedMemoryProperties.device->getRootDeviceIndex()
|
||||
: *unifiedMemoryProperties.rootDeviceIndices.begin();
|
||||
|
@ -539,7 +532,6 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, co
|
|||
allocData.device = unifiedMemoryProperties.device;
|
||||
allocData.pageSizeForAlignment = pageSizeForAlignment;
|
||||
allocData.size = size;
|
||||
allocData.context = context;
|
||||
allocData.setAllocId(this->allocationsCounter++);
|
||||
|
||||
std::unique_lock<std::shared_mutex> lock(mtx);
|
||||
|
|
|
@ -38,7 +38,6 @@ struct SvmAllocationData {
|
|||
this->allocId = svmAllocData.allocId;
|
||||
this->pageSizeForAlignment = svmAllocData.pageSizeForAlignment;
|
||||
this->isImportedAllocation = svmAllocData.isImportedAllocation;
|
||||
this->context = svmAllocData.context;
|
||||
for (auto allocation : svmAllocData.gpuAllocations.getGraphicsAllocations()) {
|
||||
if (allocation) {
|
||||
this->gpuAllocations.addAllocation(allocation);
|
||||
|
@ -54,7 +53,6 @@ struct SvmAllocationData {
|
|||
MemoryProperties allocationFlagsProperty;
|
||||
Device *device = nullptr;
|
||||
bool isImportedAllocation = false;
|
||||
void *context = nullptr;
|
||||
void setAllocId(uint32_t id) {
|
||||
allocId = id;
|
||||
}
|
||||
|
@ -155,19 +153,15 @@ class SVMAllocsManager {
|
|||
const RootDeviceIndicesContainer &rootDeviceIndices,
|
||||
const std::map<uint32_t, DeviceBitfield> &subdeviceBitfields);
|
||||
MOCKABLE_VIRTUAL void *createHostUnifiedMemoryAllocation(size_t size,
|
||||
const UnifiedMemoryProperties &svmProperties,
|
||||
void *context);
|
||||
const UnifiedMemoryProperties &svmProperties);
|
||||
MOCKABLE_VIRTUAL void *createUnifiedMemoryAllocation(size_t size,
|
||||
const UnifiedMemoryProperties &svmProperties,
|
||||
void *context);
|
||||
const UnifiedMemoryProperties &svmProperties);
|
||||
MOCKABLE_VIRTUAL void *createSharedUnifiedMemoryAllocation(size_t size,
|
||||
const UnifiedMemoryProperties &svmProperties,
|
||||
void *cmdQ,
|
||||
void *context);
|
||||
void *cmdQ);
|
||||
void *createUnifiedKmdMigratedAllocation(size_t size,
|
||||
const SvmAllocationProperties &svmProperties,
|
||||
const UnifiedMemoryProperties &unifiedMemoryProperties,
|
||||
void *context);
|
||||
const UnifiedMemoryProperties &unifiedMemoryProperties);
|
||||
void setUnifiedAllocationProperties(GraphicsAllocation *allocation, const SvmAllocationProperties &svmProperties);
|
||||
SvmAllocationData *getSVMAlloc(const void *ptr);
|
||||
MOCKABLE_VIRTUAL bool freeSVMAlloc(void *ptr, bool blocking);
|
||||
|
@ -186,7 +180,7 @@ class SVMAllocsManager {
|
|||
ResidencyContainer &residencyContainer,
|
||||
uint32_t requestedTypesMask);
|
||||
void makeInternalAllocationsResident(CommandStreamReceiver &commandStreamReceiver, uint32_t requestedTypesMask);
|
||||
void *createUnifiedAllocationWithDeviceStorage(size_t size, const SvmAllocationProperties &svmProperties, const UnifiedMemoryProperties &unifiedMemoryProperties, void *context);
|
||||
void *createUnifiedAllocationWithDeviceStorage(size_t size, const SvmAllocationProperties &svmProperties, const UnifiedMemoryProperties &unifiedMemoryProperties);
|
||||
void freeSvmAllocationWithDeviceStorage(SvmAllocationData *svmData);
|
||||
bool hasHostAllocations();
|
||||
std::atomic<uint32_t> allocationsCounter = 0;
|
||||
|
|
|
@ -37,7 +37,7 @@ GraphicsAllocation *allocateGlobalsSurface(NEO::SVMAllocsManager *const svmAlloc
|
|||
subDeviceBitfields.insert({rootDeviceIndex, deviceBitfield});
|
||||
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, subDeviceBitfields);
|
||||
unifiedMemoryProperties.device = &device;
|
||||
auto ptr = svmAllocManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmAllocManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
DEBUG_BREAK_IF(ptr == nullptr);
|
||||
if (ptr == nullptr) {
|
||||
return nullptr;
|
||||
|
|
|
@ -558,7 +558,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenUsmAllocationWhenDumpAllocationIsCa
|
|||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
unifiedMemoryProperties.device = pDevice;
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties);
|
||||
ASSERT_NE(nullptr, ptr);
|
||||
|
||||
auto gfxAllocation = svmManager->getSVMAlloc(ptr)->gpuAllocations.getGraphicsAllocation(0);
|
||||
|
|
|
@ -27,7 +27,7 @@ TEST(PrefetchManagerTests, givenPrefetchManagerWhenCallingInterfaceFunctionsThen
|
|||
PrefetchContext prefetchContext;
|
||||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr, nullptr);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr);
|
||||
ASSERT_NE(nullptr, ptr);
|
||||
|
||||
auto svmData = svmManager->getSVMAlloc(ptr);
|
||||
|
|
|
@ -55,7 +55,7 @@ TEST(SvmDeviceAllocationCacheTest, givenAllocationCacheEnabledWhenFreeingDeviceA
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
unifiedMemoryProperties.device = device;
|
||||
for (auto &testData : testDataset) {
|
||||
testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties, nullptr);
|
||||
testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties);
|
||||
ASSERT_NE(testData.allocation, nullptr);
|
||||
}
|
||||
size_t expectedCacheSize = 0u;
|
||||
|
@ -103,7 +103,7 @@ TEST(SvmDeviceAllocationCacheTest, givenAllocationsWithDifferentSizesWhenAllocat
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
unifiedMemoryProperties.device = device;
|
||||
for (auto &testData : testDataset) {
|
||||
testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties, nullptr);
|
||||
testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties);
|
||||
ASSERT_NE(testData.allocation, nullptr);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ TEST(SvmDeviceAllocationCacheTest, givenAllocationsWithDifferentSizesWhenAllocat
|
|||
std::vector<void *> allocationsToFree;
|
||||
|
||||
for (auto &testData : testDataset) {
|
||||
auto secondAllocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties, nullptr);
|
||||
auto secondAllocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties);
|
||||
EXPECT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), testDataset.size() - 1);
|
||||
EXPECT_EQ(secondAllocation, testData.allocation);
|
||||
svmManager->freeSVMAlloc(secondAllocation);
|
||||
|
@ -151,7 +151,7 @@ TEST(SvmDeviceAllocationCacheTest, givenMultipleAllocationsWhenAllocatingAfterFr
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
unifiedMemoryProperties.device = device;
|
||||
for (auto &testData : testDataset) {
|
||||
testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties, nullptr);
|
||||
testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties);
|
||||
ASSERT_NE(testData.allocation, nullptr);
|
||||
}
|
||||
|
||||
|
@ -164,18 +164,18 @@ TEST(SvmDeviceAllocationCacheTest, givenMultipleAllocationsWhenAllocatingAfterFr
|
|||
size_t expectedCacheSize = testDataset.size();
|
||||
ASSERT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), expectedCacheSize);
|
||||
|
||||
auto allocationLargerThanInCache = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis << 3, unifiedMemoryProperties, nullptr);
|
||||
auto allocationLargerThanInCache = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis << 3, unifiedMemoryProperties);
|
||||
EXPECT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), expectedCacheSize);
|
||||
|
||||
auto firstAllocation = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis, unifiedMemoryProperties, nullptr);
|
||||
auto firstAllocation = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis, unifiedMemoryProperties);
|
||||
EXPECT_EQ(firstAllocation, testDataset[0].allocation);
|
||||
EXPECT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), --expectedCacheSize);
|
||||
|
||||
auto secondAllocation = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis, unifiedMemoryProperties, nullptr);
|
||||
auto secondAllocation = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis, unifiedMemoryProperties);
|
||||
EXPECT_EQ(secondAllocation, testDataset[1].allocation);
|
||||
EXPECT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), --expectedCacheSize);
|
||||
|
||||
auto thirdAllocation = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis, unifiedMemoryProperties, nullptr);
|
||||
auto thirdAllocation = svmManager->createUnifiedMemoryAllocation(allocationSizeBasis, unifiedMemoryProperties);
|
||||
EXPECT_EQ(thirdAllocation, testDataset[2].allocation);
|
||||
EXPECT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), 0u);
|
||||
|
||||
|
@ -252,7 +252,7 @@ TEST(SvmDeviceAllocationCacheTest, givenAllocationsWithDifferentFlagsWhenAllocat
|
|||
for (auto &allocationDataToVerify : testDataset) {
|
||||
|
||||
for (auto &testData : testDataset) {
|
||||
testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, testData.unifiedMemoryProperties, nullptr);
|
||||
testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, testData.unifiedMemoryProperties);
|
||||
}
|
||||
ASSERT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), 0u);
|
||||
|
||||
|
@ -261,10 +261,10 @@ TEST(SvmDeviceAllocationCacheTest, givenAllocationsWithDifferentFlagsWhenAllocat
|
|||
}
|
||||
ASSERT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), testDataset.size());
|
||||
|
||||
auto allocationFromCache = svmManager->createUnifiedMemoryAllocation(allocationDataToVerify.allocationSize, allocationDataToVerify.unifiedMemoryProperties, nullptr);
|
||||
auto allocationFromCache = svmManager->createUnifiedMemoryAllocation(allocationDataToVerify.allocationSize, allocationDataToVerify.unifiedMemoryProperties);
|
||||
EXPECT_EQ(allocationFromCache, allocationDataToVerify.allocation);
|
||||
|
||||
auto allocationNotFromCache = svmManager->createUnifiedMemoryAllocation(allocationDataToVerify.allocationSize, allocationDataToVerify.unifiedMemoryProperties, nullptr);
|
||||
auto allocationNotFromCache = svmManager->createUnifiedMemoryAllocation(allocationDataToVerify.allocationSize, allocationDataToVerify.unifiedMemoryProperties);
|
||||
for (auto &cachedAllocation : testDataset) {
|
||||
EXPECT_NE(allocationNotFromCache, cachedAllocation.allocation);
|
||||
}
|
||||
|
@ -293,8 +293,8 @@ TEST(SvmDeviceAllocationCacheTest, givenDeviceOutOfMemoryWhenAllocatingThenCache
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
unifiedMemoryProperties.device = device;
|
||||
|
||||
auto allocationInCache = svmManager->createUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
|
||||
auto allocationInCache2 = svmManager->createUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
|
||||
auto allocationInCache = svmManager->createUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties);
|
||||
auto allocationInCache2 = svmManager->createUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties);
|
||||
ASSERT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), 0u);
|
||||
svmManager->freeSVMAlloc(allocationInCache);
|
||||
svmManager->freeSVMAlloc(allocationInCache2);
|
||||
|
@ -302,11 +302,11 @@ TEST(SvmDeviceAllocationCacheTest, givenDeviceOutOfMemoryWhenAllocatingThenCache
|
|||
ASSERT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), 2u);
|
||||
ASSERT_NE(svmManager->getSVMAlloc(allocationInCache), nullptr);
|
||||
ASSERT_NE(svmManager->getSVMAlloc(allocationInCache2), nullptr);
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(MemoryConstants::pageSize64k * 2, unifiedMemoryProperties, nullptr);
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(MemoryConstants::pageSize64k * 2, unifiedMemoryProperties);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
EXPECT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), 0u);
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
|
||||
svmManager->trimUSMDeviceAllocCache();
|
||||
ASSERT_EQ(svmManager->usmDeviceAllocationsCache.allocations.size(), 0u);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenFreeSharedAllocWithOffsetPointerThenReso
|
|||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
auto allocationSize = 4096u;
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, &cmdQ);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto svmData = svmManager->getSVMAlloc(ptr);
|
||||
auto pageFaultMemoryData = mockPageFaultManager->memoryData.find(ptr);
|
||||
|
@ -74,7 +74,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, givenKmdMigratedSharedAllocationWhenPrefetch
|
|||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ, nullptr);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
|
||||
auto svmData = svmManager->getSVMAlloc(ptr);
|
||||
|
|
|
@ -433,7 +433,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS
|
|||
SVMAllocsManager unifiedMemoryManager(memoryManager, false);
|
||||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
|
||||
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation();
|
||||
|
@ -479,33 +479,11 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, MmapFailWhenCreateSharedUnifiedMem
|
|||
SVMAllocsManager unifiedMemoryManager(memoryManager, false);
|
||||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
|
||||
|
||||
EXPECT_EQ(ptr, nullptr);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenCallToHostAllocationMemoryThenMemoryIsAllocated) {
|
||||
DebugManagerStateRestore restorer;
|
||||
|
||||
bool svmSupported = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.ftrSvm;
|
||||
if (!svmSupported) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
|
||||
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, mockDeviceBitfield}};
|
||||
SVMAllocsManager unifiedMemoryManager(memoryManager, false);
|
||||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
auto allocationSize = 4096u;
|
||||
|
||||
auto ptr = unifiedMemoryManager.createHostUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, nullptr);
|
||||
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
|
||||
unifiedMemoryManager.freeSVMAlloc(ptr);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateSharedUnifiedMemoryAllocationWithDeviceThenKmdMigratedAllocationIsCreated) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseKmdMigration.set(1);
|
||||
|
@ -526,7 +504,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
unifiedMemoryProperties.device = device.get();
|
||||
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
|
||||
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation();
|
||||
|
@ -574,7 +552,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenSetVmAdviseAtomicAttributeWhe
|
|||
for (auto atomicAdvise : {-1, 0, 1, 2}) {
|
||||
DebugManager.flags.SetVmAdviseAtomicAttribute.set(atomicAdvise);
|
||||
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
|
||||
ASSERT_NE(ptr, nullptr);
|
||||
|
||||
auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation();
|
||||
|
@ -626,7 +604,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationAndUsmInitialP
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
unifiedMemoryProperties.device = device.get();
|
||||
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
|
||||
auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation();
|
||||
|
@ -669,7 +647,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationWithAccessCoun
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
unifiedMemoryProperties.device = device.get();
|
||||
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
|
||||
auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation();
|
||||
|
@ -709,7 +687,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, whenVmAdviseIoctlFailsThenCreateSh
|
|||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
|
||||
|
||||
EXPECT_EQ(ptr, nullptr);
|
||||
EXPECT_TRUE(mock->context.receivedVmAdvise);
|
||||
|
@ -732,7 +710,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS
|
|||
SVMAllocsManager unifiedMemoryManager(memoryManager, false);
|
||||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
|
||||
|
||||
EXPECT_EQ(ptr, nullptr);
|
||||
}
|
||||
|
@ -759,7 +737,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS
|
|||
|
||||
auto size = 2 * MemoryConstants::megaByte;
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr, nullptr);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
|
||||
auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation();
|
||||
|
@ -806,7 +784,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenCreateKmdMigratedSharedAlloca
|
|||
|
||||
auto size = 2 * MemoryConstants::megaByte;
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr, nullptr);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
|
||||
auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation();
|
||||
|
@ -1485,7 +1463,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenPrintBOCreateDestroyResultFla
|
|||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr, nullptr);
|
||||
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
|
||||
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto allocation = unifiedMemoryManager.getSVMAlloc(ptr)->gpuAllocations.getDefaultGraphicsAllocation();
|
||||
|
|
|
@ -627,7 +627,7 @@ TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocWhenSetAubWritableIsCalledTh
|
|||
|
||||
auto properties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
void *cmdQ = reinterpret_cast<void *>(0xFFFF);
|
||||
void *alloc1 = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(10, properties, cmdQ, nullptr);
|
||||
void *alloc1 = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(10, properties, cmdQ);
|
||||
|
||||
pageFaultManager->baseAubWritable(false, alloc1, unifiedMemoryManager.get());
|
||||
|
||||
|
|
Loading…
Reference in New Issue