Simplify Memory Manager API [3/4]
- remove method allocateGraphicsMemory(size_t size) - pass allocation type in allocation properties - set allocation type in allocateGraphicsMemoryInPreferredPool Change-Id: Ia9296d0ab2f711b7d78aff615cb56b3a246b60ec Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
686785ce5d
commit
8ec072d39c
|
@ -212,7 +212,7 @@ LinearStream &CommandQueue::getCS(size_t minRequiredSize) {
|
|||
GraphicsAllocation *allocation = storageForAllocation->obtainReusableAllocation(requiredSize, false).release();
|
||||
|
||||
if (!allocation) {
|
||||
allocation = memoryManager->allocateGraphicsMemory(requiredSize);
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties({requiredSize, GraphicsAllocation::AllocationType::LINEAR_STREAM});
|
||||
}
|
||||
|
||||
allocation->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM);
|
||||
|
|
|
@ -32,8 +32,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueFillBuffer(
|
|||
auto memoryManager = getDevice().getMemoryManager();
|
||||
DEBUG_BREAK_IF(nullptr == memoryManager);
|
||||
|
||||
auto patternAllocation = memoryManager->allocateGraphicsMemory(alignUp(patternSize, MemoryConstants::cacheLineSize));
|
||||
patternAllocation->setAllocationType(GraphicsAllocation::AllocationType::FILL_PATTERN);
|
||||
auto patternAllocation = memoryManager->allocateGraphicsMemoryWithProperties({alignUp(patternSize, MemoryConstants::cacheLineSize), GraphicsAllocation::AllocationType::FILL_PATTERN});
|
||||
|
||||
if (patternSize == 1) {
|
||||
int patternInt = (uint32_t)((*(uint8_t *)pattern << 24) | (*(uint8_t *)pattern << 16) | (*(uint8_t *)pattern << 8) | *(uint8_t *)pattern);
|
||||
|
|
|
@ -228,7 +228,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueSVMMemFill(void *svmPtr,
|
|||
commandStreamReceieverOwnership.unlock();
|
||||
|
||||
if (!patternAllocation) {
|
||||
patternAllocation = memoryManager->allocateGraphicsMemory(patternSize);
|
||||
patternAllocation = memoryManager->allocateGraphicsMemoryWithProperties({patternSize, GraphicsAllocation::AllocationType::FILL_PATTERN});
|
||||
}
|
||||
|
||||
patternAllocation->setAllocationType(GraphicsAllocation::AllocationType::FILL_PATTERN);
|
||||
|
|
|
@ -135,7 +135,7 @@ LinearStream &CommandStreamReceiver::getCS(size_t minRequiredSize) {
|
|||
|
||||
auto allocation = internalAllocationStorage->obtainReusableAllocation(requiredSize, false).release();
|
||||
if (!allocation) {
|
||||
allocation = getMemoryManager()->allocateGraphicsMemory(requiredSize);
|
||||
allocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({requiredSize, GraphicsAllocation::AllocationType::LINEAR_STREAM});
|
||||
}
|
||||
|
||||
allocation->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM);
|
||||
|
@ -243,7 +243,7 @@ void CommandStreamReceiver::activateAubSubCapture(const MultiDispatchInfo &dispa
|
|||
|
||||
GraphicsAllocation *CommandStreamReceiver::allocateDebugSurface(size_t size) {
|
||||
UNRECOVERABLE_IF(debugSurface != nullptr);
|
||||
debugSurface = getMemoryManager()->allocateGraphicsMemory(size);
|
||||
debugSurface = getMemoryManager()->allocateGraphicsMemoryWithProperties({size, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
return debugSurface;
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ void CommandStreamReceiver::allocateHeapMemory(IndirectHeap::Type heapType,
|
|||
if (requireInternalHeap) {
|
||||
heapMemory = getMemoryManager()->allocate32BitGraphicsMemory(finalHeapSize, nullptr, AllocationOrigin::INTERNAL_ALLOCATION);
|
||||
} else {
|
||||
heapMemory = getMemoryManager()->allocateGraphicsMemory(finalHeapSize);
|
||||
heapMemory = getMemoryManager()->allocateGraphicsMemoryWithProperties({finalHeapSize, GraphicsAllocation::AllocationType::LINEAR_STREAM});
|
||||
}
|
||||
} else {
|
||||
finalHeapSize = std::max(heapMemory->getUnderlyingBufferSize(), finalHeapSize);
|
||||
|
@ -332,7 +332,7 @@ void CommandStreamReceiver::setExperimentalCmdBuffer(std::unique_ptr<Experimenta
|
|||
}
|
||||
|
||||
bool CommandStreamReceiver::initializeTagAllocation() {
|
||||
auto tagAllocation = getMemoryManager()->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto tagAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
if (!tagAllocation) {
|
||||
return false;
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ bool CommandStreamReceiver::createAllocationForHostSurface(HostPtrSurface &surfa
|
|||
allocation = memoryManager->allocateGraphicsMemoryForHostPtr(surface.getSurfaceSize(), surface.getMemoryPointer(), device.isFullRangeSvm(), requiresL3Flush);
|
||||
if (allocation == nullptr && surface.peekIsPtrCopyAllowed()) {
|
||||
// Try with no host pointer allocation and copy
|
||||
AllocationProperties properties(true, surface.getSurfaceSize());
|
||||
AllocationProperties properties(true, surface.getSurfaceSize(), GraphicsAllocation::AllocationType::UNDECIDED);
|
||||
properties.alignment = MemoryConstants::pageSize;
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ ExperimentalCommandBuffer::ExperimentalCommandBuffer(CommandStreamReceiver *csr,
|
|||
experimentalAllocationOffset(0),
|
||||
defaultPrint(true),
|
||||
timerResolution(profilingTimerResolution) {
|
||||
timestamps = csr->getMemoryManager()->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
timestamps = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
memset(timestamps->getUnderlyingBuffer(), 0, timestamps->getUnderlyingBufferSize());
|
||||
experimentalAllocation = csr->getMemoryManager()->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
experimentalAllocation = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
memset(experimentalAllocation->getUnderlyingBuffer(), 0, experimentalAllocation->getUnderlyingBufferSize());
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ void ExperimentalCommandBuffer::getCS(size_t minRequiredSize) {
|
|||
auto storageWithAllocations = commandStreamReceiver->getInternalAllocationStorage();
|
||||
GraphicsAllocation *allocation = storageWithAllocations->obtainReusableAllocation(requiredSize, false).release();
|
||||
if (!allocation) {
|
||||
allocation = memoryManager->allocateGraphicsMemory(requiredSize);
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties({requiredSize, GraphicsAllocation::AllocationType::LINEAR_STREAM});
|
||||
}
|
||||
allocation->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM);
|
||||
// Deallocate the old block, if not null
|
||||
|
|
|
@ -42,7 +42,7 @@ void ScratchSpaceControllerBase::setRequiredScratchSpace(void *sshBaseAddress,
|
|||
}
|
||||
|
||||
void ScratchSpaceControllerBase::createScratchSpaceAllocation() {
|
||||
scratchAllocation = getMemoryManager()->allocateGraphicsMemoryInPreferredPool(AllocationProperties(true, scratchSizeBytes), 0, nullptr, GraphicsAllocation::AllocationType::SCRATCH_SURFACE);
|
||||
scratchAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({scratchSizeBytes, GraphicsAllocation::AllocationType::SCRATCH_SURFACE});
|
||||
UNRECOVERABLE_IF(scratchAllocation == nullptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice) {
|
|||
outDevice.executionEnvironment->memoryManager->setForce32BitAllocations(outDevice.getDeviceInfo().force32BitAddressess);
|
||||
|
||||
if (outDevice.preemptionMode == PreemptionMode::MidThread || outDevice.isSourceLevelDebuggerActive()) {
|
||||
AllocationProperties properties(true, pHwInfo->capabilityTable.requiredPreemptionSurfaceSize);
|
||||
AllocationProperties properties(true, pHwInfo->capabilityTable.requiredPreemptionSurfaceSize, GraphicsAllocation::AllocationType::UNDECIDED);
|
||||
properties.flags.uncacheable = outDevice.getWaTable()->waCSRUncachable;
|
||||
properties.alignment = 256 * MemoryConstants::kiloByte;
|
||||
outDevice.preemptionAllocation = outDevice.executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
|
|
|
@ -98,32 +98,32 @@ void DeviceQueue::allocateResources() {
|
|||
auto &caps = device->getDeviceInfo();
|
||||
|
||||
uint32_t alignedQueueSize = alignUp(queueSize, MemoryConstants::pageSize);
|
||||
queueBuffer = device->getMemoryManager()->allocateGraphicsMemory(alignedQueueSize);
|
||||
queueBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({alignedQueueSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
|
||||
auto eventPoolBufferSize = static_cast<size_t>(caps.maxOnDeviceEvents) * sizeof(IGIL_DeviceEvent) + sizeof(IGIL_EventPool);
|
||||
eventPoolBufferSize = alignUp(eventPoolBufferSize, MemoryConstants::pageSize);
|
||||
eventPoolBuffer = device->getMemoryManager()->allocateGraphicsMemory(eventPoolBufferSize);
|
||||
eventPoolBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({eventPoolBufferSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
|
||||
auto maxEnqueue = static_cast<size_t>(alignedQueueSize) / sizeof(IGIL_CommandHeader);
|
||||
auto expectedStackSize = maxEnqueue * sizeof(uint32_t) * 3; // 3 full loads of commands
|
||||
expectedStackSize = alignUp(expectedStackSize, MemoryConstants::pageSize);
|
||||
stackBuffer = device->getMemoryManager()->allocateGraphicsMemory(expectedStackSize);
|
||||
stackBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({expectedStackSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
memset(stackBuffer->getUnderlyingBuffer(), 0, stackBuffer->getUnderlyingBufferSize());
|
||||
|
||||
auto queueStorageSize = alignedQueueSize * 2; // place for 2 full loads of queue_t
|
||||
queueStorageSize = alignUp(queueStorageSize, MemoryConstants::pageSize);
|
||||
queueStorageBuffer = device->getMemoryManager()->allocateGraphicsMemory(queueStorageSize);
|
||||
queueStorageBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({queueStorageSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
memset(queueStorageBuffer->getUnderlyingBuffer(), 0, queueStorageBuffer->getUnderlyingBufferSize());
|
||||
|
||||
auto &hwHelper = HwHelper::get(device->getHardwareInfo().pPlatform->eRenderCoreFamily);
|
||||
const size_t IDTSize = numberOfIDTables * interfaceDescriptorEntries * hwHelper.getInterfaceDescriptorDataSize();
|
||||
|
||||
// Additional padding of PAGE_SIZE for PageFaults just after DSH to satisfy hw requirements
|
||||
auto dshSize = (PARALLEL_SCHEDULER_HW_GROUPS + 2) * MAX_DSH_SIZE_PER_ENQUEUE * 8 + IDTSize + colorCalcStateSize + 4096;
|
||||
auto dshSize = (PARALLEL_SCHEDULER_HW_GROUPS + 2) * MAX_DSH_SIZE_PER_ENQUEUE * 8 + IDTSize + colorCalcStateSize + MemoryConstants::pageSize;
|
||||
dshSize = alignUp(dshSize, MemoryConstants::pageSize);
|
||||
dshBuffer = device->getMemoryManager()->allocateGraphicsMemory(dshSize);
|
||||
dshBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({dshSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
|
||||
debugQueue = device->getMemoryManager()->allocateGraphicsMemory(4096);
|
||||
debugQueue = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
debugData = (DebugDataBuffer *)debugQueue->getUnderlyingBuffer();
|
||||
memset(debugQueue->getUnderlyingBuffer(), 0, debugQueue->getUnderlyingBufferSize());
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ void DeviceQueueHw<GfxFamily>::allocateSlbBuffer() {
|
|||
slbSize += (4 * MemoryConstants::pageSize); // +4 pages spec restriction
|
||||
slbSize = alignUp(slbSize, MemoryConstants::pageSize);
|
||||
|
||||
slbBuffer = device->getMemoryManager()->allocateGraphicsMemory(slbSize);
|
||||
slbBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({slbSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
|
|
@ -31,7 +31,7 @@ GraphicsAllocation *FlatBatchBufferHelperHw<GfxFamily>::flattenBatchBuffer(Batch
|
|||
batchBuffer.chainedBatchBuffer->setAubWritable(false);
|
||||
auto sizeMainBatchBuffer = batchBuffer.chainedBatchBufferStartOffset - batchBuffer.startOffset;
|
||||
auto alignedMainBatchBufferSize = alignUp(sizeMainBatchBuffer + indirectPatchCommandsSize + batchBuffer.chainedBatchBuffer->getUnderlyingBufferSize(), MemoryConstants::pageSize);
|
||||
AllocationProperties flatBatchBufferProperties(true, alignedMainBatchBufferSize);
|
||||
AllocationProperties flatBatchBufferProperties(alignedMainBatchBufferSize, GraphicsAllocation::AllocationType::UNDECIDED);
|
||||
flatBatchBufferProperties.alignment = MemoryConstants::pageSize;
|
||||
flatBatchBuffer =
|
||||
getMemoryManager()->allocateGraphicsMemoryWithProperties(flatBatchBufferProperties);
|
||||
|
@ -109,7 +109,7 @@ GraphicsAllocation *FlatBatchBufferHelperHw<GfxFamily>::flattenBatchBuffer(Batch
|
|||
|
||||
flatBatchBufferSize = alignUp(flatBatchBufferSize, MemoryConstants::pageSize);
|
||||
flatBatchBufferSize += CSRequirements::csOverfetchSize;
|
||||
AllocationProperties flatBatchBufferProperties(true, static_cast<size_t>(flatBatchBufferSize));
|
||||
AllocationProperties flatBatchBufferProperties(static_cast<size_t>(flatBatchBufferSize), GraphicsAllocation::AllocationType::UNDECIDED);
|
||||
flatBatchBufferProperties.alignment = MemoryConstants::pageSize;
|
||||
flatBatchBuffer = getMemoryManager()->allocateGraphicsMemoryWithProperties(flatBatchBufferProperties);
|
||||
UNRECOVERABLE_IF(flatBatchBuffer == nullptr);
|
||||
|
|
|
@ -255,7 +255,7 @@ cl_int Kernel::initialize() {
|
|||
retVal = CL_OUT_OF_RESOURCES;
|
||||
break;
|
||||
}
|
||||
privateSurface = device.getMemoryManager()->allocateGraphicsMemoryInPreferredPool(AllocationProperties(true, static_cast<size_t>(privateSurfaceSize)), 0, nullptr, GraphicsAllocation::AllocationType::PRIVATE_SURFACE);
|
||||
privateSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({static_cast<size_t>(privateSurfaceSize), GraphicsAllocation::AllocationType::PRIVATE_SURFACE});
|
||||
if (privateSurface == nullptr) {
|
||||
retVal = CL_OUT_OF_RESOURCES;
|
||||
break;
|
||||
|
@ -1474,7 +1474,7 @@ void Kernel::createReflectionSurface() {
|
|||
kernelReflectionSize += blockCount * alignUp(maxConstantBufferSize, sizeof(void *));
|
||||
kernelReflectionSize += parentImageCount * sizeof(IGIL_ImageParamters);
|
||||
kernelReflectionSize += parentSamplerCount * sizeof(IGIL_ParentSamplerParams);
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemory(kernelReflectionSize);
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({kernelReflectionSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
|
||||
for (uint32_t i = 0; i < blockCount; i++) {
|
||||
const KernelInfo *pBlockInfo = blockManager->getBlockKernelInfo(i);
|
||||
|
@ -1548,7 +1548,7 @@ void Kernel::createReflectionSurface() {
|
|||
|
||||
if (DebugManager.flags.ForceDispatchScheduler.get()) {
|
||||
if (this->isSchedulerKernel && kernelReflectionSurface == nullptr) {
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,9 +192,9 @@ Buffer *Buffer::create(Context *context,
|
|||
}
|
||||
|
||||
if (!memory) {
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties.flags_intel, allocateMemory, size);
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties.flags_intel, allocateMemory, size, allocationType);
|
||||
DevicesBitfield devices = MemObjHelper::getDevicesBitfield(properties);
|
||||
memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, hostPtr, allocationType);
|
||||
memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, hostPtr);
|
||||
}
|
||||
|
||||
if (allocateMemory && memory && MemoryPool::isSystemMemoryPool(memory->getMemoryPool())) {
|
||||
|
@ -207,9 +207,9 @@ Buffer *Buffer::create(Context *context,
|
|||
allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
|
||||
zeroCopyAllowed = false;
|
||||
copyMemoryFromHostPtr = true;
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties.flags_intel, true, size);
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties.flags_intel, true, size, allocationType);
|
||||
DevicesBitfield devices = MemObjHelper::getDevicesBitfield(properties);
|
||||
memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, nullptr, allocationType);
|
||||
memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, nullptr);
|
||||
}
|
||||
|
||||
if (!memory) {
|
||||
|
|
|
@ -33,8 +33,8 @@ bool MemObjHelper::validateExtraMemoryProperties(const MemoryProperties &propert
|
|||
return true;
|
||||
}
|
||||
|
||||
AllocationProperties MemObjHelper::getAllocationProperties(cl_mem_flags_intel flags, bool allocateMemory, size_t size) {
|
||||
return AllocationProperties(allocateMemory, size);
|
||||
AllocationProperties MemObjHelper::getAllocationProperties(cl_mem_flags_intel flags, bool allocateMemory, size_t size, GraphicsAllocation::AllocationType type) {
|
||||
return AllocationProperties(allocateMemory, size, type);
|
||||
}
|
||||
|
||||
DevicesBitfield MemObjHelper::getDevicesBitfield(const MemoryProperties &properties) {
|
||||
|
|
|
@ -50,7 +50,7 @@ class MemObjHelper {
|
|||
|
||||
static bool validateExtraMemoryProperties(const MemoryProperties &properties);
|
||||
|
||||
static AllocationProperties getAllocationProperties(cl_mem_flags_intel flags, bool allocateMemory, size_t size);
|
||||
static AllocationProperties getAllocationProperties(cl_mem_flags_intel flags, bool allocateMemory, size_t size, GraphicsAllocation::AllocationType type);
|
||||
|
||||
static DevicesBitfield getDevicesBitfield(const MemoryProperties &properties);
|
||||
|
||||
|
|
|
@ -51,9 +51,9 @@ Pipe *Pipe::create(Context *context,
|
|||
memoryProperties.flags = flags;
|
||||
while (true) {
|
||||
auto size = static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace);
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(flags, true, size);
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(flags, true, size, GraphicsAllocation::AllocationType::PIPE);
|
||||
DevicesBitfield devices = MemObjHelper::getDevicesBitfield(memoryProperties);
|
||||
GraphicsAllocation *memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, nullptr, GraphicsAllocation::AllocationType::PIPE);
|
||||
GraphicsAllocation *memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, nullptr);
|
||||
if (!memory) {
|
||||
errcodeRet = CL_OUT_OF_HOST_MEMORY;
|
||||
break;
|
||||
|
|
|
@ -75,7 +75,7 @@ void *MemoryManager::allocateSystemMemory(size_t size, size_t alignment) {
|
|||
|
||||
GraphicsAllocation *MemoryManager::allocateGraphicsMemoryForSVM(size_t size, bool coherent) {
|
||||
GraphicsAllocation *graphicsAllocation = nullptr;
|
||||
graphicsAllocation = allocateGraphicsMemoryInPreferredPool(AllocationProperties(true, size), 0u, nullptr, GraphicsAllocation::AllocationType::SVM);
|
||||
graphicsAllocation = allocateGraphicsMemoryWithProperties({size, GraphicsAllocation::AllocationType::SVM});
|
||||
if (graphicsAllocation) {
|
||||
graphicsAllocation->setCoherent(coherent);
|
||||
}
|
||||
|
@ -101,13 +101,13 @@ void MemoryManager::cleanGraphicsMemoryCreatedFromHostPtr(GraphicsAllocation *gr
|
|||
|
||||
GraphicsAllocation *MemoryManager::createGraphicsAllocationWithPadding(GraphicsAllocation *inputGraphicsAllocation, size_t sizeWithPadding) {
|
||||
if (!paddingAllocation) {
|
||||
paddingAllocation = allocateGraphicsMemory(paddingBufferSize);
|
||||
paddingAllocation = allocateGraphicsMemoryWithProperties({paddingBufferSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
}
|
||||
return createPaddedAllocation(inputGraphicsAllocation, sizeWithPadding);
|
||||
}
|
||||
|
||||
GraphicsAllocation *MemoryManager::createPaddedAllocation(GraphicsAllocation *inputGraphicsAllocation, size_t sizeWithPadding) {
|
||||
return allocateGraphicsMemory(sizeWithPadding);
|
||||
return allocateGraphicsMemoryWithProperties({sizeWithPadding, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
}
|
||||
|
||||
void MemoryManager::freeSystemMemory(void *ptr) {
|
||||
|
@ -184,7 +184,7 @@ OsContext *MemoryManager::createAndRegisterOsContext(EngineInstanceT engineType,
|
|||
}
|
||||
|
||||
bool MemoryManager::getAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const DevicesBitfield devicesBitfield,
|
||||
const void *hostPtr, GraphicsAllocation::AllocationType type) {
|
||||
const void *hostPtr) {
|
||||
UNRECOVERABLE_IF(hostPtr == nullptr && !properties.flags.allocateMemory);
|
||||
|
||||
bool allow64KbPages = false;
|
||||
|
@ -193,7 +193,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
|||
bool uncacheable = properties.flags.uncacheable;
|
||||
bool mustBeZeroCopy = false;
|
||||
|
||||
switch (type) {
|
||||
switch (properties.allocationType) {
|
||||
case GraphicsAllocation::AllocationType::BUFFER:
|
||||
case GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY:
|
||||
case GraphicsAllocation::AllocationType::BUFFER_COMPRESSED:
|
||||
|
@ -211,7 +211,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
|||
break;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
switch (properties.allocationType) {
|
||||
case GraphicsAllocation::AllocationType::BUFFER:
|
||||
case GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY:
|
||||
case GraphicsAllocation::AllocationType::BUFFER_COMPRESSED:
|
||||
|
@ -221,7 +221,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
|||
break;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
switch (properties.allocationType) {
|
||||
case GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY:
|
||||
case GraphicsAllocation::AllocationType::PIPE:
|
||||
case GraphicsAllocation::AllocationType::PRINTF_SURFACE:
|
||||
|
@ -234,6 +234,16 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
|||
break;
|
||||
}
|
||||
|
||||
switch (properties.allocationType) {
|
||||
case GraphicsAllocation::AllocationType::UNDECIDED:
|
||||
case GraphicsAllocation::AllocationType::LINEAR_STREAM:
|
||||
case GraphicsAllocation::AllocationType::FILL_PATTERN:
|
||||
allocationData.flags.useSystemMemory = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
allocationData.flags.mustBeZeroCopy = mustBeZeroCopy;
|
||||
allocationData.flags.allocateMemory = properties.flags.allocateMemory;
|
||||
allocationData.flags.allow32Bit = allow32Bit;
|
||||
|
@ -241,7 +251,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
|||
allocationData.flags.forcePin = forcePin;
|
||||
allocationData.flags.uncacheable = uncacheable;
|
||||
allocationData.flags.flushL3 = properties.flags.flushL3RequiredForRead | properties.flags.flushL3RequiredForWrite;
|
||||
allocationData.flags.preferRenderCompressed = GraphicsAllocation::AllocationType::BUFFER_COMPRESSED == type;
|
||||
allocationData.flags.preferRenderCompressed = GraphicsAllocation::AllocationType::BUFFER_COMPRESSED == properties.allocationType;
|
||||
|
||||
if (allocationData.flags.mustBeZeroCopy) {
|
||||
allocationData.flags.useSystemMemory = true;
|
||||
|
@ -249,7 +259,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
|||
|
||||
allocationData.hostPtr = hostPtr;
|
||||
allocationData.size = properties.size;
|
||||
allocationData.type = type;
|
||||
allocationData.type = properties.allocationType;
|
||||
allocationData.devicesBitfield = devicesBitfield;
|
||||
allocationData.alignment = properties.alignment ? properties.alignment : MemoryConstants::preferredAlignment;
|
||||
|
||||
|
@ -259,11 +269,11 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
|||
return true;
|
||||
}
|
||||
|
||||
GraphicsAllocation *MemoryManager::allocateGraphicsMemoryInPreferredPool(AllocationProperties properties, DevicesBitfield devicesBitfield, const void *hostPtr, GraphicsAllocation::AllocationType type) {
|
||||
GraphicsAllocation *MemoryManager::allocateGraphicsMemoryInPreferredPool(AllocationProperties properties, DevicesBitfield devicesBitfield, const void *hostPtr) {
|
||||
AllocationData allocationData;
|
||||
AllocationStatus status = AllocationStatus::Error;
|
||||
|
||||
getAllocationData(allocationData, properties, devicesBitfield, hostPtr, type);
|
||||
getAllocationData(allocationData, properties, devicesBitfield, hostPtr);
|
||||
UNRECOVERABLE_IF(allocationData.type == GraphicsAllocation::AllocationType::IMAGE || allocationData.type == GraphicsAllocation::AllocationType::SHARED_RESOURCE);
|
||||
GraphicsAllocation *allocation = nullptr;
|
||||
|
||||
|
@ -271,6 +281,9 @@ GraphicsAllocation *MemoryManager::allocateGraphicsMemoryInPreferredPool(Allocat
|
|||
if (!allocation && status == AllocationStatus::RetryInNonDevicePool) {
|
||||
allocation = allocateGraphicsMemory(allocationData);
|
||||
}
|
||||
if (allocation) {
|
||||
allocation->setAllocationType(properties.allocationType);
|
||||
}
|
||||
return allocation;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,14 +52,10 @@ struct AllocationProperties {
|
|||
static_assert(sizeof(AllocationProperties::flags) == sizeof(AllocationProperties::allFlags), "");
|
||||
size_t size = 0;
|
||||
size_t alignment = 0;
|
||||
GraphicsAllocation::AllocationType allocationType = GraphicsAllocation::AllocationType::UNKNOWN;
|
||||
|
||||
AllocationProperties() {
|
||||
allFlags = 0;
|
||||
flags.flushL3RequiredForRead = 1;
|
||||
flags.flushL3RequiredForWrite = 1;
|
||||
}
|
||||
|
||||
AllocationProperties(bool allocateMemory, size_t size) : size(size) {
|
||||
AllocationProperties(size_t size, GraphicsAllocation::AllocationType allocationType) : AllocationProperties(true, size, allocationType) {}
|
||||
AllocationProperties(bool allocateMemory, size_t size, GraphicsAllocation::AllocationType allocationType) : size(size), allocationType(allocationType) {
|
||||
allFlags = 0;
|
||||
flags.flushL3RequiredForRead = 1;
|
||||
flags.flushL3RequiredForWrite = 1;
|
||||
|
@ -93,12 +89,8 @@ class MemoryManager {
|
|||
virtual void addAllocationToHostPtrManager(GraphicsAllocation *memory) = 0;
|
||||
virtual void removeAllocationFromHostPtrManager(GraphicsAllocation *memory) = 0;
|
||||
|
||||
GraphicsAllocation *allocateGraphicsMemory(size_t size) {
|
||||
return allocateGraphicsMemoryInPreferredPool(AllocationProperties(true, size), 0u, nullptr, GraphicsAllocation::AllocationType::UNDECIDED);
|
||||
}
|
||||
|
||||
GraphicsAllocation *allocateGraphicsMemoryWithProperties(const AllocationProperties &properties) {
|
||||
return allocateGraphicsMemoryInPreferredPool(properties, 0u, nullptr, GraphicsAllocation::AllocationType::UNDECIDED);
|
||||
return allocateGraphicsMemoryInPreferredPool(properties, 0u, nullptr);
|
||||
}
|
||||
|
||||
virtual GraphicsAllocation *allocateGraphicsMemoryForNonSvmHostPtr(size_t size, void *cpuPtr) = 0;
|
||||
|
@ -126,7 +118,7 @@ class MemoryManager {
|
|||
|
||||
virtual GraphicsAllocation *allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) = 0;
|
||||
|
||||
GraphicsAllocation *allocateGraphicsMemoryInPreferredPool(AllocationProperties properties, DevicesBitfield devicesBitfield, const void *hostPtr, GraphicsAllocation::AllocationType type);
|
||||
GraphicsAllocation *allocateGraphicsMemoryInPreferredPool(AllocationProperties properties, DevicesBitfield devicesBitfield, const void *hostPtr);
|
||||
|
||||
GraphicsAllocation *allocateGraphicsMemoryForSVM(size_t size, bool coherent);
|
||||
|
||||
|
@ -227,7 +219,7 @@ class MemoryManager {
|
|||
};
|
||||
|
||||
static bool getAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const DevicesBitfield devicesBitfield,
|
||||
const void *hostPtr, GraphicsAllocation::AllocationType type);
|
||||
const void *hostPtr);
|
||||
|
||||
GraphicsAllocation *allocateGraphicsMemory(const AllocationData &allocationData);
|
||||
virtual GraphicsAllocation *allocateGraphicsMemoryWithHostPtr(const AllocationData &allocationData);
|
||||
|
|
|
@ -233,7 +233,7 @@ void OsAgnosticMemoryManager::cleanOsHandles(OsHandleStorage &handleStorage) {
|
|||
GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) {
|
||||
GraphicsAllocation *alloc = nullptr;
|
||||
if (!GmmHelper::allowTiling(*imgInfo.imgDesc) && imgInfo.mipCount == 0) {
|
||||
alloc = allocateGraphicsMemory(imgInfo.size);
|
||||
alloc = allocateGraphicsMemoryWithProperties({imgInfo.size, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
} else {
|
||||
auto ptr = allocateSystemMemory(alignUp(imgInfo.size, MemoryConstants::pageSize), MemoryConstants::pageSize);
|
||||
if (ptr != nullptr) {
|
||||
|
|
|
@ -282,7 +282,7 @@ DrmAllocation *DrmMemoryManager::allocateGraphicsMemory64kb(AllocationData alloc
|
|||
|
||||
GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) {
|
||||
if (!GmmHelper::allowTiling(*imgInfo.imgDesc)) {
|
||||
auto alloc = MemoryManager::allocateGraphicsMemory(imgInfo.size);
|
||||
auto alloc = MemoryManager::allocateGraphicsMemoryWithProperties({imgInfo.size, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
if (alloc) {
|
||||
alloc->gmm = gmm;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ WddmMemoryManager::WddmMemoryManager(bool enable64kbPages, bool enableLocalMemor
|
|||
GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) {
|
||||
if (!GmmHelper::allowTiling(*imgInfo.imgDesc) && imgInfo.mipCount == 0) {
|
||||
delete gmm;
|
||||
return allocateGraphicsMemory(imgInfo.size);
|
||||
return allocateGraphicsMemoryWithProperties({imgInfo.size, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
}
|
||||
auto allocation = std::make_unique<WddmAllocation>(nullptr, imgInfo.size, nullptr, MemoryPool::SystemCpuInaccessible, getOsContextCount(), false);
|
||||
allocation->gmm = gmm;
|
||||
|
|
|
@ -37,8 +37,7 @@ void PrintfHandler::prepareDispatch(const MultiDispatchInfo &multiDispatchInfo)
|
|||
return;
|
||||
}
|
||||
kernel = multiDispatchInfo.peekMainKernel();
|
||||
printfSurface = device.getMemoryManager()->allocateGraphicsMemoryInPreferredPool(AllocationProperties(true, printfSurfaceSize), 0, nullptr, GraphicsAllocation::AllocationType::PRINTF_SURFACE);
|
||||
|
||||
printfSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({printfSurfaceSize, GraphicsAllocation::AllocationType::PRINTF_SURFACE});
|
||||
*reinterpret_cast<uint32_t *>(printfSurface->getUnderlyingBuffer()) = printfSurfaceInitialDataSize;
|
||||
|
||||
auto printfPatchAddress = ptrOffset(reinterpret_cast<uintptr_t *>(kernel->getCrossThreadData()),
|
||||
|
|
|
@ -855,7 +855,7 @@ cl_int Program::parseProgramScopePatchList() {
|
|||
|
||||
surfaceSize = patch.InlineDataSize;
|
||||
headerSize = sizeof(SPatchAllocateConstantMemorySurfaceProgramBinaryInfo);
|
||||
constantSurface = pDevice->getMemoryManager()->allocateGraphicsMemoryInPreferredPool(AllocationProperties(true, surfaceSize), 0, nullptr, GraphicsAllocation::AllocationType::CONSTANT_SURFACE);
|
||||
constantSurface = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({surfaceSize, GraphicsAllocation::AllocationType::CONSTANT_SURFACE});
|
||||
|
||||
memcpy_s(constantSurface->getUnderlyingBuffer(), surfaceSize, (cl_char *)pPatch + headerSize, surfaceSize);
|
||||
pCurPatchListPtr = ptrOffset(pCurPatchListPtr, surfaceSize);
|
||||
|
@ -877,7 +877,7 @@ cl_int Program::parseProgramScopePatchList() {
|
|||
surfaceSize = patch.InlineDataSize;
|
||||
globalVarTotalSize += (size_t)surfaceSize;
|
||||
headerSize = sizeof(SPatchAllocateGlobalMemorySurfaceProgramBinaryInfo);
|
||||
globalSurface = pDevice->getMemoryManager()->allocateGraphicsMemoryInPreferredPool(AllocationProperties(true, surfaceSize), 0, nullptr, GraphicsAllocation::AllocationType::GLOBAL_SURFACE);
|
||||
globalSurface = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({surfaceSize, GraphicsAllocation::AllocationType::GLOBAL_SURFACE});
|
||||
|
||||
memcpy_s(globalSurface->getUnderlyingBuffer(), surfaceSize, (cl_char *)pPatch + headerSize, surfaceSize);
|
||||
pCurPatchListPtr = ptrOffset(pCurPatchListPtr, surfaceSize);
|
||||
|
|
|
@ -374,7 +374,7 @@ void Program::allocateBlockPrivateSurfaces() {
|
|||
|
||||
if (privateSize > 0 && blockKernelManager->getPrivateSurface(i) == nullptr) {
|
||||
privateSize *= getDevice(0).getDeviceInfo().computeUnitsUsedForScratch * info->getMaxSimdSize();
|
||||
auto *privateSurface = this->executionEnvironment.memoryManager->allocateGraphicsMemoryInPreferredPool(AllocationProperties(true, privateSize), 0, nullptr, GraphicsAllocation::AllocationType::PRIVATE_SURFACE);
|
||||
auto *privateSurface = this->executionEnvironment.memoryManager->allocateGraphicsMemoryWithProperties({privateSize, GraphicsAllocation::AllocationType::PRIVATE_SURFACE});
|
||||
blockKernelManager->pushPrivateSurface(privateSurface, i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,8 +128,7 @@ class TagAllocator {
|
|||
size_t tagSize = alignUp(sizeof(TagType), tagAlignment);
|
||||
size_t allocationSizeRequired = tagCount * tagSize;
|
||||
|
||||
GraphicsAllocation *graphicsAllocation = memoryManager->allocateGraphicsMemory(allocationSizeRequired);
|
||||
graphicsAllocation->setAllocationType(GraphicsAllocation::AllocationType::TIMESTAMP_TAG_BUFFER);
|
||||
GraphicsAllocation *graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties({allocationSizeRequired, GraphicsAllocation::AllocationType::TIMESTAMP_TAG_BUFFER});
|
||||
gfxAllocations.push_back(graphicsAllocation);
|
||||
|
||||
uintptr_t Size = graphicsAllocation->getUnderlyingBufferSize();
|
||||
|
|
|
@ -338,11 +338,11 @@ HWTEST_F(CommandQueueHwTest, GivenNotCompleteUserEventPassedToEnqueueWhenEventIs
|
|||
size_t offset = 0;
|
||||
size_t size = 1;
|
||||
|
||||
GraphicsAllocation *constantSurface = mockCSR->getMemoryManager()->allocateGraphicsMemory(10);
|
||||
GraphicsAllocation *constantSurface = mockCSR->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
mockProgram->setConstantSurface(constantSurface);
|
||||
|
||||
GraphicsAllocation *printfSurface = mockCSR->getMemoryManager()->allocateGraphicsMemory(10);
|
||||
GraphicsAllocation *privateSurface = mockCSR->getMemoryManager()->allocateGraphicsMemory(10);
|
||||
GraphicsAllocation *printfSurface = mockCSR->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
GraphicsAllocation *privateSurface = mockCSR->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
mockKernel->setPrivateSurface(privateSurface, 10);
|
||||
|
||||
|
|
|
@ -330,7 +330,7 @@ TEST_F(CommandQueueCommandStreamTest, givenCommandStreamReceiverWithReusableAllo
|
|||
|
||||
auto memoryManager = pDevice->getMemoryManager();
|
||||
size_t requiredSize = alignUp(100, MemoryConstants::pageSize) + CSRequirements::csOverfetchSize;
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(requiredSize);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{requiredSize});
|
||||
auto &commandStreamReceiver = cmdQ.getCommandStreamReceiver();
|
||||
commandStreamReceiver.getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION);
|
||||
|
||||
|
@ -491,7 +491,7 @@ TEST_P(CommandQueueIndirectHeapTest, givenCommandStreamReceiverWithReusableAlloc
|
|||
if (this->GetParam() == IndirectHeap::INDIRECT_OBJECT) {
|
||||
allocation = memoryManager->allocate32BitGraphicsMemory(allocationSize, nullptr, AllocationOrigin::INTERNAL_ALLOCATION);
|
||||
} else {
|
||||
allocation = memoryManager->allocateGraphicsMemory(allocationSize);
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{allocationSize});
|
||||
}
|
||||
if (this->GetParam() == IndirectHeap::SURFACE_STATE) {
|
||||
allocation->setSize(commandStreamReceiver.defaultSshSize * 2);
|
||||
|
|
|
@ -84,7 +84,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueFillBufferCmdTests, GPGPUWalker) {
|
|||
}
|
||||
|
||||
HWTEST_F(EnqueueFillBufferCmdTests, addsIndirectData) {
|
||||
auto patternAllocation = context.getMemoryManager()->allocateGraphicsMemory(EnqueueFillBufferTraits::patternSize);
|
||||
auto patternAllocation = context.getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{EnqueueFillBufferTraits::patternSize});
|
||||
|
||||
auto dshBefore = pDSH->getUsed();
|
||||
auto iohBefore = pIOH->getUsed();
|
||||
|
@ -120,7 +120,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, addsIndirectData) {
|
|||
}
|
||||
|
||||
HWTEST_F(EnqueueFillBufferCmdTests, FillBufferRightLeftover) {
|
||||
auto patternAllocation = context.getMemoryManager()->allocateGraphicsMemory(EnqueueFillBufferTraits::patternSize);
|
||||
auto patternAllocation = context.getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{EnqueueFillBufferTraits::patternSize});
|
||||
|
||||
EnqueueFillBufferHelper<>::enqueueFillBuffer(pCmdQ, buffer);
|
||||
|
||||
|
@ -147,7 +147,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, FillBufferRightLeftover) {
|
|||
}
|
||||
|
||||
HWTEST_F(EnqueueFillBufferCmdTests, FillBufferMiddle) {
|
||||
auto patternAllocation = context.getMemoryManager()->allocateGraphicsMemory(EnqueueFillBufferTraits::patternSize);
|
||||
auto patternAllocation = context.getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{EnqueueFillBufferTraits::patternSize});
|
||||
|
||||
EnqueueFillBufferHelper<>::enqueueFillBuffer(pCmdQ, buffer);
|
||||
|
||||
|
@ -174,7 +174,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, FillBufferMiddle) {
|
|||
}
|
||||
|
||||
HWTEST_F(EnqueueFillBufferCmdTests, FillBufferLeftLeftover) {
|
||||
auto patternAllocation = context.getMemoryManager()->allocateGraphicsMemory(EnqueueFillBufferTraits::patternSize);
|
||||
auto patternAllocation = context.getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{EnqueueFillBufferTraits::patternSize});
|
||||
|
||||
EnqueueFillBufferHelper<>::enqueueFillBuffer(pCmdQ, buffer);
|
||||
|
||||
|
@ -266,7 +266,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueFillBufferCmdTests, MediaVFEState) {
|
|||
}
|
||||
|
||||
HWTEST_F(EnqueueFillBufferCmdTests, argumentZeroShouldMatchDestAddress) {
|
||||
auto patternAllocation = context.getMemoryManager()->allocateGraphicsMemory(EnqueueFillBufferTraits::patternSize);
|
||||
auto patternAllocation = context.getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{EnqueueFillBufferTraits::patternSize});
|
||||
|
||||
enqueueFillBuffer<FamilyType>();
|
||||
|
||||
|
@ -302,7 +302,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, argumentZeroShouldMatchDestAddress) {
|
|||
// This could happen if KernelInfo.kernelArgInfo was accessible given a Kernel. Just need an offset
|
||||
// into CrossThreadData.
|
||||
HWTEST_F(EnqueueFillBufferCmdTests, DISABLED_argumentOneShouldMatchOffset) {
|
||||
auto patternAllocation = context.getMemoryManager()->allocateGraphicsMemory(EnqueueFillBufferTraits::patternSize);
|
||||
auto patternAllocation = context.getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{EnqueueFillBufferTraits::patternSize});
|
||||
|
||||
enqueueFillBuffer<FamilyType>();
|
||||
|
||||
|
@ -335,7 +335,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, DISABLED_argumentOneShouldMatchOffset) {
|
|||
}
|
||||
|
||||
HWTEST_F(EnqueueFillBufferCmdTests, argumentTwoShouldMatchPatternPtr) {
|
||||
auto patternAllocation = context.getMemoryManager()->allocateGraphicsMemory(EnqueueFillBufferTraits::patternSize);
|
||||
auto patternAllocation = context.getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{EnqueueFillBufferTraits::patternSize});
|
||||
|
||||
enqueueFillBuffer<FamilyType>();
|
||||
|
||||
|
|
|
@ -919,7 +919,7 @@ TEST_F(EnqueueMapImageTest, givenImage1DArrayWhenEnqueueMapImageIsCalledThenRetu
|
|||
imageFormat.image_channel_data_type = CL_UNSIGNED_INT16;
|
||||
|
||||
const SurfaceFormatInfo *surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
||||
auto allocation = context->getMemoryManager()->allocateGraphicsMemory(imgSize);
|
||||
auto allocation = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{imgSize});
|
||||
ASSERT_NE(allocation, nullptr);
|
||||
|
||||
MockImage image(context, flags, allocation, *surfaceFormat, imageFormat, imageDesc);
|
||||
|
|
|
@ -43,7 +43,7 @@ struct GetSizeRequiredBufferTest : public CommandEnqueueFixture,
|
|||
BufferDefaults::context = new MockContext;
|
||||
srcBuffer = BufferHelper<>::create();
|
||||
dstBuffer = BufferHelper<>::create();
|
||||
patternAllocation = context->getMemoryManager()->allocateGraphicsMemory(EnqueueFillBufferTraits::patternSize);
|
||||
patternAllocation = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{EnqueueFillBufferTraits::patternSize});
|
||||
pDevice->setPreemptionMode(PreemptionMode::Disabled);
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ struct MultipleMapBufferTest : public DeviceFixture, public ::testing::Test {
|
|||
|
||||
template <typename FamilyType>
|
||||
std::unique_ptr<MockBuffer<FamilyType>> createMockBuffer(bool mapOnGpu) {
|
||||
auto mockAlloc = pDevice->getMemoryManager()->allocateGraphicsMemory(1024);
|
||||
auto mockAlloc = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto buffer = new MockBuffer<FamilyType>(context, 0, 1024, mockAlloc->getUnderlyingBuffer(), mockAlloc->getUnderlyingBuffer(),
|
||||
mockAlloc, false, false, false);
|
||||
if (mapOnGpu) {
|
||||
|
|
|
@ -89,7 +89,7 @@ struct MultipleMapImageTest : public DeviceFixture, public ::testing::Test {
|
|||
template <typename Traits, typename FamilyType>
|
||||
std::unique_ptr<MockImage<FamilyType>> createMockImage() {
|
||||
auto allocationSize = Traits::imageDesc.image_width * 4 * Traits::imageDesc.image_height * Traits::imageDesc.image_depth;
|
||||
auto mockAlloc = pDevice->getMemoryManager()->allocateGraphicsMemory(allocationSize);
|
||||
auto mockAlloc = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{allocationSize});
|
||||
auto tiledImage = GmmHelper::allowTiling(Traits::imageDesc);
|
||||
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(Traits::flags, &Traits::imageFormat);
|
||||
|
|
|
@ -236,7 +236,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenMakeResidentC
|
|||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
aubCsr->setOsContext(*pDevice->getDefaultEngine().osContext);
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto osContextId = aubCsr->getOsContext().getContextId();
|
||||
|
||||
|
@ -542,7 +542,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
|
|||
auto commandBuffer = aubExecutionEnvironment->commandBuffer;
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, gfxAllocation);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
@ -576,7 +576,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNonStanda
|
|||
auto commandBuffer = aubExecutionEnvironment->commandBuffer;
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
||||
|
@ -613,7 +613,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
|
|||
aubCsr->subCaptureManager.reset(aubSubCaptureManagerMock);
|
||||
ASSERT_TRUE(aubCsr->subCaptureManager->isSubCaptureEnabled());
|
||||
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, gfxAllocation);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
@ -644,7 +644,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphic
|
|||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, false, true);
|
||||
auto memoryManager = aubExecutionEnvironment->executionEnvironment->memoryManager.get();
|
||||
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
EXPECT_TRUE(gfxAllocation->isAubWritable());
|
||||
|
||||
|
@ -656,7 +656,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
|
|||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
auto memoryManager = aubExecutionEnvironment->executionEnvironment->memoryManager.get();
|
||||
|
||||
auto gfxDefaultAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxDefaultAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
;
|
||||
|
||||
ResidencyContainer allocationsForResidency = {gfxDefaultAllocation};
|
||||
aubCsr->processResidency(allocationsForResidency);
|
||||
|
@ -671,7 +672,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe
|
|||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
GraphicsAllocation::AllocationType onlyOneTimeAubWritableTypes[] = {
|
||||
GraphicsAllocation::AllocationType::BUFFER,
|
||||
|
@ -696,10 +697,12 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
|
|||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
aubCsr->setOsContext(*pDevice->getDefaultEngine().osContext);
|
||||
|
||||
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
;
|
||||
gfxBufferAllocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
|
||||
|
||||
auto gfxImageAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxImageAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
;
|
||||
gfxImageAllocation->setAllocationType(GraphicsAllocation::AllocationType::IMAGE);
|
||||
|
||||
ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation};
|
||||
|
@ -719,11 +722,13 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
|
|||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
aubCsr->setOsContext(*pDevice->getDefaultEngine().osContext);
|
||||
|
||||
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
;
|
||||
gfxBufferAllocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
|
||||
gfxBufferAllocation->setAubWritable(false);
|
||||
|
||||
auto gfxImageAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxImageAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
;
|
||||
gfxImageAllocation->setAllocationType(GraphicsAllocation::AllocationType::IMAGE);
|
||||
gfxImageAllocation->setAubWritable(false);
|
||||
|
||||
|
@ -746,11 +751,13 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
|
|||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
aubCsr->setOsContext(*pDevice->getDefaultEngine().osContext);
|
||||
|
||||
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
;
|
||||
gfxBufferAllocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
|
||||
gfxBufferAllocation->setAubWritable(false);
|
||||
|
||||
auto gfxImageAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxImageAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
;
|
||||
gfxImageAllocation->setAllocationType(GraphicsAllocation::AllocationType::IMAGE);
|
||||
gfxImageAllocation->setAubWritable(false);
|
||||
|
||||
|
@ -771,7 +778,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphic
|
|||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
EXPECT_TRUE(aubCsr->writeMemory(*gfxAllocation));
|
||||
|
||||
|
@ -783,7 +790,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphic
|
|||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
gfxAllocation->setAubWritable(false);
|
||||
EXPECT_FALSE(aubCsr->writeMemory(*gfxAllocation));
|
||||
|
|
|
@ -48,11 +48,11 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
|
|||
auto flatBatchBufferHelper = new FlatBatchBufferHelperHw<FamilyType>(*pDevice->executionEnvironment);
|
||||
aubCsr->overwriteFlatBatchBufferHelper(flatBatchBufferHelper);
|
||||
|
||||
auto chainedBatchBuffer = memoryManager->allocateGraphicsMemory(128u);
|
||||
auto otherAllocation = memoryManager->allocateGraphicsMemory(128u);
|
||||
auto chainedBatchBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{128u});
|
||||
auto otherAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{128u});
|
||||
ASSERT_NE(nullptr, chainedBatchBuffer);
|
||||
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{128u});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
|
@ -64,7 +64,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
|
|||
aubCsr->getFlatBatchBufferHelper().flattenBatchBuffer(batchBuffer, sizeBatchBuffer, DispatchMode::ImmediateDispatch),
|
||||
[&](GraphicsAllocation *ptr) { memoryManager->freeGraphicsMemory(ptr); });
|
||||
EXPECT_NE(nullptr, flatBatchBuffer->getUnderlyingBuffer());
|
||||
EXPECT_EQ(alignUp(128u + 128u, 0x1000), sizeBatchBuffer);
|
||||
EXPECT_EQ(alignUp(128u + 128u, MemoryConstants::pageSize), sizeBatchBuffer);
|
||||
|
||||
memoryManager->freeGraphicsMemory(commandBuffer);
|
||||
memoryManager->freeGraphicsMemory(chainedBatchBuffer);
|
||||
|
@ -78,7 +78,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
|
|||
auto flatBatchBufferHelper = new FlatBatchBufferHelperHw<FamilyType>(*pDevice->executionEnvironment);
|
||||
aubCsr->overwriteFlatBatchBufferHelper(flatBatchBufferHelper);
|
||||
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
|
@ -102,11 +102,11 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
|
|||
auto flatBatchBufferHelper = new FlatBatchBufferHelperHw<FamilyType>(*pDevice->executionEnvironment);
|
||||
aubCsr->overwriteFlatBatchBufferHelper(flatBatchBufferHelper);
|
||||
|
||||
auto chainedBatchBuffer = memoryManager->allocateGraphicsMemory(128u);
|
||||
auto otherAllocation = memoryManager->allocateGraphicsMemory(128u);
|
||||
auto chainedBatchBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto otherAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, chainedBatchBuffer);
|
||||
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
|
@ -278,7 +278,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF
|
|||
auto mockHelper = new MockFlatBatchBufferHelper<FamilyType>(*aubExecutionEnvironment->executionEnvironment);
|
||||
aubCsr->overwriteFlatBatchBufferHelper(mockHelper);
|
||||
|
||||
auto chainedBatchBuffer = aubExecutionEnvironment->executionEnvironment->memoryManager->allocateGraphicsMemory(128u);
|
||||
auto chainedBatchBuffer = aubExecutionEnvironment->executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, chainedBatchBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, chainedBatchBuffer, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
@ -286,7 +286,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF
|
|||
aubCsr->makeResident(*chainedBatchBuffer);
|
||||
|
||||
std::unique_ptr<GraphicsAllocation, std::function<void(GraphicsAllocation *)>> ptr(
|
||||
aubExecutionEnvironment->executionEnvironment->memoryManager->allocateGraphicsMemory(4096),
|
||||
aubExecutionEnvironment->executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}),
|
||||
[&](GraphicsAllocation *ptr) { aubExecutionEnvironment->executionEnvironment->memoryManager->freeGraphicsMemory(ptr); });
|
||||
|
||||
auto expectedAllocation = ptr.get();
|
||||
|
@ -665,7 +665,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe
|
|||
|
||||
aubCsr->ppgtt.reset(ppgttMock);
|
||||
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
gfxAllocation->setAubWritable(true);
|
||||
|
||||
auto gmm = new Gmm(nullptr, 1, false);
|
||||
|
|
|
@ -1185,11 +1185,11 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenTemporaryAndReusableAl
|
|||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
auto memoryManager = pDevice->getMemoryManager();
|
||||
|
||||
auto temporaryToClean = memoryManager->allocateGraphicsMemory(4096u);
|
||||
auto temporaryToHold = memoryManager->allocateGraphicsMemory(4096u);
|
||||
auto temporaryToClean = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto temporaryToHold = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto reusableToClean = memoryManager->allocateGraphicsMemory(4096u);
|
||||
auto reusableToHold = memoryManager->allocateGraphicsMemory(4096u);
|
||||
auto reusableToClean = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto reusableToHold = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
commandStreamReceiver.getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(temporaryToClean), TEMPORARY_ALLOCATION);
|
||||
commandStreamReceiver.getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(temporaryToHold), TEMPORARY_ALLOCATION);
|
||||
|
|
|
@ -197,7 +197,7 @@ HWTEST_F(CommandStreamReceiverTest, givenCommandStreamReceiverWhenCheckedForInit
|
|||
TEST_F(CommandStreamReceiverTest, makeResidentPushesAllocationToMemoryManagerResidencyList) {
|
||||
auto *memoryManager = commandStreamReceiver->getMemoryManager();
|
||||
|
||||
GraphicsAllocation *graphicsAllocation = memoryManager->allocateGraphicsMemory(0x1000);
|
||||
GraphicsAllocation *graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
ASSERT_NE(nullptr, graphicsAllocation);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/helpers/dispatch_info.h"
|
||||
#include "runtime/os_interface/os_context.h"
|
||||
#include "unit_tests/mocks/mock_allocation_properties.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
|
@ -150,7 +151,7 @@ HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAub
|
|||
}
|
||||
|
||||
HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAubDumpWhenFlushIsCalledThenBaseCsrFlushStampIsReturned) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
|
@ -177,7 +178,7 @@ HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAub
|
|||
}
|
||||
|
||||
HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAubDumpWhenMakeResidentIsCalledThenBaseCsrMakeResidentIsCalled) {
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, gfxAllocation);
|
||||
|
||||
csrWithAubDump->makeResident(*gfxAllocation);
|
||||
|
@ -194,12 +195,12 @@ HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAub
|
|||
}
|
||||
|
||||
HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAubDumpWhenFlushIsCalledThenBothBaseAndAubCsrProcessResidencyIsCalled) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, gfxAllocation);
|
||||
ResidencyContainer allocationsForResidency = {gfxAllocation};
|
||||
|
||||
|
@ -219,7 +220,7 @@ HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAub
|
|||
}
|
||||
|
||||
HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAubDumpWhenMakeNonResidentIsCalledThenBothBaseAndAubCsrMakeNonResidentIsCalled) {
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, gfxAllocation);
|
||||
csrWithAubDump->makeResident(*gfxAllocation);
|
||||
|
||||
|
|
|
@ -247,9 +247,9 @@ HWTEST_F(MockExperimentalCommandBufferTest, givenEnabledExperimentalCmdBufferWhe
|
|||
MemoryManager *memoryManager = commandStreamReceiver.getMemoryManager();
|
||||
|
||||
//Make two allocations, since CSR will try to reuse it also
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(3 * MemoryConstants::pageSize);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{3 * MemoryConstants::pageSize});
|
||||
storage->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION);
|
||||
allocation = memoryManager->allocateGraphicsMemory(3 * MemoryConstants::pageSize);
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{3 * MemoryConstants::pageSize});
|
||||
storage->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION);
|
||||
|
||||
MockExperimentalCommandBuffer *mockExCmdBuffer = static_cast<MockExperimentalCommandBuffer *>(commandStreamReceiver.experimentalCmdBuffer.get());
|
||||
|
|
|
@ -167,7 +167,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentIsC
|
|||
TbxMemoryManager *memoryManager = tbxCsr->getMemoryManager();
|
||||
ASSERT_NE(nullptr, memoryManager);
|
||||
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemory(4096);
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, graphicsAllocation);
|
||||
|
||||
EXPECT_EQ(0u, tbxCsr->getResidencyAllocations().size());
|
||||
|
@ -184,7 +184,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentHas
|
|||
TbxMemoryManager *memoryManager = tbxCsr->getMemoryManager();
|
||||
ASSERT_NE(nullptr, memoryManager);
|
||||
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemory(4096);
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, graphicsAllocation);
|
||||
|
||||
EXPECT_EQ(0u, tbxCsr->getResidencyAllocations().size());
|
||||
|
@ -205,7 +205,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenWriteMemoryIsCa
|
|||
TbxMemoryManager *memoryManager = tbxCsr->getMemoryManager();
|
||||
ASSERT_NE(nullptr, memoryManager);
|
||||
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemory(4096);
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, graphicsAllocation);
|
||||
|
||||
EXPECT_TRUE(tbxCsr->writeMemory(*graphicsAllocation));
|
||||
|
@ -225,7 +225,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenProcessResidenc
|
|||
TbxMemoryManager *memoryManager = tbxCsr->getMemoryManager();
|
||||
ASSERT_NE(nullptr, memoryManager);
|
||||
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemory(4096);
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, graphicsAllocation);
|
||||
|
||||
EXPECT_FALSE(graphicsAllocation->isResident(tbxCsr->getOsContext().getContextId()));
|
||||
|
@ -244,7 +244,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenProcessResidenc
|
|||
TbxMemoryManager *memoryManager = tbxCsr->getMemoryManager();
|
||||
ASSERT_NE(nullptr, memoryManager);
|
||||
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemory(4096);
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, graphicsAllocation);
|
||||
|
||||
EXPECT_FALSE(graphicsAllocation->isResident(tbxCsr->getOsContext().getContextId()));
|
||||
|
@ -263,10 +263,10 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledTh
|
|||
TbxMemoryManager *memoryManager = tbxCsr->getMemoryManager();
|
||||
ASSERT_NE(nullptr, memoryManager);
|
||||
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, graphicsAllocation);
|
||||
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
|
||||
LinearStream cs(commandBuffer);
|
||||
|
|
|
@ -912,7 +912,7 @@ TEST_F(EventTests, waitForEventsDestroysTemporaryAllocations) {
|
|||
|
||||
EXPECT_TRUE(csr.getTemporaryAllocations().peekIsEmpty());
|
||||
|
||||
GraphicsAllocation *temporaryAllocation = memoryManager->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
GraphicsAllocation *temporaryAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
csr.getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(temporaryAllocation), TEMPORARY_ALLOCATION);
|
||||
|
||||
EXPECT_EQ(temporaryAllocation, csr.getTemporaryAllocations().peekHead());
|
||||
|
|
|
@ -110,7 +110,7 @@ HWTEST_P(ParentKernelEnqueueTest, GivenParentKernelWithPrivateSurfaceWhenEnqueue
|
|||
int32_t executionStamp = 0;
|
||||
auto mockCSR = new MockCsr<FamilyType>(executionStamp, *pDevice->executionEnvironment);
|
||||
pDevice->resetCommandStreamReceiver(mockCSR);
|
||||
GraphicsAllocation *privateSurface = mockCSR->getMemoryManager()->allocateGraphicsMemory(10);
|
||||
GraphicsAllocation *privateSurface = mockCSR->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
pKernel->getProgram()->getBlockKernelManager()->pushPrivateSurface(privateSurface, 0);
|
||||
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, gws, 0, nullptr, nullptr);
|
||||
|
@ -128,7 +128,7 @@ HWTEST_P(ParentKernelEnqueueTest, GivenBlocksWithPrivateMemoryWhenEnqueueKernelT
|
|||
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
csr.storeMakeResidentAllocations = true;
|
||||
|
||||
auto privateAllocation = csr.getMemoryManager()->allocateGraphicsMemory(10);
|
||||
auto privateAllocation = csr.getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
blockKernelManager->pushPrivateSurface(privateAllocation, 0);
|
||||
|
||||
UserEvent uEvent(pContext);
|
||||
|
|
|
@ -93,7 +93,7 @@ struct Gen10CoherencyProgramingTest : public Gen10CoherencyRequirements {
|
|||
void flushTask(bool coherencyRequired) {
|
||||
flags.requiresCoherency = coherencyRequired;
|
||||
|
||||
auto graphicAlloc = csr->getMemoryManager()->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
auto graphicAlloc = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
IndirectHeap stream(graphicAlloc);
|
||||
|
||||
startOffset = csr->commandStream.getUsed();
|
||||
|
|
|
@ -199,7 +199,7 @@ HWTEST_F(KernelCommandsTest, givenSendCrossThreadDataWhenWhenAddPatchInfoComment
|
|||
}
|
||||
|
||||
HWTEST_F(KernelCommandsTest, givenIndirectHeapNotAllocatedFromInternalPoolWhenSendCrossThreadDataIsCalledThenOffsetZeroIsReturned) {
|
||||
auto nonInternalAllocation = pDevice->getMemoryManager()->allocateGraphicsMemory(4096);
|
||||
auto nonInternalAllocation = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
IndirectHeap indirectHeap(nonInternalAllocation, false);
|
||||
|
||||
MockKernelWithInternals mockKernelWithInternal(*pDevice);
|
||||
|
|
|
@ -184,7 +184,7 @@ HWTEST_F(KernelImageArgTest, givenImgWithMcsAllocWhenMakeResidentThenMakeMcsAllo
|
|||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat);
|
||||
auto img = Image::create(context.get(), 0, surfaceFormat, &imgDesc, nullptr, retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemory(4096);
|
||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
img->setMcsAllocation(mcsAlloc);
|
||||
cl_mem memObj = img;
|
||||
pKernel->setArg(0, sizeof(memObj), &memObj);
|
||||
|
|
|
@ -1965,12 +1965,12 @@ TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithGlobalMemoryWh
|
|||
MockParentKernel *parentKernel = MockParentKernel::create(context, false, true, false);
|
||||
|
||||
// graphicsMemory is released by Program
|
||||
GraphicsAllocation *globalMemory = pDevice->getMemoryManager()->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *globalMemory = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
parentKernel->mockProgram->setGlobalSurface(globalMemory);
|
||||
|
||||
// Allocte reflectionSurface, 2 * 4096 should be enough
|
||||
GraphicsAllocation *reflectionSurface = pDevice->getMemoryManager()->allocateGraphicsMemory(2 * 4096);
|
||||
GraphicsAllocation *reflectionSurface = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{2 * MemoryConstants::pageSize});
|
||||
parentKernel->setReflectionSurface(reflectionSurface);
|
||||
|
||||
memset(reflectionSurface->getUnderlyingBuffer(), 0, reflectionSurface->getUnderlyingBufferSize());
|
||||
|
@ -2004,7 +2004,7 @@ TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithGlobalMemoryAn
|
|||
}
|
||||
|
||||
// Allocte reflectionSurface, 2 * 4096 should be enough
|
||||
GraphicsAllocation *reflectionSurface = pDevice->getMemoryManager()->allocateGraphicsMemory(2 * 4096);
|
||||
GraphicsAllocation *reflectionSurface = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{2 * MemoryConstants::pageSize});
|
||||
parentKernel->setReflectionSurface(reflectionSurface);
|
||||
|
||||
memset(reflectionSurface->getUnderlyingBuffer(), 0, reflectionSurface->getUnderlyingBufferSize());
|
||||
|
@ -2032,12 +2032,12 @@ TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithConstantMemory
|
|||
MockParentKernel *parentKernel = MockParentKernel::create(context, false, false, true);
|
||||
|
||||
// graphicsMemory is released by Program
|
||||
GraphicsAllocation *constantMemory = pDevice->getMemoryManager()->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *constantMemory = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
parentKernel->mockProgram->setConstantSurface(constantMemory);
|
||||
|
||||
// Allocte reflectionSurface, 2 * 4096 should be enough
|
||||
GraphicsAllocation *reflectionSurface = pDevice->getMemoryManager()->allocateGraphicsMemory(2 * 4096);
|
||||
GraphicsAllocation *reflectionSurface = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{2 * MemoryConstants::pageSize});
|
||||
parentKernel->setReflectionSurface(reflectionSurface);
|
||||
|
||||
memset(reflectionSurface->getUnderlyingBuffer(), 0, reflectionSurface->getUnderlyingBufferSize());
|
||||
|
@ -2080,7 +2080,7 @@ TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithConstantMemory
|
|||
}
|
||||
|
||||
// Allocte reflectionSurface, 2 * 4096 should be enough
|
||||
GraphicsAllocation *reflectionSurface = pDevice->getMemoryManager()->allocateGraphicsMemory(2 * 4096);
|
||||
GraphicsAllocation *reflectionSurface = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{2 * MemoryConstants::pageSize});
|
||||
parentKernel->setReflectionSurface(reflectionSurface);
|
||||
|
||||
memset(reflectionSurface->getUnderlyingBuffer(), 0, reflectionSurface->getUnderlyingBufferSize());
|
||||
|
|
|
@ -1656,7 +1656,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenMakeResidentIsCalledThenKernelIsaIs
|
|||
commandStreamReceiver.storeMakeResidentAllocations = true;
|
||||
|
||||
auto memoryManager = commandStreamReceiver.getMemoryManager();
|
||||
pKernelInfo->kernelAllocation = memoryManager->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
pKernelInfo->kernelAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
// setup kernel arg offsets
|
||||
KernelArgPatchInfo kernelArgPatchInfo;
|
||||
|
|
|
@ -1027,7 +1027,7 @@ TEST(SharedBuffersTest, whenBuffersIsCreatedWithSharingHandlerThenItIsSharedBuff
|
|||
MockContext context;
|
||||
auto memoryManager = context.getDevice(0)->getMemoryManager();
|
||||
auto handler = new SharingHandler();
|
||||
auto graphicsAlloaction = memoryManager->allocateGraphicsMemory(4096);
|
||||
auto graphicsAlloaction = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto buffer = Buffer::createSharedBuffer(&context, CL_MEM_READ_ONLY, handler, graphicsAlloaction);
|
||||
ASSERT_NE(nullptr, buffer);
|
||||
EXPECT_EQ(handler, buffer->peekSharingHandler());
|
||||
|
|
|
@ -403,7 +403,7 @@ HWTEST_F(ImageSetArgTest, clSetKernelArgImage1Darray) {
|
|||
HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithoutUnifiedAuxCapabilityThenProgramAuxFieldsForMultisamples) {
|
||||
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
||||
McsSurfaceInfo msi = {10, 20, 3};
|
||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemory(4096);
|
||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
mcsAlloc->gmm = new Gmm(nullptr, 1, false);
|
||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||
imgDesc.num_samples = 8;
|
||||
|
@ -502,7 +502,7 @@ HWTEST_F(ImageSetArgTest, givenMultisampledR32Floatx8x24DepthStencilFormatWhenSe
|
|||
HWTEST_F(ImageSetArgTest, givenMcsAllocationAndRenderCompressionWhenSetArgOnMultisampledImgIsCalledThenProgramAuxFieldsWithMcsParams) {
|
||||
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
||||
McsSurfaceInfo msi = {10, 20, 3};
|
||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemory(4096);
|
||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
mcsAlloc->gmm = new Gmm(nullptr, 1, false);
|
||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||
imgDesc.num_samples = 8;
|
||||
|
@ -563,7 +563,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithUnifiedAuxCapa
|
|||
using AUXILIARY_SURFACE_MODE = typename RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE;
|
||||
|
||||
McsSurfaceInfo msi = {10, 20, 3};
|
||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemory(4096);
|
||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
mcsAlloc->gmm = new Gmm(nullptr, 1, false);
|
||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||
imgDesc.num_samples = 8;
|
||||
|
|
|
@ -36,7 +36,7 @@ class MemObjDestructionTest : public ::testing::TestWithParam<bool> {
|
|||
device.reset(MockDevice::create<MockDevice>(*platformDevices, executionEnvironment.get(), 0));
|
||||
context.reset(new MockContext(device.get()));
|
||||
|
||||
allocation = memoryManager->allocateGraphicsMemory(size);
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{size});
|
||||
memObj = new MemObj(context.get(), CL_MEM_OBJECT_BUFFER,
|
||||
CL_MEM_READ_WRITE,
|
||||
size,
|
||||
|
@ -190,7 +190,7 @@ HWTEST_P(MemObjAsyncDestructionTest, givenUsedMemObjWithAsyncDestructionsEnabled
|
|||
|
||||
if (!hasAllocatedMappedPtr) {
|
||||
delete memObj;
|
||||
allocation = memoryManager->allocateGraphicsMemory(size);
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{size});
|
||||
MemObjOffsetArray origin = {{0, 0, 0}};
|
||||
MemObjSizeArray region = {{1, 1, 1}};
|
||||
cl_map_flags mapFlags = CL_MAP_READ;
|
||||
|
|
|
@ -149,7 +149,7 @@ TEST(MemObj, givenNotReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThe
|
|||
|
||||
context.setMemoryManager(&memoryManager);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->updateTaskCount(2, context.getDevice(0)->getDefaultEngine().osContext->getContextId());
|
||||
*(memoryManager.getDefaultCommandStreamReceiver(0)->getTagAddress()) = 1;
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR,
|
||||
|
@ -168,7 +168,7 @@ TEST(MemObj, givenReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThenAl
|
|||
MockContext context(device.get());
|
||||
auto memoryManager = executionEnvironment.memoryManager.get();
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->updateTaskCount(1, device->getDefaultEngine().osContext->getContextId());
|
||||
*device->getDefaultEngine().commandStreamReceiver->getTagAddress() = 1;
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR,
|
||||
|
@ -187,7 +187,7 @@ TEST(MemObj, givenNotUsedGraphicsAllocationWhenMemObjDestroysAllocationAsyncThen
|
|||
|
||||
context.setMemoryManager(&memoryManager);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
|
@ -204,7 +204,7 @@ TEST(MemObj, givenMemoryManagerWithoutDeviceWhenMemObjDestroysAllocationAsyncThe
|
|||
|
||||
context.setMemoryManager(&memoryManager);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
@ -292,7 +292,7 @@ TEST(MemObj, givenRenderCompressedGmmWhenAskingForMappingOnCpuThenDisallow) {
|
|||
|
||||
context.setMemoryManager(&memoryManager);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(1);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->gmm = new Gmm(nullptr, 1, false);
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_READ_WRITE,
|
||||
|
@ -310,7 +310,7 @@ TEST(MemObj, givenDefaultWhenAskedForCpuMappingThenReturnTrue) {
|
|||
|
||||
context.setMemoryManager(&memoryManager);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(64);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR,
|
||||
64, allocation->getUnderlyingBuffer(), nullptr, allocation, true, false, false);
|
||||
|
@ -326,7 +326,7 @@ TEST(MemObj, givenNonCpuAccessibleMemoryWhenAskingForMappingOnCpuThenDisallow) {
|
|||
|
||||
context.setMemoryManager(&memoryManager);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(1);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->gmm = new Gmm(nullptr, 1, false);
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_READ_WRITE,
|
||||
|
@ -343,7 +343,7 @@ TEST(MemObj, givenMultipleMemObjectsWithReusedGraphicsAllocationWhenDestroyedThe
|
|||
MockContext context;
|
||||
context.setMemoryManager(&memoryManager);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(1);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
std::unique_ptr<MemObj> memObj1(new MemObj(&context, CL_MEM_OBJECT_BUFFER, 0, 1, nullptr, nullptr, allocation, true, false, false));
|
||||
memObj1->setSharingHandler(new MySharingHandler(allocation));
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "runtime/memory_manager/deferrable_allocation_deletion.h"
|
||||
#include "runtime/os_interface/os_context.h"
|
||||
|
||||
#include "unit_tests/mocks/mock_allocation_properties.h"
|
||||
#include "unit_tests/mocks/mock_memory_manager.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
@ -56,7 +57,7 @@ struct DeferrableAllocationDeletionTest : ::testing::Test {
|
|||
|
||||
TEST_F(DeferrableAllocationDeletionTest, givenDeferrableAllocationWhenApplyThenWaitForEachTaskCount) {
|
||||
EXPECT_EQ(gpgpuEngineInstances.size(), memoryManager->getOsContextCount());
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->updateTaskCount(1u, device1ContextId);
|
||||
*hwTag = 0u;
|
||||
asyncDeleter->deferDeletion(new DeferrableAllocationDeletion(*memoryManager, *allocation));
|
||||
|
@ -79,7 +80,7 @@ TEST_F(DeferrableAllocationDeletionTest, givenAllocationUsedByTwoOsContextsWhenA
|
|||
std::unique_ptr<Device> device2(Device::create<Device>(nullptr, device1->getExecutionEnvironment(), 1u));
|
||||
auto device2ContextId = device2->getDefaultEngine().osContext->getContextId();
|
||||
EXPECT_EQ(gpgpuEngineInstances.size() * 2, memoryManager->getOsContextCount());
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
*hwTag = 0u;
|
||||
*device2->getDefaultEngine().commandStreamReceiver->getTagAddress() = 1u;
|
||||
allocation->updateTaskCount(1u, device1ContextId);
|
||||
|
@ -96,7 +97,7 @@ TEST_F(DeferrableAllocationDeletionTest, givenAllocationUsedByTwoOsContextsWhenA
|
|||
}
|
||||
TEST_F(DeferrableAllocationDeletionTest, givenNotUsedAllocationWhenApplyDeletionThenDontWait) {
|
||||
EXPECT_EQ(gpgpuEngineInstances.size(), memoryManager->getOsContextCount());
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
EXPECT_FALSE(allocation->isUsed());
|
||||
EXPECT_EQ(0u, memoryManager->freeGraphicsMemoryCalled);
|
||||
while (!asyncDeleter->doWorkInBackground)
|
||||
|
@ -111,8 +112,8 @@ TEST_F(DeferrableAllocationDeletionTest, givenNotUsedAllocationWhenApplyDeletion
|
|||
}
|
||||
|
||||
TEST_F(DeferrableAllocationDeletionTest, givenTwoAllocationsUsedByOneOsContextsEnqueuedToAsyncDeleterWhenOneAllocationIsCompletedThenReleaseThatAllocation) {
|
||||
auto allocation1 = memoryManager->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
auto allocation2 = memoryManager->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
auto allocation1 = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto allocation2 = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
*hwTag = 1u;
|
||||
allocation1->updateTaskCount(2u, device1ContextId);
|
||||
allocation2->updateTaskCount(1u, device1ContextId);
|
||||
|
@ -129,7 +130,7 @@ TEST_F(DeferrableAllocationDeletionTest, givenTwoAllocationsUsedByOneOsContextsE
|
|||
}
|
||||
|
||||
TEST_F(DeferrableAllocationDeletionTest, givenNotCompletedAllocationWhenDeletionIsAppliedThenReturnFalse) {
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
*hwTag = 0u;
|
||||
allocation->updateTaskCount(1u, device1ContextId);
|
||||
EXPECT_EQ(0u, memoryManager->freeGraphicsMemoryCalled);
|
||||
|
@ -142,7 +143,7 @@ TEST_F(DeferrableAllocationDeletionTest, givenNotCompletedAllocationWhenDeletion
|
|||
}
|
||||
|
||||
TEST_F(DeferrableAllocationDeletionTest, givenNotUsedAllocationWhenDeletionIsAppliedThenReturnTrue) {
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
EXPECT_FALSE(allocation->isUsed());
|
||||
DeferrableAllocationDeletion deletion{*memoryManager, *allocation};
|
||||
EXPECT_TRUE(deletion.apply());
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "runtime/os_interface/os_context.h"
|
||||
#include "unit_tests/fixtures/memory_allocator_fixture.h"
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/mocks/mock_allocation_properties.h"
|
||||
#include "unit_tests/utilities/containers_tests_helpers.h"
|
||||
#include "test.h"
|
||||
|
||||
|
@ -134,9 +135,9 @@ TEST_F(InternalAllocationStorageTest, whenObtainAllocationFromMidlleOfReusableLi
|
|||
auto &reusableAllocations = csr->getAllocationsForReuse();
|
||||
EXPECT_TRUE(reusableAllocations.peekIsEmpty());
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(1);
|
||||
auto allocation2 = memoryManager->allocateGraphicsMemory(10000);
|
||||
auto allocation3 = memoryManager->allocateGraphicsMemory(1);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{1});
|
||||
auto allocation2 = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{10000});
|
||||
auto allocation3 = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{1});
|
||||
|
||||
EXPECT_TRUE(reusableAllocations.peekIsEmpty());
|
||||
EXPECT_EQ(nullptr, allocation2->next);
|
||||
|
@ -187,7 +188,7 @@ TEST_F(InternalAllocationStorageTest, whenObtainAllocationFromMidlleOfReusableLi
|
|||
TEST_F(InternalAllocationStorageTest, givenNonInternalAllocationWhenItIsPutOnReusableListWhenInternalAllocationIsRequestedThenNullIsReturned) {
|
||||
EXPECT_TRUE(csr->getAllocationsForReuse().peekIsEmpty());
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(4096);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
storage->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION);
|
||||
|
||||
EXPECT_FALSE(csr->getAllocationsForReuse().peekIsEmpty());
|
||||
|
@ -199,7 +200,7 @@ TEST_F(InternalAllocationStorageTest, givenNonInternalAllocationWhenItIsPutOnReu
|
|||
TEST_F(InternalAllocationStorageTest, givenInternalAllocationWhenItIsPutOnReusableListWhenNonInternalAllocationIsRequestedThenNullIsReturned) {
|
||||
EXPECT_TRUE(csr->getAllocationsForReuse().peekIsEmpty());
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(4096);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->is32BitAllocation = true;
|
||||
|
||||
storage->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION);
|
||||
|
@ -213,7 +214,7 @@ TEST_F(InternalAllocationStorageTest, givenInternalAllocationWhenItIsPutOnReusab
|
|||
TEST_F(InternalAllocationStorageTest, givenInternalAllocationWhenItIsPutOnReusableListWhenInternalAllocationIsRequestedThenItIsReturned) {
|
||||
EXPECT_TRUE(csr->getAllocationsForReuse().peekIsEmpty());
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(4096);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->is32BitAllocation = true;
|
||||
|
||||
storage->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "unit_tests/mocks/mock_allocation_properties.h"
|
||||
#include "unit_tests/mocks/mock_memory_manager.h"
|
||||
|
||||
#include "test.h"
|
||||
|
@ -21,8 +22,8 @@ class MemoryManagerGetAlloctionDataTest : public testing::TestWithParam<Graphics
|
|||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenHostMemoryAllocationTypeAndAllocateMemoryFlagAndNullptrWhenAllocationDataIsQueriedThenCorrectFlagsAndSizeAreSet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr);
|
||||
|
||||
EXPECT_TRUE(allocData.flags.mustBeZeroCopy);
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
|
@ -32,9 +33,9 @@ TEST(MemoryManagerGetAlloctionDataTest, givenHostMemoryAllocationTypeAndAllocate
|
|||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenNonHostMemoryAllocatoinTypeWhenAllocationDataIsQueriedThenMustBeZeroCopyAndUseSystemMemoryFlagsAreNotSet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10);
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr);
|
||||
|
||||
EXPECT_FALSE(allocData.flags.mustBeZeroCopy);
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
|
@ -45,9 +46,9 @@ TEST(MemoryManagerGetAlloctionDataTest, givenNonHostMemoryAllocatoinTypeWhenAllo
|
|||
TEST(MemoryManagerGetAlloctionDataTest, givenAllocateMemoryFlagTrueWhenHostPtrIsNotNullThenAllocationDataHasHostPtrNulled) {
|
||||
AllocationData allocData;
|
||||
char memory = 0;
|
||||
AllocationProperties properties(true, sizeof(memory));
|
||||
AllocationProperties properties(true, sizeof(memory), GraphicsAllocation::AllocationType::BUFFER);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, &memory, GraphicsAllocation::AllocationType::BUFFER);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, &memory);
|
||||
|
||||
EXPECT_EQ(sizeof(memory), allocData.size);
|
||||
EXPECT_EQ(nullptr, allocData.hostPtr);
|
||||
|
@ -55,44 +56,44 @@ TEST(MemoryManagerGetAlloctionDataTest, givenAllocateMemoryFlagTrueWhenHostPtrIs
|
|||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenBufferTypeWhenAllocationDataIsQueriedThenForcePinFlagIsSet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10);
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr);
|
||||
|
||||
EXPECT_TRUE(allocData.flags.forcePin);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenBufferHostMemoryTypeWhenAllocationDataIsQueriedThenForcePinFlagIsSet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10);
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr);
|
||||
|
||||
EXPECT_TRUE(allocData.flags.forcePin);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenBufferCompressedTypeWhenAllocationDataIsQueriedThenForcePinFlagIsSet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10);
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr);
|
||||
|
||||
EXPECT_TRUE(allocData.flags.forcePin);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenDefaultAllocationFlagsWhenAllocationDataIsQueriedThenAllocateMemoryIsFalse) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties;
|
||||
AllocationProperties properties(false, 0, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
|
||||
char memory;
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, &memory, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, &memory);
|
||||
|
||||
EXPECT_FALSE(allocData.flags.allocateMemory);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenSpecificDeviceWhenAllocationDataIsQueriedThenDeviceIsPropagatedToAllocationData) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 0);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 3u, nullptr, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
|
||||
AllocationProperties properties(true, 0, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 3u, nullptr);
|
||||
|
||||
EXPECT_EQ(3u, allocData.devicesBitfield);
|
||||
}
|
||||
|
@ -101,10 +102,10 @@ typedef MemoryManagerGetAlloctionDataTest MemoryManagerGetAlloctionData32BitAnd6
|
|||
|
||||
TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesAllowedTest, givenAllocationTypesWith32BitAnd64kbPagesAllowedWhenAllocationDataIsQueriedThenProperFlagsAreSet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 0);
|
||||
|
||||
auto allocType = GetParam();
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, allocType);
|
||||
AllocationProperties properties(true, 0, allocType);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr);
|
||||
|
||||
EXPECT_TRUE(allocData.flags.allow32Bit);
|
||||
EXPECT_TRUE(allocData.flags.allow64kbPages);
|
||||
|
@ -114,9 +115,9 @@ TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesAllowedTest, givenAllocatio
|
|||
TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesAllowedTest, given64kbAllowedAllocationTypeWhenAllocatingThenPreferRenderCompressionOnlyForSpecificTypes) {
|
||||
auto allocType = GetParam();
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10);
|
||||
AllocationProperties properties(true, 10, allocType);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, allocType);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr);
|
||||
bool bufferCompressedType = (allocType == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
|
||||
EXPECT_TRUE(allocData.flags.allow64kbPages);
|
||||
MockMemoryManager mockMemoryManager(true);
|
||||
|
@ -132,10 +133,10 @@ typedef MemoryManagerGetAlloctionDataTest MemoryManagerGetAlloctionData32BitAnd6
|
|||
|
||||
TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesNotAllowedTest, givenAllocationTypesWith32BitAnd64kbPagesDisallowedWhenAllocationDataIsQueriedThenFlagsAreNotSet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 0);
|
||||
|
||||
auto allocType = GetParam();
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, allocType);
|
||||
AllocationProperties properties(true, 0, allocType);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr);
|
||||
|
||||
EXPECT_FALSE(allocData.flags.allow32Bit);
|
||||
EXPECT_FALSE(allocData.flags.allow64kbPages);
|
||||
|
@ -173,9 +174,9 @@ TEST(MemoryManagerTest, givenForced32BitSetWhenGraphicsMemoryFor32BitAllowedType
|
|||
memoryManager.setForce32BitAllocations(true);
|
||||
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10);
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(allocData);
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
@ -196,9 +197,9 @@ TEST(MemoryManagerTest, givenForced32BitEnabledWhenGraphicsMemoryWihtoutAllow32B
|
|||
memoryManager.setForce32BitAllocations(true);
|
||||
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10);
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr);
|
||||
allocData.flags.allow32Bit = false;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(allocData);
|
||||
|
@ -214,9 +215,9 @@ TEST(MemoryManagerTest, givenForced32BitDisabledWhenGraphicsMemoryWith32BitFlagF
|
|||
memoryManager.setForce32BitAllocations(false);
|
||||
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10);
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(allocData);
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
@ -229,9 +230,9 @@ TEST(MemoryManagerTest, givenEnabled64kbPagesWhenGraphicsMemoryMustBeHostMemoryA
|
|||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(true, false, executionEnvironment);
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10);
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(allocData);
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
@ -246,9 +247,9 @@ TEST(MemoryManagerTest, givenEnabled64kbPagesWhenGraphicsMemoryMustBeHostMemoryA
|
|||
TEST(MemoryManagerTest, givenEnabled64kbPagesWhenGraphicsMemoryWithoutAllow64kbPagesFlagsIsAllocatedThenNon64kbAllocationIsReturned) {
|
||||
MockMemoryManager memoryManager(true);
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10);
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr);
|
||||
allocData.flags.allow64kbPages = false;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(allocData);
|
||||
|
@ -262,9 +263,9 @@ TEST(MemoryManagerTest, givenEnabled64kbPagesWhenGraphicsMemoryWithoutAllow64kbP
|
|||
TEST(MemoryManagerTest, givenDisabled64kbPagesWhenGraphicsMemoryMustBeHostMemoryAndIsAllocatedWithNullptrForBufferThenNon64kbAllocationIsReturned) {
|
||||
MockMemoryManager memoryManager(false);
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10);
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(allocData);
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
@ -281,9 +282,9 @@ TEST(MemoryManagerTest, givenForced32BitAndEnabled64kbPagesWhenGraphicsMemoryMus
|
|||
memoryManager.setForce32BitAllocations(true);
|
||||
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10);
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(allocData);
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
@ -300,10 +301,10 @@ TEST(MemoryManagerTest, givenEnabled64kbPagesWhenGraphicsMemoryIsAllocatedWithHo
|
|||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(true, false, executionEnvironment);
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(false, 1);
|
||||
AllocationProperties properties(false, 1, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
|
||||
char memory[1];
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, &memory, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, &memory);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(allocData);
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
@ -318,7 +319,7 @@ TEST(MemoryManagerTest, givenMemoryManagerWhenGraphicsMemoryAllocationInDevicePo
|
|||
|
||||
memoryManager.failInDevicePool = true;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryInPreferredPool(AllocationProperties(true, MemoryConstants::pageSize), 0, nullptr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_TRUE(memoryManager.allocationCreated);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, allocation->getMemoryPool());
|
||||
|
@ -329,7 +330,7 @@ TEST(MemoryManagerTest, givenMemoryManagerWhenGraphicsMemoryAllocationInDevicePo
|
|||
TEST(MemoryManagerTest, givenMemoryManagerWhenBufferTypeIsPassedThenAllocateGraphicsMemoryInPreferredPoolCanAllocateInDevicePool) {
|
||||
MockMemoryManager memoryManager(false);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryInPreferredPool(AllocationProperties(true, MemoryConstants::pageSize), 0, nullptr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
memoryManager.freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
@ -339,7 +340,7 @@ TEST(MemoryManagerTest, givenMemoryManagerWhenBufferTypeIsPassedAndAllocateInDev
|
|||
|
||||
memoryManager.failInDevicePoolWithError = true;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryInPreferredPool(AllocationProperties(true, MemoryConstants::pageSize), 0, nullptr, GraphicsAllocation::AllocationType::BUFFER);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
ASSERT_EQ(nullptr, allocation);
|
||||
EXPECT_FALSE(memoryManager.allocationInDevicePoolCreated);
|
||||
|
||||
|
@ -347,10 +348,26 @@ TEST(MemoryManagerTest, givenMemoryManagerWhenBufferTypeIsPassedAndAllocateInDev
|
|||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenSvmAllocationTypeWhenGetAllocationDataIsCalledThenZeroCopyIsRequested) {
|
||||
MockMemoryManager memoryManager(false);
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 1);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, 0, nullptr, GraphicsAllocation::AllocationType::SVM);
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::SVM}, 0, nullptr);
|
||||
EXPECT_TRUE(allocData.flags.mustBeZeroCopy);
|
||||
EXPECT_TRUE(allocData.flags.allocateMemory);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenUndecidedTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::UNDECIDED}, 0, nullptr);
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenFillPatternTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::FILL_PATTERN}, 0, nullptr);
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenLinearStreamTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::LINEAR_STREAM}, 0, nullptr);
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ TEST_F(MemoryAllocatorTest, allocateGraphics) {
|
|||
unsigned int alignment = 4096;
|
||||
|
||||
memoryManager->createAndRegisterOsContext(gpgpuEngineInstances[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(sizeof(char));
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
// initial taskCount must be -1. if not, we may kill allocation before it will be used
|
||||
|
@ -215,7 +215,7 @@ TEST_F(MemoryAllocatorTest, allocateGraphics) {
|
|||
TEST_F(MemoryAllocatorTest, allocateGraphicsPageAligned) {
|
||||
unsigned int alignment = 4096;
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(sizeof(char));
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(0u, reinterpret_cast<uintptr_t>(allocation->getUnderlyingBuffer()) & (alignment - 1));
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
|
@ -573,7 +573,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerAndUnifiedAuxCapableAlloc
|
|||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
|
||||
auto gmm = new Gmm(nullptr, 123, false);
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(123);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->gmm = gmm;
|
||||
|
||||
auto mockGmmRes = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
|
@ -589,14 +589,7 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAllocateGraphicsMemoryIsCall
|
|||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
auto size = 4096u;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(size);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, allocation->getMemoryPool());
|
||||
memoryManager.freeGraphicsMemory(allocation);
|
||||
|
||||
AllocationProperties properties(true, size);
|
||||
properties.alignment = MemoryConstants::preferredAlignment;
|
||||
allocation = memoryManager.allocateGraphicsMemoryWithProperties(properties);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{size});
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, allocation->getMemoryPool());
|
||||
memoryManager.freeGraphicsMemory(allocation);
|
||||
|
@ -765,7 +758,7 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenCreateAllocationFromNtHandle
|
|||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenLockUnlockCalledThenReturnCpuPtr) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(1);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
||||
auto ptr = memoryManager.lockResource(allocation);
|
||||
|
@ -779,7 +772,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenGraphicsAllocationCon
|
|||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
|
||||
auto graphicsAllocation = memoryManager.allocateGraphicsMemory(4096u);
|
||||
auto graphicsAllocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto graphicsAddress = graphicsAllocation->getGpuAddress();
|
||||
auto graphicsAddressToPatch = graphicsAllocation->getGpuAddressToPatch();
|
||||
|
@ -798,7 +791,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenGraphicsAllocationCon
|
|||
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenGraphicsAllocationIsPaddedThenNewGraphicsAllocationIsCreated) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
auto graphicsAllocation = memoryManager.allocateGraphicsMemory(4096u);
|
||||
auto graphicsAllocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto sizeWithPadding = 8192;
|
||||
auto paddedGraphicsAllocation = memoryManager.createGraphicsAllocationWithPadding(graphicsAllocation, sizeWithPadding);
|
||||
|
@ -817,7 +810,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenGraphicsAllocationIsP
|
|||
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenTwoGraphicsAllocationArePaddedThenOnlyOnePaddingBufferIsUsed) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
auto graphicsAllocation = memoryManager.allocateGraphicsMemory(4096u);
|
||||
auto graphicsAllocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto sizeWithPadding = 8192;
|
||||
auto paddedGraphicsAllocation = memoryManager.createGraphicsAllocationWithPadding(graphicsAllocation, sizeWithPadding);
|
||||
|
@ -841,7 +834,7 @@ TEST(OsAgnosticMemoryManager, pleaseDetectLeak) {
|
|||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAllocateMemoryWithNoAlignmentProvidedThenAllocationIsAlignedToPageSize) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
AllocationProperties properties(true, MemoryConstants::pageSize >> 1);
|
||||
MockAllocationProperties properties(MemoryConstants::pageSize >> 1);
|
||||
properties.alignment = 0;
|
||||
auto ga = memoryManager.allocateGraphicsMemoryWithProperties(properties);
|
||||
uintptr_t ptr = reinterpret_cast<uintptr_t>(ga->getUnderlyingBuffer());
|
||||
|
@ -854,7 +847,7 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAllocateMemoryWithNoAlignmen
|
|||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAllocateMemoryWithAlignmentNotAlignedToPageSizeThenAlignmentIsAlignedUp) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
AllocationProperties properties(true, MemoryConstants::pageSize >> 1);
|
||||
MockAllocationProperties properties(MemoryConstants::pageSize >> 1);
|
||||
properties.alignment = MemoryConstants::pageSize - 1;
|
||||
auto ga = memoryManager.allocateGraphicsMemoryWithProperties(properties);
|
||||
uintptr_t ptr = reinterpret_cast<uintptr_t>(ga->getUnderlyingBuffer());
|
||||
|
@ -961,11 +954,11 @@ TEST(OsAgnosticMemoryManager, GivenEnabled64kbPagesWhenHostMemoryAllocationIsCre
|
|||
ExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(true, false, executionEnvironment);
|
||||
|
||||
GraphicsAllocation *galloc = memoryManager.allocateGraphicsMemoryInPreferredPool(AllocationProperties(true, 64 * 1024), 0, nullptr, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
GraphicsAllocation *galloc = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY});
|
||||
EXPECT_NE(nullptr, galloc);
|
||||
memoryManager.freeGraphicsMemory(galloc);
|
||||
|
||||
galloc = memoryManager.allocateGraphicsMemoryInPreferredPool(AllocationProperties(true, 64 * 1024), 0, nullptr, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
galloc = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY});
|
||||
EXPECT_NE(nullptr, galloc);
|
||||
EXPECT_NE(nullptr, galloc->getUnderlyingBuffer());
|
||||
EXPECT_EQ(0u, (uintptr_t)galloc->getUnderlyingBuffer() % MemoryConstants::pageSize64k);
|
||||
|
@ -1177,13 +1170,13 @@ TEST_F(MemoryManagerWithCsrTest, GivenAllocationsInHostPtrManagerReadyForCleanin
|
|||
}
|
||||
|
||||
TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasNotUsedWhencheckGpuUsageAndDestroyGraphicsAllocationsIsCalledThenItIsDestroyedInPlace) {
|
||||
auto notUsedAllocation = memoryManager->allocateGraphicsMemory(4096);
|
||||
auto notUsedAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
memoryManager->checkGpuUsageAndDestroyGraphicsAllocations(notUsedAllocation);
|
||||
EXPECT_TRUE(csr->getTemporaryAllocations().peekIsEmpty());
|
||||
}
|
||||
|
||||
TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsCompletedWhencheckGpuUsageAndDestroyGraphicsAllocationsIsCalledThenItIsDestroyedInPlace) {
|
||||
auto usedAllocationButGpuCompleted = memoryManager->allocateGraphicsMemory(4096);
|
||||
auto usedAllocationButGpuCompleted = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto tagAddress = csr->getTagAddress();
|
||||
ASSERT_NE(0u, *tagAddress);
|
||||
|
@ -1196,7 +1189,7 @@ TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsCompletedWhenche
|
|||
|
||||
TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsNotCompletedWhencheckGpuUsageAndDestroyGraphicsAllocationsIsCalledThenItIsAddedToTemporaryAllocationList) {
|
||||
memoryManager->createAndRegisterOsContext(gpgpuEngineInstances[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
auto usedAllocationAndNotGpuCompleted = memoryManager->allocateGraphicsMemory(4096);
|
||||
auto usedAllocationAndNotGpuCompleted = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto tagAddress = csr->getTagAddress();
|
||||
|
||||
|
@ -1368,7 +1361,7 @@ HWTEST_F(GraphicsAllocationTests, givenAllocationUsedByNonDefaultCsrWhenChecking
|
|||
defaultOsContext->getEngineType().type == nonDefaultOsContext->getEngineType().type);
|
||||
|
||||
auto memoryManager = device->getExecutionEnvironment()->memoryManager.get();
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemory(1);
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
nonDefaultCsr->taskCount = *nonDefaultCsr->getTagAddress() + 1;
|
||||
nonDefaultCsr->latestFlushedTaskCount = *nonDefaultCsr->getTagAddress() + 1;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
set(IGDRCL_SRCS_tests_mocks
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_32bitAllocator.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_allocation_properties.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_async_event_handler.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_async_event_handler.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_aub_center.h
|
||||
|
|
|
@ -36,6 +36,7 @@ int closeMock(int) {
|
|||
|
||||
class TestedDrmMemoryManager : public DrmMemoryManager {
|
||||
public:
|
||||
using DrmMemoryManager::allocateGraphicsMemory;
|
||||
using DrmMemoryManager::allocateGraphicsMemory64kb;
|
||||
using DrmMemoryManager::allocateGraphicsMemoryWithHostPtr;
|
||||
using DrmMemoryManager::AllocationData;
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
|
||||
namespace OCLRT {
|
||||
struct MockAllocationProperties : public AllocationProperties {
|
||||
public:
|
||||
using AllocationProperties::AllocationProperties;
|
||||
|
||||
MockAllocationProperties(size_t size) : AllocationProperties(size, GraphicsAllocation::AllocationType::UNDECIDED) {}
|
||||
MockAllocationProperties(bool allocateMemory, size_t size) : AllocationProperties(allocateMemory, size, GraphicsAllocation::AllocationType::UNDECIDED) {}
|
||||
};
|
||||
} // namespace OCLRT
|
|
@ -160,7 +160,7 @@ std::unique_ptr<AubExecutionEnvironment> getEnvironment(bool createTagAllocation
|
|||
|
||||
std::unique_ptr<AubExecutionEnvironment> aubExecutionEnvironment(new AubExecutionEnvironment);
|
||||
if (allocateCommandBuffer) {
|
||||
aubExecutionEnvironment->commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemory(4096);
|
||||
aubExecutionEnvironment->commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
}
|
||||
aubExecutionEnvironment->executionEnvironment = std::move(executionEnvironment);
|
||||
return aubExecutionEnvironment;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#pragma once
|
||||
#include "runtime/device/device.h"
|
||||
#include "unit_tests/libult/ult_command_stream_receiver.h"
|
||||
#include "unit_tests/mocks/mock_allocation_properties.h"
|
||||
|
||||
namespace OCLRT {
|
||||
class OSTime;
|
||||
|
@ -95,7 +96,7 @@ class MockDevice : public Device {
|
|||
void allocatePreemptionAllocationIfNotPresent() {
|
||||
if (this->preemptionAllocation == nullptr) {
|
||||
if (preemptionMode == PreemptionMode::MidThread || isSourceLevelDebuggerActive()) {
|
||||
AllocationProperties allocationProperties(true, hwInfo.capabilityTable.requiredPreemptionSurfaceSize);
|
||||
MockAllocationProperties allocationProperties(hwInfo.capabilityTable.requiredPreemptionSurfaceSize);
|
||||
allocationProperties.flags.uncacheable = getWaTable()->waCSRUncachable;
|
||||
allocationProperties.alignment = 256 * MemoryConstants::kiloByte;
|
||||
this->preemptionAllocation = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(allocationProperties);
|
||||
|
|
|
@ -621,7 +621,7 @@ TEST_F(DrmCommandStreamGemWorkerTests, givenDefaultDrmCSRWhenItIsCreatedThenGemC
|
|||
}
|
||||
|
||||
TEST_F(DrmCommandStreamGemWorkerTests, givenCommandStreamWhenItIsFlushedWithGemCloseWorkerInDefaultModeThenWorkerDecreasesTheRefCount) {
|
||||
auto commandBuffer = mm->allocateGraphicsMemory(static_cast<size_t>(1024));
|
||||
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
|
@ -654,11 +654,11 @@ TEST_F(DrmCommandStreamGemWorkerTests, givenTaskThatRequiresLargeResourceCountWh
|
|||
execStorage.resize(0);
|
||||
|
||||
for (auto id = 0; id < 10; id++) {
|
||||
auto graphicsAllocation = mm->allocateGraphicsMemory(1);
|
||||
auto graphicsAllocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
csr->makeResident(*graphicsAllocation);
|
||||
graphicsAllocations.push_back(graphicsAllocation);
|
||||
}
|
||||
auto commandBuffer = mm->allocateGraphicsMemory(1024);
|
||||
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
|
@ -676,7 +676,7 @@ TEST_F(DrmCommandStreamGemWorkerTests, givenTaskThatRequiresLargeResourceCountWh
|
|||
}
|
||||
|
||||
TEST_F(DrmCommandStreamGemWorkerTests, givenGemCloseWorkerInactiveModeWhenMakeResidentIsCalledThenRefCountsAreNotUpdated) {
|
||||
auto dummyAllocation = static_cast<DrmAllocation *>(mm->allocateGraphicsMemory(1024));
|
||||
auto dummyAllocation = static_cast<DrmAllocation *>(mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
|
||||
auto bo = dummyAllocation->getBO();
|
||||
EXPECT_EQ(1u, bo->getRefCount());
|
||||
|
@ -693,8 +693,8 @@ TEST_F(DrmCommandStreamGemWorkerTests, givenGemCloseWorkerInactiveModeWhenMakeRe
|
|||
}
|
||||
|
||||
TEST_F(DrmCommandStreamGemWorkerTests, GivenTwoAllocationsWhenBackingStorageIsDifferentThenMakeResidentShouldAddTwoLocations) {
|
||||
auto allocation = static_cast<DrmAllocation *>(mm->allocateGraphicsMemory(1024));
|
||||
auto allocation2 = static_cast<DrmAllocation *>(mm->allocateGraphicsMemory(1024));
|
||||
auto allocation = static_cast<DrmAllocation *>(mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
auto allocation2 = static_cast<DrmAllocation *>(mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
|
||||
csr->makeResident(*allocation);
|
||||
csr->makeResident(*allocation2);
|
||||
|
@ -723,8 +723,8 @@ TEST_F(DrmCommandStreamGemWorkerTests, GivenTwoAllocationsWhenBackingStorageIsDi
|
|||
}
|
||||
|
||||
TEST_F(DrmCommandStreamGemWorkerTests, givenCommandStreamWithDuplicatesWhenItIsFlushedWithGemCloseWorkerInactiveModeThenCsIsNotNulled) {
|
||||
auto commandBuffer = static_cast<DrmAllocation *>(mm->allocateGraphicsMemory(1024));
|
||||
auto dummyAllocation = static_cast<DrmAllocation *>(mm->allocateGraphicsMemory(1024));
|
||||
auto commandBuffer = static_cast<DrmAllocation *>(mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
auto dummyAllocation = static_cast<DrmAllocation *>(mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
ASSERT_EQ(0u, reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) & 0xFFF);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
@ -768,7 +768,7 @@ class DrmCommandStreamBatchingTests : public Test<DrmCommandStreamEnhancedFixtur
|
|||
DrmCommandStreamEnhancedFixture::SetUp();
|
||||
if (PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]) == PreemptionMode::MidThread) {
|
||||
tmpAllocation = GlobalMockSipProgram::sipProgram->getAllocation();
|
||||
GlobalMockSipProgram::sipProgram->resetAllocation(device->getMemoryManager()->allocateGraphicsMemory(1024));
|
||||
GlobalMockSipProgram::sipProgram->resetAllocation(device->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
}
|
||||
tagAllocation = static_cast<DrmAllocation *>(device->getDefaultEngine().commandStreamReceiver->getTagAllocation());
|
||||
preemptionAllocation = static_cast<DrmAllocation *>(device->getPreemptionAllocation());
|
||||
|
@ -784,8 +784,8 @@ class DrmCommandStreamBatchingTests : public Test<DrmCommandStreamEnhancedFixtur
|
|||
|
||||
TEST_F(DrmCommandStreamBatchingTests, givenCSRWhenFlushIsCalledThenProperFlagsArePassed) {
|
||||
mock->reset();
|
||||
auto commandBuffer = mm->allocateGraphicsMemory(1024);
|
||||
auto dummyAllocation = mm->allocateGraphicsMemory(1024);
|
||||
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto dummyAllocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
ASSERT_EQ(0u, reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) & 0xFFF);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
@ -819,8 +819,8 @@ TEST_F(DrmCommandStreamBatchingTests, givenCsrWhenDispatchPolicyIsSetToBatchingT
|
|||
auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
|
||||
tCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator);
|
||||
|
||||
auto commandBuffer = mm->allocateGraphicsMemory(1024);
|
||||
auto dummyAllocation = mm->allocateGraphicsMemory(1024);
|
||||
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto dummyAllocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
ASSERT_EQ(0u, reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) & 0xFFF);
|
||||
IndirectHeap cs(commandBuffer);
|
||||
|
@ -876,7 +876,7 @@ TEST_F(DrmCommandStreamBatchingTests, givenRecordedCommandBufferWhenItIsSubmitte
|
|||
auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
|
||||
tCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator);
|
||||
|
||||
auto commandBuffer = mm->allocateGraphicsMemory(1024);
|
||||
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
IndirectHeap cs(commandBuffer);
|
||||
|
||||
tCsr->setTagAllocation(tagAllocation);
|
||||
|
@ -1288,8 +1288,8 @@ TEST_F(DrmCommandStreamLeaksTest, Flush) {
|
|||
}
|
||||
|
||||
TEST_F(DrmCommandStreamLeaksTest, ClearResidencyWhenFlushNotCalled) {
|
||||
auto allocation1 = static_cast<DrmAllocation *>(mm->allocateGraphicsMemory(1024));
|
||||
auto allocation2 = static_cast<DrmAllocation *>(mm->allocateGraphicsMemory(1024));
|
||||
auto allocation1 = static_cast<DrmAllocation *>(mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
auto allocation2 = static_cast<DrmAllocation *>(mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
ASSERT_NE(nullptr, allocation1);
|
||||
ASSERT_NE(nullptr, allocation2);
|
||||
|
||||
|
@ -1335,9 +1335,9 @@ TEST_F(DrmCommandStreamLeaksTest, FlushMultipleTimes) {
|
|||
BatchBuffer batchBuffer2{cs.getGraphicsAllocation(), 8, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
csr->flush(batchBuffer2, csr->getResidencyAllocations());
|
||||
|
||||
auto allocation = mm->allocateGraphicsMemory(1024);
|
||||
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
auto allocation2 = mm->allocateGraphicsMemory(1024);
|
||||
auto allocation2 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, allocation2);
|
||||
|
||||
csr->makeResident(*allocation);
|
||||
|
@ -1345,7 +1345,7 @@ TEST_F(DrmCommandStreamLeaksTest, FlushMultipleTimes) {
|
|||
|
||||
csr->getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(commandBuffer), REUSABLE_ALLOCATION);
|
||||
|
||||
auto commandBuffer2 = mm->allocateGraphicsMemory(1024);
|
||||
auto commandBuffer2 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer2);
|
||||
cs.replaceBuffer(commandBuffer2->getUnderlyingBuffer(), commandBuffer2->getUnderlyingBufferSize());
|
||||
cs.replaceGraphicsAllocation(commandBuffer2);
|
||||
|
@ -1358,7 +1358,7 @@ TEST_F(DrmCommandStreamLeaksTest, FlushMultipleTimes) {
|
|||
mm->freeGraphicsMemory(allocation2);
|
||||
|
||||
csr->getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(commandBuffer2), REUSABLE_ALLOCATION);
|
||||
commandBuffer2 = mm->allocateGraphicsMemory(1024);
|
||||
commandBuffer2 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer2);
|
||||
cs.replaceBuffer(commandBuffer2->getUnderlyingBuffer(), commandBuffer2->getUnderlyingBufferSize());
|
||||
cs.replaceGraphicsAllocation(commandBuffer2);
|
||||
|
@ -1416,7 +1416,7 @@ TEST_F(DrmCommandStreamLeaksTest, CheckDrmFree) {
|
|||
ASSERT_NE(0u, (reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) + 4) & 0xFFF);
|
||||
ASSERT_EQ(4u, (reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) + 4) & 0x7F);
|
||||
|
||||
auto allocation = mm->allocateGraphicsMemory(1024);
|
||||
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
csr->makeResident(*allocation);
|
||||
csr->addBatchBufferEnd(cs, nullptr);
|
||||
|
@ -1428,8 +1428,8 @@ TEST_F(DrmCommandStreamLeaksTest, CheckDrmFree) {
|
|||
}
|
||||
|
||||
TEST_F(DrmCommandStreamLeaksTest, MakeResidentClearResidencyAllocationsInCommandStreamReceiver) {
|
||||
auto allocation1 = mm->allocateGraphicsMemory(1024);
|
||||
auto allocation2 = mm->allocateGraphicsMemory(1024);
|
||||
auto allocation1 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto allocation2 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
ASSERT_NE(nullptr, allocation1);
|
||||
ASSERT_NE(nullptr, allocation2);
|
||||
|
@ -1447,7 +1447,7 @@ TEST_F(DrmCommandStreamLeaksTest, MakeResidentClearResidencyAllocationsInCommand
|
|||
}
|
||||
|
||||
TEST_F(DrmCommandStreamLeaksTest, givenMultipleMakeResidentWhenMakeNonResidentIsCalledOnlyOnceThenSurfaceIsMadeNonResident) {
|
||||
auto allocation1 = mm->allocateGraphicsMemory(1024);
|
||||
auto allocation1 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
ASSERT_NE(nullptr, allocation1);
|
||||
|
||||
|
@ -1466,7 +1466,7 @@ TEST_F(DrmCommandStreamLeaksTest, givenMultipleMakeResidentWhenMakeNonResidentIs
|
|||
}
|
||||
|
||||
TEST_F(DrmCommandStreamLeaksTest, makeNonResidentOnMemObjectCallsDrmCSMakeNonResidentWithGraphicsAllocation) {
|
||||
auto allocation1 = mm->allocateGraphicsMemory(0x1000);
|
||||
auto allocation1 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{0x1000});
|
||||
ASSERT_NE(nullptr, allocation1);
|
||||
|
||||
tCsr->makeResident(*allocation1);
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
using namespace OCLRT;
|
||||
|
||||
AllocationProperties createAllocationProperties(size_t size, bool forcePin) {
|
||||
AllocationProperties properties(true, size);
|
||||
MockAllocationProperties properties(size);
|
||||
properties.alignment = MemoryConstants::preferredAlignment;
|
||||
properties.flags.forcePin = forcePin;
|
||||
return properties;
|
||||
|
@ -371,7 +371,7 @@ TEST_F(DrmMemoryManagerTest, AllocateThenFree) {
|
|||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
auto alloc = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemory(1024));
|
||||
auto alloc = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
ASSERT_NE(nullptr, alloc);
|
||||
EXPECT_NE(nullptr, alloc->getBO());
|
||||
|
||||
|
@ -383,7 +383,7 @@ TEST_F(DrmMemoryManagerTest, AllocateNewFail) {
|
|||
mock->ioctl_expected.total = -1; //don't care
|
||||
|
||||
InjectedFunction method = [this](size_t failureIndex) {
|
||||
auto ptr = memoryManager->allocateGraphicsMemory(1024);
|
||||
auto ptr = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
if (nonfailingAllocation != failureIndex) {
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
|
@ -400,7 +400,7 @@ TEST_F(DrmMemoryManagerTest, Allocate0Bytes) {
|
|||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
auto ptr = memoryManager->allocateGraphicsMemory(static_cast<size_t>(0));
|
||||
auto ptr = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{0u});
|
||||
ASSERT_NE(nullptr, ptr);
|
||||
EXPECT_NE(nullptr, ptr->getUnderlyingBuffer());
|
||||
|
||||
|
@ -412,7 +412,7 @@ TEST_F(DrmMemoryManagerTest, Allocate3Bytes) {
|
|||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
auto ptr = memoryManager->allocateGraphicsMemory(3);
|
||||
auto ptr = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, ptr);
|
||||
EXPECT_NE(nullptr, ptr->getUnderlyingBuffer());
|
||||
|
||||
|
@ -423,7 +423,7 @@ TEST_F(DrmMemoryManagerTest, AllocateUserptrFail) {
|
|||
mock->ioctl_expected.gemUserptr = 1;
|
||||
mock->ioctl_res = -1;
|
||||
|
||||
auto ptr = memoryManager->allocateGraphicsMemory(3);
|
||||
auto ptr = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
mock->ioctl_res = 0;
|
||||
}
|
||||
|
@ -1693,7 +1693,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledThenRetu
|
|||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(1);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
||||
auto ptr = memoryManager->lockResource(allocation);
|
||||
|
@ -1709,7 +1709,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAlloca
|
|||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(1);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_NE(nullptr, allocation->getUnderlyingBuffer());
|
||||
|
||||
|
@ -1866,7 +1866,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndUnifiedAuxCapableAllocation
|
|||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
auto gmm = new Gmm(nullptr, 123, false);
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(123);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->gmm = gmm;
|
||||
|
||||
auto mockGmmRes = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
|
@ -1940,7 +1940,7 @@ TEST_F(DrmMemoryManagerTest, givenMemoryManagerSupportingVirutalPaddingWhenItIsR
|
|||
mock->ioctl_expected.gemClose = 3;
|
||||
//first let's create normal buffer
|
||||
auto bufferSize = MemoryConstants::pageSize;
|
||||
auto buffer = memoryManager->allocateGraphicsMemory(bufferSize);
|
||||
auto buffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{bufferSize});
|
||||
|
||||
//buffer should have size 16
|
||||
EXPECT_EQ(bufferSize, buffer->getUnderlyingBufferSize());
|
||||
|
@ -2054,7 +2054,7 @@ TEST_F(DrmMemoryManagerTest, givenMemoryManagerSupportingVirutalPaddingWhenAlloc
|
|||
|
||||
//first let's create normal buffer
|
||||
auto bufferSize = MemoryConstants::pageSize;
|
||||
auto buffer = memoryManager->allocateGraphicsMemory(bufferSize);
|
||||
auto buffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{bufferSize});
|
||||
|
||||
//buffer should have size 16
|
||||
EXPECT_EQ(bufferSize, buffer->getUnderlyingBufferSize());
|
||||
|
@ -2414,14 +2414,8 @@ TEST(DrmMemoryManager, givenEnabledHostMemoryValidationAndForcePinWhenMemoryMana
|
|||
TEST(DrmMemoryManager, givenMemoryManagerWhenAllocateGraphicsMemoryIsCalledThenMemoryPoolIsSystem4KBPages) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
std::unique_ptr<TestedDrmMemoryManager> memoryManager(new (std::nothrow) TestedDrmMemoryManager(Drm::get(0), false, true, executionEnvironment));
|
||||
auto size = 4096u;
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(size);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, allocation->getMemoryPool());
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties(createAllocationProperties(size, false));
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(createAllocationProperties(MemoryConstants::pageSize, false));
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, allocation->getMemoryPool());
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
|
|
|
@ -134,7 +134,7 @@ class WddmCommandStreamWithMockGdiFixture {
|
|||
ASSERT_NE(nullptr, device);
|
||||
this->csr->overrideRecorededCommandBuffer(*device);
|
||||
if (device->getPreemptionMode() == PreemptionMode::MidThread) {
|
||||
preemptionAllocation = memoryManager->allocateGraphicsMemory(1024);
|
||||
preemptionAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ TEST_F(WddmCommandStreamTest, givenFlushStampWhenWaitCalledThenWaitForSpecifiedM
|
|||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, Flush) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
@ -196,7 +196,7 @@ TEST_F(WddmCommandStreamTest, Flush) {
|
|||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenGraphicsAllocationWithDifferentGpuAddressThenCpuAddressWhenSubmitIsCalledThenGpuAddressIsUsed) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto cpuAddress = commandBuffer->getUnderlyingBuffer();
|
||||
uint64_t mockGpuAddres = 1337;
|
||||
|
@ -210,7 +210,7 @@ TEST_F(WddmCommandStreamTest, givenGraphicsAllocationWithDifferentGpuAddressThen
|
|||
}
|
||||
TEST_F(WddmCommandStreamTest, FlushWithOffset) {
|
||||
auto offset = 128u;
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
|
@ -224,7 +224,7 @@ TEST_F(WddmCommandStreamTest, FlushWithOffset) {
|
|||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledThenCoherencyRequiredFlagIsSetToFalse) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
|
@ -252,7 +252,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOf
|
|||
OsContext osContext(executionEnvironment->osInterface.get(), 0u, gpgpuEngineInstances[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo));
|
||||
executionEnvironment->commandStreamReceivers[0][0]->setOsContext(osContext);
|
||||
|
||||
auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemory(4096);
|
||||
auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
@ -277,7 +277,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOn
|
|||
OsContext osContext(executionEnvironment->osInterface.get(), 0u, gpgpuEngineInstances[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo));
|
||||
executionEnvironment->commandStreamReceivers[0][0]->setOsContext(osContext);
|
||||
|
||||
auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemory(4096);
|
||||
auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
@ -311,7 +311,7 @@ TEST(WddmPreemptionHeaderTests, givenDevicenotSupportingPreemptionWhenCommandStr
|
|||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledAndThrottleIsToLowThenSetHeaderFieldsProperly) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
|
@ -329,7 +329,7 @@ TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledAndThrottleIsToLowThenS
|
|||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledAndThrottleIsToMediumThenSetHeaderFieldsProperly) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
|
@ -347,7 +347,7 @@ TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledAndThrottleIsToMediumTh
|
|||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledAndThrottleIsToHighThenSetHeaderFieldsProperly) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
|
@ -365,12 +365,12 @@ TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledAndThrottleIsToHighThen
|
|||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWddmWithKmDafDisabledWhenFlushIsCalledWithAllocationsForResidencyThenNoneAllocationShouldBeKmDafLocked) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
||||
auto linearStreamAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto linearStreamAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, linearStreamAllocation);
|
||||
linearStreamAllocation->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM);
|
||||
ResidencyContainer allocationsForResidency = {linearStreamAllocation};
|
||||
|
@ -386,7 +386,7 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafDisabledWhenFlushIsCalledWithAll
|
|||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithoutAllocationsForResidencyThenNoneAllocationShouldBeKmDafLocked) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
@ -401,12 +401,12 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithoutA
|
|||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithResidencyAllocationsInMemoryManagerThenLinearStreamAllocationsShouldBeKmDafLocked) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
||||
auto linearStreamAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto linearStreamAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, linearStreamAllocation);
|
||||
linearStreamAllocation->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM);
|
||||
|
||||
|
@ -426,12 +426,12 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithResi
|
|||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllocationsForResidencyThenLinearStreamAllocationsShouldBeKmDafLocked) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
||||
auto linearStreamAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto linearStreamAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, linearStreamAllocation);
|
||||
linearStreamAllocation->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM);
|
||||
ResidencyContainer allocationsForResidency = {linearStreamAllocation};
|
||||
|
@ -448,12 +448,12 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo
|
|||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllocationsForResidencyThenFillPatternAllocationsShouldBeKmDafLocked) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
||||
auto fillPatternAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto fillPatternAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, fillPatternAllocation);
|
||||
fillPatternAllocation->setAllocationType(GraphicsAllocation::AllocationType::FILL_PATTERN);
|
||||
ResidencyContainer allocationsForResidency = {fillPatternAllocation};
|
||||
|
@ -470,12 +470,12 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo
|
|||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllocationsForResidencyThenNonLinearStreamAllocationShouldNotBeKmDafLocked) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
||||
auto nonLinearStreamAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto nonLinearStreamAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, nonLinearStreamAllocation);
|
||||
ResidencyContainer allocationsForResidency = {nonLinearStreamAllocation};
|
||||
|
||||
|
@ -492,7 +492,7 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo
|
|||
TEST_F(WddmCommandStreamTest, makeResident) {
|
||||
WddmMemoryManager *wddmMM = reinterpret_cast<WddmMemoryManager *>(memoryManager);
|
||||
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
|
@ -508,7 +508,7 @@ TEST_F(WddmCommandStreamTest, makeResident) {
|
|||
TEST_F(WddmCommandStreamTest, makeNonResidentPutsAllocationInEvictionAllocations) {
|
||||
WddmMemoryManager *wddmMM = reinterpret_cast<WddmMemoryManager *>(memoryManager);
|
||||
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
|
@ -524,8 +524,8 @@ TEST_F(WddmCommandStreamTest, makeNonResidentPutsAllocationInEvictionAllocations
|
|||
TEST_F(WddmCommandStreamTest, processEvictionPlacesAllAllocationsOnTrimCandidateList) {
|
||||
WddmMemoryManager *wddmMM = reinterpret_cast<WddmMemoryManager *>(memoryManager);
|
||||
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *allocation2 = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
GraphicsAllocation *allocation2 = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
ASSERT_NE(nullptr, allocation2);
|
||||
|
||||
|
@ -545,7 +545,7 @@ TEST_F(WddmCommandStreamTest, processEvictionPlacesAllAllocationsOnTrimCandidate
|
|||
TEST_F(WddmCommandStreamTest, processEvictionClearsEvictionAllocations) {
|
||||
WddmMemoryManager *wddmMM = reinterpret_cast<WddmMemoryManager *>(memoryManager);
|
||||
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
||||
csr->getEvictionAllocations().push_back(allocation);
|
||||
|
@ -560,7 +560,7 @@ TEST_F(WddmCommandStreamTest, processEvictionClearsEvictionAllocations) {
|
|||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, makeResidentNonResidentMemObj) {
|
||||
GraphicsAllocation *gfxAllocation = memoryManager->allocateGraphicsMemory(256);
|
||||
GraphicsAllocation *gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
Buffer *buffer = new AlignedBuffer(gfxAllocation);
|
||||
WddmMemoryManager *wddmMM = reinterpret_cast<WddmMemoryManager *>(memoryManager);
|
||||
|
||||
|
@ -645,7 +645,7 @@ TEST_F(WddmCommandStreamTest, givenTwoTemporaryAllocationsWhenCleanTemporaryAllo
|
|||
}
|
||||
|
||||
TEST_F(WddmCommandStreamMockGdiTest, FlushCallsWddmMakeResidentForResidencyAllocations) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
|
@ -664,7 +664,7 @@ TEST_F(WddmCommandStreamMockGdiTest, FlushCallsWddmMakeResidentForResidencyAlloc
|
|||
}
|
||||
|
||||
TEST_F(WddmCommandStreamMockGdiTest, makeResidentClearsResidencyAllocations) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
|
@ -694,7 +694,7 @@ HWTEST_F(WddmCommandStreamMockGdiTest, givenRecordedCommandBufferWhenItIsSubmitt
|
|||
if (device->getPreemptionMode() == PreemptionMode::MidThread) {
|
||||
csrSurfaceCount = 2;
|
||||
tmpAllocation = GlobalMockSipProgram::sipProgram->getAllocation();
|
||||
GlobalMockSipProgram::sipProgram->resetAllocation(memoryManager->allocateGraphicsMemory(1024));
|
||||
GlobalMockSipProgram::sipProgram->resetAllocation(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
}
|
||||
|
||||
csr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
|
||||
|
@ -702,10 +702,10 @@ HWTEST_F(WddmCommandStreamMockGdiTest, givenRecordedCommandBufferWhenItIsSubmitt
|
|||
auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
|
||||
csr->overrideSubmissionAggregator(mockedSubmissionsAggregator);
|
||||
|
||||
auto commandBuffer = memoryManager->allocateGraphicsMemory(1024);
|
||||
auto dshAlloc = memoryManager->allocateGraphicsMemory(1024);
|
||||
auto iohAlloc = memoryManager->allocateGraphicsMemory(1024);
|
||||
auto sshAlloc = memoryManager->allocateGraphicsMemory(1024);
|
||||
auto commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto dshAlloc = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto iohAlloc = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto sshAlloc = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto tagAllocation = csr->getTagAllocation();
|
||||
csr->setPreemptionCsrAllocation(preemptionAllocation);
|
||||
|
@ -890,7 +890,7 @@ HWTEST_F(WddmCsrCompressionTests, givenEnabledCompressionWhenFlushingThenInitTra
|
|||
|
||||
auto &csrCS = mockWddmCsr->getCS();
|
||||
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemory(1024);
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
IndirectHeap cs(graphicsAllocation);
|
||||
|
||||
EXPECT_FALSE(mockWddmCsr->pageTableManagerInitialized);
|
||||
|
@ -931,7 +931,7 @@ HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenFlushingThenDontIn
|
|||
|
||||
EXPECT_EQ(nullptr, myMockWddm->getPageTableManager());
|
||||
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemory(1024);
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
IndirectHeap cs(graphicsAllocation);
|
||||
|
||||
EXPECT_FALSE(mockWddmCsr->pageTableManagerInitialized);
|
||||
|
|
|
@ -15,6 +15,7 @@ class MockWddmMemoryManager : public WddmMemoryManager {
|
|||
using BaseClass = WddmMemoryManager;
|
||||
|
||||
public:
|
||||
using BaseClass::allocateGraphicsMemory;
|
||||
using BaseClass::allocateGraphicsMemory64kb;
|
||||
using BaseClass::createWddmAllocation;
|
||||
using BaseClass::WddmMemoryManager;
|
||||
|
|
|
@ -114,9 +114,8 @@ TEST(WddmMemoryManagerWithDeferredDeleterTest, givenWMMWhenAsyncDeleterIsEnabled
|
|||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenAllocateGraphicsMemoryIsCalledThenMemoryPoolIsSystem4KBPages) {
|
||||
memoryManager.reset(new MockWddmMemoryManager(false, false, wddm, executionEnvironment));
|
||||
auto size = 4096u;
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(size);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, allocation->getMemoryPool());
|
||||
EXPECT_TRUE(allocation->gmm->useSystemMemoryPool);
|
||||
|
@ -225,12 +224,6 @@ TEST_F(WddmMemoryManagerTest,
|
|||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, AllocateAndFree) {
|
||||
auto *ptr = memoryManager->allocateGraphicsMemory(0x1000);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
memoryManager->freeGraphicsMemory(ptr);
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, givenDefaultWddmMemoryManagerWhenAskedForVirtualPaddingSupportThenFalseIsReturned) {
|
||||
EXPECT_FALSE(memoryManager->peekVirtualPaddingSupport());
|
||||
}
|
||||
|
@ -288,7 +281,7 @@ TEST_F(WddmMemoryManagerTest, AllocateGpuMemHostPtr) {
|
|||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, givenDefaultMemoryManagerWhenAllocateWithSizeIsCalledThenResourceHandleIsZero) {
|
||||
auto *gpuAllocation = memoryManager->allocateGraphicsMemory(0x1000);
|
||||
auto *gpuAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto wddmAllocation = static_cast<WddmAllocation *>(gpuAllocation);
|
||||
|
||||
|
@ -331,7 +324,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCall
|
|||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenLockUnlockIsCalledThenReturnPtr) {
|
||||
auto alloc = memoryManager->allocateGraphicsMemory(1);
|
||||
auto alloc = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto ptr = memoryManager->lockResource(alloc);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
|
@ -1151,7 +1144,7 @@ TEST_F(MockWddmMemoryManagerTest, givenEnabled64kbpagesWhenCreatingGraphicsMemor
|
|||
WddmMemoryManager memoryManager64k(true, false, wddm.get(), executionEnvironment);
|
||||
EXPECT_EQ(0, wddm->createAllocationResult.called);
|
||||
|
||||
GraphicsAllocation *galloc = memoryManager64k.allocateGraphicsMemoryInPreferredPool(AllocationProperties(true, MemoryConstants::pageSize64k), 0, nullptr, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
GraphicsAllocation *galloc = memoryManager64k.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY});
|
||||
EXPECT_EQ(1, wddm->createAllocationResult.called);
|
||||
EXPECT_NE(nullptr, galloc);
|
||||
EXPECT_EQ(true, galloc->isLocked());
|
||||
|
@ -1252,7 +1245,7 @@ TEST_F(MockWddmMemoryManagerTest, givenPageTableManagerWhenMapAuxGpuVaCalledThen
|
|||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||
myWddm->resetPageTableManager(mockMngr);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(4096);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
GMM_DDI_UPDATEAUXTABLE givenDdiUpdateAuxTable = {};
|
||||
GMM_DDI_UPDATEAUXTABLE expectedDdiUpdateAuxTable = {};
|
||||
|
@ -1313,7 +1306,7 @@ TEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenReleaseingT
|
|||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||
wddm->resetPageTableManager(mockMngr);
|
||||
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemory(4096u));
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
wddmAlloc->gpuPtr = gpuVa;
|
||||
wddmAlloc->gmm->isRenderCompressed = true;
|
||||
|
||||
|
@ -1338,7 +1331,7 @@ TEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenReleasei
|
|||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||
wddm->resetPageTableManager(mockMngr);
|
||||
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemory(4096u));
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
wddmAlloc->gmm->isRenderCompressed = false;
|
||||
|
||||
EXPECT_CALL(*mockMngr, updateAuxTable(_)).Times(0);
|
||||
|
@ -1386,7 +1379,7 @@ TEST_F(MockWddmMemoryManagerTest, givenRenderCompressedFlagSetWhenInternalIsUnse
|
|||
myGmm->isRenderCompressed = false;
|
||||
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;
|
||||
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemory(4096u));
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
delete wddmAlloc->gmm;
|
||||
wddmAlloc->gmm = myGmm;
|
||||
|
||||
|
|
|
@ -2469,7 +2469,7 @@ TEST_F(ProgramTests, givenProgramWithBlockKernelsWhenfreeBlockResourcesisCalledT
|
|||
|
||||
program->addBlockKernel(infoBlock);
|
||||
|
||||
GraphicsAllocation *privateSurface = program->getDevice(0).getMemoryManager()->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *privateSurface = program->getDevice(0).getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
EXPECT_NE(nullptr, privateSurface);
|
||||
|
||||
program->getBlockKernelManager()->pushPrivateSurface(privateSurface, 0);
|
||||
|
@ -2805,7 +2805,7 @@ TEST(ProgramDestructionTests, givenProgramUsingDeviceWhenItIsDestroyedAfterPlatf
|
|||
auto device = platformImpl->getDevice(0);
|
||||
MockContext *context = new MockContext(device, false);
|
||||
MockProgram *pProgram = new MockProgram(*device->getExecutionEnvironment(), context, false);
|
||||
auto globalAllocation = device->getMemoryManager()->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
auto globalAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
pProgram->setGlobalSurface(globalAllocation);
|
||||
|
||||
platformImpl.reset(nullptr);
|
||||
|
|
Loading…
Reference in New Issue