mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
Always specify rootDeviceIndex for graphics memory allocations
Related-To: NEO-2941 Change-Id: Ia2362fd6b4e72ede02919152475f40b3edbc3658 Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
5f021afd6d
commit
63fd26f6d6
@@ -80,22 +80,22 @@ void SVMAllocsManager::makeInternalAllocationsResident(CommandStreamReceiver &co
|
||||
SVMAllocsManager::SVMAllocsManager(MemoryManager *memoryManager) : memoryManager(memoryManager) {
|
||||
}
|
||||
|
||||
void *SVMAllocsManager::createSVMAlloc(size_t size, const SvmAllocationProperties svmProperties) {
|
||||
void *SVMAllocsManager::createSVMAlloc(uint32_t rootDeviceIndex, size_t size, const SvmAllocationProperties svmProperties) {
|
||||
if (size == 0)
|
||||
return nullptr;
|
||||
|
||||
std::unique_lock<SpinLock> lock(mtx);
|
||||
if (!memoryManager->isLocalMemorySupported()) {
|
||||
return createZeroCopySvmAllocation(size, svmProperties);
|
||||
return createZeroCopySvmAllocation(rootDeviceIndex, size, svmProperties);
|
||||
} else {
|
||||
return createUnifiedAllocationWithDeviceStorage(size, svmProperties);
|
||||
return createUnifiedAllocationWithDeviceStorage(rootDeviceIndex, size, svmProperties);
|
||||
}
|
||||
}
|
||||
|
||||
void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties &memoryProperties) {
|
||||
void *SVMAllocsManager::createUnifiedMemoryAllocation(uint32_t rootDeviceIndex, size_t size, const UnifiedMemoryProperties &memoryProperties) {
|
||||
size_t alignedSize = alignUp<size_t>(size, MemoryConstants::pageSize64k);
|
||||
|
||||
AllocationProperties unifiedMemoryProperties{true,
|
||||
AllocationProperties unifiedMemoryProperties{rootDeviceIndex, true,
|
||||
alignedSize,
|
||||
memoryProperties.memoryType == InternalMemoryType::DEVICE_UNIFIED_MEMORY ? GraphicsAllocation::AllocationType::BUFFER : GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY,
|
||||
false};
|
||||
@@ -117,7 +117,7 @@ void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size, const Unified
|
||||
return reinterpret_cast<void *>(unifiedMemoryAllocation->getGpuAddress());
|
||||
}
|
||||
|
||||
void *SVMAllocsManager::createSharedUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties &memoryProperties, void *cmdQ) {
|
||||
void *SVMAllocsManager::createSharedUnifiedMemoryAllocation(uint32_t rootDeviceIndex, size_t size, const UnifiedMemoryProperties &memoryProperties, void *cmdQ) {
|
||||
auto supportDualStorageSharedMemory = memoryManager->isLocalMemorySupported();
|
||||
|
||||
if (DebugManager.flags.AllocateSharedAllocationsWithCpuAndGpuStorage.get() != -1) {
|
||||
@@ -125,7 +125,7 @@ void *SVMAllocsManager::createSharedUnifiedMemoryAllocation(size_t size, const U
|
||||
}
|
||||
|
||||
if (supportDualStorageSharedMemory) {
|
||||
auto unifiedMemoryPointer = createUnifiedAllocationWithDeviceStorage(size, {});
|
||||
auto unifiedMemoryPointer = createUnifiedAllocationWithDeviceStorage(rootDeviceIndex, size, {});
|
||||
if (!unifiedMemoryPointer) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ void *SVMAllocsManager::createSharedUnifiedMemoryAllocation(size_t size, const U
|
||||
|
||||
return unifiedMemoryPointer;
|
||||
}
|
||||
return createUnifiedMemoryAllocation(size, memoryProperties);
|
||||
return createUnifiedMemoryAllocation(rootDeviceIndex, size, memoryProperties);
|
||||
}
|
||||
|
||||
SvmAllocationData *SVMAllocsManager::getSVMAlloc(const void *ptr) {
|
||||
@@ -165,8 +165,8 @@ bool SVMAllocsManager::freeSVMAlloc(void *ptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void *SVMAllocsManager::createZeroCopySvmAllocation(size_t size, const SvmAllocationProperties &svmProperties) {
|
||||
AllocationProperties properties{true, size, GraphicsAllocation::AllocationType::SVM_ZERO_COPY, false};
|
||||
void *SVMAllocsManager::createZeroCopySvmAllocation(uint32_t rootDeviceIndex, size_t size, const SvmAllocationProperties &svmProperties) {
|
||||
AllocationProperties properties{rootDeviceIndex, true, size, GraphicsAllocation::AllocationType::SVM_ZERO_COPY, false};
|
||||
MemoryPropertiesParser::fillCachePolicyInProperties(properties, false, svmProperties.readOnly, false);
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
if (!allocation) {
|
||||
@@ -183,9 +183,9 @@ void *SVMAllocsManager::createZeroCopySvmAllocation(size_t size, const SvmAlloca
|
||||
return allocation->getUnderlyingBuffer();
|
||||
}
|
||||
|
||||
void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, const SvmAllocationProperties &svmProperties) {
|
||||
void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(uint32_t rootDeviceIndex, size_t size, const SvmAllocationProperties &svmProperties) {
|
||||
size_t alignedSize = alignUp<size_t>(size, 2 * MemoryConstants::megaByte);
|
||||
AllocationProperties cpuProperties{true, alignedSize, GraphicsAllocation::AllocationType::SVM_CPU, false};
|
||||
AllocationProperties cpuProperties{rootDeviceIndex, true, alignedSize, GraphicsAllocation::AllocationType::SVM_CPU, false};
|
||||
cpuProperties.alignment = 2 * MemoryConstants::megaByte;
|
||||
MemoryPropertiesParser::fillCachePolicyInProperties(cpuProperties, false, svmProperties.readOnly, false);
|
||||
GraphicsAllocation *allocationCpu = memoryManager->allocateGraphicsMemoryWithProperties(cpuProperties);
|
||||
@@ -196,7 +196,7 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, co
|
||||
allocationCpu->setCoherent(svmProperties.coherent);
|
||||
void *svmPtr = allocationCpu->getUnderlyingBuffer();
|
||||
|
||||
AllocationProperties gpuProperties{false, alignedSize, GraphicsAllocation::AllocationType::SVM_GPU, false};
|
||||
AllocationProperties gpuProperties{rootDeviceIndex, false, alignedSize, GraphicsAllocation::AllocationType::SVM_GPU, false};
|
||||
gpuProperties.alignment = 2 * MemoryConstants::megaByte;
|
||||
MemoryPropertiesParser::fillCachePolicyInProperties(gpuProperties, false, svmProperties.readOnly, false);
|
||||
GraphicsAllocation *allocationGpu = memoryManager->allocateGraphicsMemoryWithProperties(gpuProperties, svmPtr);
|
||||
|
||||
@@ -75,9 +75,9 @@ class SVMAllocsManager {
|
||||
};
|
||||
|
||||
SVMAllocsManager(MemoryManager *memoryManager);
|
||||
void *createSVMAlloc(size_t size, const SvmAllocationProperties svmProperties);
|
||||
void *createUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties &svmProperties);
|
||||
void *createSharedUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties &svmProperties, void *cmdQ);
|
||||
void *createSVMAlloc(uint32_t rootDeviceIndex, size_t size, const SvmAllocationProperties svmProperties);
|
||||
void *createUnifiedMemoryAllocation(uint32_t rootDeviceIndex, size_t size, const UnifiedMemoryProperties &svmProperties);
|
||||
void *createSharedUnifiedMemoryAllocation(uint32_t rootDeviceIndex, size_t size, const UnifiedMemoryProperties &svmProperties, void *cmdQ);
|
||||
SvmAllocationData *getSVMAlloc(const void *ptr);
|
||||
bool freeSVMAlloc(void *ptr);
|
||||
size_t getNumAllocs() const { return SVMAllocs.getNumAllocs(); }
|
||||
@@ -89,8 +89,8 @@ class SVMAllocsManager {
|
||||
void makeInternalAllocationsResident(CommandStreamReceiver &commandStreamReceiver, uint32_t requestedTypesMask);
|
||||
|
||||
protected:
|
||||
void *createZeroCopySvmAllocation(size_t size, const SvmAllocationProperties &svmProperties);
|
||||
void *createUnifiedAllocationWithDeviceStorage(size_t size, const SvmAllocationProperties &svmProperties);
|
||||
void *createZeroCopySvmAllocation(uint32_t rootDeviceIndex, size_t size, const SvmAllocationProperties &svmProperties);
|
||||
void *createUnifiedAllocationWithDeviceStorage(uint32_t rootDeviceIndex, size_t size, const SvmAllocationProperties &svmProperties);
|
||||
|
||||
void freeZeroCopySvmAllocation(SvmAllocationData *svmData);
|
||||
void freeSvmAllocationWithDeviceStorage(SvmAllocationData *svmData);
|
||||
|
||||
@@ -3418,7 +3418,7 @@ void *clHostMemAllocINTEL(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return neoContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
return neoContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(neoContext->getDevice(0)->getRootDeviceIndex(), size, unifiedMemoryProperties);
|
||||
}
|
||||
|
||||
void *clDeviceMemAllocINTEL(
|
||||
@@ -3445,7 +3445,7 @@ void *clDeviceMemAllocINTEL(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return neoContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
return neoContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(neoContext->getDevice(0)->getRootDeviceIndex(), size, unifiedMemoryProperties);
|
||||
}
|
||||
|
||||
void *clSharedMemAllocINTEL(
|
||||
@@ -3472,7 +3472,7 @@ void *clSharedMemAllocINTEL(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return neoContext->getSVMAllocsManager()->createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, neoContext->getSpecialQueue());
|
||||
return neoContext->getSVMAllocsManager()->createSharedUnifiedMemoryAllocation(neoContext->getDevice(0)->getRootDeviceIndex(), size, unifiedMemoryProperties, neoContext->getSpecialQueue());
|
||||
}
|
||||
|
||||
cl_int clMemFreeINTEL(
|
||||
@@ -3996,7 +3996,7 @@ void *CL_API_CALL clSVMAlloc(cl_context context,
|
||||
return pAlloc;
|
||||
}
|
||||
|
||||
pAlloc = pContext->getSVMAllocsManager()->createSVMAlloc(size, MemObjHelper::getSvmAllocationProperties(flags));
|
||||
pAlloc = pContext->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), size, MemObjHelper::getSvmAllocationProperties(flags));
|
||||
|
||||
if (pContext->isProvidingPerformanceHints()) {
|
||||
pContext->providePerformanceHint(CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL, CL_SVM_ALLOC_MEETS_ALIGNMENT_RESTRICTIONS, pAlloc, size);
|
||||
|
||||
@@ -365,7 +365,7 @@ cl_int CommandQueue::enqueueWriteMemObjForUnmap(MemObj *memObj, void *mappedPtr,
|
||||
}
|
||||
|
||||
void *CommandQueue::enqueueReadMemObjForMap(TransferProperties &transferProperties, EventsRequest &eventsRequest, cl_int &errcodeRet) {
|
||||
void *basePtr = transferProperties.memObj->getBasePtrForMap();
|
||||
void *basePtr = transferProperties.memObj->getBasePtrForMap(getDevice().getRootDeviceIndex());
|
||||
size_t mapPtrOffset = transferProperties.memObj->calculateOffsetForMapping(transferProperties.offset) + transferProperties.mipPtrOffset;
|
||||
if (transferProperties.memObj->peekClMemObjType() == CL_MEM_OBJECT_BUFFER) {
|
||||
mapPtrOffset += transferProperties.memObj->getOffset();
|
||||
|
||||
@@ -34,7 +34,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueFillBuffer(
|
||||
auto memoryManager = getDevice().getMemoryManager();
|
||||
DEBUG_BREAK_IF(nullptr == memoryManager);
|
||||
|
||||
auto patternAllocation = memoryManager->allocateGraphicsMemoryWithProperties({alignUp(patternSize, MemoryConstants::cacheLineSize), GraphicsAllocation::AllocationType::FILL_PATTERN});
|
||||
auto patternAllocation = memoryManager->allocateGraphicsMemoryWithProperties({getDevice().getRootDeviceIndex(), 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);
|
||||
|
||||
@@ -448,7 +448,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueSVMMemFill(void *svmPtr,
|
||||
commandStreamReceieverOwnership.unlock();
|
||||
|
||||
if (!patternAllocation) {
|
||||
patternAllocation = memoryManager->allocateGraphicsMemoryWithProperties({patternSize, allocationType});
|
||||
patternAllocation = memoryManager->allocateGraphicsMemoryWithProperties({getDevice().getRootDeviceIndex(), patternSize, allocationType});
|
||||
}
|
||||
|
||||
if (patternSize == 1) {
|
||||
|
||||
@@ -308,7 +308,7 @@ FlushStamp AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
|
||||
std::unique_ptr<GraphicsAllocation, std::function<void(GraphicsAllocation *)>> flatBatchBuffer(
|
||||
nullptr, [&](GraphicsAllocation *ptr) { this->getMemoryManager()->freeGraphicsMemory(ptr); });
|
||||
if (DebugManager.flags.FlattenBatchBufferForAUBDump.get()) {
|
||||
flatBatchBuffer.reset(this->flatBatchBufferHelper->flattenBatchBuffer(batchBuffer, sizeBatchBuffer, this->dispatchMode));
|
||||
flatBatchBuffer.reset(this->flatBatchBufferHelper->flattenBatchBuffer(this->rootDeviceIndex, batchBuffer, sizeBatchBuffer, this->dispatchMode));
|
||||
if (flatBatchBuffer.get() != nullptr) {
|
||||
pBatchBuffer = flatBatchBuffer->getUnderlyingBuffer();
|
||||
batchBufferGpuAddress = flatBatchBuffer->getGpuAddress();
|
||||
|
||||
@@ -125,8 +125,8 @@ void CommandStreamReceiver::ensureCommandBufferAllocation(LinearStream &commandS
|
||||
constexpr static auto allocationType = GraphicsAllocation::AllocationType::COMMAND_BUFFER;
|
||||
auto allocation = this->getInternalAllocationStorage()->obtainReusableAllocation(allocationSize, allocationType).release();
|
||||
if (allocation == nullptr) {
|
||||
const AllocationProperties commandStreamAllocationProperties{true, allocationSize, allocationType,
|
||||
isMultiOsContextCapable(), false, getDeviceIndex(), rootDeviceIndex};
|
||||
const AllocationProperties commandStreamAllocationProperties{rootDeviceIndex, true, allocationSize, allocationType,
|
||||
isMultiOsContextCapable(), false, getDeviceIndex()};
|
||||
allocation = this->getMemoryManager()->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties);
|
||||
}
|
||||
DEBUG_BREAK_IF(allocation == nullptr);
|
||||
@@ -272,7 +272,7 @@ void CommandStreamReceiver::addAubComment(const char *comment) {}
|
||||
|
||||
GraphicsAllocation *CommandStreamReceiver::allocateDebugSurface(size_t size) {
|
||||
UNRECOVERABLE_IF(debugSurface != nullptr);
|
||||
debugSurface = getMemoryManager()->allocateGraphicsMemoryWithProperties({size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
debugSurface = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
return debugSurface;
|
||||
}
|
||||
|
||||
@@ -324,8 +324,8 @@ void CommandStreamReceiver::allocateHeapMemory(IndirectHeap::Type heapType,
|
||||
auto heapMemory = internalAllocationStorage->obtainReusableAllocation(finalHeapSize, allocationType).release();
|
||||
|
||||
if (!heapMemory) {
|
||||
heapMemory = getMemoryManager()->allocateGraphicsMemoryWithProperties({true, finalHeapSize, allocationType,
|
||||
isMultiOsContextCapable(), false, getDeviceIndex(), rootDeviceIndex});
|
||||
heapMemory = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, true, finalHeapSize, allocationType,
|
||||
isMultiOsContextCapable(), false, getDeviceIndex()});
|
||||
} else {
|
||||
finalHeapSize = std::max(heapMemory->getUnderlyingBufferSize(), finalHeapSize);
|
||||
}
|
||||
@@ -363,7 +363,7 @@ void CommandStreamReceiver::setExperimentalCmdBuffer(std::unique_ptr<Experimenta
|
||||
}
|
||||
|
||||
bool CommandStreamReceiver::initializeTagAllocation() {
|
||||
auto tagAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::TAG_BUFFER});
|
||||
auto tagAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::TAG_BUFFER});
|
||||
if (!tagAllocation) {
|
||||
return false;
|
||||
}
|
||||
@@ -376,7 +376,7 @@ bool CommandStreamReceiver::initializeTagAllocation() {
|
||||
|
||||
bool CommandStreamReceiver::createPreemptionAllocation() {
|
||||
auto hwInfo = executionEnvironment.getHardwareInfo();
|
||||
AllocationProperties properties{true, hwInfo->capabilityTable.requiredPreemptionSurfaceSize, GraphicsAllocation::AllocationType::PREEMPTION, false};
|
||||
AllocationProperties properties{rootDeviceIndex, true, hwInfo->capabilityTable.requiredPreemptionSurfaceSize, GraphicsAllocation::AllocationType::PREEMPTION, false};
|
||||
properties.flags.uncacheable = hwInfo->workaroundTable.waCSRUncachable;
|
||||
properties.alignment = 256 * MemoryConstants::kiloByte;
|
||||
this->preemptionAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
|
||||
@@ -391,12 +391,12 @@ AllocationsList &CommandStreamReceiver::getAllocationsForReuse() { return intern
|
||||
|
||||
bool CommandStreamReceiver::createAllocationForHostSurface(HostPtrSurface &surface, bool requiresL3Flush) {
|
||||
auto memoryManager = getMemoryManager();
|
||||
AllocationProperties properties{false, surface.getSurfaceSize(), GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{rootDeviceIndex, false, surface.getSurfaceSize(), GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = requiresL3Flush;
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, surface.getMemoryPointer());
|
||||
if (allocation == nullptr && surface.peekIsPtrCopyAllowed()) {
|
||||
// Try with no host pointer allocation and copy
|
||||
AllocationProperties copyProperties{surface.getSurfaceSize(), GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY};
|
||||
AllocationProperties copyProperties{rootDeviceIndex, surface.getSurfaceSize(), GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY};
|
||||
copyProperties.alignment = MemoryConstants::pageSize;
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties(copyProperties);
|
||||
if (allocation) {
|
||||
@@ -414,21 +414,21 @@ bool CommandStreamReceiver::createAllocationForHostSurface(HostPtrSurface &surfa
|
||||
|
||||
TagAllocator<HwTimeStamps> *CommandStreamReceiver::getEventTsAllocator() {
|
||||
if (profilingTimeStampAllocator.get() == nullptr) {
|
||||
profilingTimeStampAllocator = std::make_unique<TagAllocator<HwTimeStamps>>(getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize);
|
||||
profilingTimeStampAllocator = std::make_unique<TagAllocator<HwTimeStamps>>(rootDeviceIndex, getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize);
|
||||
}
|
||||
return profilingTimeStampAllocator.get();
|
||||
}
|
||||
|
||||
TagAllocator<HwPerfCounter> *CommandStreamReceiver::getEventPerfCountAllocator(const uint32_t tagSize) {
|
||||
if (perfCounterAllocator.get() == nullptr) {
|
||||
perfCounterAllocator = std::make_unique<TagAllocator<HwPerfCounter>>(getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize, tagSize);
|
||||
perfCounterAllocator = std::make_unique<TagAllocator<HwPerfCounter>>(rootDeviceIndex, getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize, tagSize);
|
||||
}
|
||||
return perfCounterAllocator.get();
|
||||
}
|
||||
|
||||
TagAllocator<TimestampPacketStorage> *CommandStreamReceiver::getTimestampPacketAllocator() {
|
||||
if (timestampPacketAllocator.get() == nullptr) {
|
||||
timestampPacketAllocator = std::make_unique<TagAllocator<TimestampPacketStorage>>(getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize);
|
||||
timestampPacketAllocator = std::make_unique<TagAllocator<TimestampPacketStorage>>(rootDeviceIndex, getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize);
|
||||
}
|
||||
return timestampPacketAllocator.get();
|
||||
}
|
||||
|
||||
@@ -189,6 +189,8 @@ class CommandStreamReceiver {
|
||||
|
||||
bool isLocalMemoryEnabled() const { return localMemoryEnabled; }
|
||||
|
||||
uint32_t getRootDeviceIndex() { return rootDeviceIndex; }
|
||||
|
||||
protected:
|
||||
void cleanupResources();
|
||||
MOCKABLE_VIRTUAL uint32_t getDeviceIndex() const;
|
||||
|
||||
@@ -58,7 +58,7 @@ void CommandStreamReceiverHw<GfxFamily>::adjustComputeMode(LinearStream &csr, Di
|
||||
|
||||
template <typename GfxFamily>
|
||||
void CommandStreamReceiverHw<GfxFamily>::createScratchSpaceController() {
|
||||
scratchSpaceController = std::make_unique<ScratchSpaceControllerBase>(executionEnvironment, *internalAllocationStorage.get());
|
||||
scratchSpaceController = std::make_unique<ScratchSpaceControllerBase>(rootDeviceIndex, executionEnvironment, *internalAllocationStorage.get());
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
||||
@@ -24,9 +24,10 @@ ExperimentalCommandBuffer::ExperimentalCommandBuffer(CommandStreamReceiver *csr,
|
||||
experimentalAllocationOffset(0),
|
||||
defaultPrint(true),
|
||||
timerResolution(profilingTimerResolution) {
|
||||
timestamps = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
auto rootDeviceIndex = csr->getRootDeviceIndex();
|
||||
timestamps = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
memset(timestamps->getUnderlyingBuffer(), 0, timestamps->getUnderlyingBufferSize());
|
||||
experimentalAllocation = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
experimentalAllocation = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
memset(experimentalAllocation->getUnderlyingBuffer(), 0, experimentalAllocation->getUnderlyingBufferSize());
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
|
||||
namespace NEO {
|
||||
ScratchSpaceController::ScratchSpaceController(ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage)
|
||||
: executionEnvironment(environment), csrAllocationStorage(allocationStorage) {
|
||||
ScratchSpaceController::ScratchSpaceController(uint32_t rootDeviceIndex, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage)
|
||||
: rootDeviceIndex(rootDeviceIndex), executionEnvironment(environment), csrAllocationStorage(allocationStorage) {
|
||||
auto hwInfo = executionEnvironment.getHardwareInfo();
|
||||
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
||||
computeUnitsUsedForScratch = hwHelper.getComputeUnitsUsedForScratch(hwInfo);
|
||||
|
||||
@@ -27,7 +27,7 @@ constexpr size_t scratchSpaceOffsetFor64Bit = 4096u;
|
||||
|
||||
class ScratchSpaceController {
|
||||
public:
|
||||
ScratchSpaceController(ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage);
|
||||
ScratchSpaceController(uint32_t rootDeviceIndex, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage);
|
||||
virtual ~ScratchSpaceController();
|
||||
|
||||
GraphicsAllocation *getScratchSpaceAllocation() {
|
||||
@@ -51,6 +51,7 @@ class ScratchSpaceController {
|
||||
protected:
|
||||
MemoryManager *getMemoryManager() const;
|
||||
|
||||
const uint32_t rootDeviceIndex;
|
||||
ExecutionEnvironment &executionEnvironment;
|
||||
GraphicsAllocation *scratchAllocation = nullptr;
|
||||
GraphicsAllocation *privateScratchAllocation = nullptr;
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#include "runtime/os_interface/os_context.h"
|
||||
|
||||
namespace NEO {
|
||||
ScratchSpaceControllerBase::ScratchSpaceControllerBase(ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage)
|
||||
: ScratchSpaceController(environment, allocationStorage) {
|
||||
ScratchSpaceControllerBase::ScratchSpaceControllerBase(uint32_t rootDeviceIndex, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage)
|
||||
: ScratchSpaceController(rootDeviceIndex, environment, allocationStorage) {
|
||||
}
|
||||
|
||||
void ScratchSpaceControllerBase::setRequiredScratchSpace(void *sshBaseAddress,
|
||||
@@ -46,7 +46,7 @@ void ScratchSpaceControllerBase::setRequiredScratchSpace(void *sshBaseAddress,
|
||||
}
|
||||
|
||||
void ScratchSpaceControllerBase::createScratchSpaceAllocation() {
|
||||
scratchAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({scratchSizeBytes, GraphicsAllocation::AllocationType::SCRATCH_SURFACE});
|
||||
scratchAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, scratchSizeBytes, GraphicsAllocation::AllocationType::SCRATCH_SURFACE});
|
||||
UNRECOVERABLE_IF(scratchAllocation == nullptr);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace NEO {
|
||||
|
||||
class ScratchSpaceControllerBase : public ScratchSpaceController {
|
||||
public:
|
||||
ScratchSpaceControllerBase(ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage);
|
||||
ScratchSpaceControllerBase(uint32_t rootDeviceIndex, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage);
|
||||
|
||||
void setRequiredScratchSpace(void *sshBaseAddress,
|
||||
uint32_t requiredPerThreadScratchSize,
|
||||
|
||||
@@ -99,21 +99,22 @@ void DeviceQueue::allocateResources() {
|
||||
auto &caps = device->getDeviceInfo();
|
||||
|
||||
uint32_t alignedQueueSize = alignUp(queueSize, MemoryConstants::pageSize);
|
||||
queueBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({alignedQueueSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
auto rootDeviceIndex = device->getRootDeviceIndex();
|
||||
queueBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, alignedQueueSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
|
||||
auto eventPoolBufferSize = static_cast<size_t>(caps.maxOnDeviceEvents) * sizeof(IGIL_DeviceEvent) + sizeof(IGIL_EventPool);
|
||||
eventPoolBufferSize = alignUp(eventPoolBufferSize, MemoryConstants::pageSize);
|
||||
eventPoolBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({eventPoolBufferSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
eventPoolBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, eventPoolBufferSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
|
||||
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()->allocateGraphicsMemoryWithProperties({expectedStackSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
stackBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, expectedStackSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
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()->allocateGraphicsMemoryWithProperties({queueStorageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
queueStorageBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, queueStorageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
memset(queueStorageBuffer->getUnderlyingBuffer(), 0, queueStorageBuffer->getUnderlyingBufferSize());
|
||||
|
||||
auto &hwHelper = HwHelper::get(device->getHardwareInfo().platform.eRenderCoreFamily);
|
||||
@@ -122,9 +123,9 @@ void DeviceQueue::allocateResources() {
|
||||
// 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 + MemoryConstants::pageSize;
|
||||
dshSize = alignUp(dshSize, MemoryConstants::pageSize);
|
||||
dshBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({dshSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
dshBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, dshSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
|
||||
debugQueue = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
debugQueue = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
debugData = (DebugDataBuffer *)debugQueue->getUnderlyingBuffer();
|
||||
memset(debugQueue->getUnderlyingBuffer(), 0, debugQueue->getUnderlyingBufferSize());
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ void DeviceQueueHw<GfxFamily>::allocateSlbBuffer() {
|
||||
slbSize += (4 * MemoryConstants::pageSize); // +4 pages spec restriction
|
||||
slbSize = alignUp(slbSize, MemoryConstants::pageSize);
|
||||
|
||||
slbBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({slbSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
slbBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), slbSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
||||
@@ -29,7 +29,7 @@ class FlatBatchBufferHelper {
|
||||
MOCKABLE_VIRTUAL bool registerCommandChunk(CommandChunk &commandChunk);
|
||||
MOCKABLE_VIRTUAL bool registerCommandChunk(BatchBuffer &batchBuffer, size_t batchBufferStartCommandSize);
|
||||
MOCKABLE_VIRTUAL bool registerBatchBufferStartAddress(uint64_t commandAddress, uint64_t startAddress);
|
||||
virtual GraphicsAllocation *flattenBatchBuffer(BatchBuffer &batchBuffer, size_t &sizeBatchBuffer, DispatchMode dispatchMode) = 0;
|
||||
virtual GraphicsAllocation *flattenBatchBuffer(uint32_t rootDeviceIndex, BatchBuffer &batchBuffer, size_t &sizeBatchBuffer, DispatchMode dispatchMode) = 0;
|
||||
virtual char *getIndirectPatchCommands(size_t &indirectPatchCommandsSize, std::vector<PatchInfoData> &indirectPatchInfo) = 0;
|
||||
virtual void removePipeControlData(size_t pipeControlLocationSize, void *pipeControlForNooping) = 0;
|
||||
virtual void collectScratchSpacePatchInfo(uint64_t scratchAddress, uint64_t commandOffset, const LinearStream &csr) = 0;
|
||||
|
||||
@@ -15,7 +15,7 @@ template <typename GfxFamily>
|
||||
class FlatBatchBufferHelperHw : public FlatBatchBufferHelper {
|
||||
public:
|
||||
using FlatBatchBufferHelper::FlatBatchBufferHelper;
|
||||
GraphicsAllocation *flattenBatchBuffer(BatchBuffer &batchBuffer, size_t &sizeBatchBuffer, DispatchMode dispatchMode) override;
|
||||
GraphicsAllocation *flattenBatchBuffer(uint32_t rootDeviceIndex, BatchBuffer &batchBuffer, size_t &sizeBatchBuffer, DispatchMode dispatchMode) override;
|
||||
char *getIndirectPatchCommands(size_t &indirectPatchCommandsSize, std::vector<PatchInfoData> &indirectPatchInfo) override;
|
||||
void removePipeControlData(size_t pipeControlLocationSize, void *pipeControlForNooping) override;
|
||||
void collectScratchSpacePatchInfo(uint64_t scratchAddress, uint64_t commandOffset, const LinearStream &csr) override;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
namespace NEO {
|
||||
|
||||
template <typename GfxFamily>
|
||||
GraphicsAllocation *FlatBatchBufferHelperHw<GfxFamily>::flattenBatchBuffer(BatchBuffer &batchBuffer, size_t &sizeBatchBuffer,
|
||||
GraphicsAllocation *FlatBatchBufferHelperHw<GfxFamily>::flattenBatchBuffer(uint32_t rootDeviceIndex, BatchBuffer &batchBuffer, size_t &sizeBatchBuffer,
|
||||
DispatchMode dispatchMode) {
|
||||
typedef typename GfxFamily::MI_BATCH_BUFFER_START MI_BATCH_BUFFER_START;
|
||||
typedef typename GfxFamily::MI_BATCH_BUFFER_END MI_BATCH_BUFFER_END;
|
||||
@@ -31,7 +31,7 @@ GraphicsAllocation *FlatBatchBufferHelperHw<GfxFamily>::flattenBatchBuffer(Batch
|
||||
batchBuffer.chainedBatchBuffer->setAubWritable(false, GraphicsAllocation::defaultBank);
|
||||
auto sizeMainBatchBuffer = batchBuffer.chainedBatchBufferStartOffset - batchBuffer.startOffset;
|
||||
auto alignedMainBatchBufferSize = alignUp(sizeMainBatchBuffer + indirectPatchCommandsSize + batchBuffer.chainedBatchBuffer->getUnderlyingBufferSize(), MemoryConstants::pageSize);
|
||||
AllocationProperties flatBatchBufferProperties(alignedMainBatchBufferSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY);
|
||||
AllocationProperties flatBatchBufferProperties(rootDeviceIndex, alignedMainBatchBufferSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY);
|
||||
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(static_cast<size_t>(flatBatchBufferSize), GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY);
|
||||
AllocationProperties flatBatchBufferProperties(rootDeviceIndex, static_cast<size_t>(flatBatchBufferSize), GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY);
|
||||
flatBatchBufferProperties.alignment = MemoryConstants::pageSize;
|
||||
flatBatchBuffer = getMemoryManager()->allocateGraphicsMemoryWithProperties(flatBatchBufferProperties);
|
||||
UNRECOVERABLE_IF(flatBatchBuffer == nullptr);
|
||||
|
||||
@@ -24,9 +24,9 @@ class MemoryPropertiesParser {
|
||||
|
||||
static bool parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryPropertiesFlags &memoryProperties, cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, ObjType objectType);
|
||||
|
||||
static AllocationProperties getAllocationProperties(MemoryPropertiesFlags memoryProperties, bool allocateMemory,
|
||||
static AllocationProperties getAllocationProperties(uint32_t rootDeviceIndex, MemoryPropertiesFlags memoryProperties, bool allocateMemory,
|
||||
size_t size, GraphicsAllocation::AllocationType type, bool multiStorageResource) {
|
||||
AllocationProperties allocationProperties(allocateMemory, size, type, multiStorageResource);
|
||||
AllocationProperties allocationProperties(rootDeviceIndex, allocateMemory, size, type, multiStorageResource);
|
||||
fillPoliciesInProperties(allocationProperties, memoryProperties);
|
||||
return allocationProperties;
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ cl_int Kernel::initialize() {
|
||||
retVal = CL_OUT_OF_RESOURCES;
|
||||
break;
|
||||
}
|
||||
privateSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({static_cast<size_t>(privateSurfaceSize), GraphicsAllocation::AllocationType::PRIVATE_SURFACE});
|
||||
privateSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({device.getRootDeviceIndex(), static_cast<size_t>(privateSurfaceSize), GraphicsAllocation::AllocationType::PRIVATE_SURFACE});
|
||||
if (privateSurface == nullptr) {
|
||||
retVal = CL_OUT_OF_RESOURCES;
|
||||
break;
|
||||
@@ -372,7 +372,7 @@ cl_int Kernel::initialize() {
|
||||
}
|
||||
|
||||
if (isParentKernel) {
|
||||
program->allocateBlockPrivateSurfaces();
|
||||
program->allocateBlockPrivateSurfaces(device.getRootDeviceIndex());
|
||||
}
|
||||
|
||||
retVal = CL_SUCCESS;
|
||||
@@ -739,7 +739,7 @@ void Kernel::substituteKernelHeap(void *newKernelHeap, size_t newKernelHeapSize)
|
||||
} else {
|
||||
memoryManager->checkGpuUsageAndDestroyGraphicsAllocations(pKernelInfo->kernelAllocation);
|
||||
pKernelInfo->kernelAllocation = nullptr;
|
||||
status = pKernelInfo->createKernelAllocation(memoryManager);
|
||||
status = pKernelInfo->createKernelAllocation(device.getRootDeviceIndex(), memoryManager);
|
||||
}
|
||||
UNRECOVERABLE_IF(!status);
|
||||
}
|
||||
@@ -1621,7 +1621,7 @@ void Kernel::createReflectionSurface() {
|
||||
kernelReflectionSize += blockCount * alignUp(maxConstantBufferSize, sizeof(void *));
|
||||
kernelReflectionSize += parentImageCount * sizeof(IGIL_ImageParamters);
|
||||
kernelReflectionSize += parentSamplerCount * sizeof(IGIL_ParentSamplerParams);
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({kernelReflectionSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({device.getRootDeviceIndex(), kernelReflectionSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
|
||||
for (uint32_t i = 0; i < blockCount; i++) {
|
||||
const KernelInfo *pBlockInfo = blockManager->getBlockKernelInfo(i);
|
||||
@@ -1695,7 +1695,7 @@ void Kernel::createReflectionSurface() {
|
||||
|
||||
if (DebugManager.flags.ForceDispatchScheduler.get()) {
|
||||
if (this->isSchedulerKernel && kernelReflectionSurface == nullptr) {
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({device.getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,8 +223,9 @@ Buffer *Buffer::create(Context *context,
|
||||
context->providePerformanceHint(CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL, CL_BUFFER_NEEDS_ALLOCATE_MEMORY);
|
||||
}
|
||||
|
||||
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
|
||||
if (!memory) {
|
||||
AllocationProperties allocProperties = MemoryPropertiesParser::getAllocationProperties(memoryProperties, allocateMemory, size, allocationType, context->areMultiStorageAllocationsPreferred());
|
||||
AllocationProperties allocProperties = MemoryPropertiesParser::getAllocationProperties(rootDeviceIndex, memoryProperties, allocateMemory, size, allocationType, context->areMultiStorageAllocationsPreferred());
|
||||
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties, hostPtr);
|
||||
}
|
||||
|
||||
@@ -237,7 +238,7 @@ Buffer *Buffer::create(Context *context,
|
||||
allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
|
||||
zeroCopyAllowed = false;
|
||||
copyMemoryFromHostPtr = true;
|
||||
AllocationProperties allocProperties = MemoryPropertiesParser::getAllocationProperties(memoryProperties, true, size, allocationType, context->areMultiStorageAllocationsPreferred());
|
||||
AllocationProperties allocProperties = MemoryPropertiesParser::getAllocationProperties(rootDeviceIndex, memoryProperties, true, size, allocationType, context->areMultiStorageAllocationsPreferred());
|
||||
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties);
|
||||
}
|
||||
|
||||
@@ -282,7 +283,7 @@ Buffer *Buffer::create(Context *context,
|
||||
|
||||
if (memoryProperties.flags.useHostPtr) {
|
||||
if (!zeroCopyAllowed && !isHostPtrSVM) {
|
||||
AllocationProperties properties{false, size, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{rootDeviceIndex, false, size, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = true;
|
||||
mapAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@ Image *Image::create(Context *context,
|
||||
Buffer *parentBuffer = castToObject<Buffer>(imageDesc->mem_object);
|
||||
Image *parentImage = castToObject<Image>(imageDesc->mem_object);
|
||||
auto &hwHelper = HwHelper::get(context->getDevice(0)->getHardwareInfo().platform.eRenderCoreFamily);
|
||||
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
|
||||
|
||||
do {
|
||||
size_t imageWidth = imageDesc->image_width;
|
||||
@@ -261,7 +262,7 @@ Image *Image::create(Context *context,
|
||||
if (memoryProperties.flags.useHostPtr) {
|
||||
|
||||
if (!context->isSharedContext) {
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(imgInfo, false, memoryProperties);
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(rootDeviceIndex, imgInfo, false, memoryProperties);
|
||||
|
||||
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties, hostPtr);
|
||||
|
||||
@@ -275,17 +276,17 @@ Image *Image::create(Context *context,
|
||||
}
|
||||
} else {
|
||||
gmm = new Gmm(imgInfo, StorageInfo{});
|
||||
memory = memoryManager->allocateGraphicsMemoryWithProperties({false, imgInfo.size, GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE, false}, hostPtr);
|
||||
memory = memoryManager->allocateGraphicsMemoryWithProperties({rootDeviceIndex, false, imgInfo.size, GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE, false}, hostPtr);
|
||||
memory->setDefaultGmm(gmm);
|
||||
zeroCopy = true;
|
||||
}
|
||||
if (memory) {
|
||||
AllocationProperties properties{false, hostPtrMinSize, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{rootDeviceIndex, false, hostPtrMinSize, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = true;
|
||||
mapAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||
}
|
||||
} else {
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(imgInfo, true, memoryProperties);
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(rootDeviceIndex, imgInfo, true, memoryProperties);
|
||||
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties);
|
||||
|
||||
if (memory && MemoryPool::isSystemMemoryPool(memory->getMemoryPool())) {
|
||||
|
||||
@@ -319,9 +319,9 @@ bool MemObj::checkIfMemoryTransferIsRequired(size_t offsetInMemObject, size_t of
|
||||
return isMemTransferNeeded;
|
||||
}
|
||||
|
||||
void *MemObj::getBasePtrForMap() {
|
||||
void *MemObj::getBasePtrForMap(uint32_t rootDeviceIndex) {
|
||||
if (associatedMemObject) {
|
||||
return associatedMemObject->getBasePtrForMap();
|
||||
return associatedMemObject->getBasePtrForMap(rootDeviceIndex);
|
||||
}
|
||||
if (getMemoryPropertiesFlags() & CL_MEM_USE_HOST_PTR) {
|
||||
return getHostPtr();
|
||||
@@ -332,7 +332,7 @@ void *MemObj::getBasePtrForMap() {
|
||||
} else {
|
||||
auto memory = memoryManager->allocateSystemMemory(getSize(), MemoryConstants::pageSize);
|
||||
setAllocatedMapPtr(memory);
|
||||
AllocationProperties properties{false, getSize(), GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{rootDeviceIndex, false, getSize(), GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, memory);
|
||||
setMapAllocation(allocation);
|
||||
return getAllocatedMapPtr();
|
||||
|
||||
@@ -66,7 +66,7 @@ class MemObj : public BaseObject<_cl_mem> {
|
||||
bool addMappedPtr(void *ptr, size_t ptrLength, cl_map_flags &mapFlags, MemObjSizeArray &size, MemObjOffsetArray &offset, uint32_t mipLevel);
|
||||
bool findMappedPtr(void *mappedPtr, MapInfo &outMapInfo) { return mapOperationsHandler.find(mappedPtr, outMapInfo); }
|
||||
void removeMappedPtr(void *mappedPtr) { mapOperationsHandler.remove(mappedPtr); }
|
||||
void *getBasePtrForMap();
|
||||
void *getBasePtrForMap(uint32_t rootDeviceIndex);
|
||||
|
||||
MOCKABLE_VIRTUAL void setAllocatedMapPtr(void *allocatedMapPtr);
|
||||
void *getAllocatedMapPtr() const { return allocatedMapPtr; }
|
||||
|
||||
@@ -32,7 +32,7 @@ class MemObjHelper {
|
||||
static bool parseUnifiedMemoryProperties(cl_mem_properties_intel *properties, SVMAllocsManager::UnifiedMemoryProperties &unifiedMemoryProperties);
|
||||
static bool validateMemoryPropertiesForBuffer(const MemoryPropertiesFlags &memoryProperties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel);
|
||||
static bool validateMemoryPropertiesForImage(const MemoryPropertiesFlags &memoryProperties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel, cl_mem parent);
|
||||
static AllocationProperties getAllocationPropertiesWithImageInfo(ImageInfo &imgInfo, bool allocateMemory, const MemoryPropertiesFlags &memoryProperties);
|
||||
static AllocationProperties getAllocationPropertiesWithImageInfo(uint32_t rootDeviceIndex, ImageInfo &imgInfo, bool allocateMemory, const MemoryPropertiesFlags &memoryProperties);
|
||||
static bool checkMemFlagsForSubBuffer(cl_mem_flags flags);
|
||||
static SVMAllocsManager::SvmAllocationProperties getSvmAllocationProperties(cl_mem_flags flags);
|
||||
static bool isSuitableForRenderCompression(bool renderCompressed, const MemoryPropertiesFlags &properties, Context &context, bool preferCompression);
|
||||
|
||||
@@ -84,8 +84,8 @@ bool MemObjHelper::parseUnifiedMemoryProperties(cl_mem_properties_intel *propert
|
||||
return true;
|
||||
}
|
||||
|
||||
AllocationProperties MemObjHelper::getAllocationPropertiesWithImageInfo(ImageInfo &imgInfo, bool allocateMemory, const MemoryPropertiesFlags &memoryProperties) {
|
||||
AllocationProperties allocationProperties{allocateMemory, imgInfo, GraphicsAllocation::AllocationType::IMAGE};
|
||||
AllocationProperties MemObjHelper::getAllocationPropertiesWithImageInfo(uint32_t rootDeviceIndex, ImageInfo &imgInfo, bool allocateMemory, const MemoryPropertiesFlags &memoryProperties) {
|
||||
AllocationProperties allocationProperties{rootDeviceIndex, allocateMemory, imgInfo, GraphicsAllocation::AllocationType::IMAGE};
|
||||
MemoryPropertiesParser::fillPoliciesInProperties(allocationProperties, memoryProperties);
|
||||
return allocationProperties;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "runtime/mem_obj/pipe.h"
|
||||
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/helpers/get_info.h"
|
||||
#include "runtime/helpers/memory_properties_flags_helpers.h"
|
||||
#include "runtime/mem_obj/mem_obj_helper.h"
|
||||
@@ -54,8 +55,9 @@ Pipe *Pipe::create(Context *context,
|
||||
MemoryPropertiesFlags memoryPropertiesFlags = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
|
||||
while (true) {
|
||||
auto size = static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace);
|
||||
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
|
||||
AllocationProperties allocProperties =
|
||||
MemoryPropertiesParser::getAllocationProperties(memoryPropertiesFlags, true, size, GraphicsAllocation::AllocationType::PIPE, false);
|
||||
MemoryPropertiesParser::getAllocationProperties(rootDeviceIndex, memoryPropertiesFlags, true, size, GraphicsAllocation::AllocationType::PIPE, false);
|
||||
GraphicsAllocation *memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties);
|
||||
if (!memory) {
|
||||
errcodeRet = CL_OUT_OF_HOST_MEMORY;
|
||||
|
||||
@@ -26,44 +26,45 @@ struct AllocationProperties {
|
||||
uint32_t allFlags = 0;
|
||||
};
|
||||
static_assert(sizeof(AllocationProperties::flags) == sizeof(AllocationProperties::allFlags), "");
|
||||
const uint32_t rootDeviceIndex;
|
||||
size_t size = 0;
|
||||
size_t alignment = 0;
|
||||
GraphicsAllocation::AllocationType allocationType = GraphicsAllocation::AllocationType::UNKNOWN;
|
||||
ImageInfo *imgInfo = nullptr;
|
||||
bool multiStorageResource = false;
|
||||
uint32_t subDeviceIndex = AllocationProperties::noDeviceSpecified;
|
||||
uint32_t rootDeviceIndex = AllocationProperties::noDeviceSpecified;
|
||||
|
||||
AllocationProperties(size_t size,
|
||||
AllocationProperties(uint32_t rootDeviceIndex, size_t size,
|
||||
GraphicsAllocation::AllocationType allocationType)
|
||||
: AllocationProperties(true, size, allocationType, false) {}
|
||||
: AllocationProperties(rootDeviceIndex, true, size, allocationType, false) {}
|
||||
|
||||
AllocationProperties(bool allocateMemory,
|
||||
AllocationProperties(uint32_t rootDeviceIndex, bool allocateMemory,
|
||||
ImageInfo &imgInfo,
|
||||
GraphicsAllocation::AllocationType allocationType)
|
||||
: AllocationProperties(allocateMemory, 0u, allocationType, false) {
|
||||
: AllocationProperties(rootDeviceIndex, allocateMemory, 0u, allocationType, false) {
|
||||
this->imgInfo = &imgInfo;
|
||||
}
|
||||
|
||||
AllocationProperties(bool allocateMemory,
|
||||
AllocationProperties(uint32_t rootDeviceIndex,
|
||||
bool allocateMemory,
|
||||
size_t size,
|
||||
GraphicsAllocation::AllocationType allocationType,
|
||||
bool isMultiStorageAllocation)
|
||||
: AllocationProperties(allocateMemory, size, allocationType, false, isMultiStorageAllocation, AllocationProperties::noDeviceSpecified, AllocationProperties::noDeviceSpecified) {}
|
||||
: AllocationProperties(rootDeviceIndex, allocateMemory, size, allocationType, false, isMultiStorageAllocation, AllocationProperties::noDeviceSpecified) {}
|
||||
|
||||
AllocationProperties(bool allocateMemory,
|
||||
size_t size,
|
||||
GraphicsAllocation::AllocationType allocationType,
|
||||
bool multiOsContextCapable,
|
||||
bool isMultiStorageAllocation,
|
||||
uint32_t subDeviceIndex,
|
||||
uint32_t rootDeviceIndex)
|
||||
: size(size), allocationType(allocationType), multiStorageResource(isMultiStorageAllocation), subDeviceIndex(subDeviceIndex), rootDeviceIndex(rootDeviceIndex) {
|
||||
AllocationProperties(uint32_t rootDeviceIndexParam,
|
||||
bool allocateMemoryParam,
|
||||
size_t sizeParam,
|
||||
GraphicsAllocation::AllocationType allocationTypeParam,
|
||||
bool multiOsContextCapableParam,
|
||||
bool isMultiStorageAllocationParam,
|
||||
uint32_t subDeviceIndexParam)
|
||||
: rootDeviceIndex(rootDeviceIndexParam), size(sizeParam), allocationType(allocationTypeParam), multiStorageResource(isMultiStorageAllocationParam), subDeviceIndex(subDeviceIndexParam) {
|
||||
allFlags = 0;
|
||||
flags.flushL3RequiredForRead = 1;
|
||||
flags.flushL3RequiredForWrite = 1;
|
||||
flags.allocateMemory = allocateMemory;
|
||||
flags.multiOsContextCapable = multiOsContextCapable;
|
||||
flags.allocateMemory = allocateMemoryParam;
|
||||
flags.multiOsContextCapable = multiOsContextCapableParam;
|
||||
}
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -120,13 +120,13 @@ void MemoryManager::cleanGraphicsMemoryCreatedFromHostPtr(GraphicsAllocation *gr
|
||||
|
||||
GraphicsAllocation *MemoryManager::createGraphicsAllocationWithPadding(GraphicsAllocation *inputGraphicsAllocation, size_t sizeWithPadding) {
|
||||
if (!paddingAllocation) {
|
||||
paddingAllocation = allocateGraphicsMemoryWithProperties({paddingBufferSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
paddingAllocation = allocateGraphicsMemoryWithProperties({inputGraphicsAllocation->getRootDeviceIndex(), paddingBufferSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
}
|
||||
return createPaddedAllocation(inputGraphicsAllocation, sizeWithPadding);
|
||||
}
|
||||
|
||||
GraphicsAllocation *MemoryManager::createPaddedAllocation(GraphicsAllocation *inputGraphicsAllocation, size_t sizeWithPadding) {
|
||||
return allocateGraphicsMemoryWithProperties({sizeWithPadding, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
return allocateGraphicsMemoryWithProperties({inputGraphicsAllocation->getRootDeviceIndex(), sizeWithPadding, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
}
|
||||
|
||||
void MemoryManager::freeSystemMemory(void *ptr) {
|
||||
@@ -314,9 +314,8 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
||||
allocationData.hostPtr = nullptr;
|
||||
}
|
||||
|
||||
if (properties.rootDeviceIndex != AllocationProperties::noDeviceSpecified) {
|
||||
allocationData.rootDeviceIndex = properties.rootDeviceIndex;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -151,9 +151,8 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemoryImpl(con
|
||||
}
|
||||
|
||||
GraphicsAllocation *OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness) {
|
||||
uint32_t rootDeviceIndex = properties.rootDeviceIndex == AllocationProperties::noDeviceSpecified ? 0 : properties.rootDeviceIndex;
|
||||
auto graphicsAllocation = createMemoryAllocation(properties.allocationType, nullptr, reinterpret_cast<void *>(1), 1,
|
||||
4096u, static_cast<uint64_t>(handle), MemoryPool::SystemCpuInaccessible, rootDeviceIndex,
|
||||
4096u, static_cast<uint64_t>(handle), MemoryPool::SystemCpuInaccessible, properties.rootDeviceIndex,
|
||||
false, false, requireSpecificBitness);
|
||||
graphicsAllocation->setSharedHandle(handle);
|
||||
graphicsAllocation->set32BitAllocation(requireSpecificBitness);
|
||||
|
||||
@@ -419,11 +419,9 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
|
||||
auto boHandle = openFd.handle;
|
||||
auto bo = findAndReferenceSharedBufferObject(boHandle);
|
||||
|
||||
uint32_t rootDeviceIndex = AllocationProperties::noDeviceSpecified == properties.rootDeviceIndex ? 0 : properties.rootDeviceIndex;
|
||||
|
||||
if (bo == nullptr) {
|
||||
size_t size = lseekFunction(handle, 0, SEEK_END);
|
||||
bo = createSharedBufferObject(boHandle, size, requireSpecificBitness, rootDeviceIndex);
|
||||
bo = createSharedBufferObject(boHandle, size, requireSpecificBitness, properties.rootDeviceIndex);
|
||||
|
||||
if (!bo) {
|
||||
return nullptr;
|
||||
@@ -434,12 +432,12 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
|
||||
|
||||
lock.unlock();
|
||||
|
||||
auto drmAllocation = new DrmAllocation(rootDeviceIndex, properties.allocationType, bo, reinterpret_cast<void *>(bo->gpuAddress), bo->size,
|
||||
auto drmAllocation = new DrmAllocation(properties.rootDeviceIndex, properties.allocationType, bo, reinterpret_cast<void *>(bo->gpuAddress), bo->size,
|
||||
handle, MemoryPool::SystemCpuInaccessible);
|
||||
|
||||
if (requireSpecificBitness && this->force32bitAllocations) {
|
||||
drmAllocation->set32BitAllocation(true);
|
||||
drmAllocation->setGpuBaseAddress(GmmHelper::canonize(getExternalHeapBaseAddress(rootDeviceIndex)));
|
||||
drmAllocation->setGpuBaseAddress(GmmHelper::canonize(getExternalHeapBaseAddress(properties.rootDeviceIndex)));
|
||||
}
|
||||
|
||||
if (properties.imgInfo) {
|
||||
|
||||
@@ -254,8 +254,7 @@ GraphicsAllocation *WddmMemoryManager::createAllocationFromHandle(osHandle handl
|
||||
}
|
||||
|
||||
GraphicsAllocation *WddmMemoryManager::createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness) {
|
||||
uint32_t rootDeviceIndex = properties.rootDeviceIndex == AllocationProperties::noDeviceSpecified ? 0 : properties.rootDeviceIndex;
|
||||
return createAllocationFromHandle(handle, requireSpecificBitness, false, properties.allocationType, rootDeviceIndex);
|
||||
return createAllocationFromHandle(handle, requireSpecificBitness, false, properties.allocationType, properties.rootDeviceIndex);
|
||||
}
|
||||
|
||||
GraphicsAllocation *WddmMemoryManager::createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex) {
|
||||
|
||||
@@ -475,10 +475,10 @@ uint32_t KernelInfo::getConstantBufferSize() const {
|
||||
return patchInfo.dataParameterStream ? patchInfo.dataParameterStream->DataParameterStreamSize : 0;
|
||||
}
|
||||
|
||||
bool KernelInfo::createKernelAllocation(MemoryManager *memoryManager) {
|
||||
bool KernelInfo::createKernelAllocation(uint32_t rootDeviceIndex, MemoryManager *memoryManager) {
|
||||
UNRECOVERABLE_IF(kernelAllocation);
|
||||
auto kernelIsaSize = heapInfo.pKernelHeader->KernelHeapSize;
|
||||
kernelAllocation = memoryManager->allocateGraphicsMemoryWithProperties({kernelIsaSize, GraphicsAllocation::AllocationType::KERNEL_ISA});
|
||||
kernelAllocation = memoryManager->allocateGraphicsMemoryWithProperties({rootDeviceIndex, kernelIsaSize, GraphicsAllocation::AllocationType::KERNEL_ISA});
|
||||
if (!kernelAllocation) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ struct KernelInfo {
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool createKernelAllocation(MemoryManager *memoryManager);
|
||||
bool createKernelAllocation(uint32_t rootDeviceIndex, MemoryManager *memoryManager);
|
||||
|
||||
std::string name;
|
||||
std::string attributes;
|
||||
|
||||
@@ -38,7 +38,7 @@ void PrintfHandler::prepareDispatch(const MultiDispatchInfo &multiDispatchInfo)
|
||||
return;
|
||||
}
|
||||
kernel = multiDispatchInfo.peekMainKernel();
|
||||
printfSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({printfSurfaceSize, GraphicsAllocation::AllocationType::PRINTF_SURFACE});
|
||||
printfSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({device.getRootDeviceIndex(), printfSurfaceSize, GraphicsAllocation::AllocationType::PRINTF_SURFACE});
|
||||
*reinterpret_cast<uint32_t *>(printfSurface->getUnderlyingBuffer()) = printfSurfaceInitialDataSize;
|
||||
|
||||
auto printfPatchAddress = ptrOffset(reinterpret_cast<uintptr_t *>(kernel->getCrossThreadData()),
|
||||
|
||||
@@ -861,7 +861,7 @@ cl_int Program::parsePatchList(KernelInfo &kernelInfo, uint32_t kernelNum) {
|
||||
}
|
||||
|
||||
if (kernelInfo.heapInfo.pKernelHeader->KernelHeapSize && this->pDevice) {
|
||||
retVal = kernelInfo.createKernelAllocation(this->pDevice->getMemoryManager()) ? CL_SUCCESS : CL_OUT_OF_HOST_MEMORY;
|
||||
retVal = kernelInfo.createKernelAllocation(this->pDevice->getRootDeviceIndex(), this->pDevice->getMemoryManager()) ? CL_SUCCESS : CL_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
if (this->pDevice && kernelInfo.workloadInfo.slmStaticSize > this->pDevice->getDeviceInfo().localMemSize) {
|
||||
@@ -884,7 +884,7 @@ GraphicsAllocation *allocateGlobalsSurface(NEO::Context *ctx, NEO::Device *devic
|
||||
svmProps.coherent = false;
|
||||
svmProps.readOnly = constant;
|
||||
svmProps.hostPtrReadOnly = constant;
|
||||
auto ptr = ctx->getSVMAllocsManager()->createSVMAlloc(size, svmProps);
|
||||
auto ptr = ctx->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), size, svmProps);
|
||||
UNRECOVERABLE_IF(ptr == nullptr);
|
||||
auto svmAlloc = ctx->getSVMAllocsManager()->getSVMAlloc(ptr);
|
||||
UNRECOVERABLE_IF(svmAlloc == nullptr);
|
||||
@@ -896,7 +896,7 @@ GraphicsAllocation *allocateGlobalsSurface(NEO::Context *ctx, NEO::Device *devic
|
||||
} else {
|
||||
UNRECOVERABLE_IF(device == nullptr);
|
||||
auto allocationType = constant ? GraphicsAllocation::AllocationType::CONSTANT_SURFACE : GraphicsAllocation::AllocationType::GLOBAL_SURFACE;
|
||||
auto gpuAlloc = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({size, allocationType});
|
||||
auto gpuAlloc = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), size, allocationType});
|
||||
UNRECOVERABLE_IF(gpuAlloc == nullptr);
|
||||
memcpy_s(gpuAlloc->getUnderlyingBuffer(), gpuAlloc->getUnderlyingBufferSize(), initData, size);
|
||||
return gpuAlloc;
|
||||
|
||||
@@ -361,7 +361,7 @@ void Program::separateBlockKernels() {
|
||||
allKernelInfos.clear();
|
||||
}
|
||||
|
||||
void Program::allocateBlockPrivateSurfaces() {
|
||||
void Program::allocateBlockPrivateSurfaces(uint32_t rootDeviceIndex) {
|
||||
size_t blockCount = blockKernelManager->getCount();
|
||||
|
||||
for (uint32_t i = 0; i < blockCount; i++) {
|
||||
@@ -372,7 +372,7 @@ void Program::allocateBlockPrivateSurfaces() {
|
||||
|
||||
if (privateSize > 0 && blockKernelManager->getPrivateSurface(i) == nullptr) {
|
||||
privateSize *= getDevice(0).getDeviceInfo().computeUnitsUsedForScratch * info->getMaxSimdSize();
|
||||
auto *privateSurface = this->executionEnvironment.memoryManager->allocateGraphicsMemoryWithProperties({privateSize, GraphicsAllocation::AllocationType::PRIVATE_SURFACE});
|
||||
auto *privateSurface = this->executionEnvironment.memoryManager->allocateGraphicsMemoryWithProperties({rootDeviceIndex, privateSize, GraphicsAllocation::AllocationType::PRIVATE_SURFACE});
|
||||
blockKernelManager->pushPrivateSurface(privateSurface, i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ class Program : public BaseObject<_cl_program> {
|
||||
return blockKernelManager;
|
||||
}
|
||||
|
||||
void allocateBlockPrivateSurfaces();
|
||||
void allocateBlockPrivateSurfaces(uint32_t rootDeviceIndex);
|
||||
void freeBlockResources();
|
||||
void cleanCurrentKernelInfo();
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class D3DBuffer : public D3DSharing<D3D> {
|
||||
}
|
||||
|
||||
sharingFcns->getSharedHandle(bufferStaging, &sharedHandle);
|
||||
AllocationProperties properties = {false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false};
|
||||
AllocationProperties properties = {context->getDevice(0)->getRootDeviceIndex(), false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false};
|
||||
auto alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)sharedHandle), properties, true);
|
||||
|
||||
auto d3dBufferObj = new D3DBuffer<D3D>(context, d3dBuffer, bufferStaging, sharedResource);
|
||||
|
||||
@@ -76,11 +76,12 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
|
||||
|
||||
bool isSharedResource = false;
|
||||
bool lockable = false;
|
||||
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
|
||||
|
||||
GraphicsAllocation *alloc = nullptr;
|
||||
if (surfaceInfo->shared_handle) {
|
||||
isSharedResource = true;
|
||||
AllocationProperties allocProperties(false, 0u, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||
AllocationProperties allocProperties(rootDeviceIndex, false, 0u, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||
alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)surfaceInfo->shared_handle), allocProperties,
|
||||
false);
|
||||
updateImgInfo(alloc->getDefaultGmm(), imgInfo, imgDesc, oclPlane, 0u);
|
||||
@@ -94,7 +95,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
|
||||
imgDesc.image_height /= 2;
|
||||
}
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(imgInfo, true, memoryProperties);
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(rootDeviceIndex, imgInfo, true, memoryProperties);
|
||||
allocProperties.allocationType = GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY;
|
||||
|
||||
alloc = context->getMemoryManager()->allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr);
|
||||
|
||||
@@ -65,13 +65,14 @@ Image *D3DTexture<D3D>::create2d(Context *context, D3DTexture2d *d3dTexture, cl_
|
||||
|
||||
GraphicsAllocation *alloc = nullptr;
|
||||
auto memoryManager = context->getMemoryManager();
|
||||
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
|
||||
|
||||
if (textureDesc.MiscFlags & D3DResourceFlags::MISC_SHARED_NTHANDLE) {
|
||||
sharingFcns->getSharedNTHandle(textureStaging, &sharedHandle);
|
||||
alloc = memoryManager->createGraphicsAllocationFromNTHandle(sharedHandle, 0);
|
||||
alloc = memoryManager->createGraphicsAllocationFromNTHandle(sharedHandle, rootDeviceIndex);
|
||||
} else {
|
||||
sharingFcns->getSharedHandle(textureStaging, &sharedHandle);
|
||||
AllocationProperties allocProperties(nullptr, false, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||
AllocationProperties allocProperties(rootDeviceIndex, nullptr, false, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||
alloc = memoryManager->createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)sharedHandle), allocProperties, false);
|
||||
}
|
||||
DEBUG_BREAK_IF(!alloc);
|
||||
@@ -128,13 +129,14 @@ Image *D3DTexture<D3D>::create3d(Context *context, D3DTexture3d *d3dTexture, cl_
|
||||
|
||||
GraphicsAllocation *alloc = nullptr;
|
||||
auto memoryManager = context->getMemoryManager();
|
||||
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
|
||||
|
||||
if (textureDesc.MiscFlags & D3DResourceFlags::MISC_SHARED_NTHANDLE) {
|
||||
sharingFcns->getSharedNTHandle(textureStaging, &sharedHandle);
|
||||
alloc = memoryManager->createGraphicsAllocationFromNTHandle(sharedHandle, 0);
|
||||
alloc = memoryManager->createGraphicsAllocationFromNTHandle(sharedHandle, rootDeviceIndex);
|
||||
} else {
|
||||
sharingFcns->getSharedHandle(textureStaging, &sharedHandle);
|
||||
AllocationProperties allocProperties(nullptr, false, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||
AllocationProperties allocProperties(rootDeviceIndex, nullptr, false, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||
alloc = memoryManager->createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)sharedHandle), allocProperties, false);
|
||||
}
|
||||
DEBUG_BREAK_IF(!alloc);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "public/cl_gl_private_intel.h"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/gmm_helper/gmm.h"
|
||||
#include "runtime/helpers/get_info.h"
|
||||
#include "runtime/mem_obj/buffer.h"
|
||||
@@ -128,7 +129,7 @@ GraphicsAllocation *GlBuffer::createGraphicsAllocation(Context *context, unsigne
|
||||
}
|
||||
|
||||
if (!graphicsAllocation) {
|
||||
AllocationProperties properties = {false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false};
|
||||
AllocationProperties properties = {context->getDevice(0)->getRootDeviceIndex(), false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false};
|
||||
// couldn't find allocation for reuse - create new
|
||||
graphicsAllocation =
|
||||
context->getMemoryManager()->createGraphicsAllocationFromSharedHandle(bufferInfo.globalShareHandle, properties, true);
|
||||
|
||||
@@ -46,7 +46,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
|
||||
|
||||
errorCode.set(CL_SUCCESS);
|
||||
|
||||
AllocationProperties allocProperties(false, 0u, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||
AllocationProperties allocProperties(context->getDevice(0)->getRootDeviceIndex(), false, 0u, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||
auto alloc = memoryManager->createGraphicsAllocationFromSharedHandle(texInfo.globalShareHandle, allocProperties, false);
|
||||
|
||||
if (alloc == nullptr) {
|
||||
@@ -115,7 +115,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
|
||||
|
||||
GraphicsAllocation *mcsAlloc = nullptr;
|
||||
if (texInfo.globalShareHandleMCS) {
|
||||
AllocationProperties allocProperties(0, GraphicsAllocation::AllocationType::MCS);
|
||||
AllocationProperties allocProperties(context->getDevice(0)->getRootDeviceIndex(), 0, GraphicsAllocation::AllocationType::MCS);
|
||||
mcsAlloc = memoryManager->createGraphicsAllocationFromSharedHandle(texInfo.globalShareHandleMCS, allocProperties, false);
|
||||
if (texInfo.pGmmResInfoMCS) {
|
||||
DEBUG_BREAK_IF(mcsAlloc->getDefaultGmm() != nullptr);
|
||||
|
||||
@@ -62,7 +62,7 @@ Image *VASurface::createSharedVaSurface(Context *context, VASharingFunctions *sh
|
||||
auto imgSurfaceFormat = Image::getSurfaceFormatFromTable(flags, &imgFormat);
|
||||
|
||||
sharingFunctions->extGetSurfaceHandle(surface, &sharedHandle);
|
||||
AllocationProperties properties(false, imgInfo, GraphicsAllocation::AllocationType::SHARED_IMAGE);
|
||||
AllocationProperties properties(context->getDevice(0)->getRootDeviceIndex(), false, imgInfo, GraphicsAllocation::AllocationType::SHARED_IMAGE);
|
||||
|
||||
auto alloc = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
||||
|
||||
|
||||
@@ -51,7 +51,9 @@ class TagAllocator {
|
||||
public:
|
||||
using NodeType = TagNode<TagType>;
|
||||
|
||||
TagAllocator(MemoryManager *memMngr, size_t tagCount, size_t tagAlignment, size_t tagSize = sizeof(TagType)) : memoryManager(memMngr),
|
||||
TagAllocator(uint32_t rootDeviceIndex, MemoryManager *memMngr, size_t tagCount,
|
||||
size_t tagAlignment, size_t tagSize = sizeof(TagType)) : rootDeviceIndex(rootDeviceIndex),
|
||||
memoryManager(memMngr),
|
||||
tagCount(tagCount),
|
||||
tagAlignment(tagAlignment) {
|
||||
|
||||
@@ -108,6 +110,7 @@ class TagAllocator {
|
||||
std::vector<GraphicsAllocation *> gfxAllocations;
|
||||
std::vector<NodeType *> tagPoolMemory;
|
||||
|
||||
const uint32_t rootDeviceIndex;
|
||||
MemoryManager *memoryManager;
|
||||
size_t tagCount;
|
||||
size_t tagAlignment;
|
||||
@@ -132,7 +135,7 @@ class TagAllocator {
|
||||
size_t allocationSizeRequired = tagCount * tagSize;
|
||||
|
||||
auto allocationType = TagType::getAllocationType();
|
||||
GraphicsAllocation *graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties({allocationSizeRequired, allocationType});
|
||||
GraphicsAllocation *graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties({rootDeviceIndex, allocationSizeRequired, allocationType});
|
||||
gfxAllocations.push_back(graphicsAllocation);
|
||||
|
||||
uint64_t gpuBaseAddress = graphicsAllocation->getGpuAddress();
|
||||
|
||||
@@ -372,7 +372,7 @@ TEST_F(CommandQueueCommandStreamTest, givenCommandStreamReceiverWithReusableAllo
|
||||
|
||||
auto memoryManager = pDevice->getMemoryManager();
|
||||
size_t requiredSize = alignUp(100 + CSRequirements::minCommandQueueCommandStreamSize + CSRequirements::csOverfetchSize, MemoryConstants::pageSize64k);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({requiredSize, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), requiredSize, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto &commandStreamReceiver = cmdQ.getGpgpuCommandStreamReceiver();
|
||||
commandStreamReceiver.getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION);
|
||||
|
||||
|
||||
@@ -818,7 +818,7 @@ HWTEST_F(DispatchWalkerTest, givenThereAreAllocationsForReuseWhenDispatchWalkerI
|
||||
MockMultiDispatchInfo multiDispatchInfo(&kernel);
|
||||
|
||||
auto &csr = pCmdQ->getGpgpuCommandStreamReceiver();
|
||||
auto allocation = csr.getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize64k + CSRequirements::csOverfetchSize,
|
||||
auto allocation = csr.getMemoryManager()->allocateGraphicsMemoryWithProperties({csr.getRootDeviceIndex(), MemoryConstants::pageSize64k + CSRequirements::csOverfetchSize,
|
||||
GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
csr.getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>{allocation}, REUSABLE_ALLOCATION);
|
||||
ASSERT_FALSE(csr.getInternalAllocationStorage()->getAllocationsForReuse().peekIsEmpty());
|
||||
@@ -868,8 +868,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DispatchWalkerTest, GivenMultipleKernelsWhenDispatch
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
|
||||
auto memoryManager = this->pDevice->getMemoryManager();
|
||||
auto kernelIsaAllocation = memoryManager->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::KERNEL_ISA});
|
||||
auto kernelIsaWithSamplerAllocation = memoryManager->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::KERNEL_ISA});
|
||||
auto kernelIsaAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::KERNEL_ISA});
|
||||
auto kernelIsaWithSamplerAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::KERNEL_ISA});
|
||||
kernelInfo.kernelAllocation = kernelIsaAllocation;
|
||||
kernelInfoWithSampler.kernelAllocation = kernelIsaWithSamplerAllocation;
|
||||
auto gpuAddress1 = kernelIsaAllocation->getGpuAddressToPatch();
|
||||
@@ -1369,7 +1369,7 @@ HWTEST_P(ProfilingCommandsTest, givenKernelWhenProfilingCommandStartIsTakenThenT
|
||||
bool checkForStart = GetParam();
|
||||
|
||||
auto &cmdStream = pCmdQ->getCS(0);
|
||||
TagAllocator<HwTimeStamps> timeStampAllocator(this->pDevice->getMemoryManager(), 10, MemoryConstants::cacheLineSize);
|
||||
TagAllocator<HwTimeStamps> timeStampAllocator(pDevice->getRootDeviceIndex(), this->pDevice->getMemoryManager(), 10, MemoryConstants::cacheLineSize);
|
||||
|
||||
auto hwTimeStamp1 = timeStampAllocator.getTag();
|
||||
ASSERT_NE(nullptr, hwTimeStamp1);
|
||||
|
||||
@@ -225,7 +225,7 @@ HWTEST_F(EnqueueHandlerTest, givenTimestampPacketWriteEnabledAndCommandWithCache
|
||||
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
csr.timestampPacketWriteEnabled = true;
|
||||
|
||||
auto mockTagAllocator = new MockTagAllocator<>(pDevice->getMemoryManager());
|
||||
auto mockTagAllocator = new MockTagAllocator<>(csr.rootDeviceIndex, pDevice->getMemoryManager());
|
||||
csr.timestampPacketAllocator.reset(mockTagAllocator);
|
||||
std::unique_ptr<MockCommandQueueWithCacheFlush<FamilyType>> mockCmdQ(new MockCommandQueueWithCacheFlush<FamilyType>(context, pDevice, 0));
|
||||
mockCmdQ->commandRequireCacheFlush = true;
|
||||
@@ -241,7 +241,7 @@ HWTEST_F(EnqueueHandlerTest, givenTimestampPacketWriteDisabledAndCommandWithCach
|
||||
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
csr.timestampPacketWriteEnabled = false;
|
||||
|
||||
auto mockTagAllocator = new MockTagAllocator<>(pDevice->getMemoryManager());
|
||||
auto mockTagAllocator = new MockTagAllocator<>(pDevice->getRootDeviceIndex(), pDevice->getMemoryManager());
|
||||
csr.timestampPacketAllocator.reset(mockTagAllocator);
|
||||
std::unique_ptr<MockCommandQueueWithCacheFlush<FamilyType>> mockCmdQ(new MockCommandQueueWithCacheFlush<FamilyType>(context, pDevice, 0));
|
||||
mockCmdQ->commandRequireCacheFlush = true;
|
||||
|
||||
@@ -439,7 +439,7 @@ HWTEST_F(EnqueueKernelTest, givenReducedAddressSpaceGraphicsAllocationForHostPtr
|
||||
auto memoryManager = mockCsr->getMemoryManager();
|
||||
uint32_t hostPtr[10]{};
|
||||
|
||||
AllocationProperties properties{false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{device->getRootDeviceIndex(), false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = true;
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||
MockKernelWithInternals mockKernel(*device, context);
|
||||
@@ -463,7 +463,7 @@ HWTEST_F(EnqueueKernelTest, givenReducedAddressSpaceGraphicsAllocationForHostPtr
|
||||
auto memoryManager = mockCsr->getMemoryManager();
|
||||
uint32_t hostPtr[10]{};
|
||||
|
||||
AllocationProperties properties{false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{device->getRootDeviceIndex(), false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = false;
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||
MockKernelWithInternals mockKernel(*device, context);
|
||||
@@ -488,7 +488,7 @@ HWTEST_F(EnqueueKernelTest, givenFullAddressSpaceGraphicsAllocationWhenEnqueueKe
|
||||
auto memoryManager = mockCsr->getMemoryManager();
|
||||
uint32_t hostPtr[10]{};
|
||||
|
||||
AllocationProperties properties{false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{device->getRootDeviceIndex(), false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = false;
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||
MockKernelWithInternals mockKernel(*device, context);
|
||||
|
||||
@@ -31,9 +31,9 @@ struct EnqueueSvmMemCopyTest : public DeviceFixture,
|
||||
}
|
||||
|
||||
CommandQueueFixture::SetUp(pDevice, 0);
|
||||
srcSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
srcSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
ASSERT_NE(nullptr, srcSvmPtr);
|
||||
dstSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
dstSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
ASSERT_NE(nullptr, dstSvmPtr);
|
||||
auto srcSvmData = context->getSVMAllocsManager()->getSVMAlloc(srcSvmPtr);
|
||||
ASSERT_NE(nullptr, srcSvmData);
|
||||
|
||||
@@ -34,7 +34,7 @@ struct EnqueueSvmMemFillTest : public DeviceFixture,
|
||||
ASSERT_TRUE((0 < patternSize) && (patternSize <= 128));
|
||||
SVMAllocsManager::SvmAllocationProperties svmProperties;
|
||||
svmProperties.coherent = true;
|
||||
svmPtr = context->getSVMAllocsManager()->createSVMAlloc(256, svmProperties);
|
||||
svmPtr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, svmProperties);
|
||||
ASSERT_NE(nullptr, svmPtr);
|
||||
auto svmData = context->getSVMAllocsManager()->getSVMAlloc(svmPtr);
|
||||
ASSERT_NE(nullptr, svmData);
|
||||
|
||||
@@ -43,7 +43,7 @@ struct EnqueueSvmTest : public DeviceFixture,
|
||||
}
|
||||
DeviceFixture::SetUp();
|
||||
CommandQueueFixture::SetUp(pDevice, 0);
|
||||
ptrSVM = context->getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
ptrSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
@@ -251,7 +251,7 @@ TEST_F(EnqueueSvmTest, enqueueSVMMemcpy_InvalidValueDstPtrIsNull) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.EnableAsyncEventsHandler.set(false);
|
||||
void *pDstSVM = nullptr;
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
retVal = this->pCmdQ->enqueueSVMMemcpy(
|
||||
false, // cl_bool blocking_copy
|
||||
pDstSVM, // void *dst_ptr
|
||||
@@ -496,7 +496,7 @@ TEST_F(EnqueueSvmTest, givenDstHostPtrAndSrcHostPtrAndSizeZeroWhenEnqueueSVMMemc
|
||||
|
||||
HWTEST_F(EnqueueSvmTest, givenSvmToSvmCopyTypeWhenEnqueueNonBlockingSVMMemcpyThenSvmMemcpyCommandIsEnqueued) {
|
||||
void *pDstSVM = ptrSVM;
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
MockCommandQueueHw<FamilyType> myCmdQ(context, pDevice, 0);
|
||||
retVal = myCmdQ.enqueueSVMMemcpy(
|
||||
false, // cl_bool blocking_copy
|
||||
@@ -526,7 +526,7 @@ HWTEST_F(EnqueueSvmTest, givenSvmToSvmCopyTypeWhenEnqueueNonBlockingSVMMemcpyThe
|
||||
|
||||
TEST_F(EnqueueSvmTest, givenSvmToSvmCopyTypeWhenEnqueueBlockingSVMMemcpyThenSuccessIsReturned) {
|
||||
void *pDstSVM = ptrSVM;
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
retVal = this->pCmdQ->enqueueSVMMemcpy(
|
||||
true, // cl_bool blocking_copy
|
||||
pDstSVM, // void *dst_ptr
|
||||
@@ -542,7 +542,7 @@ TEST_F(EnqueueSvmTest, givenSvmToSvmCopyTypeWhenEnqueueBlockingSVMMemcpyThenSucc
|
||||
|
||||
TEST_F(EnqueueSvmTest, enqueueSVMMemcpyBlockedOnEvent_Success) {
|
||||
void *pDstSVM = ptrSVM;
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
auto uEvent = make_releaseable<UserEvent>();
|
||||
cl_event eventWaitList[] = {uEvent.get()};
|
||||
retVal = this->pCmdQ->enqueueSVMMemcpy(
|
||||
@@ -563,7 +563,7 @@ TEST_F(EnqueueSvmTest, enqueueSVMMemcpyCoherent_Success) {
|
||||
void *pDstSVM = ptrSVM;
|
||||
SVMAllocsManager::SvmAllocationProperties svmProperties;
|
||||
svmProperties.coherent = true;
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256, svmProperties);
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, svmProperties);
|
||||
retVal = this->pCmdQ->enqueueSVMMemcpy(
|
||||
false, // cl_bool blocking_copy
|
||||
pDstSVM, // void *dst_ptr
|
||||
@@ -581,7 +581,7 @@ TEST_F(EnqueueSvmTest, enqueueSVMMemcpyCoherentBlockedOnEvent_Success) {
|
||||
void *pDstSVM = ptrSVM;
|
||||
SVMAllocsManager::SvmAllocationProperties svmProperties;
|
||||
svmProperties.coherent = true;
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256, svmProperties);
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, svmProperties);
|
||||
auto uEvent = make_releaseable<UserEvent>();
|
||||
cl_event eventWaitList[] = {uEvent.get()};
|
||||
retVal = this->pCmdQ->enqueueSVMMemcpy(
|
||||
@@ -806,7 +806,7 @@ TEST_F(EnqueueSvmTest, concurentMapAccess) {
|
||||
|
||||
auto allocSvm = [&](uint32_t from, uint32_t to) {
|
||||
for (uint32_t i = from; i <= to; i++) {
|
||||
svmPtrs[i] = context->getSVMAllocsManager()->createSVMAlloc(1, {});
|
||||
svmPtrs[i] = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 1, {});
|
||||
auto svmData = context->getSVMAllocsManager()->getSVMAlloc(svmPtrs[i]);
|
||||
ASSERT_NE(nullptr, svmData);
|
||||
auto ga = svmData->gpuAllocation;
|
||||
@@ -882,7 +882,7 @@ TEST(CreateSvmAllocTests, givenVariousSvmAllocationPropertiesWhenAllocatingSvmTh
|
||||
svmAllocationProperties.readOnly = isReadOnly;
|
||||
svmAllocationProperties.hostPtrReadOnly = isHostPtrReadOnly;
|
||||
|
||||
auto ptrSVM = mockContext->getSVMAllocsManager()->createSVMAlloc(256, svmAllocationProperties);
|
||||
auto ptrSVM = mockContext->getSVMAllocsManager()->createSVMAlloc(mockDevice->getRootDeviceIndex(), 256, svmAllocationProperties);
|
||||
EXPECT_NE(nullptr, ptrSVM);
|
||||
mockContext->getSVMAllocsManager()->freeSVMAlloc(ptrSVM);
|
||||
}
|
||||
@@ -902,7 +902,7 @@ struct EnqueueSvmTestLocalMemory : public DeviceFixture,
|
||||
DeviceFixture::SetUp();
|
||||
context = std::make_unique<MockContext>(pDevice, true);
|
||||
size = 256;
|
||||
svmPtr = context->getSVMAllocsManager()->createSVMAlloc(size, {});
|
||||
svmPtr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), size, {});
|
||||
ASSERT_NE(nullptr, svmPtr);
|
||||
mockSvmManager = reinterpret_cast<MockSVMAllocsManager *>(context->getSVMAllocsManager());
|
||||
}
|
||||
@@ -1264,7 +1264,7 @@ HWTEST_F(EnqueueSvmTest, whenInternalAllocationsAreMadeResidentThenOnlyNonSvmAll
|
||||
auto allocationSize = 4096u;
|
||||
auto svmManager = this->context->getSVMAllocsManager();
|
||||
EXPECT_NE(0u, svmManager->getNumAllocs());
|
||||
auto unifiedMemoryPtr = svmManager->createUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties);
|
||||
auto unifiedMemoryPtr = svmManager->createUnifiedMemoryAllocation(pDevice->getRootDeviceIndex(), allocationSize, unifiedMemoryProperties);
|
||||
EXPECT_NE(nullptr, unifiedMemoryPtr);
|
||||
EXPECT_EQ(2u, svmManager->getNumAllocs());
|
||||
|
||||
@@ -1351,7 +1351,7 @@ TEST_F(EnqueueSvmTest, givenPageFaultManagerWhenEnqueueMemcpyThenAllocIsDecommit
|
||||
mockMemoryManager->pageFaultManager.reset(new MockPageFaultManager());
|
||||
auto memoryManager = context->getMemoryManager();
|
||||
context->memoryManager = mockMemoryManager.get();
|
||||
auto srcSvm = context->getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
auto srcSvm = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
mockMemoryManager->getPageFaultManager()->insertAllocation(srcSvm, 256, context->getSVMAllocsManager(), context->getSpecialQueue());
|
||||
mockMemoryManager->getPageFaultManager()->insertAllocation(ptrSVM, 256, context->getSVMAllocsManager(), context->getSpecialQueue());
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->transferToCpuCalled, 2);
|
||||
|
||||
@@ -164,7 +164,7 @@ HWTEST_F(MultipleMapBufferTest, givenNotMappedPtrWhenUnmapedOnGpuThenReturnError
|
||||
EXPECT_FALSE(buffer->mappingOnCpuAllowed());
|
||||
|
||||
EXPECT_EQ(0u, buffer->mapOperationsHandler.size());
|
||||
retVal = clEnqueueUnmapMemObject(cmdQ.get(), buffer.get(), buffer->getBasePtrForMap(), 0, nullptr, nullptr);
|
||||
retVal = clEnqueueUnmapMemObject(cmdQ.get(), buffer.get(), buffer->getBasePtrForMap(cmdQ->getDevice().getRootDeviceIndex()), 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_INVALID_VALUE, retVal);
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ HWTEST_F(MultipleMapBufferTest, givenInvalidPtrWhenUnmappedOnCpuThenReturnError)
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
EXPECT_TRUE(buffer->mappingOnCpuAllowed());
|
||||
|
||||
retVal = clEnqueueUnmapMemObject(cmdQ.get(), buffer.get(), buffer->getBasePtrForMap(), 0, nullptr, nullptr);
|
||||
retVal = clEnqueueUnmapMemObject(cmdQ.get(), buffer.get(), buffer->getBasePtrForMap(cmdQ->getDevice().getRootDeviceIndex()), 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_INVALID_VALUE, retVal);
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ HWTEST_F(MultipleMapImageTest, givenNotMappedPtrWhenUnmapedThenReturnError) {
|
||||
EXPECT_EQ(!UnitTestHelper<FamilyType>::tiledImagesSupported, image->mappingOnCpuAllowed());
|
||||
|
||||
EXPECT_EQ(0u, image->mapOperationsHandler.size());
|
||||
retVal = clEnqueueUnmapMemObject(cmdQ.get(), image.get(), image->getBasePtrForMap(), 0, nullptr, nullptr);
|
||||
retVal = clEnqueueUnmapMemObject(cmdQ.get(), image.get(), image->getBasePtrForMap(cmdQ->getDevice().getRootDeviceIndex()), 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_INVALID_VALUE, retVal);
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ HWTEST_F(MultipleMapImageTest, givenInvalidPtrWhenUnmappedOnCpuThenReturnError)
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
EXPECT_TRUE(image->mappingOnCpuAllowed());
|
||||
|
||||
retVal = clEnqueueUnmapMemObject(cmdQ.get(), image.get(), image->getBasePtrForMap(), 0, nullptr, nullptr);
|
||||
retVal = clEnqueueUnmapMemObject(cmdQ.get(), image.get(), image->getBasePtrForMap(cmdQ->getDevice().getRootDeviceIndex()), 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_INVALID_VALUE, retVal);
|
||||
}
|
||||
|
||||
|
||||
@@ -782,8 +782,8 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, enqueueSVMMemcpyWhenZeroSizeEnqueueIsDetect
|
||||
}
|
||||
auto mockCmdQ = std::unique_ptr<MockCommandQueueHw<FamilyType>>(new MockCommandQueueHw<FamilyType>(&context, pDevice, 0));
|
||||
|
||||
void *pSrcSVM = context.getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
void *pDstSVM = context.getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
void *pSrcSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
void *pDstSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
size_t zeroSize = 0;
|
||||
mockCmdQ->enqueueSVMMemcpy(false, pSrcSVM, pDstSVM, zeroSize, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(static_cast<cl_command_type>(CL_COMMAND_MARKER), mockCmdQ->lastCommandType);
|
||||
@@ -799,8 +799,8 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, enqueueSVMMemcpyWhenZeroSizeEnqueueIsDetect
|
||||
auto mockCmdQ = std::unique_ptr<MockCommandQueueHw<FamilyType>>(new MockCommandQueueHw<FamilyType>(&context, pDevice, 0));
|
||||
|
||||
cl_event event;
|
||||
void *pSrcSVM = context.getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
void *pDstSVM = context.getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
void *pSrcSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
void *pDstSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
size_t zeroSize = 0;
|
||||
mockCmdQ->enqueueSVMMemcpy(false, pSrcSVM, pDstSVM, zeroSize, 0, nullptr, &event);
|
||||
EXPECT_EQ(static_cast<cl_command_type>(CL_COMMAND_MARKER), mockCmdQ->lastCommandType);
|
||||
@@ -824,7 +824,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, enqueueSVMMemFillWhenZeroSizeEnqueueIsDetec
|
||||
}
|
||||
auto mockCmdQ = std::unique_ptr<MockCommandQueueHw<FamilyType>>(new MockCommandQueueHw<FamilyType>(&context, pDevice, 0));
|
||||
|
||||
void *pSVM = context.getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
void *pSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
const float pattern[1] = {1.2345f};
|
||||
size_t zeroSize = 0;
|
||||
mockCmdQ->enqueueSVMMemFill(pSVM, &pattern, sizeof(pattern), zeroSize, 0, nullptr, nullptr);
|
||||
@@ -840,7 +840,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, enqueueSVMMemFillWhenZeroSizeEnqueueIsDetec
|
||||
auto mockCmdQ = std::unique_ptr<MockCommandQueueHw<FamilyType>>(new MockCommandQueueHw<FamilyType>(&context, pDevice, 0));
|
||||
|
||||
cl_event event;
|
||||
void *pSVM = context.getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
void *pSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
const float pattern[1] = {1.2345f};
|
||||
size_t zeroSize = 0;
|
||||
mockCmdQ->enqueueSVMMemFill(pSVM, &pattern, sizeof(pattern), zeroSize, 0, nullptr, &event);
|
||||
|
||||
@@ -54,7 +54,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
|
||||
size_t sizeBatchBuffer = 0xffffu;
|
||||
|
||||
std::unique_ptr<GraphicsAllocation, std::function<void(GraphicsAllocation *)>> flatBatchBuffer(
|
||||
aubCsr->getFlatBatchBufferHelper().flattenBatchBuffer(batchBuffer, sizeBatchBuffer, DispatchMode::ImmediateDispatch),
|
||||
aubCsr->getFlatBatchBufferHelper().flattenBatchBuffer(aubCsr->getRootDeviceIndex(), batchBuffer, sizeBatchBuffer, DispatchMode::ImmediateDispatch),
|
||||
[&](GraphicsAllocation *ptr) { memoryManager->freeGraphicsMemory(ptr); });
|
||||
EXPECT_NE(nullptr, flatBatchBuffer->getUnderlyingBuffer());
|
||||
EXPECT_EQ(alignUp(128u + 128u, MemoryConstants::pageSize), sizeBatchBuffer);
|
||||
@@ -79,7 +79,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
|
||||
size_t sizeBatchBuffer = 0xffffu;
|
||||
|
||||
std::unique_ptr<GraphicsAllocation, std::function<void(GraphicsAllocation *)>> flatBatchBuffer(
|
||||
aubCsr->getFlatBatchBufferHelper().flattenBatchBuffer(batchBuffer, sizeBatchBuffer, DispatchMode::ImmediateDispatch),
|
||||
aubCsr->getFlatBatchBufferHelper().flattenBatchBuffer(aubCsr->getRootDeviceIndex(), batchBuffer, sizeBatchBuffer, DispatchMode::ImmediateDispatch),
|
||||
[&](GraphicsAllocation *ptr) { memoryManager->freeGraphicsMemory(ptr); });
|
||||
EXPECT_EQ(nullptr, flatBatchBuffer.get());
|
||||
EXPECT_EQ(0xffffu, sizeBatchBuffer);
|
||||
@@ -106,7 +106,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
|
||||
size_t sizeBatchBuffer = 0xffffu;
|
||||
|
||||
std::unique_ptr<GraphicsAllocation, std::function<void(GraphicsAllocation *)>> flatBatchBuffer(
|
||||
aubCsr->getFlatBatchBufferHelper().flattenBatchBuffer(batchBuffer, sizeBatchBuffer, DispatchMode::AdaptiveDispatch),
|
||||
aubCsr->getFlatBatchBufferHelper().flattenBatchBuffer(aubCsr->getRootDeviceIndex(), batchBuffer, sizeBatchBuffer, DispatchMode::AdaptiveDispatch),
|
||||
[&](GraphicsAllocation *ptr) { memoryManager->freeGraphicsMemory(ptr); });
|
||||
EXPECT_EQ(nullptr, flatBatchBuffer.get());
|
||||
EXPECT_EQ(0xffffu, sizeBatchBuffer);
|
||||
@@ -225,7 +225,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
|
||||
size_t sizeBatchBuffer = 0u;
|
||||
|
||||
std::unique_ptr<GraphicsAllocation, std::function<void(GraphicsAllocation *)>> flatBatchBuffer(
|
||||
aubCsr->getFlatBatchBufferHelper().flattenBatchBuffer(batchBuffer, sizeBatchBuffer, DispatchMode::BatchedDispatch),
|
||||
aubCsr->getFlatBatchBufferHelper().flattenBatchBuffer(aubCsr->getRootDeviceIndex(), batchBuffer, sizeBatchBuffer, DispatchMode::BatchedDispatch),
|
||||
[&](GraphicsAllocation *ptr) { memoryManager->freeGraphicsMemory(ptr); });
|
||||
|
||||
EXPECT_NE(nullptr, flatBatchBuffer.get());
|
||||
@@ -252,7 +252,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenDefault
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs};
|
||||
ResidencyContainer allocationsForResidency = {};
|
||||
|
||||
EXPECT_CALL(*mockHelper, flattenBatchBuffer(::testing::_, ::testing::_, ::testing::_)).Times(0);
|
||||
EXPECT_CALL(*mockHelper, flattenBatchBuffer(aubCsr->getRootDeviceIndex(), ::testing::_, ::testing::_, ::testing::_)).Times(0);
|
||||
aubCsr->flush(batchBuffer, allocationsForResidency);
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF
|
||||
[&](GraphicsAllocation *ptr) { aubExecutionEnvironment->executionEnvironment->memoryManager->freeGraphicsMemory(ptr); });
|
||||
|
||||
auto expectedAllocation = ptr.get();
|
||||
EXPECT_CALL(*mockHelper, flattenBatchBuffer(::testing::_, ::testing::_, ::testing::_)).WillOnce(::testing::Return(ptr.release()));
|
||||
EXPECT_CALL(*mockHelper, flattenBatchBuffer(aubCsr->getRootDeviceIndex(), ::testing::_, ::testing::_, ::testing::_)).WillOnce(::testing::Return(ptr.release()));
|
||||
aubCsr->flush(batchBuffer, allocationsForResidency);
|
||||
|
||||
EXPECT_EQ(batchBuffer.commandBufferAllocation, expectedAllocation);
|
||||
@@ -304,7 +304,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs};
|
||||
|
||||
EXPECT_CALL(*mockHelper, flattenBatchBuffer(::testing::_, ::testing::_, ::testing::_)).Times(1);
|
||||
EXPECT_CALL(*mockHelper, flattenBatchBuffer(aubCsr->getRootDeviceIndex(), ::testing::_, ::testing::_, ::testing::_)).Times(1);
|
||||
aubCsr->flush(batchBuffer, allocationsForResidency);
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs};
|
||||
|
||||
EXPECT_CALL(*mockHelper, flattenBatchBuffer(::testing::_, ::testing::_, ::testing::_)).Times(1);
|
||||
EXPECT_CALL(*mockHelper, flattenBatchBuffer(aubCsr->getRootDeviceIndex(), ::testing::_, ::testing::_, ::testing::_)).Times(1);
|
||||
aubCsr->flush(batchBuffer, allocationsForResidency);
|
||||
}
|
||||
|
||||
@@ -469,7 +469,7 @@ HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWh
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(imgInfo, true, {});
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(aubCsr->getRootDeviceIndex(), imgInfo, true, {});
|
||||
|
||||
auto imageAllocation = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr);
|
||||
ASSERT_NE(nullptr, imageAllocation);
|
||||
|
||||
@@ -475,7 +475,7 @@ struct MockScratchController : public ScratchSpaceController {
|
||||
|
||||
HWTEST_F(CommandStreamReceiverFlushTaskTests, whenScratchIsRequiredForFirstFlushAndPrivateScratchForSecondFlushThenHandleResidencyProperly) {
|
||||
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
auto scratchController = new MockScratchController(*pDevice->executionEnvironment, *commandStreamReceiver->getInternalAllocationStorage());
|
||||
auto scratchController = new MockScratchController(pDevice->getRootDeviceIndex(), *pDevice->executionEnvironment, *commandStreamReceiver->getInternalAllocationStorage());
|
||||
commandStreamReceiver->scratchSpaceController.reset(scratchController);
|
||||
pDevice->resetCommandStreamReceiver(commandStreamReceiver);
|
||||
|
||||
@@ -510,7 +510,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, whenScratchIsRequiredForFirstFlush
|
||||
|
||||
HWTEST_F(CommandStreamReceiverFlushTaskTests, whenPrivateScratchIsRequiredForFirstFlushAndCommonScratchForSecondFlushThenHandleResidencyProperly) {
|
||||
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
auto scratchController = new MockScratchController(*pDevice->executionEnvironment, *commandStreamReceiver->getInternalAllocationStorage());
|
||||
auto scratchController = new MockScratchController(pDevice->getRootDeviceIndex(), *pDevice->executionEnvironment, *commandStreamReceiver->getInternalAllocationStorage());
|
||||
commandStreamReceiver->scratchSpaceController.reset(scratchController);
|
||||
pDevice->resetCommandStreamReceiver(commandStreamReceiver);
|
||||
|
||||
|
||||
@@ -1526,7 +1526,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenBlockedKernelWhenItIsUnblocke
|
||||
|
||||
std::unique_ptr<MockKernel> pKernel(MockKernel::create(*pDevice, mockProgram.get(), numGrfRequired));
|
||||
auto event = std::make_unique<MockEvent<Event>>(pCmdQ.get(), CL_COMMAND_MARKER, 0, 0);
|
||||
auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
|
||||
IndirectHeap *dsh = nullptr, *ioh = nullptr, *ssh = nullptr;
|
||||
pCmdQ->allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 4096u, dsh);
|
||||
|
||||
@@ -781,7 +781,7 @@ HWTEST_F(BcsTests, givenMapAllocationWhenDispatchReadWriteOperationThenSetValidG
|
||||
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
auto memoryManager = csr.getMemoryManager();
|
||||
|
||||
AllocationProperties properties{false, 1234, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{csr.getRootDeviceIndex(), false, 1234, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
GraphicsAllocation *mapAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, reinterpret_cast<void *>(0x12340000));
|
||||
|
||||
auto mapAllocationOffset = 0x1234;
|
||||
@@ -838,7 +838,7 @@ HWTEST_F(BcsTests, givenMapAllocationInBuiltinOpParamsWhenConstructingThenUseItA
|
||||
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
auto memoryManager = csr.getMemoryManager();
|
||||
|
||||
AllocationProperties properties{false, 1234, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{csr.getRootDeviceIndex(), false, 1234, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
GraphicsAllocation *mapAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, reinterpret_cast<void *>(0x12340000));
|
||||
|
||||
auto mapAllocationOffset = 0x1234;
|
||||
@@ -881,7 +881,7 @@ HWTEST_F(BcsTests, givenNonZeroCopySvmAllocationWhenConstructingBlitPropertiesFo
|
||||
SVMAllocsManager svmAllocsManager(&mockMemoryManager);
|
||||
|
||||
auto svmAllocationProperties = MemObjHelper::getSvmAllocationProperties(CL_MEM_READ_WRITE);
|
||||
auto svmAlloc = svmAllocsManager.createSVMAlloc(1, svmAllocationProperties);
|
||||
auto svmAlloc = svmAllocsManager.createSVMAlloc(csr.getRootDeviceIndex(), 1, svmAllocationProperties);
|
||||
auto svmData = svmAllocsManager.getSVMAlloc(svmAlloc);
|
||||
|
||||
EXPECT_NE(nullptr, svmData->gpuAllocation);
|
||||
@@ -1031,7 +1031,7 @@ struct MockScratchSpaceController : ScratchSpaceControllerBase {
|
||||
using ScratchSpaceControllerTest = Test<DeviceFixture>;
|
||||
|
||||
TEST_F(ScratchSpaceControllerTest, whenScratchSpaceControllerIsDestroyedThenItReleasePrivateScratchSpaceAllocation) {
|
||||
MockScratchSpaceController scratchSpaceController(*pDevice->getExecutionEnvironment(), *pDevice->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
|
||||
MockScratchSpaceController scratchSpaceController(pDevice->getRootDeviceIndex(), *pDevice->getExecutionEnvironment(), *pDevice->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
|
||||
scratchSpaceController.privateScratchAllocation = pDevice->getExecutionEnvironment()->memoryManager->allocateGraphicsMemoryInPreferredPool(MockAllocationProperties{MemoryConstants::pageSize}, nullptr);
|
||||
EXPECT_NE(nullptr, scratchSpaceController.privateScratchAllocation);
|
||||
//no memory leak is expected
|
||||
|
||||
@@ -483,7 +483,7 @@ TEST_F(ReducedAddrSpaceCommandStreamReceiverTest,
|
||||
}
|
||||
|
||||
TEST_F(CommandStreamReceiverTest, givenMinimumSizeDoesNotExceedCurrentWhenCallingEnsureCommandBufferAllocationThenDoNotReallocate) {
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({128u, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), 128u, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
LinearStream commandStream{allocation};
|
||||
|
||||
commandStreamReceiver->ensureCommandBufferAllocation(commandStream, 100u, 0u);
|
||||
@@ -498,7 +498,7 @@ TEST_F(CommandStreamReceiverTest, givenMinimumSizeDoesNotExceedCurrentWhenCallin
|
||||
}
|
||||
|
||||
TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentWhenCallingEnsureCommandBufferAllocationThenReallocate) {
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({128u, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), 128u, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
LinearStream commandStream{allocation};
|
||||
|
||||
commandStreamReceiver->ensureCommandBufferAllocation(commandStream, 129u, 0u);
|
||||
@@ -507,7 +507,7 @@ TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentWhenCallingEnsur
|
||||
}
|
||||
|
||||
TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentWhenCallingEnsureCommandBufferAllocationThenReallocateAndAlignSizeTo64kb) {
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({128u, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), 128u, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
LinearStream commandStream{allocation};
|
||||
|
||||
commandStreamReceiver->ensureCommandBufferAllocation(commandStream, 129u, 0u);
|
||||
@@ -522,7 +522,7 @@ TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentWhenCallingEnsur
|
||||
}
|
||||
|
||||
TEST_F(CommandStreamReceiverTest, givenAdditionalAllocationSizeWhenCallingEnsureCommandBufferAllocationThenSizesOfAllocationAndCommandBufferAreCorrect) {
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({128u, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), 128u, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
LinearStream commandStream{allocation};
|
||||
|
||||
commandStreamReceiver->ensureCommandBufferAllocation(commandStream, 129u, 350u);
|
||||
@@ -544,7 +544,7 @@ TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentAndNoAllocations
|
||||
}
|
||||
|
||||
TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentAndAllocationsForReuseWhenCallingEnsureCommandBufferAllocationThenObtainAllocationFromInternalAllocationStorage) {
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
internalAllocationStorage->storeAllocation(std::unique_ptr<GraphicsAllocation>{allocation}, REUSABLE_ALLOCATION);
|
||||
LinearStream commandStream;
|
||||
|
||||
@@ -557,7 +557,7 @@ TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentAndAllocationsFo
|
||||
}
|
||||
|
||||
TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentAndNoSuitableReusableAllocationWhenCallingEnsureCommandBufferAllocationThenObtainAllocationMemoryManager) {
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
internalAllocationStorage->storeAllocation(std::unique_ptr<GraphicsAllocation>{allocation}, REUSABLE_ALLOCATION);
|
||||
LinearStream commandStream;
|
||||
|
||||
@@ -633,3 +633,67 @@ TEST(CommandStreamReceiverDeviceIndexTest, givenOsContextWithNoDeviceBitfieldWhe
|
||||
csr.setupContext(*osContext);
|
||||
EXPECT_EQ(0u, csr.getDeviceIndex());
|
||||
}
|
||||
|
||||
TEST(CommandStreamReceiverRootDeviceIndexTest, commandStreamGraphicsAllocationsHaveCorrectRootDeviceIndex) {
|
||||
const uint32_t expectedRootDeviceIndex = 101;
|
||||
|
||||
// Setup
|
||||
auto executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->rootDeviceEnvironments.resize(2 * expectedRootDeviceIndex);
|
||||
auto memoryManager = new MockMemoryManager(false, false, *executionEnvironment);
|
||||
executionEnvironment->memoryManager.reset(memoryManager);
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, expectedRootDeviceIndex));
|
||||
auto commandStreamReceiver = &device->getGpgpuCommandStreamReceiver();
|
||||
|
||||
ASSERT_NE(nullptr, commandStreamReceiver);
|
||||
EXPECT_EQ(expectedRootDeviceIndex, commandStreamReceiver->getRootDeviceIndex());
|
||||
|
||||
// Linear stream / Command buffer
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({expectedRootDeviceIndex, 128u, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
LinearStream commandStream{allocation};
|
||||
|
||||
commandStreamReceiver->ensureCommandBufferAllocation(commandStream, 100u, 0u);
|
||||
EXPECT_EQ(allocation, commandStream.getGraphicsAllocation());
|
||||
EXPECT_EQ(128u, commandStream.getMaxAvailableSpace());
|
||||
EXPECT_EQ(expectedRootDeviceIndex, commandStream.getGraphicsAllocation()->getRootDeviceIndex());
|
||||
|
||||
commandStreamReceiver->ensureCommandBufferAllocation(commandStream, 1024u, 0u);
|
||||
EXPECT_NE(allocation, commandStream.getGraphicsAllocation());
|
||||
EXPECT_EQ(0u, commandStream.getMaxAvailableSpace() % MemoryConstants::pageSize64k);
|
||||
EXPECT_EQ(expectedRootDeviceIndex, commandStream.getGraphicsAllocation()->getRootDeviceIndex());
|
||||
memoryManager->freeGraphicsMemory(commandStream.getGraphicsAllocation());
|
||||
|
||||
// Debug surface
|
||||
auto debugSurface = commandStreamReceiver->allocateDebugSurface(MemoryConstants::pageSize);
|
||||
ASSERT_NE(nullptr, debugSurface);
|
||||
EXPECT_EQ(expectedRootDeviceIndex, debugSurface->getRootDeviceIndex());
|
||||
|
||||
// Indirect heaps
|
||||
IndirectHeap::Type heapTypes[]{IndirectHeap::DYNAMIC_STATE, IndirectHeap::GENERAL_STATE, IndirectHeap::INDIRECT_OBJECT, IndirectHeap::SURFACE_STATE};
|
||||
for (auto heapType : heapTypes) {
|
||||
IndirectHeap *heap = nullptr;
|
||||
commandStreamReceiver->allocateHeapMemory(heapType, MemoryConstants::pageSize, heap);
|
||||
ASSERT_NE(nullptr, heap);
|
||||
ASSERT_NE(nullptr, heap->getGraphicsAllocation());
|
||||
EXPECT_EQ(expectedRootDeviceIndex, heap->getGraphicsAllocation()->getRootDeviceIndex());
|
||||
memoryManager->freeGraphicsMemory(heap->getGraphicsAllocation());
|
||||
delete heap;
|
||||
}
|
||||
|
||||
// Tag allocation
|
||||
ASSERT_NE(nullptr, commandStreamReceiver->getTagAllocation());
|
||||
EXPECT_EQ(expectedRootDeviceIndex, commandStreamReceiver->getTagAllocation()->getRootDeviceIndex());
|
||||
|
||||
// Preemption allocation
|
||||
if (nullptr == commandStreamReceiver->getPreemptionAllocation()) {
|
||||
commandStreamReceiver->createPreemptionAllocation();
|
||||
}
|
||||
EXPECT_EQ(expectedRootDeviceIndex, commandStreamReceiver->getPreemptionAllocation()->getRootDeviceIndex());
|
||||
|
||||
// HostPtr surface
|
||||
char memory[8] = {1, 2, 3, 4, 5, 6, 7, 8};
|
||||
HostPtrSurface surface(memory, sizeof(memory), true);
|
||||
EXPECT_TRUE(commandStreamReceiver->createAllocationForHostSurface(surface, false));
|
||||
ASSERT_NE(nullptr, surface.getAllocation());
|
||||
EXPECT_EQ(expectedRootDeviceIndex, surface.getAllocation()->getRootDeviceIndex());
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ struct ComputeModeRequirements : public ::testing::Test {
|
||||
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
csr = new myCsr<FamilyType>(*device->executionEnvironment);
|
||||
device->resetCommandStreamReceiver(csr);
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(device->getRootDeviceIndex(), false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
|
||||
alloc = device->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)123, properties, false);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "test.h"
|
||||
#include "unit_tests/fixtures/ult_command_stream_receiver_fixture.h"
|
||||
#include "unit_tests/mocks/mock_experimental_command_buffer.h"
|
||||
#include "unit_tests/mocks/mock_memory_manager.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@@ -258,9 +259,10 @@ HWTEST_F(MockExperimentalCommandBufferTest, givenEnabledExperimentalCmdBufferWhe
|
||||
MemoryManager *memoryManager = commandStreamReceiver.getMemoryManager();
|
||||
|
||||
//Make two allocations, since CSR will try to reuse it also
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({3 * MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto rootDeviceIndex = pDevice->getRootDeviceIndex();
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({rootDeviceIndex, 3 * MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
storage->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION);
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties({3 * MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties({rootDeviceIndex, 3 * MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
storage->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION);
|
||||
|
||||
MockExperimentalCommandBuffer *mockExCmdBuffer = static_cast<MockExperimentalCommandBuffer *>(commandStreamReceiver.experimentalCmdBuffer.get());
|
||||
@@ -351,3 +353,19 @@ HWTEST_F(ExperimentalCommandBufferTest, givenEnabledExperimentalCmdBufferWhenCom
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ(output.c_str(), "");
|
||||
}
|
||||
|
||||
TEST(ExperimentalCommandBufferRootDeviceIndexTest, experimentalCommandBufferGraphicsAllocationsHaveCorrectRootDeviceIndex) {
|
||||
const uint32_t expectedRootDeviceIndex = 101;
|
||||
|
||||
// Setup
|
||||
auto executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->rootDeviceEnvironments.resize(2 * expectedRootDeviceIndex);
|
||||
auto memoryManager = new MockMemoryManager(false, false, *executionEnvironment);
|
||||
executionEnvironment->memoryManager.reset(memoryManager);
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, expectedRootDeviceIndex));
|
||||
auto experimentalCommandBuffer = std::make_unique<MockExperimentalCommandBuffer>(&device->getGpgpuCommandStreamReceiver());
|
||||
|
||||
ASSERT_NE(nullptr, experimentalCommandBuffer);
|
||||
EXPECT_EQ(expectedRootDeviceIndex, experimentalCommandBuffer->experimentalAllocation->getRootDeviceIndex());
|
||||
EXPECT_EQ(expectedRootDeviceIndex, experimentalCommandBuffer->timestamps->getRootDeviceIndex());
|
||||
}
|
||||
|
||||
@@ -664,7 +664,7 @@ TEST_F(PerformanceHintEnqueueTest, GivenSVMPointerWhenEnqueueSVMMapIsCallingThen
|
||||
if (!pPlatform->peekExecutionEnvironment()->getHardwareInfo()->capabilityTable.ftrSvm) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
void *svmPtr = context->getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
void *svmPtr = context->getSVMAllocsManager()->createSVMAlloc(0, 256, {});
|
||||
|
||||
pCmdQ->enqueueSVMMap(CL_FALSE, 0, svmPtr, 256, 0, nullptr, nullptr, false);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class D3D9Tests : public PlatformFixture, public ::testing::Test {
|
||||
}
|
||||
GraphicsAllocation *allocateGraphicsMemoryForImage(const AllocationData &allocationData) override {
|
||||
auto gmm = std::make_unique<Gmm>(*allocationData.imgInfo, StorageInfo{});
|
||||
AllocationProperties properties(nullptr, false, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||
AllocationProperties properties(allocationData.rootDeviceIndex, nullptr, false, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(1, properties, false);
|
||||
alloc->setDefaultGmm(forceGmm);
|
||||
gmmOwnershipPassed = true;
|
||||
|
||||
@@ -84,7 +84,7 @@ TEST(EventBuilder, givenVirtualEventWithCommandThenFinalizeAddChild) {
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 1, ih1);
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::INDIRECT_OBJECT, 1, ih2);
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::SURFACE_STATE, 1, ih3);
|
||||
auto cmdStream = new LinearStream(device->getMemoryManager()->allocateGraphicsMemoryWithProperties({1, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
auto cmdStream = new LinearStream(device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), 1, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
|
||||
std::vector<Surface *> surfaces;
|
||||
auto kernelOperation = std::make_unique<KernelOperation>(cmdStream, *device->getDefaultEngine().commandStreamReceiver->getInternalAllocationStorage());
|
||||
@@ -133,7 +133,7 @@ TEST(EventBuilder, givenVirtualEventWithSubmittedCommandAsParentThenFinalizeNotA
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 1, ih1);
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::INDIRECT_OBJECT, 1, ih2);
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::SURFACE_STATE, 1, ih3);
|
||||
auto cmdStream = new LinearStream(device->getMemoryManager()->allocateGraphicsMemoryWithProperties({4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
auto cmdStream = new LinearStream(device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
|
||||
std::vector<Surface *> surfaces;
|
||||
auto kernelOperation = std::make_unique<KernelOperation>(cmdStream, *device->getDefaultEngine().commandStreamReceiver->getInternalAllocationStorage());
|
||||
|
||||
@@ -460,7 +460,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsKernelOperation) {
|
||||
CommandQueue cmdQ(mockContext, pDevice, nullptr);
|
||||
MockEvent<Event> event(&cmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0);
|
||||
|
||||
auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
IndirectHeap *dsh = nullptr, *ioh = nullptr, *ssh = nullptr;
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 4096u, dsh);
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::INDIRECT_OBJECT, 4096u, ioh);
|
||||
@@ -512,7 +512,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsAbortKernelOperation) {
|
||||
CommandQueue cmdQ(mockContext, pDevice, nullptr);
|
||||
MockEvent<Event> event(&cmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0);
|
||||
|
||||
auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
IndirectHeap *dsh = nullptr, *ioh = nullptr, *ssh = nullptr;
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 4096u, dsh);
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::INDIRECT_OBJECT, 4096u, ioh);
|
||||
@@ -546,7 +546,7 @@ TEST_F(InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOut
|
||||
CommandQueue cmdQ(mockContext, pDevice, nullptr);
|
||||
MockEvent<Event> event(&cmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0);
|
||||
|
||||
auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
IndirectHeap *dsh = nullptr, *ioh = nullptr, *ssh = nullptr;
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 4096u, dsh);
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::INDIRECT_OBJECT, 4096u, ioh);
|
||||
@@ -919,7 +919,7 @@ HWTEST_F(EventTest, givenVirtualEventWhenCommandSubmittedThenLockCSROccurs) {
|
||||
pCmdQ->allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 1, ih1);
|
||||
pCmdQ->allocateHeapMemory(IndirectHeap::INDIRECT_OBJECT, 1, ih2);
|
||||
pCmdQ->allocateHeapMemory(IndirectHeap::SURFACE_STATE, 1, ih3);
|
||||
auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
|
||||
std::vector<Surface *> surfaces;
|
||||
auto kernelOperation = std::make_unique<KernelOperation>(cmdStream, *pDevice->getDefaultEngine().commandStreamReceiver->getInternalAllocationStorage());
|
||||
@@ -1468,7 +1468,7 @@ HWTEST_F(InternalsEventTest, givenAbortedCommandWhenSubmitCalledThenDontUpdateFl
|
||||
MockKernelWithInternals mockKernelWithInternals(*pDevice);
|
||||
auto pKernel = mockKernelWithInternals.mockKernel;
|
||||
|
||||
auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
IndirectHeap *dsh = nullptr, *ioh = nullptr, *ssh = nullptr;
|
||||
pCmdQ->allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 4096u, dsh);
|
||||
pCmdQ->allocateHeapMemory(IndirectHeap::INDIRECT_OBJECT, 4096u, ioh);
|
||||
|
||||
@@ -96,7 +96,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenLockedEMcritca
|
||||
|
||||
size_t minSizeSSHForEM = HardwareCommandsHelper<FamilyType>::getSizeRequiredForExecutionModel(IndirectHeap::SURFACE_STATE, *parentKernel);
|
||||
|
||||
auto cmdStreamAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto cmdStreamAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto blockedCommandData = std::make_unique<KernelOperation>(new LinearStream(cmdStreamAllocation),
|
||||
*pCmdQ->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
|
||||
blockedCommandData->setHeaps(dsh, ioh, ssh);
|
||||
@@ -154,7 +154,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenParentKernelWh
|
||||
uint32_t colorCalcSizeDevQueue = DeviceQueue::colorCalcStateSize;
|
||||
EXPECT_EQ(colorCalcSizeDevQueue, usedDSHBeforeSubmit);
|
||||
|
||||
auto cmdStreamAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto cmdStreamAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto blockedCommandData = std::make_unique<KernelOperation>(new LinearStream(cmdStreamAllocation),
|
||||
*pCmdQ->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
|
||||
blockedCommandData->setHeaps(dsh, ioh, ssh);
|
||||
@@ -195,7 +195,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenParentKernelWh
|
||||
|
||||
dsh->getSpace(mockDevQueue.getDshOffset());
|
||||
|
||||
auto cmdStreamAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto cmdStreamAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto blockedCommandData = std::make_unique<KernelOperation>(new LinearStream(cmdStreamAllocation),
|
||||
*pCmdQ->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
|
||||
blockedCommandData->setHeaps(dsh, ioh, ssh);
|
||||
@@ -233,7 +233,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenBlockedParentK
|
||||
pCmdQ->allocateHeapMemory(IndirectHeap::SURFACE_STATE, heapSize, ssh);
|
||||
dsh->getSpace(mockDevQueue.getDshOffset());
|
||||
|
||||
auto cmdStreamAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto cmdStreamAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto blockedCommandData = std::make_unique<KernelOperation>(new LinearStream(cmdStreamAllocation),
|
||||
*pCmdQ->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
|
||||
blockedCommandData->setHeaps(dsh, ioh, ssh);
|
||||
@@ -274,7 +274,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenParentKernelWh
|
||||
pCmdQ->allocateHeapMemory(IndirectHeap::SURFACE_STATE, heapSize, ssh);
|
||||
dsh->getSpace(mockDevQueue.getDshOffset());
|
||||
|
||||
auto cmdStreamAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto cmdStreamAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto blockedCommandData = std::make_unique<KernelOperation>(new LinearStream(cmdStreamAllocation),
|
||||
*pCmdQ->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
|
||||
blockedCommandData->setHeaps(dsh, ioh, ssh);
|
||||
@@ -327,7 +327,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenUsedCommandQue
|
||||
queueDsh.getSpace(usedSize);
|
||||
queueIoh.getSpace(usedSize);
|
||||
|
||||
auto cmdStreamAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto cmdStreamAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto blockedCommandData = std::make_unique<KernelOperation>(new LinearStream(cmdStreamAllocation),
|
||||
*pCmdQ->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
|
||||
blockedCommandData->setHeaps(dsh, ioh, ssh);
|
||||
@@ -375,7 +375,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenNotUsedSSHWhen
|
||||
|
||||
void *sshBuffer = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0u).getCpuBase();
|
||||
|
||||
auto cmdStreamAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto cmdStreamAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
auto blockedCommandData = std::make_unique<KernelOperation>(new LinearStream(cmdStreamAllocation),
|
||||
*pCmdQ->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
|
||||
blockedCommandData->setHeaps(dsh, ioh, ssh);
|
||||
|
||||
@@ -51,7 +51,7 @@ class D3DTests : public PlatformFixture, public ::testing::Test {
|
||||
return alloc;
|
||||
}
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex) override {
|
||||
AllocationProperties properties(true, 0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, false, false, 0, rootDeviceIndex);
|
||||
AllocationProperties properties(rootDeviceIndex, true, 0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, false, false, 0);
|
||||
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)handle), properties, false);
|
||||
alloc->setDefaultGmm(forceGmm);
|
||||
gmmOwnershipPassed = true;
|
||||
|
||||
@@ -42,7 +42,7 @@ struct Gen12LpCoherencyRequirements : public ::testing::Test {
|
||||
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
csr = new myCsr(*device->executionEnvironment);
|
||||
device->resetCommandStreamReceiver(csr);
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(device->getRootDeviceIndex(), false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
|
||||
alloc = device->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)123, properties, false);
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ TEST(MemoryPropertiesParser, givenInvalidFlagsIntelWhenParsingMemoryPropertiesFo
|
||||
}
|
||||
|
||||
TEST(MemoryPropertiesParser, givenDifferentParametersWhenCallingFillCachePolicyInPropertiesThenFlushL3FlagsAreCorrectlySet) {
|
||||
AllocationProperties allocationProperties{0, GraphicsAllocation::AllocationType::BUFFER};
|
||||
AllocationProperties allocationProperties{0, 0, GraphicsAllocation::AllocationType::BUFFER};
|
||||
|
||||
for (auto uncached : ::testing::Bool()) {
|
||||
for (auto readOnly : ::testing::Bool()) {
|
||||
|
||||
@@ -104,7 +104,7 @@ TEST(CommandTest, givenWaitlistRequestWhenCommandComputeKernelIsCreatedThenMakeL
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 1, ih1);
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::INDIRECT_OBJECT, 1, ih2);
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::SURFACE_STATE, 1, ih3);
|
||||
auto cmdStream = new LinearStream(device->getMemoryManager()->allocateGraphicsMemoryWithProperties({1, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
auto cmdStream = new LinearStream(device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), 1, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
|
||||
std::vector<Surface *> surfaces;
|
||||
auto kernelOperation = std::make_unique<KernelOperation>(cmdStream, *device->getDefaultEngine().commandStreamReceiver->getInternalAllocationStorage());
|
||||
@@ -137,7 +137,7 @@ TEST(KernelOperationDestruction, givenKernelOperationWhenItIsDestructedThenAllAl
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 1, ih1);
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::INDIRECT_OBJECT, 1, ih2);
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::SURFACE_STATE, 1, ih3);
|
||||
auto cmdStream = new LinearStream(device->getMemoryManager()->allocateGraphicsMemoryWithProperties({1, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
auto cmdStream = new LinearStream(device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), 1, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
|
||||
auto &heapAllocation1 = *ih1->getGraphicsAllocation();
|
||||
auto &heapAllocation2 = *ih2->getGraphicsAllocation();
|
||||
@@ -213,7 +213,7 @@ HWTEST_F(DispatchFlagsTests, givenCommandComputeKernelWhenSubmitThenPassCorrectD
|
||||
mockCmdQ->allocateHeapMemory(IndirectHeap::SURFACE_STATE, 1, ih3);
|
||||
|
||||
PreemptionMode preemptionMode = device->getPreemptionMode();
|
||||
auto cmdStream = new LinearStream(device->getMemoryManager()->allocateGraphicsMemoryWithProperties({1, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
auto cmdStream = new LinearStream(device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), 1, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
|
||||
std::vector<Surface *> surfaces;
|
||||
auto kernelOperation = std::make_unique<KernelOperation>(cmdStream, *mockCmdQ->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
|
||||
@@ -263,7 +263,7 @@ HWTEST_F(DispatchFlagsTests, givenCommandWithoutKernelWhenSubmitThenPassCorrectD
|
||||
mockCmdQ->allocateHeapMemory(IndirectHeap::INDIRECT_OBJECT, 1, ih2);
|
||||
mockCmdQ->allocateHeapMemory(IndirectHeap::SURFACE_STATE, 1, ih3);
|
||||
|
||||
auto cmdStream = new LinearStream(device->getMemoryManager()->allocateGraphicsMemoryWithProperties({1, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
auto cmdStream = new LinearStream(device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), 1, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
auto kernelOperation = std::make_unique<KernelOperation>(cmdStream, *mockCmdQ->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
|
||||
kernelOperation->setHeaps(ih1, ih2, ih3);
|
||||
std::unique_ptr<Command> command(new CommandWithoutKernel(*mockCmdQ, kernelOperation));
|
||||
@@ -301,7 +301,7 @@ HWTEST_F(DispatchFlagsTests, givenCommandComputeKernelWhenSubmitThenPassCorrectD
|
||||
mockCmdQ->dispatchHints = 1234;
|
||||
|
||||
PreemptionMode preemptionMode = device->getPreemptionMode();
|
||||
auto cmdStream = new LinearStream(device->getMemoryManager()->allocateGraphicsMemoryWithProperties({1, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
auto cmdStream = new LinearStream(device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), 1, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
|
||||
|
||||
std::vector<Surface *> surfaces;
|
||||
auto kernelOperation = std::make_unique<KernelOperation>(cmdStream, *mockCmdQ->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
|
||||
|
||||
@@ -202,7 +202,7 @@ TEST_F(TimestampPacketSimpleTests, givenImplicitDependencyWhenEndTagIsWrittenThe
|
||||
TEST_F(TimestampPacketSimpleTests, whenNewTagIsTakenThenReinitialize) {
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
MockMemoryManager memoryManager(executionEnvironment);
|
||||
MockTagAllocator<TimestampPacketStorage> allocator(&memoryManager, 1);
|
||||
MockTagAllocator<TimestampPacketStorage> allocator(0, &memoryManager, 1);
|
||||
|
||||
auto firstNode = allocator.getTag();
|
||||
auto i = 0u;
|
||||
@@ -485,7 +485,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingThe
|
||||
auto &csr = device->getUltCommandStreamReceiver<FamilyType>();
|
||||
csr.timestampPacketWriteEnabled = true;
|
||||
|
||||
auto mockTagAllocator = new MockTagAllocator<>(executionEnvironment->memoryManager.get());
|
||||
auto mockTagAllocator = new MockTagAllocator<>(device->getRootDeviceIndex(), executionEnvironment->memoryManager.get());
|
||||
csr.timestampPacketAllocator.reset(mockTagAllocator);
|
||||
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context, device.get(), nullptr);
|
||||
|
||||
@@ -1059,7 +1059,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWithMultipleNodesWhenItIsQuer
|
||||
}
|
||||
|
||||
HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingNonBlockedThenMakeItResident) {
|
||||
auto mockTagAllocator = new MockTagAllocator<>(executionEnvironment->memoryManager.get(), 1);
|
||||
auto mockTagAllocator = new MockTagAllocator<>(device->getRootDeviceIndex(), executionEnvironment->memoryManager.get(), 1);
|
||||
|
||||
auto &csr = device->getUltCommandStreamReceiver<FamilyType>();
|
||||
csr.timestampPacketAllocator.reset(mockTagAllocator);
|
||||
@@ -1081,7 +1081,7 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingNonBlockedT
|
||||
}
|
||||
|
||||
HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingBlockedThenMakeItResident) {
|
||||
auto mockTagAllocator = new MockTagAllocator<>(executionEnvironment->memoryManager.get(), 1);
|
||||
auto mockTagAllocator = new MockTagAllocator<>(device->getRootDeviceIndex(), executionEnvironment->memoryManager.get(), 1);
|
||||
|
||||
auto &csr = device->getUltCommandStreamReceiver<FamilyType>();
|
||||
csr.timestampPacketAllocator.reset(mockTagAllocator);
|
||||
@@ -1228,7 +1228,7 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingWithOmitTim
|
||||
}
|
||||
|
||||
HWTEST_F(TimestampPacketTests, givenEventsWaitlistFromDifferentDevicesWhenEnqueueingThenMakeAllTimestampsResident) {
|
||||
TagAllocator<TimestampPacketStorage> tagAllocator(executionEnvironment->memoryManager.get(), 1, 1);
|
||||
TagAllocator<TimestampPacketStorage> tagAllocator(device->getRootDeviceIndex(), executionEnvironment->memoryManager.get(), 1, 1);
|
||||
auto device2 = std::unique_ptr<MockDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
|
||||
|
||||
auto &ultCsr = device->getUltCommandStreamReceiver<FamilyType>();
|
||||
@@ -1263,7 +1263,7 @@ HWTEST_F(TimestampPacketTests, givenEventsWaitlistFromDifferentDevicesWhenEnqueu
|
||||
}
|
||||
|
||||
HWTEST_F(TimestampPacketTests, givenEventsWaitlistFromDifferentCSRsWhenEnqueueingThenMakeAllTimestampsResident) {
|
||||
TagAllocator<TimestampPacketStorage> tagAllocator(executionEnvironment->memoryManager.get(), 1, 1);
|
||||
TagAllocator<TimestampPacketStorage> tagAllocator(device->getRootDeviceIndex(), executionEnvironment->memoryManager.get(), 1, 1);
|
||||
|
||||
auto &ultCsr = device->getUltCommandStreamReceiver<FamilyType>();
|
||||
ultCsr.timestampPacketWriteEnabled = true;
|
||||
@@ -1694,7 +1694,7 @@ HWTEST_F(TimestampPacketTests, givenKernelWhichDoesntRequireFlushWhenEnqueueingK
|
||||
auto &csr = device->getUltCommandStreamReceiver<FamilyType>();
|
||||
csr.timestampPacketWriteEnabled = true;
|
||||
|
||||
auto mockTagAllocator = new MockTagAllocator<>(executionEnvironment->memoryManager.get());
|
||||
auto mockTagAllocator = new MockTagAllocator<>(device->getRootDeviceIndex(), executionEnvironment->memoryManager.get());
|
||||
csr.timestampPacketAllocator.reset(mockTagAllocator);
|
||||
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context, device.get(), nullptr);
|
||||
// obtain first node for cmdQ and event1
|
||||
@@ -1710,7 +1710,7 @@ HWTEST_F(TimestampPacketTests, givenKernelWhichRequiresFlushWhenEnqueueingKernel
|
||||
auto &csr = device->getUltCommandStreamReceiver<FamilyType>();
|
||||
csr.timestampPacketWriteEnabled = true;
|
||||
|
||||
auto mockTagAllocator = new MockTagAllocator<>(executionEnvironment->memoryManager.get());
|
||||
auto mockTagAllocator = new MockTagAllocator<>(device->getRootDeviceIndex(), executionEnvironment->memoryManager.get());
|
||||
csr.timestampPacketAllocator.reset(mockTagAllocator);
|
||||
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context, device.get(), nullptr);
|
||||
kernel->mockKernel->svmAllocationsRequireCacheFlush = true;
|
||||
|
||||
@@ -512,7 +512,7 @@ TEST_F(CloneKernelTest, cloneKernelWithExecInfo) {
|
||||
if (!pDevice->getHardwareInfo().capabilityTable.ftrSvm) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
void *ptrSVM = pContext->getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
void *ptrSVM = pContext->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
ASSERT_NE(nullptr, ptrSVM);
|
||||
|
||||
auto svmData = pContext->getSVMAllocsManager()->getSVMAlloc(ptrSVM);
|
||||
|
||||
@@ -1731,7 +1731,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenItUsesIndirectUnifiedMemoryDeviceAl
|
||||
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY));
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(pDevice->getRootDeviceIndex(), 4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY));
|
||||
|
||||
mockKernel.mockKernel->makeResident(this->pDevice->getGpgpuCommandStreamReceiver());
|
||||
|
||||
@@ -1755,8 +1755,8 @@ HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectHostMemoryWhenMakeResident
|
||||
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto unifiedDeviceMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY));
|
||||
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY));
|
||||
auto unifiedDeviceMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(pDevice->getRootDeviceIndex(), 4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY));
|
||||
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(pDevice->getRootDeviceIndex(), 4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY));
|
||||
|
||||
mockKernel.mockKernel->makeResident(this->pDevice->getGpgpuCommandStreamReceiver());
|
||||
EXPECT_EQ(0u, commandStreamReceiver.getResidencyAllocations().size());
|
||||
@@ -1775,8 +1775,8 @@ HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectSharedMemoryWhenMakeReside
|
||||
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto unifiedSharedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY), mockKernel.mockContext->getSpecialQueue());
|
||||
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY));
|
||||
auto unifiedSharedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(pDevice->getRootDeviceIndex(), 4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY), mockKernel.mockContext->getSpecialQueue());
|
||||
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(pDevice->getRootDeviceIndex(), 4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY));
|
||||
|
||||
mockKernel.mockKernel->makeResident(this->pDevice->getGpgpuCommandStreamReceiver());
|
||||
EXPECT_EQ(0u, commandStreamReceiver.getResidencyAllocations().size());
|
||||
@@ -1797,7 +1797,7 @@ HWTEST_F(KernelResidencyTest, givenDeviceUnifiedMemoryAndPageFaultManagerWhenMak
|
||||
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY));
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(pDevice->getRootDeviceIndex(), 4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY));
|
||||
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
|
||||
|
||||
EXPECT_EQ(0u, mockKernel.mockKernel->kernelUnifiedMemoryGfxAllocations.size());
|
||||
@@ -1823,7 +1823,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndPageFaultManagerWhenMak
|
||||
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY), mockKernel.mockContext->getSpecialQueue());
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(pDevice->getRootDeviceIndex(), 4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY), mockKernel.mockContext->getSpecialQueue());
|
||||
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
|
||||
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue());
|
||||
|
||||
@@ -1856,7 +1856,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndNotRequiredMemSyncWhenM
|
||||
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY), mockKernel.mockContext->getSpecialQueue());
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(pDevice->getRootDeviceIndex(), 4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY), mockKernel.mockContext->getSpecialQueue());
|
||||
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
|
||||
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue());
|
||||
|
||||
@@ -1882,7 +1882,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAllocPageFaultManagerAndIn
|
||||
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY), mockKernel.mockContext->getSpecialQueue());
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(pDevice->getRootDeviceIndex(), 4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY), mockKernel.mockContext->getSpecialQueue());
|
||||
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue());
|
||||
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 1);
|
||||
@@ -1909,7 +1909,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenSetKernelExecInfoWithUnifiedMemoryI
|
||||
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY));
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(pDevice->getRootDeviceIndex(), 4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY));
|
||||
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
|
||||
|
||||
EXPECT_EQ(0u, mockKernel.mockKernel->kernelUnifiedMemoryGfxAllocations.size());
|
||||
@@ -1932,9 +1932,9 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithUnifiedMemor
|
||||
MockKernelWithInternals mockKernel(*this->pDevice);
|
||||
|
||||
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY));
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(pDevice->getRootDeviceIndex(), 4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY));
|
||||
|
||||
auto unifiedMemoryAllocation2 = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY));
|
||||
auto unifiedMemoryAllocation2 = svmAllocationsManager->createUnifiedMemoryAllocation(pDevice->getRootDeviceIndex(), 4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY));
|
||||
|
||||
auto status = clSetKernelExecInfo(mockKernel.mockKernel, CL_KERNEL_EXEC_INFO_USM_PTRS_INTEL, sizeof(unifiedMemoryAllocation), &unifiedMemoryAllocation);
|
||||
EXPECT_EQ(CL_SUCCESS, status);
|
||||
|
||||
@@ -22,7 +22,7 @@ TEST_F(KernelSubstituteTest, givenKernelWhenSubstituteKernelHeapWithGreaterSizeT
|
||||
pHeader->KernelHeapSize = initialHeapSize;
|
||||
|
||||
EXPECT_EQ(nullptr, kernel.kernelInfo.kernelAllocation);
|
||||
kernel.kernelInfo.createKernelAllocation(pDevice->getMemoryManager());
|
||||
kernel.kernelInfo.createKernelAllocation(pDevice->getRootDeviceIndex(), pDevice->getMemoryManager());
|
||||
auto firstAllocation = kernel.kernelInfo.kernelAllocation;
|
||||
EXPECT_NE(nullptr, firstAllocation);
|
||||
auto firstAllocationSize = firstAllocation->getUnderlyingBufferSize();
|
||||
@@ -53,7 +53,7 @@ TEST_F(KernelSubstituteTest, givenKernelWhenSubstituteKernelHeapWithSameSizeThen
|
||||
pHeader->KernelHeapSize = initialHeapSize;
|
||||
|
||||
EXPECT_EQ(nullptr, kernel.kernelInfo.kernelAllocation);
|
||||
kernel.kernelInfo.createKernelAllocation(pDevice->getMemoryManager());
|
||||
kernel.kernelInfo.createKernelAllocation(pDevice->getRootDeviceIndex(), pDevice->getMemoryManager());
|
||||
auto firstAllocation = kernel.kernelInfo.kernelAllocation;
|
||||
EXPECT_NE(nullptr, firstAllocation);
|
||||
auto firstAllocationSize = firstAllocation->getUnderlyingBufferSize();
|
||||
@@ -83,7 +83,7 @@ TEST_F(KernelSubstituteTest, givenKernelWhenSubstituteKernelHeapWithSmallerSizeT
|
||||
pHeader->KernelHeapSize = initialHeapSize;
|
||||
|
||||
EXPECT_EQ(nullptr, kernel.kernelInfo.kernelAllocation);
|
||||
kernel.kernelInfo.createKernelAllocation(pDevice->getMemoryManager());
|
||||
kernel.kernelInfo.createKernelAllocation(pDevice->getRootDeviceIndex(), pDevice->getMemoryManager());
|
||||
auto firstAllocation = kernel.kernelInfo.kernelAllocation;
|
||||
EXPECT_NE(nullptr, firstAllocation);
|
||||
auto firstAllocationSize = firstAllocation->getUnderlyingBufferSize();
|
||||
@@ -115,7 +115,7 @@ TEST_F(KernelSubstituteTest, givenKernelWithUsedKernelAllocationWhenSubstituteKe
|
||||
const size_t initialHeapSize = 0x40;
|
||||
pHeader->KernelHeapSize = initialHeapSize;
|
||||
|
||||
kernel.kernelInfo.createKernelAllocation(memoryManager);
|
||||
kernel.kernelInfo.createKernelAllocation(pDevice->getRootDeviceIndex(), memoryManager);
|
||||
auto firstAllocation = kernel.kernelInfo.kernelAllocation;
|
||||
|
||||
uint32_t notReadyTaskCount = *commandStreamReceiver.getTagAddress() + 1u;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "runtime/command_stream/command_stream_receiver_hw.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "runtime/os_interface/os_context.h"
|
||||
@@ -183,7 +184,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
||||
createPerDssBackedBufferCalled++;
|
||||
bool result = BaseClass::createPerDssBackedBuffer(device);
|
||||
if (!perDssBackedBuffer) {
|
||||
AllocationProperties properties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HEAP};
|
||||
AllocationProperties properties{device.getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HEAP};
|
||||
perDssBackedBuffer = executionEnvironment.memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -291,7 +291,7 @@ TEST_F(BufferSetArgTest, clSetKernelArgSVMPointer) {
|
||||
if (!pDevice->getHardwareInfo().capabilityTable.ftrSvm) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
void *ptrSVM = pContext->getSVMAllocsManager()->createSVMAlloc(256, {});
|
||||
void *ptrSVM = pContext->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {});
|
||||
EXPECT_NE(nullptr, ptrSVM);
|
||||
|
||||
auto svmData = pContext->getSVMAllocsManager()->getSVMAlloc(ptrSVM);
|
||||
|
||||
@@ -640,7 +640,7 @@ struct RenderCompressedBuffersSvmTests : public RenderCompressedBuffersTests {
|
||||
TEST_F(RenderCompressedBuffersSvmTests, givenSvmAllocationWhenCreatingBufferThenForceDisableCompression) {
|
||||
hwInfo->capabilityTable.ftrRenderCompressedBuffers = true;
|
||||
|
||||
auto svmPtr = context->getSVMAllocsManager()->createSVMAlloc(sizeof(uint32_t), {});
|
||||
auto svmPtr = context->getSVMAllocsManager()->createSVMAlloc(device->getRootDeviceIndex(), sizeof(uint32_t), {});
|
||||
auto expectedAllocationType = context->getSVMAllocsManager()->getSVMAlloc(svmPtr)->gpuAllocation->getAllocationType();
|
||||
buffer.reset(Buffer::create(context.get(), CL_MEM_USE_HOST_PTR, sizeof(uint32_t), svmPtr, retVal));
|
||||
EXPECT_EQ(expectedAllocationType, buffer->getGraphicsAllocation()->getAllocationType());
|
||||
@@ -1170,7 +1170,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenInputAndOutputTimestampPacketWhenBlitCal
|
||||
|
||||
auto &cmdQueueCsr = static_cast<UltCommandStreamReceiver<FamilyType> &>(cmdQ->getGpgpuCommandStreamReceiver());
|
||||
auto memoryManager = cmdQueueCsr.getMemoryManager();
|
||||
cmdQueueCsr.timestampPacketAllocator = std::make_unique<TagAllocator<TimestampPacketStorage>>(memoryManager, 1,
|
||||
cmdQueueCsr.timestampPacketAllocator = std::make_unique<TagAllocator<TimestampPacketStorage>>(device->getRootDeviceIndex(), memoryManager, 1,
|
||||
MemoryConstants::cacheLineSize);
|
||||
|
||||
auto buffer = clUniquePtr<Buffer>(Buffer::create(bcsMockContext.get(), CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
@@ -1650,7 +1650,7 @@ TEST_P(ValidHostPtr, failedAllocationInjection) {
|
||||
TEST_P(ValidHostPtr, SvmHostPtr) {
|
||||
const DeviceInfo &devInfo = pDevice->getDeviceInfo();
|
||||
if (devInfo.svmCapabilities != 0) {
|
||||
auto ptr = context->getSVMAllocsManager()->createSVMAlloc(64, {});
|
||||
auto ptr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 64, {});
|
||||
|
||||
auto bufferSvm = Buffer::create(context.get(), CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, 64, ptr, retVal);
|
||||
EXPECT_NE(nullptr, bufferSvm);
|
||||
|
||||
@@ -79,7 +79,7 @@ HWTEST_F(ImageUnmapTest, givenImageWhenUnmapMemObjIsCalledThenEnqueueNonBlocking
|
||||
HWTEST_F(ImageUnmapTest, givenImageWhenUnmapMemObjIsCalledWithMemUseHostPtrAndWithoutEventsThenFinishIsCalled) {
|
||||
std::unique_ptr<MyMockCommandQueue<FamilyType>> commandQueue(new MyMockCommandQueue<FamilyType>(context.get(), device.get()));
|
||||
image.reset(ImageHelper<ImageUseHostPtr<Image3dDefaults>>::create(context.get()));
|
||||
auto ptr = image->getBasePtrForMap();
|
||||
auto ptr = image->getBasePtrForMap(device->getRootDeviceIndex());
|
||||
MemObjOffsetArray origin = {{0, 0, 0}};
|
||||
MemObjSizeArray region = {{1, 1, 1}};
|
||||
cl_map_flags mapFlags = CL_MAP_WRITE;
|
||||
@@ -91,7 +91,7 @@ HWTEST_F(ImageUnmapTest, givenImageWhenUnmapMemObjIsCalledWithMemUseHostPtrAndWi
|
||||
|
||||
HWTEST_F(ImageUnmapTest, givenImageWhenUnmapMemObjIsCalledWithoutMemUseHostPtrThenFinishIsCalled) {
|
||||
std::unique_ptr<MyMockCommandQueue<FamilyType>> commandQueue(new MyMockCommandQueue<FamilyType>(context.get(), device.get()));
|
||||
auto ptr = image->getBasePtrForMap();
|
||||
auto ptr = image->getBasePtrForMap(device->getRootDeviceIndex());
|
||||
MemObjOffsetArray origin = {{0, 0, 0}};
|
||||
MemObjSizeArray region = {{1, 1, 1}};
|
||||
cl_map_flags mapFlags = CL_MAP_WRITE;
|
||||
@@ -118,7 +118,7 @@ HWTEST_F(ImageUnmapTest, givenImageWhenUnmapMemObjIsCalledWithMemUseHostPtrAndWi
|
||||
MockEvent<UserEvent> mockEvent(context.get());
|
||||
mockEvent.setStatus(0);
|
||||
cl_event clEvent = &mockEvent;
|
||||
auto ptr = image->getBasePtrForMap();
|
||||
auto ptr = image->getBasePtrForMap(device->getRootDeviceIndex());
|
||||
MemObjOffsetArray origin = {{0, 0, 0}};
|
||||
MemObjSizeArray region = {{1, 1, 1}};
|
||||
cl_map_flags mapFlags = CL_MAP_WRITE;
|
||||
|
||||
@@ -573,7 +573,7 @@ TEST_P(CreateImageHostPtr, getAddress) {
|
||||
image = createImage(retVal);
|
||||
ASSERT_NE(nullptr, image);
|
||||
|
||||
auto address = image->getBasePtrForMap();
|
||||
auto address = image->getBasePtrForMap(0);
|
||||
EXPECT_NE(nullptr, address);
|
||||
|
||||
if (!(flags & CL_MEM_USE_HOST_PTR)) {
|
||||
@@ -1528,7 +1528,7 @@ HWTEST_F(HwImageTest, givenImageHwWhenSettingCCSParamsThenSetClearColorParamsIsC
|
||||
format.image_channel_order = CL_RGBA;
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(imgInfo, true, {});
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(0, imgInfo, true, {});
|
||||
|
||||
auto graphicsAllocation = memoryManager.allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr);
|
||||
|
||||
@@ -1559,7 +1559,7 @@ HWTEST_F(HwImageTest, givenImageHwWithUnifiedSurfaceAndMcsWhenSettingParamsForMu
|
||||
cl_image_format format = {};
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(imgInfo, true, {});
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(0, imgInfo, true, {});
|
||||
|
||||
auto graphicsAllocation = memoryManager.allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr);
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ TEST(MemObj, givenHostPtrAndUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnHostP
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
1, nullptr, &hostPtr, nullptr, true, false, false);
|
||||
|
||||
EXPECT_EQ(&hostPtr, memObj.getBasePtrForMap());
|
||||
EXPECT_EQ(&hostPtr, memObj.getBasePtrForMap(context.getDevice(0)->getRootDeviceIndex()));
|
||||
}
|
||||
|
||||
TEST(MemObj, givenHostPtrWithoutUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnAllocatedPtr) {
|
||||
@@ -128,8 +128,8 @@ TEST(MemObj, givenHostPtrWithoutUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnA
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
1, nullptr, &hostPtr, nullptr, true, false, false);
|
||||
|
||||
EXPECT_NE(&hostPtr, memObj.getBasePtrForMap());
|
||||
EXPECT_EQ(memObj.getAllocatedMapPtr(), memObj.getBasePtrForMap());
|
||||
EXPECT_NE(&hostPtr, memObj.getBasePtrForMap(context.getDevice(0)->getRootDeviceIndex()));
|
||||
EXPECT_EQ(memObj.getAllocatedMapPtr(), memObj.getBasePtrForMap(context.getDevice(0)->getRootDeviceIndex()));
|
||||
}
|
||||
|
||||
TEST(MemObj, givenMemObjWhenReleaseAllocatedPtrIsCalledTwiceThenItDoesntCrash) {
|
||||
@@ -483,7 +483,7 @@ TEST(MemObj, givenMemObjNotUsingHostPtrWhenGettingBasePtrTwiceReturnSameMapPtr)
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
||||
1, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
void *mapPtr = memObj.getBasePtrForMap();
|
||||
void *mapPtr = memObj.getBasePtrForMap(context.getDevice(0)->getRootDeviceIndex());
|
||||
EXPECT_NE(nullptr, mapPtr);
|
||||
auto mapAllocation = memObj.getMapAllocation();
|
||||
ASSERT_NE(nullptr, mapAllocation);
|
||||
|
||||
@@ -169,9 +169,9 @@ TEST_F(SubBufferTest, givenBufferWithHostPtrWhenSubbufferGetsMapPtrThenExpectBuf
|
||||
ASSERT_NE(nullptr, subBuffer);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
void *mapPtr = subBuffer->getBasePtrForMap();
|
||||
void *mapPtr = subBuffer->getBasePtrForMap(0);
|
||||
EXPECT_EQ(pHostPtr, mapPtr);
|
||||
mapPtr = subBuffer->getBasePtrForMap();
|
||||
mapPtr = subBuffer->getBasePtrForMap(0);
|
||||
EXPECT_EQ(pHostPtr, mapPtr);
|
||||
|
||||
subBuffer->release();
|
||||
@@ -189,8 +189,8 @@ TEST_F(SubBufferTest, givenBufferWithNoHostPtrWhenSubbufferGetsMapPtrThenExpectB
|
||||
ASSERT_NE(nullptr, subBuffer);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
void *mapPtr = subBuffer->getBasePtrForMap();
|
||||
void *bufferMapPtr = buffer->getBasePtrForMap();
|
||||
void *mapPtr = subBuffer->getBasePtrForMap(0);
|
||||
void *bufferMapPtr = buffer->getBasePtrForMap(0);
|
||||
EXPECT_EQ(bufferMapPtr, mapPtr);
|
||||
auto mapAllocation = subBuffer->getMapAllocation();
|
||||
auto bufferMapAllocation = buffer->getMapAllocation();
|
||||
@@ -198,7 +198,7 @@ TEST_F(SubBufferTest, givenBufferWithNoHostPtrWhenSubbufferGetsMapPtrThenExpectB
|
||||
EXPECT_EQ(bufferMapAllocation, mapAllocation);
|
||||
EXPECT_EQ(bufferMapPtr, mapAllocation->getUnderlyingBuffer());
|
||||
|
||||
mapPtr = subBuffer->getBasePtrForMap();
|
||||
mapPtr = subBuffer->getBasePtrForMap(0);
|
||||
EXPECT_EQ(bufferMapPtr, mapPtr);
|
||||
|
||||
subBuffer->release();
|
||||
|
||||
@@ -174,7 +174,7 @@ TEST(ZeroCopyWithDebugFlag, GivenBufferInputsThatWouldResultInZeroCopyAndDisable
|
||||
EXPECT_EQ(nullptr, buffer->getAllocatedMapPtr());
|
||||
auto bufferAllocation = buffer->getGraphicsAllocation()->getUnderlyingBuffer();
|
||||
|
||||
auto mapAllocation = buffer->getBasePtrForMap();
|
||||
auto mapAllocation = buffer->getBasePtrForMap(0);
|
||||
EXPECT_EQ(mapAllocation, buffer->getAllocatedMapPtr());
|
||||
EXPECT_NE(mapAllocation, bufferAllocation);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ TEST_F(InternalAllocationStorageTest, whenCleanAllocationListThenRemoveOnlyCompl
|
||||
}
|
||||
|
||||
TEST_F(InternalAllocationStorageTest, whenAllocationIsStoredAsReusableButIsStillUsedThenCannotBeObtained) {
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(AllocationProperties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(AllocationProperties{0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
|
||||
storage->storeAllocationWithTaskCount(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION, 2u);
|
||||
|
||||
@@ -92,7 +92,7 @@ TEST_F(InternalAllocationStorageTest, whenObtainAllocationFromEmptyReuseListThen
|
||||
}
|
||||
|
||||
TEST_F(InternalAllocationStorageTest, whenCompletedAllocationIsStoredAsReusableAndThenCanBeObtained) {
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(AllocationProperties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(AllocationProperties{0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
|
||||
storage->storeAllocationWithTaskCount(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION, 2u);
|
||||
@@ -110,7 +110,7 @@ TEST_F(InternalAllocationStorageTest, whenCompletedAllocationIsStoredAsReusableA
|
||||
|
||||
TEST_F(InternalAllocationStorageTest, whenNotUsedAllocationIsStoredAsReusableAndThenCanBeObtained) {
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(AllocationProperties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(AllocationProperties{0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_FALSE(allocation->isUsed());
|
||||
EXPECT_EQ(0u, csr->peekTaskCount());
|
||||
@@ -131,9 +131,9 @@ TEST_F(InternalAllocationStorageTest, whenObtainAllocationFromMidlleOfReusableLi
|
||||
auto &reusableAllocations = csr->getAllocationsForReuse();
|
||||
EXPECT_TRUE(reusableAllocations.peekIsEmpty());
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(AllocationProperties{1, GraphicsAllocation::AllocationType::BUFFER});
|
||||
auto allocation2 = memoryManager->allocateGraphicsMemoryWithProperties(AllocationProperties{10000, GraphicsAllocation::AllocationType::BUFFER});
|
||||
auto allocation3 = memoryManager->allocateGraphicsMemoryWithProperties(AllocationProperties{1, GraphicsAllocation::AllocationType::BUFFER});
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(AllocationProperties{0, 1, GraphicsAllocation::AllocationType::BUFFER});
|
||||
auto allocation2 = memoryManager->allocateGraphicsMemoryWithProperties(AllocationProperties{0, 10000, GraphicsAllocation::AllocationType::BUFFER});
|
||||
auto allocation3 = memoryManager->allocateGraphicsMemoryWithProperties(AllocationProperties{0, 1, GraphicsAllocation::AllocationType::BUFFER});
|
||||
|
||||
EXPECT_TRUE(reusableAllocations.peekIsEmpty());
|
||||
EXPECT_EQ(nullptr, allocation2->next);
|
||||
@@ -184,7 +184,7 @@ TEST_F(InternalAllocationStorageTest, whenObtainAllocationFromMidlleOfReusableLi
|
||||
TEST_F(InternalAllocationStorageTest, givenAllocationWhenItIsPutOnReusableListWhenOtherAllocationTypeIsRequestedThenNullIsReturned) {
|
||||
EXPECT_TRUE(csr->getAllocationsForReuse().peekIsEmpty());
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(AllocationProperties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(AllocationProperties{0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
storage->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION);
|
||||
|
||||
EXPECT_FALSE(csr->getAllocationsForReuse().peekIsEmpty());
|
||||
|
||||
@@ -48,23 +48,23 @@ TEST(MemoryManagerTest, givenAllowed32BitAndFroce32BitWhenGraphicsAllocationInDe
|
||||
}
|
||||
|
||||
TEST(AllocationFlagsTest, givenAllocateMemoryFlagWhenGetAllocationFlagsIsCalledThenAllocateFlagIsCorrectlySet) {
|
||||
auto allocationProperties = MemoryPropertiesParser::getAllocationProperties({}, true, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
auto allocationProperties = MemoryPropertiesParser::getAllocationProperties(0, {}, true, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
EXPECT_TRUE(allocationProperties.flags.allocateMemory);
|
||||
|
||||
allocationProperties = MemoryPropertiesParser::getAllocationProperties({}, false, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
EXPECT_FALSE(allocationProperties.flags.allocateMemory);
|
||||
auto allocationProperties2 = MemoryPropertiesParser::getAllocationProperties(0, {}, false, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
EXPECT_FALSE(allocationProperties2.flags.allocateMemory);
|
||||
}
|
||||
|
||||
TEST(UncacheableFlagsTest, givenUncachedResourceFlagWhenGetAllocationFlagsIsCalledThenUncacheableFlagIsCorrectlySet) {
|
||||
cl_mem_flags_intel flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, flagsIntel);
|
||||
auto allocationFlags = MemoryPropertiesParser::getAllocationProperties(memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
auto allocationFlags = MemoryPropertiesParser::getAllocationProperties(0, memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
EXPECT_TRUE(allocationFlags.flags.uncacheable);
|
||||
|
||||
flagsIntel = 0;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, flagsIntel);
|
||||
allocationFlags = MemoryPropertiesParser::getAllocationProperties(memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
EXPECT_FALSE(allocationFlags.flags.uncacheable);
|
||||
auto allocationFlags2 = MemoryPropertiesParser::getAllocationProperties(0, memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
EXPECT_FALSE(allocationFlags2.flags.uncacheable);
|
||||
}
|
||||
|
||||
TEST(AllocationFlagsTest, givenReadOnlyResourceFlagWhenGetAllocationFlagsIsCalledThenFlushL3FlagsAreCorrectlySet) {
|
||||
@@ -72,13 +72,13 @@ TEST(AllocationFlagsTest, givenReadOnlyResourceFlagWhenGetAllocationFlagsIsCalle
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
|
||||
|
||||
auto allocationFlags =
|
||||
MemoryPropertiesParser::getAllocationProperties(memoryProperties, true, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
MemoryPropertiesParser::getAllocationProperties(0, memoryProperties, true, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
EXPECT_FALSE(allocationFlags.flags.flushL3RequiredForRead);
|
||||
EXPECT_FALSE(allocationFlags.flags.flushL3RequiredForWrite);
|
||||
|
||||
allocationFlags = MemoryPropertiesParser::getAllocationProperties({}, true, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
EXPECT_TRUE(allocationFlags.flags.flushL3RequiredForRead);
|
||||
EXPECT_TRUE(allocationFlags.flags.flushL3RequiredForWrite);
|
||||
auto allocationFlags2 = MemoryPropertiesParser::getAllocationProperties(0, {}, true, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
EXPECT_TRUE(allocationFlags2.flags.flushL3RequiredForRead);
|
||||
EXPECT_TRUE(allocationFlags2.flags.flushL3RequiredForWrite);
|
||||
}
|
||||
|
||||
TEST(StorageInfoTest, whenStorageInfoIsCreatedWithDefaultConstructorThenReturnsOneHandle) {
|
||||
|
||||
@@ -23,7 +23,7 @@ class MemoryManagerGetAlloctionDataTest : public testing::TestWithParam<Graphics
|
||||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenHostMemoryAllocationTypeAndAllocateMemoryFlagAndNullptrWhenAllocationDataIsQueriedThenCorrectFlagsAndSizeAreSet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||
AllocationProperties properties(0, true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||
MockMemoryManager mockMemoryManager;
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
|
||||
@@ -34,7 +34,7 @@ TEST(MemoryManagerGetAlloctionDataTest, givenHostMemoryAllocationTypeAndAllocate
|
||||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenNonHostMemoryAllocatoinTypeWhenAllocationDataIsQueriedThenUseSystemMemoryFlagsIsNotSet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
AllocationProperties properties(0, true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
|
||||
MockMemoryManager mockMemoryManager;
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
@@ -47,7 +47,7 @@ TEST(MemoryManagerGetAlloctionDataTest, givenNonHostMemoryAllocatoinTypeWhenAllo
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenAllocateMemoryFlagTrueWhenHostPtrIsNotNullThenAllocationDataHasHostPtrNulled) {
|
||||
AllocationData allocData;
|
||||
char memory = 0;
|
||||
AllocationProperties properties(true, sizeof(memory), GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
AllocationProperties properties(0, true, sizeof(memory), GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
|
||||
MockMemoryManager mockMemoryManager;
|
||||
MockMemoryManager::getAllocationData(allocData, properties, &memory, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
@@ -58,7 +58,7 @@ TEST(MemoryManagerGetAlloctionDataTest, givenAllocateMemoryFlagTrueWhenHostPtrIs
|
||||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenBufferTypeWhenAllocationDataIsQueriedThenForcePinFlagIsSet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
AllocationProperties properties(0, true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
|
||||
MockMemoryManager mockMemoryManager;
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
@@ -68,7 +68,7 @@ TEST(MemoryManagerGetAlloctionDataTest, givenBufferTypeWhenAllocationDataIsQueri
|
||||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenBufferHostMemoryTypeWhenAllocationDataIsQueriedThenForcePinFlagIsSet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||
AllocationProperties properties(0, true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||
|
||||
MockMemoryManager mockMemoryManager;
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
@@ -78,7 +78,7 @@ TEST(MemoryManagerGetAlloctionDataTest, givenBufferHostMemoryTypeWhenAllocationD
|
||||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenBufferCompressedTypeWhenAllocationDataIsQueriedThenForcePinFlagIsSet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, false);
|
||||
AllocationProperties properties(0, true, 10, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, false);
|
||||
|
||||
MockMemoryManager mockMemoryManager;
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
@@ -88,7 +88,7 @@ TEST(MemoryManagerGetAlloctionDataTest, givenBufferCompressedTypeWhenAllocationD
|
||||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenWriteCombinedTypeWhenAllocationDataIsQueriedThenForcePinFlagIsSet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::WRITE_COMBINED, false);
|
||||
AllocationProperties properties(0, true, 10, GraphicsAllocation::AllocationType::WRITE_COMBINED, false);
|
||||
|
||||
MockMemoryManager mockMemoryManager;
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
@@ -98,7 +98,7 @@ TEST(MemoryManagerGetAlloctionDataTest, givenWriteCombinedTypeWhenAllocationData
|
||||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenDefaultAllocationFlagsWhenAllocationDataIsQueriedThenAllocateMemoryIsFalse) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(false, 0, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, false);
|
||||
AllocationProperties properties(0, false, 0, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, false);
|
||||
char memory;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
MockMemoryManager::getAllocationData(allocData, properties, &memory, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
@@ -111,7 +111,7 @@ typedef MemoryManagerGetAlloctionDataTest MemoryManagerGetAlloctionData32BitAnd6
|
||||
TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesAllowedTest, givenAllocationTypesWith32BitAnd64kbPagesAllowedWhenAllocationDataIsQueriedThenProperFlagsAreSet) {
|
||||
AllocationData allocData;
|
||||
auto allocType = GetParam();
|
||||
AllocationProperties properties(true, 0, allocType, false);
|
||||
AllocationProperties properties(0, true, 0, allocType, false);
|
||||
|
||||
MockMemoryManager mockMemoryManager;
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
@@ -124,7 +124,7 @@ TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesAllowedTest, givenAllocatio
|
||||
TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesAllowedTest, given64kbAllowedAllocationTypeWhenAllocatingThenPreferRenderCompressionOnlyForSpecificTypes) {
|
||||
auto allocType = GetParam();
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, allocType, false);
|
||||
AllocationProperties properties(0, true, 10, allocType, false);
|
||||
|
||||
MockMemoryManager mockMemoryManager(true, false);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
@@ -143,7 +143,7 @@ typedef MemoryManagerGetAlloctionDataTest MemoryManagerGetAlloctionData32BitAnd6
|
||||
TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesNotAllowedTest, givenAllocationTypesWith32BitAnd64kbPagesDisallowedWhenAllocationDataIsQueriedThenFlagsAreNotSet) {
|
||||
AllocationData allocData;
|
||||
auto allocType = GetParam();
|
||||
AllocationProperties properties(true, 0, allocType, false);
|
||||
AllocationProperties properties(0, true, 0, allocType, false);
|
||||
|
||||
MockMemoryManager mockMemoryManager;
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
@@ -185,7 +185,7 @@ TEST(MemoryManagerTest, givenForced32BitSetWhenGraphicsMemoryFor32BitAllowedType
|
||||
memoryManager.setForce32BitAllocations(true);
|
||||
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
AllocationProperties properties(0, true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
||||
|
||||
@@ -208,7 +208,7 @@ TEST(MemoryManagerTest, givenForced32BitEnabledWhenGraphicsMemoryWihtoutAllow32B
|
||||
memoryManager.setForce32BitAllocations(true);
|
||||
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
AllocationProperties properties(0, true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
||||
allocData.flags.allow32Bit = false;
|
||||
@@ -226,7 +226,7 @@ TEST(MemoryManagerTest, givenForced32BitDisabledWhenGraphicsMemoryWith32BitFlagF
|
||||
memoryManager.setForce32BitAllocations(false);
|
||||
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
AllocationProperties properties(0, true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
||||
|
||||
@@ -241,7 +241,7 @@ TEST(MemoryManagerTest, givenEnabled64kbPagesWhenGraphicsMemoryMustBeHostMemoryA
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
MockMemoryManager memoryManager(true, false, executionEnvironment);
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||
AllocationProperties properties(0, true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
||||
|
||||
@@ -259,7 +259,7 @@ TEST(MemoryManagerTest, givenEnabled64kbPagesWhenGraphicsMemoryWithoutAllow64kbP
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
MockMemoryManager memoryManager(true, false, executionEnvironment);
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
AllocationProperties properties(0, true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
||||
allocData.flags.allow64kbPages = false;
|
||||
@@ -276,7 +276,7 @@ TEST(MemoryManagerTest, givenDisabled64kbPagesWhenGraphicsMemoryMustBeHostMemory
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
MockMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||
AllocationProperties properties(0, true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
||||
|
||||
@@ -295,7 +295,7 @@ TEST(MemoryManagerTest, givenForced32BitAndEnabled64kbPagesWhenGraphicsMemoryMus
|
||||
memoryManager.setForce32BitAllocations(true);
|
||||
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||
AllocationProperties properties(0, true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
||||
|
||||
@@ -314,7 +314,7 @@ TEST(MemoryManagerTest, givenEnabled64kbPagesWhenGraphicsMemoryIsAllocatedWithHo
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
MockMemoryManager memoryManager(true, false, executionEnvironment);
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(false, 1, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||
AllocationProperties properties(0, false, 1, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||
|
||||
char memory[1];
|
||||
MockMemoryManager::getAllocationData(allocData, properties, &memory, memoryManager.createStorageInfoFromProperties(properties));
|
||||
@@ -366,7 +366,7 @@ TEST(MemoryManagerTest, givenMemoryManagerWhenBufferTypeIsPassedAndAllocateInDev
|
||||
TEST(MemoryManagerTest, givenSvmAllocationTypeWhenGetAllocationDataIsCalledThenAllocatingMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::SVM_ZERO_COPY};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::SVM_ZERO_COPY};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_TRUE(allocData.flags.allocateMemory);
|
||||
}
|
||||
@@ -374,7 +374,7 @@ TEST(MemoryManagerTest, givenSvmAllocationTypeWhenGetAllocationDataIsCalledThenA
|
||||
TEST(MemoryManagerTest, givenSvmAllocationTypeWhenGetAllocationDataIsCalledThen64kbPagesAreAllowedAnd32BitAllocationIsDisallowed) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::SVM_ZERO_COPY};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::SVM_ZERO_COPY};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_TRUE(allocData.flags.allow64kbPages);
|
||||
EXPECT_FALSE(allocData.flags.allow32Bit);
|
||||
@@ -383,7 +383,7 @@ TEST(MemoryManagerTest, givenSvmAllocationTypeWhenGetAllocationDataIsCalledThen6
|
||||
TEST(MemoryManagerTest, givenTagBufferTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::TAG_BUFFER};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::TAG_BUFFER};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
@@ -391,7 +391,7 @@ TEST(MemoryManagerTest, givenTagBufferTypeWhenGetAllocationDataIsCalledThenSyste
|
||||
TEST(MemoryManagerTest, givenPreemptionTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::PREEMPTION};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::PREEMPTION};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
@@ -399,7 +399,7 @@ TEST(MemoryManagerTest, givenPreemptionTypeWhenGetAllocationDataIsCalledThenSyst
|
||||
TEST(MemoryManagerTest, givenSharedContextImageTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
@@ -407,7 +407,7 @@ TEST(MemoryManagerTest, givenSharedContextImageTypeWhenGetAllocationDataIsCalled
|
||||
TEST(MemoryManagerTest, givenMCSTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::MCS};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::MCS};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
@@ -415,7 +415,7 @@ TEST(MemoryManagerTest, givenMCSTypeWhenGetAllocationDataIsCalledThenSystemMemor
|
||||
TEST(MemoryManagerTest, givenPipeTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::PIPE};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::PIPE};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
@@ -423,7 +423,7 @@ TEST(MemoryManagerTest, givenPipeTypeWhenGetAllocationDataIsCalledThenSystemMemo
|
||||
TEST(MemoryManagerTest, givenGlobalSurfaceTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::GLOBAL_SURFACE};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::GLOBAL_SURFACE};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
@@ -431,7 +431,7 @@ TEST(MemoryManagerTest, givenGlobalSurfaceTypeWhenGetAllocationDataIsCalledThenS
|
||||
TEST(MemoryManagerTest, givenWriteCombinedTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::WRITE_COMBINED};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::WRITE_COMBINED};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
@@ -439,7 +439,7 @@ TEST(MemoryManagerTest, givenWriteCombinedTypeWhenGetAllocationDataIsCalledThenS
|
||||
TEST(MemoryManagerTest, givenDeviceQueueBufferTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
@@ -447,7 +447,7 @@ TEST(MemoryManagerTest, givenDeviceQueueBufferTypeWhenGetAllocationDataIsCalledT
|
||||
TEST(MemoryManagerTest, givenInternalHostMemoryTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
@@ -455,7 +455,7 @@ TEST(MemoryManagerTest, givenInternalHostMemoryTypeWhenGetAllocationDataIsCalled
|
||||
TEST(MemoryManagerTest, givenFillPatternTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::FILL_PATTERN};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::FILL_PATTERN};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
@@ -463,7 +463,7 @@ TEST(MemoryManagerTest, givenFillPatternTypeWhenGetAllocationDataIsCalledThenSys
|
||||
TEST(MemoryManagerTest, givenLinearStreamTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::LINEAR_STREAM};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::LINEAR_STREAM};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
EXPECT_TRUE(allocData.flags.requiresCpuAccess);
|
||||
@@ -472,7 +472,7 @@ TEST(MemoryManagerTest, givenLinearStreamTypeWhenGetAllocationDataIsCalledThenSy
|
||||
TEST(MemoryManagerTest, givenTimestampPacketTagBufferTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequestedAndRequireCpuAccess) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER};
|
||||
mockMemoryManager.getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
EXPECT_TRUE(allocData.flags.requiresCpuAccess);
|
||||
@@ -481,7 +481,7 @@ TEST(MemoryManagerTest, givenTimestampPacketTagBufferTypeWhenGetAllocationDataIs
|
||||
TEST(MemoryManagerTest, givenProfilingTagBufferTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
EXPECT_FALSE(allocData.flags.requiresCpuAccess);
|
||||
@@ -490,7 +490,7 @@ TEST(MemoryManagerTest, givenProfilingTagBufferTypeWhenGetAllocationDataIsCalled
|
||||
TEST(MemoryManagerTest, givenAllocationPropertiesWithMultiOsContextCapableFlagEnabledWhenAllocateMemoryThenAllocationDataIsMultiOsContextCapable) {
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
MockMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
AllocationProperties properties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER};
|
||||
AllocationProperties properties{0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER};
|
||||
properties.flags.multiOsContextCapable = true;
|
||||
|
||||
AllocationData allocData;
|
||||
@@ -501,7 +501,7 @@ TEST(MemoryManagerTest, givenAllocationPropertiesWithMultiOsContextCapableFlagEn
|
||||
TEST(MemoryManagerTest, givenAllocationPropertiesWithMultiOsContextCapableFlagDisabledWhenAllocateMemoryThenAllocationDataIsNotMultiOsContextCapable) {
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
MockMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
AllocationProperties properties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER};
|
||||
AllocationProperties properties{0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER};
|
||||
properties.flags.multiOsContextCapable = false;
|
||||
|
||||
AllocationData allocData;
|
||||
@@ -512,7 +512,7 @@ TEST(MemoryManagerTest, givenAllocationPropertiesWithMultiOsContextCapableFlagDi
|
||||
TEST(MemoryManagerTest, givenConstantSurfaceTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::CONSTANT_SURFACE};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::CONSTANT_SURFACE};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
@@ -524,7 +524,7 @@ TEST(MemoryManagerTest, givenInternalHeapTypeThenUseInternal32BitAllocator) {
|
||||
TEST(MemoryManagerTest, givenInternalHeapTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::INTERNAL_HEAP};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::INTERNAL_HEAP};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
EXPECT_TRUE(allocData.flags.requiresCpuAccess);
|
||||
@@ -533,7 +533,7 @@ TEST(MemoryManagerTest, givenInternalHeapTypeWhenGetAllocationDataIsCalledThenSy
|
||||
TEST(MemoryManagerTest, givenKernelIsaTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::KERNEL_ISA};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::KERNEL_ISA};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
@@ -541,7 +541,7 @@ TEST(MemoryManagerTest, givenKernelIsaTypeWhenGetAllocationDataIsCalledThenSyste
|
||||
TEST(MemoryManagerTest, givenLinearStreamWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::LINEAR_STREAM};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::LINEAR_STREAM};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
EXPECT_TRUE(allocData.flags.requiresCpuAccess);
|
||||
@@ -550,7 +550,7 @@ TEST(MemoryManagerTest, givenLinearStreamWhenGetAllocationDataIsCalledThenSystem
|
||||
TEST(MemoryManagerTest, givenPrintfAllocationWhenGetAllocationDataIsCalledThenDontUseSystemMemoryAndRequireCpuAccess) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::PRINTF_SURFACE};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::PRINTF_SURFACE};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
EXPECT_TRUE(allocData.flags.requiresCpuAccess);
|
||||
@@ -564,7 +564,7 @@ TEST(MemoryManagerTest, givenExternalHostMemoryWhenGetAllocationDataIsCalledThen
|
||||
AllocationData allocData;
|
||||
auto hostPtr = reinterpret_cast<void *>(0x1234);
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{0, false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, hostPtr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
EXPECT_FALSE(allocData.flags.allocateMemory);
|
||||
@@ -576,11 +576,11 @@ TEST(MemoryManagerTest, givenExternalHostMemoryWhenGetAllocationDataIsCalledThen
|
||||
TEST(MemoryManagerTest, getAllocationDataProperlyHandlesRootDeviceIndexFromAllcationProperties) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{1, GraphicsAllocation::AllocationType::BUFFER};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::BUFFER};
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_EQ(allocData.rootDeviceIndex, 0u);
|
||||
|
||||
properties.rootDeviceIndex = 100;
|
||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_EQ(allocData.rootDeviceIndex, properties.rootDeviceIndex);
|
||||
AllocationProperties properties2{100, 1, GraphicsAllocation::AllocationType::BUFFER};
|
||||
MockMemoryManager::getAllocationData(allocData, properties2, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||
EXPECT_EQ(allocData.rootDeviceIndex, properties2.rootDeviceIndex);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ TEST_F(MemoryManagerMultiDeviceTest, givenRootDeviceIndexSpecifiedWhenAllocateGr
|
||||
GraphicsAllocation::AllocationType::KERNEL_ISA};
|
||||
for (auto allocationType : allocationTypes) {
|
||||
for (uint32_t rootDeviceIndex = 0; rootDeviceIndex < getNumRootDevices(); ++rootDeviceIndex) {
|
||||
AllocationProperties properties{true, MemoryConstants::pageSize, allocationType, false, false, 0, rootDeviceIndex};
|
||||
AllocationProperties properties{rootDeviceIndex, true, MemoryConstants::pageSize, allocationType, false, false, 0};
|
||||
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
ASSERT_NE(gfxAllocation, nullptr);
|
||||
|
||||
@@ -52,7 +52,7 @@ TEST(MemoryManagerTest, whenCreatingOsAgnosticMemoryManagerThenSupportsMultiStor
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, whenCreatingAllocPropertiesForMultiStorageResourceThenMultiStorageResourcesFlagIsSetToTrue) {
|
||||
AllocationProperties properties{false, 0u, GraphicsAllocation::AllocationType::SCRATCH_SURFACE, false, true, 0, 0};
|
||||
AllocationProperties properties{0, false, 0u, GraphicsAllocation::AllocationType::SCRATCH_SURFACE, false, true, 0};
|
||||
EXPECT_TRUE(properties.multiStorageResource);
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ TEST_F(MemoryAllocatorTest, givenMemoryManagerWhenAskedFor32bitAllocationWithPtr
|
||||
TEST_F(MemoryAllocatorTest, givenAllocationWithFragmentsWhenCallingFreeGraphicsMemoryThenDoNotCallHandleFenceCompletion) {
|
||||
auto size = 3u * MemoryConstants::pageSize;
|
||||
auto *ptr = reinterpret_cast<void *>(0xbeef1);
|
||||
AllocationProperties properties{false, size, GraphicsAllocation::AllocationType::BUFFER, false};
|
||||
AllocationProperties properties{0, false, size, GraphicsAllocation::AllocationType::BUFFER, false};
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, ptr);
|
||||
EXPECT_EQ(3u, allocation->fragmentsStorage.fragmentCount);
|
||||
@@ -438,7 +438,7 @@ TEST_F(MemoryAllocatorTest, givenAllocationWithFragmentsWhenCallingFreeGraphicsM
|
||||
}
|
||||
|
||||
TEST_F(MemoryAllocatorTest, givenAllocationWithoutFragmentsWhenCallingFreeGraphicsMemoryThenCallHandleFenceCompletion) {
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
EXPECT_EQ(0u, allocation->fragmentsStorage.fragmentCount);
|
||||
|
||||
EXPECT_EQ(0u, memoryManager->handleFenceCompletionCalled);
|
||||
@@ -595,7 +595,7 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAskedFor32BitAllocationWhenL
|
||||
memoryManager.forceLimitedRangeAllocator(0, 0xFFFFFFFFF);
|
||||
|
||||
AllocationData allocationData;
|
||||
MockMemoryManager::getAllocationData(allocationData, {MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER}, nullptr, StorageInfo{});
|
||||
MockMemoryManager::getAllocationData(allocationData, {0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER}, nullptr, StorageInfo{});
|
||||
auto gfxAllocation = memoryManager.allocateGraphicsMemoryWithAlignment(allocationData);
|
||||
ASSERT_NE(gfxAllocation, nullptr);
|
||||
EXPECT_NE(gfxAllocation->getGpuBaseAddress(), 0ull);
|
||||
@@ -613,7 +613,7 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAskedForNon32BitAllocationWh
|
||||
memoryManager.forceLimitedRangeAllocator(0, 0xFFFFFFFFF);
|
||||
|
||||
AllocationData allocationData;
|
||||
MockMemoryManager::getAllocationData(allocationData, {MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER}, nullptr, StorageInfo{});
|
||||
MockMemoryManager::getAllocationData(allocationData, {0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER}, nullptr, StorageInfo{});
|
||||
auto gfxAllocation = memoryManager.allocateGraphicsMemoryWithAlignment(allocationData);
|
||||
ASSERT_NE(gfxAllocation, nullptr);
|
||||
EXPECT_EQ(gfxAllocation->getGpuBaseAddress(), 0ull);
|
||||
@@ -835,7 +835,7 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAllocate32BitGraphicsMemoryW
|
||||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWith64KBPagesEnabledWhenAllocateGraphicsMemoryThenMemoryPoolIsSystem64KBPages) {
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(true, false, executionEnvironment);
|
||||
auto svmAllocation = memoryManager.allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SVM_ZERO_COPY});
|
||||
auto svmAllocation = memoryManager.allocateGraphicsMemoryWithProperties({0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SVM_ZERO_COPY});
|
||||
EXPECT_NE(nullptr, svmAllocation);
|
||||
EXPECT_EQ(MemoryPool::System64KBPages, svmAllocation->getMemoryPool());
|
||||
memoryManager.freeGraphicsMemory(svmAllocation);
|
||||
@@ -844,7 +844,7 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWith64KBPagesEnabledWhenAllocate
|
||||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWith64KBPagesDisabledWhenAllocateGraphicsMemoryThen4KBGraphicsAllocationIsReturned) {
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||
auto svmAllocation = memoryManager.allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SVM_ZERO_COPY});
|
||||
auto svmAllocation = memoryManager.allocateGraphicsMemoryWithProperties({0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SVM_ZERO_COPY});
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, svmAllocation->getMemoryPool());
|
||||
memoryManager.freeGraphicsMemory(svmAllocation);
|
||||
}
|
||||
@@ -854,7 +854,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocat
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||
osHandle handle = 1;
|
||||
auto size = 4096u;
|
||||
AllocationProperties properties(false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||
EXPECT_NE(nullptr, sharedAllocation);
|
||||
EXPECT_FALSE(sharedAllocation->isCoherent());
|
||||
@@ -870,7 +870,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocat
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||
osHandle handle = 1;
|
||||
auto size = 4096u;
|
||||
AllocationProperties properties(false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0u, 0u);
|
||||
AllocationProperties properties(0u, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0u);
|
||||
EXPECT_EQ(properties.subDeviceIndex, 0u);
|
||||
EXPECT_EQ(properties.rootDeviceIndex, 0u);
|
||||
|
||||
@@ -890,7 +890,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocat
|
||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||
osHandle handle = 1;
|
||||
auto size = 4096u;
|
||||
AllocationProperties properties(false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, true);
|
||||
EXPECT_NE(nullptr, sharedAllocation);
|
||||
EXPECT_TRUE(sharedAllocation->is32BitAllocation());
|
||||
@@ -1162,7 +1162,7 @@ TEST_P(OsAgnosticMemoryManagerWithParams, givenReducedGpuAddressSpaceWhenAllocat
|
||||
}
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
auto hostPtr = reinterpret_cast<const void *>(0x5001);
|
||||
AllocationProperties properties{false, 13, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{0, false, 13, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = requiresL3Flush;
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
@@ -1181,7 +1181,7 @@ TEST_P(OsAgnosticMemoryManagerWithParams, givenFullGpuAddressSpaceWhenAllocateGr
|
||||
}
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
auto hostPtr = reinterpret_cast<const void *>(0x5001);
|
||||
AllocationProperties properties{false, 13, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{0, false, 13, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = requiresL3Flush;
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
@@ -1205,7 +1205,7 @@ TEST_P(OsAgnosticMemoryManagerWithParams, givenDisabledHostPtrTrackingWhenAlloca
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
auto hostPtr = reinterpret_cast<const void *>(0x5001);
|
||||
|
||||
AllocationProperties properties{false, 13, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
AllocationProperties properties{0, false, 13, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = requiresL3Flush;
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
@@ -1757,7 +1757,7 @@ TEST(MemoryManagerTest, givenExecutionEnvrionmentWithCleanedRootDeviceExecutions
|
||||
|
||||
TEST(MemoryManagerTest, givenAllocationTypesThatMayNeedL3FlushWhenCallingGetAllocationDataThenFlushL3FlagIsCorrectlySet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(1, GraphicsAllocation::AllocationType::UNKNOWN);
|
||||
AllocationProperties properties(0, 1, GraphicsAllocation::AllocationType::UNKNOWN);
|
||||
properties.flags.flushL3RequiredForRead = 1;
|
||||
properties.flags.flushL3RequiredForWrite = 1;
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ using SVMMemoryAllocatorTest = Test<SVMMemoryAllocatorFixture<false>>;
|
||||
using SVMLocalMemoryAllocatorTest = Test<SVMMemoryAllocatorFixture<true>>;
|
||||
|
||||
TEST_F(SVMMemoryAllocatorTest, whenCreateZeroSizedSVMAllocationThenReturnNullptr) {
|
||||
auto ptr = svmManager->createSVMAlloc(0, {});
|
||||
auto ptr = svmManager->createSVMAlloc(0, 0, {});
|
||||
|
||||
EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs());
|
||||
EXPECT_EQ(ptr, nullptr);
|
||||
@@ -59,7 +59,7 @@ TEST_F(SVMMemoryAllocatorTest, whenRequestSVMAllocsThenReturnNonNullptr) {
|
||||
}
|
||||
|
||||
TEST_F(SVMMemoryAllocatorTest, whenSVMAllocationIsFreedThenCannotBeGotAgain) {
|
||||
auto ptr = svmManager->createSVMAlloc(MemoryConstants::pageSize, {});
|
||||
auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {});
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto svmData = svmManager->getSVMAlloc(ptr);
|
||||
ASSERT_NE(nullptr, svmData);
|
||||
@@ -77,7 +77,7 @@ TEST_F(SVMMemoryAllocatorTest, whenSVMAllocationIsFreedThenCannotBeGotAgain) {
|
||||
}
|
||||
|
||||
TEST_F(SVMMemoryAllocatorTest, whenGetSVMAllocationFromReturnedPointerAreaThenReturnSameAllocation) {
|
||||
auto ptr = svmManager->createSVMAlloc(MemoryConstants::pageSize, {});
|
||||
auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {});
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
auto svmData = svmManager->getSVMAlloc(ptr);
|
||||
ASSERT_NE(nullptr, svmData);
|
||||
@@ -96,7 +96,7 @@ TEST_F(SVMMemoryAllocatorTest, whenGetSVMAllocationFromReturnedPointerAreaThenRe
|
||||
}
|
||||
|
||||
TEST_F(SVMMemoryAllocatorTest, whenGetSVMAllocationFromOutsideOfReturnedPointerAreaThenDontReturnThisAllocation) {
|
||||
auto ptr = svmManager->createSVMAlloc(MemoryConstants::pageSize, {});
|
||||
auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {});
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
auto svmData = svmManager->getSVMAlloc(ptr);
|
||||
ASSERT_NE(nullptr, svmData);
|
||||
@@ -117,7 +117,7 @@ TEST_F(SVMMemoryAllocatorTest, whenGetSVMAllocationFromOutsideOfReturnedPointerA
|
||||
TEST_F(SVMMemoryAllocatorTest, whenCouldNotAllocateInMemoryManagerThenReturnsNullAndDoesNotChangeAllocsMap) {
|
||||
FailMemoryManager failMemoryManager(executionEnvironment);
|
||||
svmManager->memoryManager = &failMemoryManager;
|
||||
auto ptr = svmManager->createSVMAlloc(MemoryConstants::pageSize, {});
|
||||
auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {});
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs());
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
@@ -129,7 +129,7 @@ TEST_F(SVMMemoryAllocatorTest, whenCouldNotAllocateInMemoryManagerThenCreateUnif
|
||||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties;
|
||||
unifiedMemoryProperties.memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY;
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(0, 4096u, unifiedMemoryProperties);
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs());
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
@@ -138,7 +138,7 @@ TEST_F(SVMMemoryAllocatorTest, whenCouldNotAllocateInMemoryManagerThenCreateUnif
|
||||
TEST_F(SVMMemoryAllocatorTest, given64kbAllowedWhenAllocatingSvmMemoryThenDontPreferRenderCompression) {
|
||||
MockMemoryManager memoryManager64Kb(true, false, executionEnvironment);
|
||||
svmManager->memoryManager = &memoryManager64Kb;
|
||||
auto ptr = svmManager->createSVMAlloc(MemoryConstants::pageSize, {});
|
||||
auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {});
|
||||
EXPECT_FALSE(memoryManager64Kb.preferRenderCompressedFlagPassed);
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
}
|
||||
@@ -146,13 +146,13 @@ TEST_F(SVMMemoryAllocatorTest, given64kbAllowedWhenAllocatingSvmMemoryThenDontPr
|
||||
TEST_F(SVMMemoryAllocatorTest, given64kbAllowedwhenAllocatingSvmMemoryThenAllocationIsIn64kbPagePool) {
|
||||
MockMemoryManager memoryManager64Kb(true, false, executionEnvironment);
|
||||
svmManager->memoryManager = &memoryManager64Kb;
|
||||
auto ptr = svmManager->createSVMAlloc(MemoryConstants::pageSize, {});
|
||||
auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {});
|
||||
EXPECT_EQ(MemoryPool::System64KBPages, svmManager->getSVMAlloc(ptr)->gpuAllocation->getMemoryPool());
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
}
|
||||
|
||||
TEST_F(SVMMemoryAllocatorTest, given64kbDisallowedWhenAllocatingSvmMemoryThenAllocationIsIn4kbPagePool) {
|
||||
auto ptr = svmManager->createSVMAlloc(MemoryConstants::pageSize, {});
|
||||
auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {});
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, svmManager->getSVMAlloc(ptr)->gpuAllocation->getMemoryPool());
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ TEST_F(SVMMemoryAllocatorTest, given64kbDisallowedWhenAllocatingSvmMemoryThenAll
|
||||
TEST_F(SVMMemoryAllocatorTest, whenCoherentFlagIsPassedThenAllocationIsCoherent) {
|
||||
SVMAllocsManager::SvmAllocationProperties svmProperties;
|
||||
svmProperties.coherent = true;
|
||||
auto ptr = svmManager->createSVMAlloc(MemoryConstants::pageSize, svmProperties);
|
||||
auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, svmProperties);
|
||||
EXPECT_TRUE(svmManager->getSVMAlloc(ptr)->gpuAllocation->isCoherent());
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
}
|
||||
@@ -169,7 +169,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenDeviceAllocationIsCreatedThenItIsStoredW
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties;
|
||||
unifiedMemoryProperties.memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY;
|
||||
auto allocationSize = 4096u;
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(0, 4096u, unifiedMemoryProperties);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
EXPECT_EQ(nullptr, allocation->cpuAllocation);
|
||||
@@ -188,7 +188,7 @@ TEST_F(SVMMemoryAllocatorTest, whenHostAllocationIsCreatedThenItIsStoredWithProp
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties;
|
||||
unifiedMemoryProperties.memoryType = InternalMemoryType::HOST_UNIFIED_MEMORY;
|
||||
auto allocationSize = 4096u;
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(0, 4096u, unifiedMemoryProperties);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
EXPECT_EQ(nullptr, allocation->cpuAllocation);
|
||||
@@ -212,7 +212,7 @@ TEST_F(SVMMemoryAllocatorTest, whenCouldNotAllocateInMemoryManagerThenCreateShar
|
||||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties;
|
||||
unifiedMemoryProperties.memoryType = InternalMemoryType::SHARED_UNIFIED_MEMORY;
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(0, 4096u, unifiedMemoryProperties, &cmdQ);
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs());
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
@@ -223,7 +223,7 @@ TEST_F(SVMMemoryAllocatorTest, whenSharedAllocationIsCreatedThenItIsStoredWithPr
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties;
|
||||
unifiedMemoryProperties.memoryType = InternalMemoryType::SHARED_UNIFIED_MEMORY;
|
||||
auto allocationSize = 4096u;
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(0, 4096u, unifiedMemoryProperties, &cmdQ);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
EXPECT_EQ(nullptr, allocation->cpuAllocation);
|
||||
@@ -246,7 +246,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithDebugFlagSe
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties;
|
||||
unifiedMemoryProperties.memoryType = InternalMemoryType::SHARED_UNIFIED_MEMORY;
|
||||
auto allocationSize = 4096u;
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(0, 4096u, unifiedMemoryProperties, &cmdQ);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
EXPECT_NE(nullptr, allocation->cpuAllocation);
|
||||
@@ -275,7 +275,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithLocalMemory
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties;
|
||||
unifiedMemoryProperties.memoryType = InternalMemoryType::SHARED_UNIFIED_MEMORY;
|
||||
auto allocationSize = 4096u;
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(0, 4096u, unifiedMemoryProperties, &cmdQ);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
EXPECT_NE(nullptr, allocation->cpuAllocation);
|
||||
@@ -303,7 +303,7 @@ TEST_F(SVMMemoryAllocatorTest, givenSharedAllocationsDebugFlagWhenDeviceMemoryIs
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties;
|
||||
unifiedMemoryProperties.memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY;
|
||||
auto allocationSize = 4096u;
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(0, 4096u, unifiedMemoryProperties);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto allocation = svmManager->getSVMAlloc(ptr);
|
||||
EXPECT_EQ(nullptr, allocation->cpuAllocation);
|
||||
@@ -356,7 +356,7 @@ TEST(SvmAllocationPropertiesTests, givenDifferentMemFlagsWhenGettingSvmAllocatio
|
||||
TEST_F(SVMMemoryAllocatorTest, whenReadOnlySvmAllocationCreatedThenGraphicsAllocationHasWriteableFlagFalse) {
|
||||
SVMAllocsManager::SvmAllocationProperties svmProperties;
|
||||
svmProperties.readOnly = true;
|
||||
void *svm = svmManager->createSVMAlloc(4096, svmProperties);
|
||||
void *svm = svmManager->createSVMAlloc(0, 4096, svmProperties);
|
||||
EXPECT_NE(nullptr, svm);
|
||||
|
||||
auto svmData = svmManager->getSVMAlloc(svm);
|
||||
@@ -369,7 +369,7 @@ TEST_F(SVMMemoryAllocatorTest, whenReadOnlySvmAllocationCreatedThenGraphicsAlloc
|
||||
}
|
||||
|
||||
TEST_F(SVMLocalMemoryAllocatorTest, whenAllocatingSvmThenExpectCpuAllocationWithPointerAndGpuAllocationWithSameGpuAddress) {
|
||||
auto ptr = svmManager->createSVMAlloc(MemoryConstants::pageSize, {});
|
||||
auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {});
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
auto svmData = svmManager->getSVMAlloc(ptr);
|
||||
ASSERT_NE(nullptr, svmData);
|
||||
@@ -385,7 +385,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenAllocatingSvmThenExpectCpuAllocationWith
|
||||
}
|
||||
|
||||
TEST_F(SVMLocalMemoryAllocatorTest, whenGetSVMAllocationFromOutsideOfReturnedPointerAreaThenDontReturnThisAllocation) {
|
||||
auto ptr = svmManager->createSVMAlloc(MemoryConstants::pageSize, {});
|
||||
auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {});
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
auto svmData = svmManager->getSVMAlloc(ptr);
|
||||
ASSERT_NE(nullptr, svmData);
|
||||
@@ -406,7 +406,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenGetSVMAllocationFromOutsideOfReturnedPoi
|
||||
TEST_F(SVMLocalMemoryAllocatorTest, whenCouldNotAllocateCpuAllocationInMemoryManagerThenReturnsNullAndDoesNotChangeAllocsMap) {
|
||||
FailMemoryManager failMemoryManager(false, true, executionEnvironment);
|
||||
svmManager->memoryManager = &failMemoryManager;
|
||||
auto ptr = svmManager->createSVMAlloc(MemoryConstants::pageSize, {});
|
||||
auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {});
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs());
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
@@ -415,7 +415,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenCouldNotAllocateCpuAllocationInMemoryMan
|
||||
TEST_F(SVMLocalMemoryAllocatorTest, whenCouldNotAllocateGpuAllocationInMemoryManagerThenReturnsNullAndDoesNotChangeAllocsMap) {
|
||||
FailMemoryManager failMemoryManager(1, executionEnvironment, true);
|
||||
svmManager->memoryManager = &failMemoryManager;
|
||||
auto ptr = svmManager->createSVMAlloc(MemoryConstants::pageSize, {});
|
||||
auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {});
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs());
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
@@ -423,7 +423,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenCouldNotAllocateGpuAllocationInMemoryMan
|
||||
|
||||
TEST_F(SVMLocalMemoryAllocatorTest, whenCouldNotReserveCpuAddressRangeInMemoryManagerThenReturnsNullAndDoesNotChangeAllocsMap) {
|
||||
memoryManager->failReserveAddress = true;
|
||||
auto ptr = svmManager->createSVMAlloc(MemoryConstants::pageSize, {});
|
||||
auto ptr = svmManager->createSVMAlloc(0, MemoryConstants::pageSize, {});
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
EXPECT_EQ(0u, svmManager->SVMAllocs.getNumAllocs());
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
|
||||
namespace NEO {
|
||||
struct MockAllocationProperties : public AllocationProperties {
|
||||
MockAllocationProperties(size_t size, GraphicsAllocation::AllocationType allocationType) : AllocationProperties(size, allocationType) {}
|
||||
MockAllocationProperties(size_t size) : AllocationProperties(size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY) {}
|
||||
MockAllocationProperties(bool allocateMemory, size_t size) : AllocationProperties(allocateMemory, size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, false) {}
|
||||
MockAllocationProperties(bool allocateMemory, size_t size, GraphicsAllocation::AllocationType allocationType) : AllocationProperties(allocateMemory, size, allocationType, false) {}
|
||||
MockAllocationProperties(size_t size, GraphicsAllocation::AllocationType allocationType) : AllocationProperties(0, size, allocationType) {}
|
||||
MockAllocationProperties(size_t size) : AllocationProperties(0, size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY) {}
|
||||
MockAllocationProperties(bool allocateMemory, size_t size) : AllocationProperties(0, allocateMemory, size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, false) {}
|
||||
MockAllocationProperties(bool allocateMemory, size_t size, GraphicsAllocation::AllocationType allocationType) : AllocationProperties(0, allocateMemory, size, allocationType, false) {}
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -241,8 +241,8 @@ class MockFlatBatchBufferHelper : public FlatBatchBufferHelperHw<GfxFamily> {
|
||||
MOCK_METHOD1(removePatchInfoData, bool(uint64_t));
|
||||
MOCK_METHOD1(registerCommandChunk, bool(CommandChunk &));
|
||||
MOCK_METHOD2(registerBatchBufferStartAddress, bool(uint64_t, uint64_t));
|
||||
MOCK_METHOD3(flattenBatchBuffer,
|
||||
GraphicsAllocation *(BatchBuffer &batchBuffer, size_t &sizeBatchBuffer, DispatchMode dispatchMode));
|
||||
MOCK_METHOD4(flattenBatchBuffer,
|
||||
GraphicsAllocation *(uint32_t rootDeviceIndex, BatchBuffer &batchBuffer, size_t &sizeBatchBuffer, DispatchMode dispatchMode));
|
||||
};
|
||||
|
||||
class MockCommandStreamReceiver : public CommandStreamReceiver {
|
||||
|
||||
@@ -49,7 +49,7 @@ class MockGmm : public Gmm {
|
||||
imgDesc.image_width = 5;
|
||||
imgDesc.image_height = 5;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
return memoryManager.allocateGraphicsMemoryWithProperties({true, imgInfo, GraphicsAllocation::AllocationType::IMAGE});
|
||||
return memoryManager.allocateGraphicsMemoryWithProperties({0, true, imgInfo, GraphicsAllocation::AllocationType::IMAGE});
|
||||
}
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -18,7 +18,7 @@ class MockTagAllocator : public TagAllocator<TagType> {
|
||||
using BaseClass::usedTags;
|
||||
using NodeType = typename BaseClass::NodeType;
|
||||
|
||||
MockTagAllocator(MemoryManager *memoryManager, size_t tagCount = 10) : BaseClass(memoryManager, tagCount, 10) {}
|
||||
MockTagAllocator(uint32_t rootDeviceIndex, MemoryManager *memoryManager, size_t tagCount = 10) : BaseClass(rootDeviceIndex, memoryManager, tagCount, 10) {}
|
||||
|
||||
void returnTag(NodeType *node) override {
|
||||
releaseReferenceNodes.push_back(node);
|
||||
|
||||
@@ -49,7 +49,7 @@ TEST(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSharedAllocationIsCreatedFro
|
||||
|
||||
auto createFunction = [&]() {
|
||||
size_t indexFree = index++;
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
createdAllocations[indexFree] = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||
EXPECT_NE(nullptr, createdAllocations[indexFree]);
|
||||
};
|
||||
@@ -114,7 +114,7 @@ TEST(DrmMemoryManagerTest, givenMultipleThreadsWhenSharedAllocationIsCreatedThen
|
||||
|
||||
auto createFunction = [&]() {
|
||||
size_t indexFree = index++;
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
createdAllocations[indexFree] = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||
EXPECT_NE(nullptr, createdAllocations[indexFree]);
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenCopyMemoryToAllocationThen
|
||||
|
||||
std::vector<uint8_t> dataToCopy(MemoryConstants::pageSize, 1u);
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({dataToCopy.size(), GraphicsAllocation::AllocationType::BUFFER});
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({0, dataToCopy.size(), GraphicsAllocation::AllocationType::BUFFER});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
||||
auto ret = memoryManager->copyMemoryToAllocation(allocation, dataToCopy.data(), dataToCopy.size());
|
||||
|
||||
@@ -1526,7 +1526,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndOsHandleWhenCreateIsCalledT
|
||||
osHandle handle = 1u;
|
||||
this->mock->outputHandle = 2u;
|
||||
size_t size = 4096u;
|
||||
AllocationProperties properties(false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
|
||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||
ASSERT_NE(nullptr, graphicsAllocation);
|
||||
@@ -1556,7 +1556,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndOsHandleWhenCreateIsCalledA
|
||||
osHandle handle = 1u;
|
||||
this->mock->outputHandle = 2u;
|
||||
size_t size = 4096u;
|
||||
AllocationProperties properties(false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0u, 0u);
|
||||
AllocationProperties properties(0u, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0u);
|
||||
ASSERT_EQ(properties.subDeviceIndex, 0u);
|
||||
ASSERT_EQ(properties.rootDeviceIndex, 0u);
|
||||
|
||||
@@ -1605,7 +1605,7 @@ TEST_F(DrmMemoryManagerTest, givenOsHandleWithNonTiledObjectWhenCreateFromShared
|
||||
imgInfo.surfaceFormat = gmmSurfaceFormat;
|
||||
imgInfo.plane = GMM_PLANE_Y;
|
||||
|
||||
AllocationProperties properties(false, imgInfo, GraphicsAllocation::AllocationType::SHARED_IMAGE);
|
||||
AllocationProperties properties(0, false, imgInfo, GraphicsAllocation::AllocationType::SHARED_IMAGE);
|
||||
|
||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||
ASSERT_NE(nullptr, graphicsAllocation);
|
||||
@@ -1645,7 +1645,7 @@ TEST_F(DrmMemoryManagerTest, givenOsHandleWithTileYObjectWhenCreateFromSharedHan
|
||||
imgInfo.surfaceFormat = gmmSurfaceFormat;
|
||||
imgInfo.plane = GMM_PLANE_Y;
|
||||
|
||||
AllocationProperties properties(false, imgInfo, GraphicsAllocation::AllocationType::SHARED_IMAGE);
|
||||
AllocationProperties properties(0, false, imgInfo, GraphicsAllocation::AllocationType::SHARED_IMAGE);
|
||||
|
||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||
ASSERT_NE(nullptr, graphicsAllocation);
|
||||
@@ -1663,7 +1663,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndOsHandleWhenAllocationFails
|
||||
osHandle handle = 1u;
|
||||
|
||||
InjectedFunction method = [this, &handle](size_t failureIndex) {
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
|
||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||
if (MemoryManagement::nonfailingAllocation == failureIndex) {
|
||||
@@ -1698,7 +1698,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndThreeOsHandlesWhenReuseCrea
|
||||
if (i == 2)
|
||||
this->mock->outputHandle = 3u;
|
||||
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
|
||||
graphicsAllocations[i] = memoryManager->createGraphicsAllocationFromSharedHandle(handles[i], properties, false);
|
||||
//Clang-tidy false positive WA
|
||||
@@ -1739,7 +1739,7 @@ TEST_F(DrmMemoryManagerTest, given32BitAddressingWhenBufferFromSharedHandleAndBi
|
||||
osHandle handle = 1u;
|
||||
this->mock->outputHandle = 2u;
|
||||
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
|
||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, true);
|
||||
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
|
||||
@@ -1757,7 +1757,7 @@ TEST_F(DrmMemoryManagerTest, given32BitAddressingWhenBufferFromSharedHandleIsCre
|
||||
memoryManager->setForce32BitAllocations(true);
|
||||
osHandle handle = 1u;
|
||||
this->mock->outputHandle = 2u;
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
|
||||
|
||||
@@ -1777,7 +1777,7 @@ TEST_F(DrmMemoryManagerTest, givenLimitedRangeAllocatorWhenBufferFromSharedHandl
|
||||
memoryManager->forceLimitedRangeAllocator(0xFFFFFFFFF);
|
||||
osHandle handle = 1u;
|
||||
this->mock->outputHandle = 2u;
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||
EXPECT_FALSE(graphicsAllocation->is32BitAllocation());
|
||||
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
|
||||
@@ -1795,7 +1795,7 @@ TEST_F(DrmMemoryManagerTest, givenNon32BitAddressingWhenBufferFromSharedHandleIs
|
||||
memoryManager->setForce32BitAllocations(false);
|
||||
osHandle handle = 1u;
|
||||
this->mock->outputHandle = 2u;
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, true);
|
||||
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
|
||||
EXPECT_FALSE(graphicsAllocation->is32BitAllocation());
|
||||
@@ -1811,7 +1811,7 @@ TEST_F(DrmMemoryManagerTest, givenSharedHandleWhenAllocationIsCreatedAndIoctlPri
|
||||
|
||||
osHandle handle = 1u;
|
||||
this->mock->outputHandle = 2u;
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||
EXPECT_EQ(nullptr, graphicsAllocation);
|
||||
memoryManager->freeGraphicsMemory(graphicsAllocation);
|
||||
@@ -1823,7 +1823,7 @@ TEST_F(DrmMemoryManagerTest, givenTwoGraphicsAllocationsThatShareTheSameBufferOb
|
||||
mock->ioctl_expected.gemWait = 2;
|
||||
|
||||
osHandle sharedHandle = 1u;
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
||||
auto graphicsAllocation2 = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
||||
|
||||
@@ -1850,7 +1850,7 @@ TEST_F(DrmMemoryManagerTest, givenTwoGraphicsAllocationsThatDoesnShareTheSameBuf
|
||||
mock->ioctl_expected.gemWait = 2;
|
||||
|
||||
osHandle sharedHandle = 1u;
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
||||
mock->outputHandle++;
|
||||
auto graphicsAllocation2 = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
||||
@@ -2103,7 +2103,7 @@ TEST_F(DrmMemoryManagerTest, givenSharedAllocationWithSmallerThenRealSizeWhenCre
|
||||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
osHandle sharedHandle = 1u;
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
|
||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
||||
|
||||
@@ -2476,7 +2476,7 @@ TEST_F(DrmMemoryManagerBasic, givenMemoryManagerWhenCreateAllocationFromHandleIs
|
||||
true,
|
||||
executionEnvironment));
|
||||
auto osHandle = 1u;
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation->getMemoryPool());
|
||||
@@ -3188,7 +3188,7 @@ TEST(DrmMemoryManagerFreeGraphicsMemoryCallSequenceTest, givenDrmMemoryManagerAn
|
||||
executionEnvironment.osInterface->get()->setDrm(Drm::get(0));
|
||||
GMockDrmMemoryManager gmockDrmMemoryManager(executionEnvironment);
|
||||
|
||||
AllocationProperties properties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER};
|
||||
AllocationProperties properties{0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER};
|
||||
auto allocation = gmockDrmMemoryManager.allocateGraphicsMemoryWithProperties(properties);
|
||||
ASSERT_NE(allocation, nullptr);
|
||||
|
||||
@@ -3209,7 +3209,7 @@ TEST(DrmMemoryManagerFreeGraphicsMemoryUnreferenceTest, givenDrmMemoryManagerAnd
|
||||
::testing::NiceMock<GMockDrmMemoryManager> gmockDrmMemoryManager(executionEnvironment);
|
||||
|
||||
osHandle handle = 1u;
|
||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
auto allocation = gmockDrmMemoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
||||
|
||||
@@ -437,7 +437,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF
|
||||
EXPECT_EQ(0u, status);
|
||||
|
||||
MemoryManagerCreate<WddmMemoryManager> mm(false, false, *executionEnvironment);
|
||||
AllocationProperties properties(false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
|
||||
auto graphicsAllocation = mm.createGraphicsAllocationFromSharedHandle(ALLOCATION_HANDLE, properties, false);
|
||||
auto wddmAllocation = (WddmAllocation *)graphicsAllocation;
|
||||
@@ -474,7 +474,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF
|
||||
EXPECT_EQ(0u, status);
|
||||
|
||||
MemoryManagerCreate<WddmMemoryManager> mm(false, false, *executionEnvironment);
|
||||
AllocationProperties properties(false, 4096, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
AllocationProperties properties(0, false, 4096, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||
|
||||
auto graphicsAllocation = mm.createGraphicsAllocationFromSharedHandle(ALLOCATION_HANDLE, properties, false);
|
||||
auto wddmAllocation = (WddmAllocation *)graphicsAllocation;
|
||||
|
||||
@@ -185,7 +185,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWith64KBPagesDisabledWhenA
|
||||
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
|
||||
auto size = MemoryConstants::pageSize;
|
||||
|
||||
auto svmAllocation = memoryManager->allocateGraphicsMemoryWithProperties({size, GraphicsAllocation::AllocationType::SVM_ZERO_COPY});
|
||||
auto svmAllocation = memoryManager->allocateGraphicsMemoryWithProperties({0, size, GraphicsAllocation::AllocationType::SVM_ZERO_COPY});
|
||||
EXPECT_NE(nullptr, svmAllocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, svmAllocation->getMemoryPool());
|
||||
EXPECT_TRUE(svmAllocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
@@ -196,7 +196,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWith64KBPagesEnabledWhenAl
|
||||
memoryManager.reset(new MockWddmMemoryManager(true, false, *executionEnvironment));
|
||||
auto size = MemoryConstants::pageSize;
|
||||
|
||||
auto svmAllocation = memoryManager->allocateGraphicsMemoryWithProperties({size, GraphicsAllocation::AllocationType::SVM_ZERO_COPY});
|
||||
auto svmAllocation = memoryManager->allocateGraphicsMemoryWithProperties({0, size, GraphicsAllocation::AllocationType::SVM_ZERO_COPY});
|
||||
EXPECT_NE(nullptr, svmAllocation);
|
||||
EXPECT_EQ(MemoryPool::System64KBPages, svmAllocation->getMemoryPool());
|
||||
memoryManager->freeGraphicsMemory(svmAllocation);
|
||||
@@ -215,7 +215,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenCreateAllocationFromHa
|
||||
|
||||
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
|
||||
|
||||
AllocationProperties properties(false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0, 0);
|
||||
AllocationProperties properties(0, false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation->getMemoryPool());
|
||||
@@ -235,8 +235,8 @@ TEST_F(WddmMemoryManagerSimpleTest, givenAllocationPropertiesWhenCreateAllocatio
|
||||
|
||||
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
|
||||
|
||||
AllocationProperties propertiesBuffer(false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0, 0);
|
||||
AllocationProperties propertiesImage(false, 0, GraphicsAllocation::AllocationType::SHARED_IMAGE, false, false, 0, 0);
|
||||
AllocationProperties propertiesBuffer(0, false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
AllocationProperties propertiesImage(0, false, 0, GraphicsAllocation::AllocationType::SHARED_IMAGE, false, false, 0);
|
||||
|
||||
AllocationProperties *propertiesArray[2] = {&propertiesBuffer, &propertiesImage};
|
||||
|
||||
@@ -264,7 +264,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenCreateAllocationFromHandleAndMapCallFail
|
||||
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
|
||||
EXPECT_EQ(0u, memoryManager->freeGraphicsMemoryImplCalled);
|
||||
|
||||
AllocationProperties properties(false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0, 0);
|
||||
AllocationProperties properties(0, false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
|
||||
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||
EXPECT_EQ(nullptr, allocation);
|
||||
@@ -304,7 +304,7 @@ TEST_F(WddmMemoryManagerTest, givenAllocateGraphicsMemoryForNonSvmHostPtrIsCalle
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenZeroFenceValueOnSingleEngineRegisteredWhenHandleFenceCompletionIsCalledThenDoNotWaitOnCpu) {
|
||||
ASSERT_EQ(1u, memoryManager->getRegisteredEnginesCount());
|
||||
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({32, GraphicsAllocation::AllocationType::BUFFER}));
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, 32, GraphicsAllocation::AllocationType::BUFFER}));
|
||||
allocation->getResidencyData().updateCompletionData(0u, 0u);
|
||||
|
||||
memoryManager->handleFenceCompletion(allocation);
|
||||
@@ -316,7 +316,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenZeroFenceValueOnSingleEngineRegisteredW
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSingleEngineRegisteredWhenHandleFenceCompletionIsCalledThenWaitOnCpuOnce) {
|
||||
ASSERT_EQ(1u, memoryManager->getRegisteredEnginesCount());
|
||||
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({32, GraphicsAllocation::AllocationType::BUFFER}));
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, 32, GraphicsAllocation::AllocationType::BUFFER}));
|
||||
auto fence = &static_cast<OsContextWin *>(memoryManager->getRegisteredEngines()[0].osContext)->getResidencyController().getMonitoredFence();
|
||||
allocation->getResidencyData().updateCompletionData(129u, 0u);
|
||||
|
||||
@@ -333,7 +333,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValuesOnMultipleEnginesRegi
|
||||
2, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false);
|
||||
ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount());
|
||||
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({32, GraphicsAllocation::AllocationType::BUFFER}));
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, 32, GraphicsAllocation::AllocationType::BUFFER}));
|
||||
auto lastEngineFence = &static_cast<OsContextWin *>(memoryManager->getRegisteredEngines()[1].osContext)->getResidencyController().getMonitoredFence();
|
||||
allocation->getResidencyData().updateCompletionData(129u, 0u);
|
||||
allocation->getResidencyData().updateCompletionData(152u, 1u);
|
||||
@@ -351,7 +351,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSomeOfMultipleEngine
|
||||
2, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false);
|
||||
ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount());
|
||||
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({32, GraphicsAllocation::AllocationType::BUFFER}));
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, 32, GraphicsAllocation::AllocationType::BUFFER}));
|
||||
auto lastEngineFence = &static_cast<OsContextWin *>(memoryManager->getRegisteredEngines()[0].osContext)->getResidencyController().getMonitoredFence();
|
||||
allocation->getResidencyData().updateCompletionData(129u, 0u);
|
||||
allocation->getResidencyData().updateCompletionData(0, 1u);
|
||||
@@ -441,7 +441,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(pSysMem, 4096u, false));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
AllocationProperties properties(false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0, 0);
|
||||
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(gpuAllocation);
|
||||
@@ -492,7 +492,7 @@ TEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleReturns32BitAllocW
|
||||
|
||||
memoryManager->setForce32BitAllocations(true);
|
||||
|
||||
AllocationProperties properties(false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0, 0);
|
||||
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, true);
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
@@ -515,7 +515,7 @@ TEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleDoesNotReturn32Bit
|
||||
|
||||
memoryManager->setForce32BitAllocations(true);
|
||||
|
||||
AllocationProperties properties(false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0, 0);
|
||||
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
|
||||
@@ -535,7 +535,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHandl
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(pSysMem, 4096u, false));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
AllocationProperties properties(false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0, 0);
|
||||
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
auto gpuAllocation = (WddmAllocation *)memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||
EXPECT_NE(nullptr, gpuAllocation);
|
||||
auto expectedDestroyHandle = gpuAllocation->resourceHandle;
|
||||
@@ -557,7 +557,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromShared
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(pSysMem, size, false));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
AllocationProperties properties(false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0, 0);
|
||||
AllocationProperties properties(0, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
EXPECT_EQ(size, gpuAllocation->getUnderlyingBufferSize());
|
||||
@@ -574,7 +574,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleFa
|
||||
|
||||
wddm->failOpenSharedHandle = true;
|
||||
|
||||
AllocationProperties properties(false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0, 0);
|
||||
AllocationProperties properties(0, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||
EXPECT_EQ(nullptr, gpuAllocation);
|
||||
}
|
||||
@@ -1247,7 +1247,7 @@ TEST_F(WddmMemoryManagerWithAsyncDeleterTest, givenMemoryManagerWithAsyncDeleter
|
||||
EXPECT_EQ(0u, wddm->createAllocationResult.called);
|
||||
deleter->expectDrainBlockingValue(true);
|
||||
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(imgInfo, true, {});
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(0, imgInfo, true, {});
|
||||
|
||||
memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr);
|
||||
EXPECT_EQ(1, deleter->drainCalled);
|
||||
@@ -1266,7 +1266,7 @@ TEST_F(WddmMemoryManagerWithAsyncDeleterTest, givenMemoryManagerWithAsyncDeleter
|
||||
EXPECT_EQ(0u, wddm->createAllocationResult.called);
|
||||
EXPECT_EQ(0u, wddm->mapGpuVirtualAddressResult.called);
|
||||
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(imgInfo, true, {});
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(0, imgInfo, true, {});
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr);
|
||||
EXPECT_EQ(0, deleter->drainCalled);
|
||||
@@ -1284,7 +1284,7 @@ TEST_F(WddmMemoryManagerWithAsyncDeleterTest, givenMemoryManagerWithoutAsyncDele
|
||||
wddm->createAllocationStatus = STATUS_GRAPHICS_NO_VIDEO_MEMORY;
|
||||
EXPECT_EQ(0u, wddm->createAllocationResult.called);
|
||||
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(imgInfo, true, {});
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(0, imgInfo, true, {});
|
||||
|
||||
memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr);
|
||||
EXPECT_EQ(1u, wddm->createAllocationResult.called);
|
||||
@@ -1716,7 +1716,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenWriteCombinedAllocationThenCpuAddressIs
|
||||
}
|
||||
memoryManager.reset(new MockWddmMemoryManager(true, true, *executionEnvironment));
|
||||
size_t size = 2 * MemoryConstants::megaByte;
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({size, GraphicsAllocation::AllocationType::WRITE_COMBINED}));
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, size, GraphicsAllocation::AllocationType::WRITE_COMBINED}));
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(size, allocation->getUnderlyingBufferSize());
|
||||
EXPECT_NE(nullptr, allocation->getUnderlyingBuffer());
|
||||
@@ -1740,7 +1740,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenBufferHostMemoryAllocationAndLimitedRan
|
||||
|
||||
memoryManager.reset(new MockWddmMemoryManager(true, true, *executionEnvironment));
|
||||
size_t size = 2 * MemoryConstants::megaByte;
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({size, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY}));
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, size, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY}));
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(size, allocation->getUnderlyingBufferSize());
|
||||
EXPECT_NE(nullptr, allocation->getUnderlyingBuffer());
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user