Move AllocationType enum out of GraphicsAllocation class

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2022-02-04 13:59:01 +00:00
committed by Compute-Runtime-Automation
parent fd27098194
commit 4b0d986876
262 changed files with 2075 additions and 2063 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -15,23 +15,23 @@ namespace NEO {
class AubHelper : public NonCopyableOrMovableClass {
public:
static bool isOneTimeAubWritableAllocationType(const GraphicsAllocation::AllocationType &type) {
static bool isOneTimeAubWritableAllocationType(const AllocationType &type) {
switch (type) {
case GraphicsAllocation::AllocationType::PIPE:
case GraphicsAllocation::AllocationType::CONSTANT_SURFACE:
case GraphicsAllocation::AllocationType::GLOBAL_SURFACE:
case GraphicsAllocation::AllocationType::KERNEL_ISA:
case GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL:
case GraphicsAllocation::AllocationType::PRIVATE_SURFACE:
case GraphicsAllocation::AllocationType::SCRATCH_SURFACE:
case GraphicsAllocation::AllocationType::WORK_PARTITION_SURFACE:
case GraphicsAllocation::AllocationType::BUFFER:
case GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY:
case GraphicsAllocation::AllocationType::IMAGE:
case GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
case GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR:
case GraphicsAllocation::AllocationType::MAP_ALLOCATION:
case GraphicsAllocation::AllocationType::SVM_GPU:
case AllocationType::PIPE:
case AllocationType::CONSTANT_SURFACE:
case AllocationType::GLOBAL_SURFACE:
case AllocationType::KERNEL_ISA:
case AllocationType::KERNEL_ISA_INTERNAL:
case AllocationType::PRIVATE_SURFACE:
case AllocationType::SCRATCH_SURFACE:
case AllocationType::WORK_PARTITION_SURFACE:
case AllocationType::BUFFER:
case AllocationType::BUFFER_HOST_MEMORY:
case AllocationType::IMAGE:
case AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
case AllocationType::EXTERNAL_HOST_PTR:
case AllocationType::MAP_ALLOCATION:
case AllocationType::SVM_GPU:
return true;
default:
return false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -29,16 +29,16 @@ enum DumpFormat {
};
inline bool isWritableBuffer(GraphicsAllocation &gfxAllocation) {
return (gfxAllocation.getAllocationType() == GraphicsAllocation::AllocationType::BUFFER ||
gfxAllocation.getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY ||
gfxAllocation.getAllocationType() == GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR ||
gfxAllocation.getAllocationType() == GraphicsAllocation::AllocationType::MAP_ALLOCATION ||
gfxAllocation.getAllocationType() == GraphicsAllocation::AllocationType::SVM_GPU) &&
return (gfxAllocation.getAllocationType() == AllocationType::BUFFER ||
gfxAllocation.getAllocationType() == AllocationType::BUFFER_HOST_MEMORY ||
gfxAllocation.getAllocationType() == AllocationType::EXTERNAL_HOST_PTR ||
gfxAllocation.getAllocationType() == AllocationType::MAP_ALLOCATION ||
gfxAllocation.getAllocationType() == AllocationType::SVM_GPU) &&
gfxAllocation.isMemObjectsAllocationWithWritableFlags();
}
inline bool isWritableImage(GraphicsAllocation &gfxAllocation) {
return (gfxAllocation.getAllocationType() == GraphicsAllocation::AllocationType::IMAGE) &&
return (gfxAllocation.getAllocationType() == AllocationType::IMAGE) &&
gfxAllocation.isMemObjectsAllocationWithWritableFlags();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -43,7 +43,7 @@ const SipKernel &BuiltIns::getSipKernel(SipKernelType type, Device &device) {
UNRECOVERABLE_IF(ret != TranslationOutput::ErrorCode::Success);
UNRECOVERABLE_IF(sipBinary.size() == 0);
const auto allocType = GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL;
const auto allocType = AllocationType::KERNEL_ISA_INTERNAL;
AllocationProperties properties = {device.getRootDeviceIndex(), sipBinary.size(), allocType, device.getDeviceBitfield()};
properties.flags.use32BitFrontWindow = false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -124,7 +124,7 @@ bool SipKernel::initRawBinaryFromFileKernel(SipKernelType type, Device &device,
void *alignedBuffer = alignedMalloc(bytesRead, MemoryConstants::pageSize);
memcpy_s(alignedBuffer, bytesRead, fileData.data(), bytesRead);
const auto allocType = GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL;
const auto allocType = AllocationType::KERNEL_ISA_INTERNAL;
AllocationProperties properties = {rootDeviceIndex, bytesRead, allocType, device.getDeviceBitfield()};
properties.flags.use32BitFrontWindow = false;
@@ -188,7 +188,7 @@ bool SipKernel::initHexadecimalArraySipKernel(SipKernelType type, Device &device
auto &hwInfo = device.getHardwareInfo();
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
hwHelper.setSipKernelData(sipKernelBinary, kernelBinarySize);
const auto allocType = GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL;
const auto allocType = AllocationType::KERNEL_ISA_INTERNAL;
AllocationProperties properties = {rootDeviceIndex, kernelBinarySize, allocType, device.getDeviceBitfield()};
properties.flags.use32BitFrontWindow = false;

View File

@@ -35,7 +35,7 @@ CommandContainer::~CommandContainer() {
}
}
for (auto deallocation : deallocationContainer) {
if (((deallocation->getAllocationType() == GraphicsAllocation::AllocationType::INTERNAL_HEAP) || (deallocation->getAllocationType() == GraphicsAllocation::AllocationType::LINEAR_STREAM))) {
if (((deallocation->getAllocationType() == AllocationType::INTERNAL_HEAP) || (deallocation->getAllocationType() == AllocationType::LINEAR_STREAM))) {
getHeapHelper()->storeHeapAllocation(deallocation);
}
}
@@ -243,13 +243,13 @@ GraphicsAllocation *CommandContainer::obtainNextCommandBufferAllocation() {
GraphicsAllocation *cmdBufferAllocation = nullptr;
if (this->reusableAllocationList) {
cmdBufferAllocation = this->reusableAllocationList->detachAllocation(alignedSize, nullptr, nullptr, GraphicsAllocation::AllocationType::COMMAND_BUFFER).release();
cmdBufferAllocation = this->reusableAllocationList->detachAllocation(alignedSize, nullptr, nullptr, AllocationType::COMMAND_BUFFER).release();
}
if (!cmdBufferAllocation) {
AllocationProperties properties{device->getRootDeviceIndex(),
true /* allocateMemory*/,
alignedSize,
GraphicsAllocation::AllocationType::COMMAND_BUFFER,
AllocationType::COMMAND_BUFFER,
(device->getNumGenericSubDevices() > 1u) /* multiOsContextCapable */,
false,
device->getDeviceBitfield()};

View File

@@ -588,7 +588,7 @@ void EncodeSurfaceState<Family>::encodeExtraBufferParams(EncodeSurfaceStateArgs
uint32_t compressionFormat = 0;
bool setConstCachePolicy = false;
if (args.allocation && args.allocation->getAllocationType() == GraphicsAllocation::AllocationType::CONSTANT_SURFACE) {
if (args.allocation && args.allocation->getAllocationType() == AllocationType::CONSTANT_SURFACE) {
setConstCachePolicy = true;
}

View File

@@ -687,7 +687,7 @@ bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxA
template <typename GfxFamily>
bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(AllocationView &allocationView) {
GraphicsAllocation gfxAllocation(this->rootDeviceIndex, GraphicsAllocation::AllocationType::UNKNOWN, reinterpret_cast<void *>(allocationView.first), allocationView.first, 0llu, allocationView.second, MemoryPool::MemoryNull, 0u);
GraphicsAllocation gfxAllocation(this->rootDeviceIndex, AllocationType::UNKNOWN, reinterpret_cast<void *>(allocationView.first), allocationView.first, 0llu, allocationView.second, MemoryPool::MemoryNull, 0u);
return writeMemory(gfxAllocation);
}

View File

@@ -180,7 +180,7 @@ void CommandStreamReceiver::ensureCommandBufferAllocation(LinearStream &commandS
}
const auto allocationSize = alignUp(minimumRequiredSize + additionalAllocationSize, MemoryConstants::pageSize64k);
constexpr static auto allocationType = GraphicsAllocation::AllocationType::COMMAND_BUFFER;
constexpr static auto allocationType = AllocationType::COMMAND_BUFFER;
auto allocation = this->getInternalAllocationStorage()->obtainReusableAllocation(allocationSize, allocationType).release();
if (allocation == nullptr) {
const AllocationProperties commandStreamAllocationProperties{rootDeviceIndex, true, allocationSize, allocationType,
@@ -368,7 +368,7 @@ MultiGraphicsAllocation &CommandStreamReceiver::createTagsMultiAllocation() {
auto maxRootDeviceIndex = *std::max_element(rootDeviceIndices.begin(), rootDeviceIndices.end(), std::less<uint32_t const>());
auto allocations = new MultiGraphicsAllocation(maxRootDeviceIndex);
AllocationProperties unifiedMemoryProperties{rootDeviceIndices.at(0), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::TAG_BUFFER, systemMemoryBitfield};
AllocationProperties unifiedMemoryProperties{rootDeviceIndices.at(0), MemoryConstants::pageSize, AllocationType::TAG_BUFFER, systemMemoryBitfield};
this->getMemoryManager()->createMultiGraphicsAllocationInSystemMemoryPool(rootDeviceIndices, unifiedMemoryProperties, *allocations);
return *allocations;
@@ -437,7 +437,7 @@ void CommandStreamReceiver::startControllingDirectSubmissions() {
GraphicsAllocation *CommandStreamReceiver::allocateDebugSurface(size_t size) {
UNRECOVERABLE_IF(debugSurface != nullptr);
debugSurface = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, getOsContext().getDeviceBitfield()});
debugSurface = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, size, AllocationType::INTERNAL_HOST_MEMORY, getOsContext().getDeviceBitfield()});
return debugSurface;
}
@@ -478,9 +478,9 @@ void CommandStreamReceiver::allocateHeapMemory(IndirectHeap::Type heapType,
minRequiredSize += reservedSize;
finalHeapSize = alignUp(std::max(finalHeapSize, minRequiredSize), MemoryConstants::pageSize);
auto allocationType = GraphicsAllocation::AllocationType::LINEAR_STREAM;
auto allocationType = AllocationType::LINEAR_STREAM;
if (requireInternalHeap) {
allocationType = GraphicsAllocation::AllocationType::INTERNAL_HEAP;
allocationType = AllocationType::INTERNAL_HEAP;
}
auto heapMemory = internalAllocationStorage->obtainReusableAllocation(finalHeapSize, allocationType).release();
@@ -608,7 +608,7 @@ bool CommandStreamReceiver::createWorkPartitionAllocation(const Device &device)
}
UNRECOVERABLE_IF(device.getNumGenericSubDevices() < 2);
AllocationProperties properties{this->rootDeviceIndex, true, 4096u, GraphicsAllocation::AllocationType::WORK_PARTITION_SURFACE, true, false, deviceBitfield};
AllocationProperties properties{this->rootDeviceIndex, true, 4096u, AllocationType::WORK_PARTITION_SURFACE, true, false, deviceBitfield};
this->workPartitionAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
if (this->workPartitionAllocation == nullptr) {
return false;
@@ -640,7 +640,7 @@ bool CommandStreamReceiver::createGlobalFenceAllocation() {
}
DEBUG_BREAK_IF(this->globalFenceAllocation != nullptr);
this->globalFenceAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::GLOBAL_FENCE, osContext->getDeviceBitfield()});
this->globalFenceAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, AllocationType::GLOBAL_FENCE, osContext->getDeviceBitfield()});
return this->globalFenceAllocation != nullptr;
}
@@ -650,7 +650,7 @@ bool CommandStreamReceiver::createPreemptionAllocation() {
if (DebugManager.flags.OverrideCsrAllocationSize.get() > 0) {
preemptionSurfaceSize = DebugManager.flags.OverrideCsrAllocationSize.get();
}
AllocationProperties properties{rootDeviceIndex, true, preemptionSurfaceSize, GraphicsAllocation::AllocationType::PREEMPTION, isMultiOsContextCapable(), false, deviceBitfield};
AllocationProperties properties{rootDeviceIndex, true, preemptionSurfaceSize, AllocationType::PREEMPTION, isMultiOsContextCapable(), false, deviceBitfield};
properties.flags.uncacheable = hwInfo->workaroundTable.flags.waCSRUncachable;
properties.alignment = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getPreemptionAllocationAlignment();
this->preemptionAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
@@ -668,13 +668,13 @@ AllocationsList &CommandStreamReceiver::getAllocationsForReuse() { return intern
bool CommandStreamReceiver::createAllocationForHostSurface(HostPtrSurface &surface, bool requiresL3Flush) {
std::unique_lock<decltype(hostPtrSurfaceCreationMutex)> lock = this->obtainHostPtrSurfaceCreationLock();
auto allocation = internalAllocationStorage->obtainTemporaryAllocationWithPtr(surface.getSurfaceSize(), surface.getMemoryPointer(), GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR);
auto allocation = internalAllocationStorage->obtainTemporaryAllocationWithPtr(surface.getSurfaceSize(), surface.getMemoryPointer(), AllocationType::EXTERNAL_HOST_PTR);
if (allocation == nullptr) {
auto memoryManager = getMemoryManager();
AllocationProperties properties{rootDeviceIndex,
false, // allocateMemory
surface.getSurfaceSize(), GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR,
surface.getSurfaceSize(), AllocationType::EXTERNAL_HOST_PTR,
false, // isMultiStorageAllocation
osContext->getDeviceBitfield()};
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = requiresL3Flush;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -100,7 +100,7 @@ class CommandStreamReceiverSimulatedHw : public CommandStreamReceiverSimulatedCo
void *cpuAddress;
size_t size;
this->getParametersForWriteMemory(graphicsAllocation, gpuAddress, cpuAddress, size);
int hint = graphicsAllocation.getAllocationType() == GraphicsAllocation::AllocationType::COMMAND_BUFFER
int hint = graphicsAllocation.getAllocationType() == AllocationType::COMMAND_BUFFER
? AubMemDump::DataTypeHintValues::TraceBatchBuffer
: AubMemDump::DataTypeHintValues::TraceNotype;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2020 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -26,9 +26,9 @@ ExperimentalCommandBuffer::ExperimentalCommandBuffer(CommandStreamReceiver *csr,
defaultPrint(true),
timerResolution(profilingTimerResolution) {
auto rootDeviceIndex = csr->getRootDeviceIndex();
timestamps = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, csr->getOsContext().getDeviceBitfield()});
timestamps = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, AllocationType::INTERNAL_HOST_MEMORY, csr->getOsContext().getDeviceBitfield()});
memset(timestamps->getUnderlyingBuffer(), 0, timestamps->getUnderlyingBufferSize());
experimentalAllocation = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, csr->getOsContext().getDeviceBitfield()});
experimentalAllocation = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, AllocationType::INTERNAL_HOST_MEMORY, csr->getOsContext().getDeviceBitfield()});
memset(experimentalAllocation->getUnderlyingBuffer(), 0, experimentalAllocation->getUnderlyingBufferSize());
}

View File

@@ -47,7 +47,7 @@ void ScratchSpaceControllerBase::setRequiredScratchSpace(void *sshBaseAddress,
}
void ScratchSpaceControllerBase::createScratchSpaceAllocation() {
scratchAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, scratchSizeBytes, GraphicsAllocation::AllocationType::SCRATCH_SURFACE, this->csrAllocationStorage.getDeviceBitfield()});
scratchAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, scratchSizeBytes, AllocationType::SCRATCH_SURFACE, this->csrAllocationStorage.getDeviceBitfield()});
UNRECOVERABLE_IF(scratchAllocation == nullptr);
}

View File

@@ -169,7 +169,7 @@ void ScratchSpaceControllerXeHPAndLater::prepareScratchAllocation(uint32_t requi
scratchSurfaceDirty = true;
scratchSizeBytes = requiredScratchSizeInBytes;
perThreadScratchSize = requiredPerThreadScratchSizeAlignedUp;
AllocationProperties properties{this->rootDeviceIndex, true, scratchSizeBytes, GraphicsAllocation::AllocationType::SCRATCH_SURFACE, multiTileCapable, false, osContext.getDeviceBitfield()};
AllocationProperties properties{this->rootDeviceIndex, true, scratchSizeBytes, AllocationType::SCRATCH_SURFACE, multiTileCapable, false, osContext.getDeviceBitfield()};
scratchAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
}
if (privateScratchSpaceSupported) {
@@ -183,7 +183,7 @@ void ScratchSpaceControllerXeHPAndLater::prepareScratchAllocation(uint32_t requi
privateScratchSizeBytes = requiredPrivateScratchSizeInBytes;
perThreadPrivateScratchSize = requiredPerThreadPrivateScratchSizeAlignedUp;
scratchSurfaceDirty = true;
AllocationProperties properties{this->rootDeviceIndex, true, privateScratchSizeBytes, GraphicsAllocation::AllocationType::PRIVATE_SURFACE, multiTileCapable, false, osContext.getDeviceBitfield()};
AllocationProperties properties{this->rootDeviceIndex, true, privateScratchSizeBytes, AllocationType::PRIVATE_SURFACE, multiTileCapable, false, osContext.getDeviceBitfield()};
privateScratchAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
}
}

View File

@@ -632,7 +632,7 @@ GraphicsAllocation *Device::getRTDispatchGlobals(uint32_t maxBvhLevels) {
void Device::initializeRayTracing(uint32_t maxBvhLevels) {
if (rtMemoryBackedBuffer == nullptr) {
auto size = RayTracingHelper::getTotalMemoryBackedFifoSize(*this);
rtMemoryBackedBuffer = getMemoryManager()->allocateGraphicsMemoryWithProperties({getRootDeviceIndex(), size, GraphicsAllocation::AllocationType::BUFFER, getDeviceBitfield()});
rtMemoryBackedBuffer = getMemoryManager()->allocateGraphicsMemoryWithProperties({getRootDeviceIndex(), size, AllocationType::BUFFER, getDeviceBitfield()});
}
while (rtDispatchGlobals.size() <= maxBvhLevels) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -65,7 +65,7 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::allocateResources() {
const auto allocationSize = alignUp(minimumRequiredSize + additionalAllocationSize, MemoryConstants::pageSize64k);
const AllocationProperties commandStreamAllocationProperties{device.getRootDeviceIndex(),
true, allocationSize,
GraphicsAllocation::AllocationType::RING_BUFFER,
AllocationType::RING_BUFFER,
isMultiOsContextCapable, osContext.getDeviceBitfield()};
ringBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties);
UNRECOVERABLE_IF(ringBuffer == nullptr);
@@ -77,7 +77,7 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::allocateResources() {
const AllocationProperties semaphoreAllocationProperties{device.getRootDeviceIndex(),
true, MemoryConstants::pageSize,
GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER,
AllocationType::SEMAPHORE_BUFFER,
isMultiOsContextCapable, osContext.getDeviceBitfield()};
semaphores = memoryManager->allocateGraphicsMemoryWithProperties(semaphoreAllocationProperties);
UNRECOVERABLE_IF(semaphores == nullptr);

View File

@@ -67,7 +67,7 @@ void EncodeSurfaceState<Family>::encodeExtraBufferParams(EncodeSurfaceStateArgs
auto surfaceState = reinterpret_cast<R_SURFACE_STATE *>(args.outMemory);
const bool isL3Allowed = surfaceState->getMemoryObjectControlState() == args.gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
if (isL3Allowed) {
const bool isConstantSurface = args.allocation && args.allocation->getAllocationType() == GraphicsAllocation::AllocationType::CONSTANT_SURFACE;
const bool isConstantSurface = args.allocation && args.allocation->getAllocationType() == AllocationType::CONSTANT_SURFACE;
bool useL1 = args.isReadOnly || isConstantSurface;
if (DebugManager.flags.ForceL1Caching.get() != 1) {

View File

@@ -180,7 +180,7 @@ void HwHelperHw<Family>::setExtraAllocationData(AllocationData &allocationData,
}
}
if (HwInfoConfig::get(hwInfo.platform.eProductFamily)->isStorageInfoAdjustmentRequired()) {
if (properties.allocationType == GraphicsAllocation::AllocationType::BUFFER && !properties.flags.preferCompressed && !properties.flags.shareable) {
if (properties.allocationType == AllocationType::BUFFER && !properties.flags.preferCompressed && !properties.flags.shareable) {
allocationData.storageInfo.isLockable = true;
}
}

View File

@@ -13,104 +13,104 @@
namespace NEO {
void AppResourceHelper::copyResourceTagStr(char *dst, GraphicsAllocation::AllocationType type, size_t size) {
void AppResourceHelper::copyResourceTagStr(char *dst, AllocationType type, size_t size) {
if (DebugManager.flags.EnableResourceTags.get()) {
auto tag = getResourceTagStr(type);
strcpy_s(dst, size, tag);
}
}
const char *AppResourceHelper::getResourceTagStr(GraphicsAllocation::AllocationType type) {
const char *AppResourceHelper::getResourceTagStr(AllocationType type) {
switch (type) {
case GraphicsAllocation::AllocationType::UNKNOWN:
case AllocationType::UNKNOWN:
return "UNKNOWN";
case GraphicsAllocation::AllocationType::BUFFER:
case AllocationType::BUFFER:
return "BUFFER";
case GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY:
case AllocationType::BUFFER_HOST_MEMORY:
return "BFHSTMEM";
case GraphicsAllocation::AllocationType::COMMAND_BUFFER:
case AllocationType::COMMAND_BUFFER:
return "CMNDBUFF";
case GraphicsAllocation::AllocationType::CONSTANT_SURFACE:
case AllocationType::CONSTANT_SURFACE:
return "CSNTSRFC";
case GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR:
case AllocationType::EXTERNAL_HOST_PTR:
return "EXHSTPTR";
case GraphicsAllocation::AllocationType::FILL_PATTERN:
case AllocationType::FILL_PATTERN:
return "FILPATRN";
case GraphicsAllocation::AllocationType::GLOBAL_SURFACE:
case AllocationType::GLOBAL_SURFACE:
return "GLBLSRFC";
case GraphicsAllocation::AllocationType::IMAGE:
case AllocationType::IMAGE:
return "IMAGE";
case GraphicsAllocation::AllocationType::INDIRECT_OBJECT_HEAP:
case AllocationType::INDIRECT_OBJECT_HEAP:
return "INOBHEAP";
case GraphicsAllocation::AllocationType::INSTRUCTION_HEAP:
case AllocationType::INSTRUCTION_HEAP:
return "INSTHEAP";
case GraphicsAllocation::AllocationType::INTERNAL_HEAP:
case AllocationType::INTERNAL_HEAP:
return "INTLHEAP";
case GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY:
case AllocationType::INTERNAL_HOST_MEMORY:
return "INHSTMEM";
case GraphicsAllocation::AllocationType::KERNEL_ISA:
case AllocationType::KERNEL_ISA:
return "KERNLISA";
case GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL:
case AllocationType::KERNEL_ISA_INTERNAL:
return "KRLISAIN";
case GraphicsAllocation::AllocationType::LINEAR_STREAM:
case AllocationType::LINEAR_STREAM:
return "LINRSTRM";
case GraphicsAllocation::AllocationType::MAP_ALLOCATION:
case AllocationType::MAP_ALLOCATION:
return "MAPALLOC";
case GraphicsAllocation::AllocationType::MCS:
case AllocationType::MCS:
return "MCS";
case GraphicsAllocation::AllocationType::PIPE:
case AllocationType::PIPE:
return "PIPE";
case GraphicsAllocation::AllocationType::PREEMPTION:
case AllocationType::PREEMPTION:
return "PRMPTION";
case GraphicsAllocation::AllocationType::PRINTF_SURFACE:
case AllocationType::PRINTF_SURFACE:
return "PRNTSRFC";
case GraphicsAllocation::AllocationType::PRIVATE_SURFACE:
case AllocationType::PRIVATE_SURFACE:
return "PRVTSRFC";
case GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER:
case AllocationType::PROFILING_TAG_BUFFER:
return "PROFTGBF";
case GraphicsAllocation::AllocationType::SCRATCH_SURFACE:
case AllocationType::SCRATCH_SURFACE:
return "SCRHSRFC";
case GraphicsAllocation::AllocationType::SHARED_BUFFER:
case AllocationType::SHARED_BUFFER:
return "SHRDBUFF";
case GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE:
case AllocationType::SHARED_CONTEXT_IMAGE:
return "SRDCXIMG";
case GraphicsAllocation::AllocationType::SHARED_IMAGE:
case AllocationType::SHARED_IMAGE:
return "SHERDIMG";
case GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY:
case AllocationType::SHARED_RESOURCE_COPY:
return "SRDRSCCP";
case GraphicsAllocation::AllocationType::SURFACE_STATE_HEAP:
case AllocationType::SURFACE_STATE_HEAP:
return "SRFCSTHP";
case GraphicsAllocation::AllocationType::SVM_CPU:
case AllocationType::SVM_CPU:
return "SVM_CPU";
case GraphicsAllocation::AllocationType::SVM_GPU:
case AllocationType::SVM_GPU:
return "SVM_GPU";
case GraphicsAllocation::AllocationType::SVM_ZERO_COPY:
case AllocationType::SVM_ZERO_COPY:
return "SVM0COPY";
case GraphicsAllocation::AllocationType::TAG_BUFFER:
case AllocationType::TAG_BUFFER:
return "TAGBUFER";
case GraphicsAllocation::AllocationType::GLOBAL_FENCE:
case AllocationType::GLOBAL_FENCE:
return "GLBLFENC";
case GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
case AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
return "TSPKTGBF";
case GraphicsAllocation::AllocationType::WRITE_COMBINED:
case AllocationType::WRITE_COMBINED:
return "WRTCMBND";
case GraphicsAllocation::AllocationType::RING_BUFFER:
case AllocationType::RING_BUFFER:
return "RINGBUFF";
case GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER:
case AllocationType::SEMAPHORE_BUFFER:
return "SMPHRBUF";
case GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA:
case AllocationType::DEBUG_CONTEXT_SAVE_AREA:
return "DBCXSVAR";
case GraphicsAllocation::AllocationType::DEBUG_SBA_TRACKING_BUFFER:
case AllocationType::DEBUG_SBA_TRACKING_BUFFER:
return "DBSBATRB";
case GraphicsAllocation::AllocationType::DEBUG_MODULE_AREA:
case AllocationType::DEBUG_MODULE_AREA:
return "DBMDLARE";
case GraphicsAllocation::AllocationType::UNIFIED_SHARED_MEMORY:
case AllocationType::UNIFIED_SHARED_MEMORY:
return "USHRDMEM";
case GraphicsAllocation::AllocationType::WORK_PARTITION_SURFACE:
case AllocationType::WORK_PARTITION_SURFACE:
return "WRPRTSRF";
case GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER:
case AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER:
return "GPUTSDBF";
case GraphicsAllocation::AllocationType::SW_TAG_BUFFER:
case AllocationType::SW_TAG_BUFFER:
return "SWTAGBF";
default:
return "NOTFOUND";

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -10,8 +10,8 @@
namespace NEO {
struct AppResourceHelper {
public:
static const char *getResourceTagStr(GraphicsAllocation::AllocationType type);
static void copyResourceTagStr(char *dst, GraphicsAllocation::AllocationType type, size_t size);
static const char *getResourceTagStr(AllocationType type);
static void copyResourceTagStr(char *dst, AllocationType type, size_t size);
};
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -43,7 +43,7 @@ BindlessHeapsHelper::~BindlessHeapsHelper() {
}
GraphicsAllocation *BindlessHeapsHelper::getHeapAllocation(size_t heapSize, size_t alignment, bool allocInFrontWindow) {
auto allocationType = GraphicsAllocation::AllocationType::LINEAR_STREAM;
auto allocationType = AllocationType::LINEAR_STREAM;
NEO::AllocationProperties properties{rootDeviceIndex, true, heapSize, allocationType, isMultiOsContextCapable, deviceBitfield};
properties.flags.use32BitFrontWindow = allocInFrontWindow;
properties.alignment = alignment;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -16,12 +16,12 @@ void HwHelperHw<Family>::setExtraAllocationData(AllocationData &allocationData,
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
if (LocalMemoryAccessMode::CpuAccessDisallowed == hwInfoConfig.getLocalMemoryAccessMode(hwInfo)) {
if (properties.allocationType == GraphicsAllocation::AllocationType::LINEAR_STREAM ||
properties.allocationType == GraphicsAllocation::AllocationType::INTERNAL_HEAP ||
properties.allocationType == GraphicsAllocation::AllocationType::PRINTF_SURFACE ||
properties.allocationType == GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER ||
properties.allocationType == GraphicsAllocation::AllocationType::RING_BUFFER ||
properties.allocationType == GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER) {
if (properties.allocationType == AllocationType::LINEAR_STREAM ||
properties.allocationType == AllocationType::INTERNAL_HEAP ||
properties.allocationType == AllocationType::PRINTF_SURFACE ||
properties.allocationType == AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER ||
properties.allocationType == AllocationType::RING_BUFFER ||
properties.allocationType == AllocationType::SEMAPHORE_BUFFER) {
allocationData.flags.useSystemMemory = true;
}
if (!allocationData.flags.useSystemMemory) {
@@ -31,9 +31,9 @@ void HwHelperHw<Family>::setExtraAllocationData(AllocationData &allocationData,
}
if (hwInfoConfig.allowStatelessCompression(hwInfo)) {
if (properties.allocationType == GraphicsAllocation::AllocationType::GLOBAL_SURFACE ||
properties.allocationType == GraphicsAllocation::AllocationType::CONSTANT_SURFACE ||
properties.allocationType == GraphicsAllocation::AllocationType::PRINTF_SURFACE) {
if (properties.allocationType == AllocationType::GLOBAL_SURFACE ||
properties.allocationType == AllocationType::CONSTANT_SURFACE ||
properties.allocationType == AllocationType::PRINTF_SURFACE) {
allocationData.flags.requiresCpuAccess = false;
allocationData.storageInfo.isLockable = false;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -33,7 +33,7 @@ GraphicsAllocation *FlatBatchBufferHelperHw<GfxFamily>::flattenBatchBuffer(uint3
batchBuffer.chainedBatchBuffer->setAubWritable(false, GraphicsAllocation::defaultBank);
auto sizeMainBatchBuffer = batchBuffer.chainedBatchBufferStartOffset - batchBuffer.startOffset;
auto alignedMainBatchBufferSize = alignUp(sizeMainBatchBuffer + indirectPatchCommandsSize + batchBuffer.chainedBatchBuffer->getUnderlyingBufferSize(), MemoryConstants::pageSize);
AllocationProperties flatBatchBufferProperties(rootDeviceIndex, alignedMainBatchBufferSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, deviceBitfield);
AllocationProperties flatBatchBufferProperties(rootDeviceIndex, alignedMainBatchBufferSize, AllocationType::INTERNAL_HOST_MEMORY, deviceBitfield);
flatBatchBufferProperties.alignment = MemoryConstants::pageSize;
flatBatchBuffer =
getMemoryManager()->allocateGraphicsMemoryWithProperties(flatBatchBufferProperties);
@@ -111,7 +111,7 @@ GraphicsAllocation *FlatBatchBufferHelperHw<GfxFamily>::flattenBatchBuffer(uint3
flatBatchBufferSize = alignUp(flatBatchBufferSize, MemoryConstants::pageSize);
flatBatchBufferSize += CSRequirements::csOverfetchSize;
AllocationProperties flatBatchBufferProperties(rootDeviceIndex, static_cast<size_t>(flatBatchBufferSize), GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, deviceBitfield);
AllocationProperties flatBatchBufferProperties(rootDeviceIndex, static_cast<size_t>(flatBatchBufferSize), AllocationType::INTERNAL_HOST_MEMORY, deviceBitfield);
flatBatchBufferProperties.alignment = MemoryConstants::pageSize;
flatBatchBuffer = getMemoryManager()->allocateGraphicsMemoryWithProperties(flatBatchBufferProperties);
UNRECOVERABLE_IF(flatBatchBuffer == nullptr);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -16,22 +16,22 @@ namespace NEO {
HeapAssigner::HeapAssigner() {
apiAllowExternalHeapForSshAndDsh = ApiSpecificConfig::getHeapConfiguration();
}
bool HeapAssigner::useInternal32BitHeap(GraphicsAllocation::AllocationType allocType) {
bool HeapAssigner::useInternal32BitHeap(AllocationType allocType) {
return GraphicsAllocation::isIsaAllocationType(allocType) ||
allocType == GraphicsAllocation::AllocationType::INTERNAL_HEAP;
allocType == AllocationType::INTERNAL_HEAP;
}
bool HeapAssigner::use32BitHeap(GraphicsAllocation::AllocationType allocType) {
bool HeapAssigner::use32BitHeap(AllocationType allocType) {
return useExternal32BitHeap(allocType) || useInternal32BitHeap(allocType);
}
HeapIndex HeapAssigner::get32BitHeapIndex(GraphicsAllocation::AllocationType allocType, bool useLocalMem, const HardwareInfo &hwInfo, bool useFrontWindow) {
HeapIndex HeapAssigner::get32BitHeapIndex(AllocationType allocType, bool useLocalMem, const HardwareInfo &hwInfo, bool useFrontWindow) {
if (useInternal32BitHeap(allocType)) {
return useFrontWindow ? mapInternalWindowIndex(MemoryManager::selectInternalHeap(useLocalMem)) : MemoryManager::selectInternalHeap(useLocalMem);
}
return useFrontWindow ? mapExternalWindowIndex(MemoryManager::selectExternalHeap(useLocalMem)) : MemoryManager::selectExternalHeap(useLocalMem);
}
bool HeapAssigner::useExternal32BitHeap(GraphicsAllocation::AllocationType allocType) {
bool HeapAssigner::useExternal32BitHeap(AllocationType allocType) {
if (apiAllowExternalHeapForSshAndDsh) {
return allocType == GraphicsAllocation::AllocationType::LINEAR_STREAM;
return allocType == AllocationType::LINEAR_STREAM;
}
return false;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -13,10 +13,10 @@ struct HardwareInfo;
struct HeapAssigner {
HeapAssigner();
~HeapAssigner() = default;
bool useExternal32BitHeap(GraphicsAllocation::AllocationType allocType);
bool useInternal32BitHeap(GraphicsAllocation::AllocationType allocType);
bool use32BitHeap(GraphicsAllocation::AllocationType allocType);
HeapIndex get32BitHeapIndex(GraphicsAllocation::AllocationType allocType, bool useLocalMem, const HardwareInfo &hwInfo, bool useFrontWindow);
bool useExternal32BitHeap(AllocationType allocType);
bool useInternal32BitHeap(AllocationType allocType);
bool use32BitHeap(AllocationType allocType);
HeapIndex get32BitHeapIndex(AllocationType allocType, bool useLocalMem, const HardwareInfo &hwInfo, bool useFrontWindow);
static bool heapTypeExternalWithFrontWindowPool(HeapIndex heap);
static bool isInternalHeap(HeapIndex heap);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2020 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -15,9 +15,9 @@
namespace NEO {
GraphicsAllocation *HeapHelper::getHeapAllocation(uint32_t heapType, size_t heapSize, size_t alignment, uint32_t rootDeviceIndex) {
auto allocationType = GraphicsAllocation::AllocationType::LINEAR_STREAM;
auto allocationType = AllocationType::LINEAR_STREAM;
if (IndirectHeap::Type::INDIRECT_OBJECT == heapType) {
allocationType = GraphicsAllocation::AllocationType::INTERNAL_HEAP;
allocationType = AllocationType::INTERNAL_HEAP;
}
auto allocation = this->storageForReuse->obtainReusableAllocation(heapSize, allocationType);

View File

@@ -23,7 +23,7 @@ class MemoryPropertiesHelper {
static AllocationProperties getAllocationProperties(
uint32_t rootDeviceIndex, MemoryProperties memoryProperties, bool allocateMemory, size_t size,
GraphicsAllocation::AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo,
AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo,
DeviceBitfield subDevicesBitfieldParam, bool deviceOnlyVisibilty);
static DeviceBitfield adjustDeviceBitfield(uint32_t rootDeviceIndex, const MemoryProperties &memoryProperties,

View File

@@ -12,7 +12,7 @@ namespace NEO {
AllocationProperties MemoryPropertiesHelper::getAllocationProperties(
uint32_t rootDeviceIndex, MemoryProperties memoryProperties, bool allocateMemory, size_t size,
GraphicsAllocation::AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo,
AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo,
DeviceBitfield subDevicesBitfieldParam, bool deviceOnlyVisibilty) {
auto deviceBitfield = adjustDeviceBitfield(rootDeviceIndex, memoryProperties, subDevicesBitfieldParam);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -39,8 +39,8 @@ class TimestampPackets : public TagTypeBase {
};
public:
static constexpr GraphicsAllocation::AllocationType getAllocationType() {
return GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER;
static constexpr AllocationType getAllocationType() {
return AllocationType::TIMESTAMP_PACKET_TAG_BUFFER;
}
static constexpr TagNodeType getTagNodeType() { return TagNodeType::TimestampPacket; }

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2019-2021 Intel Corporation
# Copyright (C) 2019-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@@ -10,6 +10,7 @@ set(NEO_CORE_MEMORY_MANAGER
${CMAKE_CURRENT_SOURCE_DIR}/address_mapper.h
${CMAKE_CURRENT_SOURCE_DIR}/allocations_list.h
${CMAKE_CURRENT_SOURCE_DIR}/allocations_list.cpp
${CMAKE_CURRENT_SOURCE_DIR}/allocation_type.h
${CMAKE_CURRENT_SOURCE_DIR}/alignment_selector.cpp
${CMAKE_CURRENT_SOURCE_DIR}/alignment_selector.h
${CMAKE_CURRENT_SOURCE_DIR}/allocation_properties.h

View File

@@ -37,7 +37,7 @@ struct AllocationProperties {
uint32_t rootDeviceIndex = std::numeric_limits<uint32_t>::max();
size_t size = 0;
size_t alignment = 0;
GraphicsAllocation::AllocationType allocationType = GraphicsAllocation::AllocationType::UNKNOWN;
AllocationType allocationType = AllocationType::UNKNOWN;
GraphicsAllocation::UsmInitialPlacement usmInitialPlacement = GraphicsAllocation::UsmInitialPlacement::DEFAULT;
ImageInfo *imgInfo = nullptr;
bool multiStorageResource = false;
@@ -50,12 +50,12 @@ struct AllocationProperties {
uint32_t cacheRegion = 0;
AllocationProperties(uint32_t rootDeviceIndex, size_t size,
GraphicsAllocation::AllocationType allocationType, DeviceBitfield subDevicesBitfieldParam)
AllocationType allocationType, DeviceBitfield subDevicesBitfieldParam)
: AllocationProperties(rootDeviceIndex, true, size, allocationType, false, subDevicesBitfieldParam) {}
AllocationProperties(uint32_t rootDeviceIndex, bool allocateMemory,
ImageInfo &imgInfo,
GraphicsAllocation::AllocationType allocationType,
AllocationType allocationType,
DeviceBitfield subDevicesBitfieldParam)
: AllocationProperties(rootDeviceIndex, allocateMemory, 0u, allocationType, false, subDevicesBitfieldParam) {
this->imgInfo = &imgInfo;
@@ -64,7 +64,7 @@ struct AllocationProperties {
AllocationProperties(uint32_t rootDeviceIndex,
bool allocateMemory,
size_t size,
GraphicsAllocation::AllocationType allocationType,
AllocationType allocationType,
bool isMultiStorageAllocation,
DeviceBitfield subDevicesBitfieldParam)
: AllocationProperties(rootDeviceIndex, allocateMemory, size, allocationType, false, isMultiStorageAllocation, subDevicesBitfieldParam) {}
@@ -72,7 +72,7 @@ struct AllocationProperties {
AllocationProperties(uint32_t rootDeviceIndexParam,
bool allocateMemoryParam,
size_t sizeParam,
GraphicsAllocation::AllocationType allocationTypeParam,
AllocationType allocationTypeParam,
bool multiOsContextCapable,
bool isMultiStorageAllocationParam,
DeviceBitfield subDevicesBitfieldParam)
@@ -114,7 +114,7 @@ struct AllocationData {
uint32_t allFlags = 0;
};
static_assert(sizeof(AllocationData::flags) == sizeof(AllocationData::allFlags), "");
GraphicsAllocation::AllocationType type = GraphicsAllocation::AllocationType::UNKNOWN;
AllocationType type = AllocationType::UNKNOWN;
GraphicsAllocation::UsmInitialPlacement usmInitialPlacement = GraphicsAllocation::UsmInitialPlacement::DEFAULT;
const void *hostPtr = nullptr;
uint64_t gpuAddress = 0;

View File

@@ -0,0 +1,59 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
namespace NEO {
enum class AllocationType {
UNKNOWN = 0,
BUFFER,
BUFFER_HOST_MEMORY,
COMMAND_BUFFER,
CONSTANT_SURFACE,
EXTERNAL_HOST_PTR,
FILL_PATTERN,
GLOBAL_SURFACE,
IMAGE,
INDIRECT_OBJECT_HEAP,
INSTRUCTION_HEAP,
INTERNAL_HEAP,
INTERNAL_HOST_MEMORY,
KERNEL_ISA,
KERNEL_ISA_INTERNAL,
LINEAR_STREAM,
MAP_ALLOCATION,
MCS,
PIPE,
PREEMPTION,
PRINTF_SURFACE,
PRIVATE_SURFACE,
PROFILING_TAG_BUFFER,
SCRATCH_SURFACE,
SHARED_BUFFER,
SHARED_CONTEXT_IMAGE,
SHARED_IMAGE,
SHARED_RESOURCE_COPY,
SURFACE_STATE_HEAP,
SVM_CPU,
SVM_GPU,
SVM_ZERO_COPY,
TAG_BUFFER,
GLOBAL_FENCE,
TIMESTAMP_PACKET_TAG_BUFFER,
WRITE_COMBINED,
RING_BUFFER,
SEMAPHORE_BUFFER,
DEBUG_CONTEXT_SAVE_AREA,
DEBUG_SBA_TRACKING_BUFFER,
DEBUG_MODULE_AREA,
UNIFIED_SHARED_MEMORY,
WORK_PARTITION_SURFACE,
GPU_TIMESTAMP_DEVICE_BUFFER,
SW_TAG_BUFFER,
COUNT
};
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -15,7 +15,7 @@ struct ReusableAllocationRequirements {
const void *requiredPtr;
size_t requiredMinimalSize;
volatile uint32_t *csrTagAddress;
GraphicsAllocation::AllocationType allocationType;
AllocationType allocationType;
uint32_t contextId;
uint32_t activeTileCount;
uint32_t tagOffset;
@@ -27,7 +27,7 @@ AllocationsList::AllocationsList(AllocationUsage allocationUsage)
AllocationsList::AllocationsList()
: allocationUsage(REUSABLE_ALLOCATION) {}
std::unique_ptr<GraphicsAllocation> AllocationsList::detachAllocation(size_t requiredMinimalSize, const void *requiredPtr, CommandStreamReceiver *commandStreamReceiver, GraphicsAllocation::AllocationType allocationType) {
std::unique_ptr<GraphicsAllocation> AllocationsList::detachAllocation(size_t requiredMinimalSize, const void *requiredPtr, CommandStreamReceiver *commandStreamReceiver, AllocationType allocationType) {
ReusableAllocationRequirements req;
req.requiredMinimalSize = requiredMinimalSize;
req.csrTagAddress = (commandStreamReceiver == nullptr) ? nullptr : commandStreamReceiver->getTagAddress();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -19,7 +19,7 @@ class AllocationsList : public IDList<GraphicsAllocation, true, true> {
public:
AllocationsList(AllocationUsage allocationUsage);
AllocationsList();
std::unique_ptr<GraphicsAllocation> detachAllocation(size_t requiredMinimalSize, const void *requiredPtr, CommandStreamReceiver *commandStreamReceiver, GraphicsAllocation::AllocationType allocationType);
std::unique_ptr<GraphicsAllocation> detachAllocation(size_t requiredMinimalSize, const void *requiredPtr, CommandStreamReceiver *commandStreamReceiver, AllocationType allocationType);
void freeAllGraphicsAllocations(Device *neoDevice);
private:

View File

@@ -42,9 +42,9 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope
sizeof(storageInfo.resourceTag));
switch (properties.allocationType) {
case GraphicsAllocation::AllocationType::KERNEL_ISA:
case GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL:
case GraphicsAllocation::AllocationType::DEBUG_MODULE_AREA: {
case AllocationType::KERNEL_ISA:
case AllocationType::KERNEL_ISA_INTERNAL:
case AllocationType::DEBUG_MODULE_AREA: {
auto placeIsaOnMultiTile = (properties.subDevicesBitfield.count() != 1);
if (executionEnvironment.isDebuggingEnabled()) {
@@ -64,13 +64,13 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope
storageInfo.tileInstanced = false;
}
} break;
case GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA:
case GraphicsAllocation::AllocationType::WORK_PARTITION_SURFACE:
case AllocationType::DEBUG_CONTEXT_SAVE_AREA:
case AllocationType::WORK_PARTITION_SURFACE:
storageInfo.cloningOfPageTables = false;
storageInfo.memoryBanks = allTilesValue;
storageInfo.tileInstanced = true;
break;
case GraphicsAllocation::AllocationType::PRIVATE_SURFACE:
case AllocationType::PRIVATE_SURFACE:
storageInfo.cloningOfPageTables = false;
if (properties.subDevicesBitfield.count() == 1) {
@@ -81,17 +81,17 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope
storageInfo.tileInstanced = true;
}
break;
case GraphicsAllocation::AllocationType::COMMAND_BUFFER:
case GraphicsAllocation::AllocationType::INTERNAL_HEAP:
case GraphicsAllocation::AllocationType::LINEAR_STREAM:
case AllocationType::COMMAND_BUFFER:
case AllocationType::INTERNAL_HEAP:
case AllocationType::LINEAR_STREAM:
storageInfo.cloningOfPageTables = properties.flags.multiOsContextCapable;
storageInfo.memoryBanks = preferredTile;
if (!properties.flags.multiOsContextCapable) {
storageInfo.pageTablesVisibility = preferredTile;
}
break;
case GraphicsAllocation::AllocationType::SCRATCH_SURFACE:
case GraphicsAllocation::AllocationType::PREEMPTION:
case AllocationType::SCRATCH_SURFACE:
case AllocationType::PREEMPTION:
if (properties.flags.multiOsContextCapable) {
storageInfo.cloningOfPageTables = false;
storageInfo.memoryBanks = allTilesValue;
@@ -101,7 +101,7 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope
storageInfo.pageTablesVisibility = preferredTile;
}
break;
case GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER:
case AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER:
if (properties.flags.multiOsContextCapable) {
storageInfo.cloningOfPageTables = true;
} else {
@@ -109,8 +109,8 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope
storageInfo.cloningOfPageTables = false;
}
break;
case GraphicsAllocation::AllocationType::BUFFER:
case GraphicsAllocation::AllocationType::SVM_GPU: {
case AllocationType::BUFFER:
case AllocationType::SVM_GPU: {
auto colouringPolicy = properties.colouringPolicy;
auto granularity = properties.colouringGranularity;
@@ -149,7 +149,7 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope
}
break;
}
case GraphicsAllocation::AllocationType::UNIFIED_SHARED_MEMORY:
case AllocationType::UNIFIED_SHARED_MEMORY:
storageInfo.memoryBanks = allTilesValue;
break;
default:

View File

@@ -11,6 +11,7 @@
#include "shared/source/helpers/constants.h"
#include "shared/source/helpers/debug_helpers.h"
#include "shared/source/helpers/ptr_math.h"
#include "shared/source/memory_manager/allocation_type.h"
#include "shared/source/memory_manager/definitions/engine_limits.h"
#include "shared/source/memory_manager/definitions/storage_info.h"
#include "shared/source/memory_manager/host_ptr_defines.h"
@@ -53,55 +54,6 @@ struct AubInfo {
class GraphicsAllocation : public IDNode<GraphicsAllocation> {
public:
enum class AllocationType {
UNKNOWN = 0,
BUFFER,
BUFFER_HOST_MEMORY,
COMMAND_BUFFER,
CONSTANT_SURFACE,
EXTERNAL_HOST_PTR,
FILL_PATTERN,
GLOBAL_SURFACE,
IMAGE,
INDIRECT_OBJECT_HEAP,
INSTRUCTION_HEAP,
INTERNAL_HEAP,
INTERNAL_HOST_MEMORY,
KERNEL_ISA,
KERNEL_ISA_INTERNAL,
LINEAR_STREAM,
MAP_ALLOCATION,
MCS,
PIPE,
PREEMPTION,
PRINTF_SURFACE,
PRIVATE_SURFACE,
PROFILING_TAG_BUFFER,
SCRATCH_SURFACE,
SHARED_BUFFER,
SHARED_CONTEXT_IMAGE,
SHARED_IMAGE,
SHARED_RESOURCE_COPY,
SURFACE_STATE_HEAP,
SVM_CPU,
SVM_GPU,
SVM_ZERO_COPY,
TAG_BUFFER,
GLOBAL_FENCE,
TIMESTAMP_PACKET_TAG_BUFFER,
WRITE_COMBINED,
RING_BUFFER,
SEMAPHORE_BUFFER,
DEBUG_CONTEXT_SAVE_AREA,
DEBUG_SBA_TRACKING_BUFFER,
DEBUG_MODULE_AREA,
UNIFIED_SHARED_MEMORY,
WORK_PARTITION_SURFACE,
GPU_TIMESTAMP_DEVICE_BUFFER,
SW_TAG_BUFFER,
COUNT
};
enum UsmInitialPlacement {
DEFAULT,
CPU,
@@ -245,9 +197,9 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
allocationType == AllocationType::SHARED_RESOURCE_COPY;
}
static bool isIsaAllocationType(GraphicsAllocation::AllocationType type) {
return type == GraphicsAllocation::AllocationType::KERNEL_ISA ||
type == GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL ||
static bool isIsaAllocationType(AllocationType type) {
return type == AllocationType::KERNEL_ISA ||
type == AllocationType::KERNEL_ISA_INTERNAL ||
type == AllocationType::DEBUG_MODULE_AREA;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -65,12 +65,12 @@ void InternalAllocationStorage::freeAllocationsList(uint32_t waitTaskCount, Allo
}
}
std::unique_ptr<GraphicsAllocation> InternalAllocationStorage::obtainReusableAllocation(size_t requiredSize, GraphicsAllocation::AllocationType allocationType) {
std::unique_ptr<GraphicsAllocation> InternalAllocationStorage::obtainReusableAllocation(size_t requiredSize, AllocationType allocationType) {
auto allocation = allocationsForReuse.detachAllocation(requiredSize, nullptr, &commandStreamReceiver, allocationType);
return allocation;
}
std::unique_ptr<GraphicsAllocation> InternalAllocationStorage::obtainTemporaryAllocationWithPtr(size_t requiredSize, const void *requiredPtr, GraphicsAllocation::AllocationType allocationType) {
std::unique_ptr<GraphicsAllocation> InternalAllocationStorage::obtainTemporaryAllocationWithPtr(size_t requiredSize, const void *requiredPtr, AllocationType allocationType) {
auto allocation = temporaryAllocations.detachAllocation(requiredSize, requiredPtr, &commandStreamReceiver, allocationType);
return allocation;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -18,8 +18,8 @@ class InternalAllocationStorage {
MOCKABLE_VIRTUAL void cleanAllocationList(uint32_t waitTaskCount, uint32_t allocationUsage);
void storeAllocation(std::unique_ptr<GraphicsAllocation> &&gfxAllocation, uint32_t allocationUsage);
void storeAllocationWithTaskCount(std::unique_ptr<GraphicsAllocation> &&gfxAllocation, uint32_t allocationUsage, uint32_t taskCount);
std::unique_ptr<GraphicsAllocation> obtainReusableAllocation(size_t requiredSize, GraphicsAllocation::AllocationType allocationType);
std::unique_ptr<GraphicsAllocation> obtainTemporaryAllocationWithPtr(size_t requiredSize, const void *requiredPtr, GraphicsAllocation::AllocationType allocationType);
std::unique_ptr<GraphicsAllocation> obtainReusableAllocation(size_t requiredSize, AllocationType allocationType);
std::unique_ptr<GraphicsAllocation> obtainTemporaryAllocationWithPtr(size_t requiredSize, const void *requiredPtr, AllocationType allocationType);
AllocationsList &getTemporaryAllocations() { return temporaryAllocations; }
AllocationsList &getAllocationsForReuse() { return allocationsForReuse; }
DeviceBitfield getDeviceBitfield() const;

View File

@@ -144,7 +144,7 @@ GraphicsAllocation *MemoryManager::createGraphicsAllocationWithPadding(GraphicsA
}
GraphicsAllocation *MemoryManager::createPaddedAllocation(GraphicsAllocation *inputGraphicsAllocation, size_t sizeWithPadding) {
return allocateGraphicsMemoryWithProperties({inputGraphicsAllocation->getRootDeviceIndex(), sizeWithPadding, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, systemMemoryBitfield});
return allocateGraphicsMemoryWithProperties({inputGraphicsAllocation->getRootDeviceIndex(), sizeWithPadding, AllocationType::INTERNAL_HOST_MEMORY, systemMemoryBitfield});
}
void *MemoryManager::createMultiGraphicsAllocationInSystemMemoryPool(std::vector<uint32_t> &rootDeviceIndices, AllocationProperties &properties, MultiGraphicsAllocation &multiGraphicsAllocation) {
@@ -289,7 +289,7 @@ OsContext *MemoryManager::createAndRegisterOsContext(CommandStreamReceiver *comm
bool MemoryManager::getAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const void *hostPtr, const StorageInfo &storageInfo) {
UNRECOVERABLE_IF(hostPtr == nullptr && !properties.flags.allocateMemory);
UNRECOVERABLE_IF(properties.allocationType == GraphicsAllocation::AllocationType::UNKNOWN);
UNRECOVERABLE_IF(properties.allocationType == AllocationType::UNKNOWN);
auto hwInfo = executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]->getHardwareInfo();
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
@@ -300,16 +300,16 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
bool mayRequireL3Flush = false;
switch (properties.allocationType) {
case GraphicsAllocation::AllocationType::BUFFER:
case GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY:
case GraphicsAllocation::AllocationType::CONSTANT_SURFACE:
case GraphicsAllocation::AllocationType::GLOBAL_SURFACE:
case GraphicsAllocation::AllocationType::PIPE:
case GraphicsAllocation::AllocationType::PRINTF_SURFACE:
case GraphicsAllocation::AllocationType::PRIVATE_SURFACE:
case GraphicsAllocation::AllocationType::SCRATCH_SURFACE:
case GraphicsAllocation::AllocationType::WORK_PARTITION_SURFACE:
case GraphicsAllocation::AllocationType::WRITE_COMBINED:
case AllocationType::BUFFER:
case AllocationType::BUFFER_HOST_MEMORY:
case AllocationType::CONSTANT_SURFACE:
case AllocationType::GLOBAL_SURFACE:
case AllocationType::PIPE:
case AllocationType::PRINTF_SURFACE:
case AllocationType::PRIVATE_SURFACE:
case AllocationType::SCRATCH_SURFACE:
case AllocationType::WORK_PARTITION_SURFACE:
case AllocationType::WRITE_COMBINED:
allow64KbPages = true;
allow32Bit = true;
default:
@@ -317,64 +317,64 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
}
switch (properties.allocationType) {
case GraphicsAllocation::AllocationType::SVM_GPU:
case GraphicsAllocation::AllocationType::SVM_ZERO_COPY:
case GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER:
case GraphicsAllocation::AllocationType::PREEMPTION:
case AllocationType::SVM_GPU:
case AllocationType::SVM_ZERO_COPY:
case AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER:
case AllocationType::PREEMPTION:
allow64KbPages = true;
default:
break;
}
switch (properties.allocationType) {
case GraphicsAllocation::AllocationType::BUFFER:
case GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY:
case GraphicsAllocation::AllocationType::WRITE_COMBINED:
case AllocationType::BUFFER:
case AllocationType::BUFFER_HOST_MEMORY:
case AllocationType::WRITE_COMBINED:
forcePin = true;
default:
break;
}
switch (properties.allocationType) {
case GraphicsAllocation::AllocationType::BUFFER:
case GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY:
case GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR:
case GraphicsAllocation::AllocationType::GLOBAL_SURFACE:
case GraphicsAllocation::AllocationType::IMAGE:
case GraphicsAllocation::AllocationType::MAP_ALLOCATION:
case GraphicsAllocation::AllocationType::PIPE:
case GraphicsAllocation::AllocationType::SHARED_BUFFER:
case GraphicsAllocation::AllocationType::SHARED_IMAGE:
case GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY:
case GraphicsAllocation::AllocationType::SVM_CPU:
case GraphicsAllocation::AllocationType::SVM_GPU:
case GraphicsAllocation::AllocationType::SVM_ZERO_COPY:
case GraphicsAllocation::AllocationType::WRITE_COMBINED:
case AllocationType::BUFFER:
case AllocationType::BUFFER_HOST_MEMORY:
case AllocationType::EXTERNAL_HOST_PTR:
case AllocationType::GLOBAL_SURFACE:
case AllocationType::IMAGE:
case AllocationType::MAP_ALLOCATION:
case AllocationType::PIPE:
case AllocationType::SHARED_BUFFER:
case AllocationType::SHARED_IMAGE:
case AllocationType::SHARED_RESOURCE_COPY:
case AllocationType::SVM_CPU:
case AllocationType::SVM_GPU:
case AllocationType::SVM_ZERO_COPY:
case AllocationType::WRITE_COMBINED:
mayRequireL3Flush = true;
default:
break;
}
switch (properties.allocationType) {
case GraphicsAllocation::AllocationType::COMMAND_BUFFER:
case GraphicsAllocation::AllocationType::RING_BUFFER:
case GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER:
case GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY:
case GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR:
case GraphicsAllocation::AllocationType::FILL_PATTERN:
case GraphicsAllocation::AllocationType::MAP_ALLOCATION:
case GraphicsAllocation::AllocationType::MCS:
case GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER:
case GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE:
case GraphicsAllocation::AllocationType::SVM_CPU:
case GraphicsAllocation::AllocationType::SVM_ZERO_COPY:
case GraphicsAllocation::AllocationType::TAG_BUFFER:
case GraphicsAllocation::AllocationType::GLOBAL_FENCE:
case GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY:
case GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
case GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA:
case GraphicsAllocation::AllocationType::DEBUG_SBA_TRACKING_BUFFER:
case GraphicsAllocation::AllocationType::SW_TAG_BUFFER:
case AllocationType::COMMAND_BUFFER:
case AllocationType::RING_BUFFER:
case AllocationType::SEMAPHORE_BUFFER:
case AllocationType::BUFFER_HOST_MEMORY:
case AllocationType::EXTERNAL_HOST_PTR:
case AllocationType::FILL_PATTERN:
case AllocationType::MAP_ALLOCATION:
case AllocationType::MCS:
case AllocationType::PROFILING_TAG_BUFFER:
case AllocationType::SHARED_CONTEXT_IMAGE:
case AllocationType::SVM_CPU:
case AllocationType::SVM_ZERO_COPY:
case AllocationType::TAG_BUFFER:
case AllocationType::GLOBAL_FENCE:
case AllocationType::INTERNAL_HOST_MEMORY:
case AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
case AllocationType::DEBUG_CONTEXT_SAVE_AREA:
case AllocationType::DEBUG_SBA_TRACKING_BUFFER:
case AllocationType::SW_TAG_BUFFER:
allocationData.flags.useSystemMemory = true;
default:
break;
@@ -385,25 +385,25 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
}
switch (properties.allocationType) {
case GraphicsAllocation::AllocationType::COMMAND_BUFFER:
case GraphicsAllocation::AllocationType::IMAGE:
case GraphicsAllocation::AllocationType::INDIRECT_OBJECT_HEAP:
case GraphicsAllocation::AllocationType::INSTRUCTION_HEAP:
case GraphicsAllocation::AllocationType::INTERNAL_HEAP:
case GraphicsAllocation::AllocationType::KERNEL_ISA:
case GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL:
case GraphicsAllocation::AllocationType::LINEAR_STREAM:
case GraphicsAllocation::AllocationType::MCS:
case GraphicsAllocation::AllocationType::PREEMPTION:
case GraphicsAllocation::AllocationType::SCRATCH_SURFACE:
case GraphicsAllocation::AllocationType::WORK_PARTITION_SURFACE:
case GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE:
case GraphicsAllocation::AllocationType::SHARED_IMAGE:
case GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY:
case GraphicsAllocation::AllocationType::SURFACE_STATE_HEAP:
case GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
case GraphicsAllocation::AllocationType::DEBUG_MODULE_AREA:
case GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER:
case AllocationType::COMMAND_BUFFER:
case AllocationType::IMAGE:
case AllocationType::INDIRECT_OBJECT_HEAP:
case AllocationType::INSTRUCTION_HEAP:
case AllocationType::INTERNAL_HEAP:
case AllocationType::KERNEL_ISA:
case AllocationType::KERNEL_ISA_INTERNAL:
case AllocationType::LINEAR_STREAM:
case AllocationType::MCS:
case AllocationType::PREEMPTION:
case AllocationType::SCRATCH_SURFACE:
case AllocationType::WORK_PARTITION_SURFACE:
case AllocationType::SHARED_CONTEXT_IMAGE:
case AllocationType::SHARED_IMAGE:
case AllocationType::SHARED_RESOURCE_COPY:
case AllocationType::SURFACE_STATE_HEAP:
case AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
case AllocationType::DEBUG_MODULE_AREA:
case AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER:
allocationData.flags.resource48Bit = true;
break;
default:
@@ -425,19 +425,19 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
allocationData.flags.multiOsContextCapable = properties.flags.multiOsContextCapable;
allocationData.usmInitialPlacement = properties.usmInitialPlacement;
if (properties.allocationType == GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA) {
if (properties.allocationType == AllocationType::DEBUG_CONTEXT_SAVE_AREA) {
allocationData.flags.zeroMemory = 1;
}
if (properties.allocationType == GraphicsAllocation::AllocationType::DEBUG_MODULE_AREA) {
if (properties.allocationType == AllocationType::DEBUG_MODULE_AREA) {
allocationData.flags.use32BitFrontWindow = true;
} else {
allocationData.flags.use32BitFrontWindow = properties.flags.use32BitFrontWindow;
}
allocationData.hostPtr = hostPtr;
if (properties.allocationType == GraphicsAllocation::AllocationType::KERNEL_ISA ||
properties.allocationType == GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL) {
if (properties.allocationType == AllocationType::KERNEL_ISA ||
properties.allocationType == AllocationType::KERNEL_ISA_INTERNAL) {
allocationData.size = properties.size + hwHelper.getPaddingForISAAllocation();
} else {
allocationData.size = properties.size;
@@ -494,7 +494,7 @@ GraphicsAllocation *MemoryManager::allocateInternalGraphicsMemoryWithHostCopy(ui
size_t size) {
NEO::AllocationProperties copyProperties{rootDeviceIndex,
size,
NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
NEO::AllocationType::INTERNAL_HOST_MEMORY,
bitField};
copyProperties.alignment = MemoryConstants::pageSize;
auto allocation = this->allocateGraphicsMemoryWithProperties(copyProperties);
@@ -518,7 +518,7 @@ bool MemoryManager::mapAuxGpuVA(GraphicsAllocation *graphicsAllocation) {
}
GraphicsAllocation *MemoryManager::allocateGraphicsMemory(const AllocationData &allocationData) {
if (allocationData.type == GraphicsAllocation::AllocationType::IMAGE || allocationData.type == GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY) {
if (allocationData.type == AllocationType::IMAGE || allocationData.type == AllocationType::SHARED_RESOURCE_COPY) {
UNRECOVERABLE_IF(allocationData.imgInfo == nullptr);
return allocateGraphicsMemoryForImage(allocationData);
}
@@ -578,29 +578,29 @@ EngineControlContainer &MemoryManager::getRegisteredEngines() {
return registeredEngines;
}
bool MemoryManager::isExternalAllocation(GraphicsAllocation::AllocationType allocationType) {
if (allocationType == GraphicsAllocation::AllocationType::BUFFER ||
allocationType == GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY ||
allocationType == GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR ||
allocationType == GraphicsAllocation::AllocationType::FILL_PATTERN ||
allocationType == GraphicsAllocation::AllocationType::IMAGE ||
allocationType == GraphicsAllocation::AllocationType::MAP_ALLOCATION ||
allocationType == GraphicsAllocation::AllocationType::PIPE ||
allocationType == GraphicsAllocation::AllocationType::SHARED_BUFFER ||
allocationType == GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE ||
allocationType == GraphicsAllocation::AllocationType::SHARED_IMAGE ||
allocationType == GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY ||
allocationType == GraphicsAllocation::AllocationType::SVM_CPU ||
allocationType == GraphicsAllocation::AllocationType::SVM_GPU ||
allocationType == GraphicsAllocation::AllocationType::SVM_ZERO_COPY ||
allocationType == GraphicsAllocation::AllocationType::UNIFIED_SHARED_MEMORY ||
allocationType == GraphicsAllocation::AllocationType::WRITE_COMBINED) {
bool MemoryManager::isExternalAllocation(AllocationType allocationType) {
if (allocationType == AllocationType::BUFFER ||
allocationType == AllocationType::BUFFER_HOST_MEMORY ||
allocationType == AllocationType::EXTERNAL_HOST_PTR ||
allocationType == AllocationType::FILL_PATTERN ||
allocationType == AllocationType::IMAGE ||
allocationType == AllocationType::MAP_ALLOCATION ||
allocationType == AllocationType::PIPE ||
allocationType == AllocationType::SHARED_BUFFER ||
allocationType == AllocationType::SHARED_CONTEXT_IMAGE ||
allocationType == AllocationType::SHARED_IMAGE ||
allocationType == AllocationType::SHARED_RESOURCE_COPY ||
allocationType == AllocationType::SVM_CPU ||
allocationType == AllocationType::SVM_GPU ||
allocationType == AllocationType::SVM_ZERO_COPY ||
allocationType == AllocationType::UNIFIED_SHARED_MEMORY ||
allocationType == AllocationType::WRITE_COMBINED) {
return true;
}
return false;
}
LocalMemoryUsageBankSelector *MemoryManager::getLocalMemoryUsageBankSelector(GraphicsAllocation::AllocationType allocationType, uint32_t rootDeviceIndex) {
LocalMemoryUsageBankSelector *MemoryManager::getLocalMemoryUsageBankSelector(AllocationType allocationType, uint32_t rootDeviceIndex) {
if (isExternalAllocation(allocationType)) {
return externalLocalMemoryUsageBankSelector[rootDeviceIndex].get();
}
@@ -681,7 +681,7 @@ bool MemoryManager::copyMemoryToAllocation(GraphicsAllocation *graphicsAllocatio
for (auto i = 0u; i < graphicsAllocation->storageInfo.getNumBanks(); ++i) {
memcpy_s(ptrOffset(static_cast<uint8_t *>(graphicsAllocation->getUnderlyingBuffer()) + i * graphicsAllocation->getUnderlyingBufferSize(), destinationOffset),
(graphicsAllocation->getUnderlyingBufferSize() - destinationOffset), memoryToCopy, sizeToCopy);
if (graphicsAllocation->getAllocationType() != GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA) {
if (graphicsAllocation->getAllocationType() != AllocationType::DEBUG_CONTEXT_SAVE_AREA) {
break;
}
}
@@ -731,9 +731,9 @@ bool MemoryManager::isHostPointerTrackingEnabled(uint32_t rootDeviceIndex) {
return (peekExecutionEnvironment().rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo()->capabilityTable.hostPtrTrackingEnabled | is32bit);
}
bool MemoryManager::useNonSvmHostPtrAlloc(GraphicsAllocation::AllocationType allocationType, uint32_t rootDeviceIndex) {
bool isExternalHostPtrAlloc = (allocationType == GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR);
bool isMapAlloc = (allocationType == GraphicsAllocation::AllocationType::MAP_ALLOCATION);
bool MemoryManager::useNonSvmHostPtrAlloc(AllocationType allocationType, uint32_t rootDeviceIndex) {
bool isExternalHostPtrAlloc = (allocationType == AllocationType::EXTERNAL_HOST_PTR);
bool isMapAlloc = (allocationType == AllocationType::MAP_ALLOCATION);
if (forceNonSvmForExternalHostPtr && isExternalHostPtrAlloc) {
return true;
@@ -798,7 +798,7 @@ void MemoryManager::overrideAllocationData(AllocationData &allocationData, const
int32_t directRingPlacement = DebugManager.flags.DirectSubmissionBufferPlacement.get();
int32_t directRingAddressing = DebugManager.flags.DirectSubmissionBufferAddressing.get();
if (properties.allocationType == GraphicsAllocation::AllocationType::RING_BUFFER) {
if (properties.allocationType == AllocationType::RING_BUFFER) {
if (directRingPlacement != -1) {
if (directRingPlacement == 0) {
allocationData.flags.requiresCpuAccess = true;
@@ -819,7 +819,7 @@ void MemoryManager::overrideAllocationData(AllocationData &allocationData, const
}
int32_t directSemaphorePlacement = DebugManager.flags.DirectSubmissionSemaphorePlacement.get();
int32_t directSemaphoreAddressing = DebugManager.flags.DirectSubmissionSemaphoreAddressing.get();
if (properties.allocationType == GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER) {
if (properties.allocationType == AllocationType::SEMAPHORE_BUFFER) {
if (directSemaphorePlacement != -1) {
if (directSemaphorePlacement == 0) {
allocationData.flags.requiresCpuAccess = true;
@@ -839,10 +839,10 @@ void MemoryManager::overrideAllocationData(AllocationData &allocationData, const
}
}
bool MemoryManager::isAllocationTypeToCapture(GraphicsAllocation::AllocationType type) const {
bool MemoryManager::isAllocationTypeToCapture(AllocationType type) const {
switch (type) {
case GraphicsAllocation::AllocationType::SCRATCH_SURFACE:
case GraphicsAllocation::AllocationType::PRIVATE_SURFACE:
case AllocationType::SCRATCH_SURFACE:
case AllocationType::PRIVATE_SURFACE:
return true;
default:
break;
@@ -852,7 +852,7 @@ bool MemoryManager::isAllocationTypeToCapture(GraphicsAllocation::AllocationType
bool MemoryManager::isLocalMemoryUsedForIsa(uint32_t rootDeviceIndex) {
std::call_once(checkIsaPlacementOnceFlags[rootDeviceIndex], [&] {
AllocationProperties properties = {rootDeviceIndex, 0x1000, GraphicsAllocation::AllocationType::KERNEL_ISA, 1};
AllocationProperties properties = {rootDeviceIndex, 0x1000, AllocationType::KERNEL_ISA, 1};
AllocationData data;
getAllocationData(data, properties, nullptr, StorageInfo());
isaInLocalMemory[rootDeviceIndex] = !data.flags.useSystemMemory;

View File

@@ -94,7 +94,7 @@ class MemoryManager {
virtual bool isNTHandle(osHandle handle, uint32_t rootDeviceIndex) { return false; }
virtual GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) = 0;
virtual void closeSharedHandle(GraphicsAllocation *graphicsAllocation){};
virtual GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, GraphicsAllocation::AllocationType allocType) = 0;
virtual GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) = 0;
virtual bool mapAuxGpuVA(GraphicsAllocation *graphicsAllocation);
@@ -106,10 +106,10 @@ class MemoryManager {
MOCKABLE_VIRTUAL bool isLimitedGPU(uint32_t rootDeviceIndex) {
return peek32bit() && !peekExecutionEnvironment().rootDeviceEnvironments[rootDeviceIndex]->isFullRangeSvm();
}
MOCKABLE_VIRTUAL bool isLimitedGPUOnType(uint32_t rootDeviceIndex, GraphicsAllocation::AllocationType type) {
MOCKABLE_VIRTUAL bool isLimitedGPUOnType(uint32_t rootDeviceIndex, AllocationType type) {
return isLimitedGPU(rootDeviceIndex) &&
(type != GraphicsAllocation::AllocationType::MAP_ALLOCATION) &&
(type != GraphicsAllocation::AllocationType::IMAGE);
(type != AllocationType::MAP_ALLOCATION) &&
(type != AllocationType::IMAGE);
}
void cleanGraphicsMemoryCreatedFromHostPtr(GraphicsAllocation *);
@@ -215,12 +215,12 @@ class MemoryManager {
virtual bool setMemAdvise(GraphicsAllocation *gfxAllocation, MemAdviseFlags flags, uint32_t rootDeviceIndex) { return true; }
bool isExternalAllocation(GraphicsAllocation::AllocationType allocationType);
LocalMemoryUsageBankSelector *getLocalMemoryUsageBankSelector(GraphicsAllocation::AllocationType allocationType, uint32_t rootDeviceIndex);
bool isExternalAllocation(AllocationType allocationType);
LocalMemoryUsageBankSelector *getLocalMemoryUsageBankSelector(AllocationType allocationType, uint32_t rootDeviceIndex);
bool isLocalMemoryUsedForIsa(uint32_t rootDeviceIndex);
MOCKABLE_VIRTUAL bool isNonSvmBuffer(const void *hostPtr, GraphicsAllocation::AllocationType allocationType, uint32_t rootDeviceIndex) {
return !force32bitAllocations && hostPtr && !isHostPointerTrackingEnabled(rootDeviceIndex) && (allocationType == GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
MOCKABLE_VIRTUAL bool isNonSvmBuffer(const void *hostPtr, AllocationType allocationType, uint32_t rootDeviceIndex) {
return !force32bitAllocations && hostPtr && !isHostPointerTrackingEnabled(rootDeviceIndex) && (allocationType == AllocationType::BUFFER_HOST_MEMORY);
}
virtual void releaseDeviceSpecificMemResources(uint32_t rootDeviceIndex){};
@@ -239,7 +239,7 @@ class MemoryManager {
static bool isCopyRequired(ImageInfo &imgInfo, const void *hostPtr);
bool useNonSvmHostPtrAlloc(GraphicsAllocation::AllocationType allocationType, uint32_t rootDeviceIndex);
bool useNonSvmHostPtrAlloc(AllocationType allocationType, uint32_t rootDeviceIndex);
StorageInfo createStorageInfoFromProperties(const AllocationProperties &properties);
virtual GraphicsAllocation *createGraphicsAllocation(OsHandleStorage &handleStorage, const AllocationData &allocationData) = 0;
@@ -261,7 +261,7 @@ class MemoryManager {
virtual void unlockResourceImpl(GraphicsAllocation &graphicsAllocation) = 0;
virtual void freeAssociatedResourceImpl(GraphicsAllocation &graphicsAllocation) { return unlockResourceImpl(graphicsAllocation); };
virtual void registerAllocationInOs(GraphicsAllocation *allocation) {}
bool isAllocationTypeToCapture(GraphicsAllocation::AllocationType type) const;
bool isAllocationTypeToCapture(AllocationType type) const;
void zeroCpuMemoryIfRequested(const AllocationData &allocationData, void *cpuPtr, size_t size) {
if (allocationData.flags.zeroMemory) {
memset(cpuPtr, 0, size);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -59,7 +59,7 @@ GraphicsAllocation *MultiGraphicsAllocation::getGraphicsAllocation(uint32_t root
return graphicsAllocations[rootDeviceIndex];
}
GraphicsAllocation::AllocationType MultiGraphicsAllocation::getAllocationType() const {
AllocationType MultiGraphicsAllocation::getAllocationType() const {
return getDefaultGraphicsAllocation()->getAllocationType();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -29,7 +29,7 @@ class MultiGraphicsAllocation {
GraphicsAllocation *getGraphicsAllocation(uint32_t rootDeviceIndex) const;
GraphicsAllocation::AllocationType getAllocationType() const;
AllocationType getAllocationType() const;
bool isCoherent() const;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -71,12 +71,12 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryWithAlignment
}
auto alignment = allocationData.alignment;
if (allocationData.type == GraphicsAllocation::AllocationType::SVM_CPU) {
if (allocationData.type == AllocationType::SVM_CPU) {
alignment = MemoryConstants::pageSize2Mb;
sizeAligned = alignUp(allocationData.size, MemoryConstants::pageSize2Mb);
}
if (allocationData.type == GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA) {
if (allocationData.type == AllocationType::DEBUG_CONTEXT_SAVE_AREA) {
sizeAligned *= allocationData.storageInfo.getNumBanks();
}
@@ -85,7 +85,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryWithAlignment
memoryAllocation = createMemoryAllocation(allocationData.type, ptr, ptr, reinterpret_cast<uint64_t>(ptr), allocationData.size,
counter, MemoryPool::System4KBPages, allocationData.rootDeviceIndex, allocationData.flags.uncacheable, allocationData.flags.flushL3, false);
if (allocationData.type == GraphicsAllocation::AllocationType::SVM_CPU) {
if (allocationData.type == AllocationType::SVM_CPU) {
//add padding in case mapPtr is not aligned
size_t reserveSize = sizeAligned + alignment;
void *gpuPtr = reserveCpuAddressRange(reserveSize, allocationData.rootDeviceIndex);
@@ -99,7 +99,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryWithAlignment
memoryAllocation->setCpuPtrAndGpuAddress(ptr, reinterpret_cast<uint64_t>(gpuPtr));
}
if (allocationData.type == GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA) {
if (allocationData.type == AllocationType::DEBUG_CONTEXT_SAVE_AREA) {
memoryAllocation->storageInfo = allocationData.storageInfo;
}
@@ -401,7 +401,7 @@ void OsAgnosticMemoryManager::releaseReservedCpuAddressRange(void *reserved, siz
alignedFreeWrapper(reserved);
}
MemoryAllocation *OsAgnosticMemoryManager::createMemoryAllocation(GraphicsAllocation::AllocationType allocationType, void *driverAllocatedCpuPointer,
MemoryAllocation *OsAgnosticMemoryManager::createMemoryAllocation(AllocationType allocationType, void *driverAllocatedCpuPointer,
void *pMem, uint64_t gpuAddress, size_t memSize, uint64_t count,
MemoryPool::Type pool, uint32_t rootDeviceIndex, bool uncacheable,
bool flushL3Required, bool requireSpecificBitness) {
@@ -459,7 +459,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryInDevicePool(
adjustedAllocationData.size = alignUp(allocationData.size, MemoryConstants::pageSize64k);
adjustedAllocationData.alignment = MemoryConstants::pageSize64k;
allocation = static_cast<MemoryAllocation *>(allocate32BitGraphicsMemoryImpl(adjustedAllocationData, true));
} else if (allocationData.type == GraphicsAllocation::AllocationType::SVM_GPU) {
} else if (allocationData.type == AllocationType::SVM_GPU) {
auto storage = allocateSystemMemory(allocationData.size, MemoryConstants::pageSize2Mb);
allocation = new MemoryAllocation(allocationData.rootDeviceIndex, numHandles, allocationData.type, storage, storage, reinterpret_cast<uint64_t>(allocationData.hostPtr),
allocationData.size, counter, MemoryPool::LocalMemory, false, allocationData.flags.flushL3, maxOsContextCount);
@@ -467,8 +467,8 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryInDevicePool(
} else {
std::unique_ptr<Gmm> gmm;
size_t sizeAligned64k = 0;
if (allocationData.type == GraphicsAllocation::AllocationType::IMAGE ||
allocationData.type == GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY) {
if (allocationData.type == AllocationType::IMAGE ||
allocationData.type == AllocationType::SHARED_RESOURCE_COPY) {
allocationData.imgInfo->useLocalMemory = true;
gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), *allocationData.imgInfo,
allocationData.storageInfo, allocationData.flags.preferCompressed);
@@ -496,7 +496,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryInDevicePool(
}
auto systemMemory = allocateSystemMemory(sizeAligned64k, MemoryConstants::pageSize64k);
if (allocationData.type == GraphicsAllocation::AllocationType::PREEMPTION) {
if (allocationData.type == AllocationType::PREEMPTION) {
memset(systemMemory, 0, sizeAligned64k);
}
auto sizeOfHeapChunk = sizeAligned64k;

View File

@@ -70,7 +70,7 @@ class OsAgnosticMemoryManager : public MemoryManager {
void initialize(bool aubUsage);
~OsAgnosticMemoryManager() override;
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override;
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, GraphicsAllocation::AllocationType allocType) override { return nullptr; }
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) override { return nullptr; }
void addAllocationToHostPtrManager(GraphicsAllocation *gfxAllocation) override;
void removeAllocationFromHostPtrManager(GraphicsAllocation *gfxAllocation) override;
@@ -106,7 +106,7 @@ class OsAgnosticMemoryManager : public MemoryManager {
void unlockResourceImpl(GraphicsAllocation &graphicsAllocation) override {}
GraphicsAllocation *allocate32BitGraphicsMemoryImpl(const AllocationData &allocationData, bool useLocalMemory) override;
GraphicsAllocation *allocateGraphicsMemoryInDevicePool(const AllocationData &allocationData, AllocationStatus &status) override;
MemoryAllocation *createMemoryAllocation(GraphicsAllocation::AllocationType allocationType, void *driverAllocatedCpuPointer, void *pMem, uint64_t gpuAddress, size_t memSize,
MemoryAllocation *createMemoryAllocation(AllocationType allocationType, void *driverAllocatedCpuPointer, void *pMem, uint64_t gpuAddress, size_t memSize,
uint64_t count, MemoryPool::Type pool, uint32_t rootDeviceIndex, bool uncacheable, bool flushL3Required, bool requireSpecificBitness);
bool fakeBigAllocations = false;

View File

@@ -127,7 +127,7 @@ void *SVMAllocsManager::createHostUnifiedMemoryAllocation(size_t size,
size_t alignedSize = alignUp<size_t>(size, pageSizeForAlignment);
bool compressionEnabled = false;
GraphicsAllocation::AllocationType allocationType = getGraphicsAllocationTypeAndCompressionPreference(memoryProperties, compressionEnabled);
AllocationType allocationType = getGraphicsAllocationTypeAndCompressionPreference(memoryProperties, compressionEnabled);
std::vector<uint32_t> rootDeviceIndicesVector(memoryProperties.rootDeviceIndices.begin(), memoryProperties.rootDeviceIndices.end());
@@ -179,7 +179,7 @@ void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size,
size_t alignedSize = alignUp<size_t>(size, pageSizeForAlignment);
bool compressionEnabled = false;
GraphicsAllocation::AllocationType allocationType = getGraphicsAllocationTypeAndCompressionPreference(memoryProperties, compressionEnabled);
AllocationType allocationType = getGraphicsAllocationTypeAndCompressionPreference(memoryProperties, compressionEnabled);
bool multiStorageAllocation = (deviceBitfield.count() > 1) && multiOsContextSupport;
if ((deviceBitfield.count() > 1) && !multiOsContextSupport) {
@@ -285,7 +285,7 @@ void *SVMAllocsManager::createUnifiedKmdMigratedAllocation(size_t size, const Sv
AllocationProperties gpuProperties{rootDeviceIndex,
true,
alignedSize,
GraphicsAllocation::AllocationType::UNIFIED_SHARED_MEMORY,
AllocationType::UNIFIED_SHARED_MEMORY,
false,
false,
deviceBitfield};
@@ -356,7 +356,7 @@ bool SVMAllocsManager::freeSVMAlloc(void *ptr, bool blocking) {
pageFaultManager->removeAllocation(ptr);
}
std::unique_lock<SpinLock> lock(mtx);
if (svmData->gpuAllocations.getAllocationType() == GraphicsAllocation::AllocationType::SVM_ZERO_COPY) {
if (svmData->gpuAllocations.getAllocationType() == AllocationType::SVM_ZERO_COPY) {
freeZeroCopySvmAllocation(svmData);
} else {
freeSvmAllocationWithDeviceStorage(svmData);
@@ -375,7 +375,7 @@ void *SVMAllocsManager::createZeroCopySvmAllocation(size_t size, const SvmAlloca
AllocationProperties properties{rootDeviceIndex,
true, // allocateMemory
size,
GraphicsAllocation::AllocationType::SVM_ZERO_COPY,
AllocationType::SVM_ZERO_COPY,
false, // isMultiStorageAllocation
deviceBitfield};
MemoryPropertiesHelper::fillCachePolicyInProperties(properties, false, svmProperties.readOnly, false, properties.cacheRegion);
@@ -411,7 +411,7 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, co
DeviceBitfield subDevices = unifiedMemoryProperties.subdeviceBitfields.at(rootDeviceIndex);
AllocationProperties cpuProperties{rootDeviceIndex,
true, // allocateMemory
alignedSizeCpu, GraphicsAllocation::AllocationType::SVM_CPU,
alignedSizeCpu, AllocationType::SVM_CPU,
false, // isMultiStorageAllocation
subDevices};
cpuProperties.alignment = MemoryConstants::pageSize2Mb;
@@ -438,7 +438,7 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(size_t size, co
AllocationProperties gpuProperties{rootDeviceIndex,
false,
alignedSizeGpu,
GraphicsAllocation::AllocationType::SVM_GPU,
AllocationType::SVM_GPU,
false,
multiStorageAllocation,
subDevices};
@@ -563,20 +563,20 @@ void SVMAllocsManager::removeSvmMapOperation(const void *regionSvmPtr) {
svmMapOperations.remove(regionSvmPtr);
}
GraphicsAllocation::AllocationType SVMAllocsManager::getGraphicsAllocationTypeAndCompressionPreference(const UnifiedMemoryProperties &unifiedMemoryProperties, bool &compressionEnabled) const {
AllocationType SVMAllocsManager::getGraphicsAllocationTypeAndCompressionPreference(const UnifiedMemoryProperties &unifiedMemoryProperties, bool &compressionEnabled) const {
compressionEnabled = false;
GraphicsAllocation::AllocationType allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
AllocationType allocationType = AllocationType::BUFFER_HOST_MEMORY;
if (unifiedMemoryProperties.memoryType == InternalMemoryType::DEVICE_UNIFIED_MEMORY) {
if (unifiedMemoryProperties.allocationFlags.allocFlags.allocWriteCombined) {
allocationType = GraphicsAllocation::AllocationType::WRITE_COMBINED;
allocationType = AllocationType::WRITE_COMBINED;
} else {
UNRECOVERABLE_IF(nullptr == unifiedMemoryProperties.device);
const auto &hwInfoConfig = *HwInfoConfig::get(unifiedMemoryProperties.device->getHardwareInfo().platform.eProductFamily);
if (hwInfoConfig.allowStatelessCompression(unifiedMemoryProperties.device->getHardwareInfo())) {
compressionEnabled = true;
}
allocationType = GraphicsAllocation::AllocationType::BUFFER;
allocationType = AllocationType::BUFFER;
}
}
return allocationType;

View File

@@ -165,7 +165,7 @@ class SVMAllocsManager {
void *createZeroCopySvmAllocation(size_t size, const SvmAllocationProperties &svmProperties,
const std::set<uint32_t> &rootDeviceIndices,
const std::map<uint32_t, DeviceBitfield> &subdeviceBitfields);
GraphicsAllocation::AllocationType getGraphicsAllocationTypeAndCompressionPreference(const UnifiedMemoryProperties &unifiedMemoryProperties, bool &compressionEnabled) const;
AllocationType getGraphicsAllocationTypeAndCompressionPreference(const UnifiedMemoryProperties &unifiedMemoryProperties, bool &compressionEnabled) const;
void freeZeroCopySvmAllocation(SvmAllocationData *svmData);

View File

@@ -123,16 +123,16 @@ void DrmAllocation::registerBOBindExtHandle(Drm *drm) {
Drm::ResourceClass resourceClass = Drm::ResourceClass::MaxSize;
switch (this->allocationType) {
case GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA:
case AllocationType::DEBUG_CONTEXT_SAVE_AREA:
resourceClass = Drm::ResourceClass::ContextSaveArea;
break;
case GraphicsAllocation::AllocationType::DEBUG_SBA_TRACKING_BUFFER:
case AllocationType::DEBUG_SBA_TRACKING_BUFFER:
resourceClass = Drm::ResourceClass::SbaTrackingBuffer;
break;
case GraphicsAllocation::AllocationType::KERNEL_ISA:
case AllocationType::KERNEL_ISA:
resourceClass = Drm::ResourceClass::Isa;
break;
case GraphicsAllocation::AllocationType::DEBUG_MODULE_AREA:
case AllocationType::DEBUG_MODULE_AREA:
resourceClass = Drm::ResourceClass::ModuleHeapDebugArea;
break;
default:

View File

@@ -267,7 +267,7 @@ DrmAllocation *DrmMemoryManager::createGraphicsAllocation(OsHandleStorage &handl
}
DrmAllocation *DrmMemoryManager::allocateGraphicsMemoryWithAlignment(const AllocationData &allocationData) {
if (allocationData.type == NEO::GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA) {
if (allocationData.type == NEO::AllocationType::DEBUG_CONTEXT_SAVE_AREA) {
return createMultiHostAllocation(allocationData);
}
@@ -285,7 +285,7 @@ DrmAllocation *DrmMemoryManager::allocateGraphicsMemoryWithAlignmentImpl(const A
uint64_t alignedGpuAddress = 0;
size_t alignedStorageSize = cSize;
size_t alignedVirtualAdressRangeSize = cSize;
auto svmCpuAllocation = allocationData.type == GraphicsAllocation::AllocationType::SVM_CPU;
auto svmCpuAllocation = allocationData.type == AllocationType::SVM_CPU;
if (svmCpuAllocation) {
//add padding in case reserved addr is not aligned
alignedStorageSize = alignUp(cSize, cAlignment);
@@ -343,7 +343,7 @@ DrmAllocation *DrmMemoryManager::createAllocWithAlignmentFromUserptr(const Alloc
}
void DrmMemoryManager::obtainGpuAddress(const AllocationData &allocationData, BufferObject *bo, uint64_t gpuAddress) {
if ((isLimitedRange(allocationData.rootDeviceIndex) || allocationData.type == GraphicsAllocation::AllocationType::SVM_CPU) &&
if ((isLimitedRange(allocationData.rootDeviceIndex) || allocationData.type == AllocationType::SVM_CPU) &&
!allocationData.flags.isUSMHostAllocation) {
bo->setAddress(gpuAddress);
}
@@ -1111,7 +1111,7 @@ void *DrmMemoryManager::lockResourceInLocalMemoryImpl(GraphicsAllocation &graphi
return nullptr;
}
auto bo = static_cast<DrmAllocation &>(graphicsAllocation).getBO();
if (graphicsAllocation.getAllocationType() == GraphicsAllocation::AllocationType::WRITE_COMBINED) {
if (graphicsAllocation.getAllocationType() == AllocationType::WRITE_COMBINED) {
auto addr = lockResourceInLocalMemoryImpl(bo);
auto alignedAddr = alignUp(addr, MemoryConstants::pageSize64k);
auto notUsedSize = ptrDiff(alignedAddr, addr);
@@ -1213,22 +1213,22 @@ void fillGmmsInAllocation(GmmClientContext *clientContext, DrmAllocation *alloca
}
}
uint64_t getGpuAddress(const AlignmentSelector &alignmentSelector, HeapAssigner &heapAssigner, const HardwareInfo &hwInfo, GraphicsAllocation::AllocationType allocType, GfxPartition *gfxPartition,
uint64_t getGpuAddress(const AlignmentSelector &alignmentSelector, HeapAssigner &heapAssigner, const HardwareInfo &hwInfo, AllocationType allocType, GfxPartition *gfxPartition,
size_t &sizeAllocated, const void *hostPtr, bool resource48Bit, bool useFrontWindow) {
uint64_t gpuAddress = 0;
switch (allocType) {
case GraphicsAllocation::AllocationType::SVM_GPU:
case AllocationType::SVM_GPU:
gpuAddress = reinterpret_cast<uint64_t>(hostPtr);
sizeAllocated = 0;
break;
case GraphicsAllocation::AllocationType::KERNEL_ISA:
case GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL:
case GraphicsAllocation::AllocationType::INTERNAL_HEAP:
case GraphicsAllocation::AllocationType::DEBUG_MODULE_AREA: {
case AllocationType::KERNEL_ISA:
case AllocationType::KERNEL_ISA_INTERNAL:
case AllocationType::INTERNAL_HEAP:
case AllocationType::DEBUG_MODULE_AREA: {
auto heap = heapAssigner.get32BitHeapIndex(allocType, true, hwInfo, useFrontWindow);
gpuAddress = GmmHelper::canonize(gfxPartition->heapAllocate(heap, sizeAllocated));
} break;
case GraphicsAllocation::AllocationType::WRITE_COMBINED:
case AllocationType::WRITE_COMBINED:
sizeAllocated = 0;
break;
default:
@@ -1247,11 +1247,11 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryInDevicePool(const A
if (!this->localMemorySupported[allocationData.rootDeviceIndex] ||
allocationData.flags.useSystemMemory ||
(allocationData.flags.allow32Bit && this->force32bitAllocations) ||
allocationData.type == GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY) {
allocationData.type == AllocationType::SHARED_RESOURCE_COPY) {
return nullptr;
}
if (allocationData.type == GraphicsAllocation::AllocationType::UNIFIED_SHARED_MEMORY) {
if (allocationData.type == AllocationType::UNIFIED_SHARED_MEMORY) {
auto allocation = this->createSharedUnifiedMemoryAllocation(allocationData);
status = allocation ? AllocationStatus::Success : AllocationStatus::Error;
return allocation;
@@ -1261,13 +1261,13 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryInDevicePool(const A
size_t sizeAligned = 0;
auto numHandles = allocationData.storageInfo.getNumBanks();
bool createSingleHandle = 1 == numHandles;
if (allocationData.type == GraphicsAllocation::AllocationType::IMAGE) {
if (allocationData.type == AllocationType::IMAGE) {
allocationData.imgInfo->useLocalMemory = true;
gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), *allocationData.imgInfo,
allocationData.storageInfo, allocationData.flags.preferCompressed);
sizeAligned = alignUp(allocationData.imgInfo->size, MemoryConstants::pageSize64k);
} else {
if (allocationData.type == GraphicsAllocation::AllocationType::WRITE_COMBINED) {
if (allocationData.type == AllocationType::WRITE_COMBINED) {
sizeAligned = alignUp(allocationData.size + MemoryConstants::pageSize64k, 2 * MemoryConstants::megaByte) + 2 * MemoryConstants::megaByte;
} else {
sizeAligned = alignUp(allocationData.size, MemoryConstants::pageSize64k);
@@ -1315,7 +1315,7 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryInDevicePool(const A
status = AllocationStatus::Error;
return nullptr;
}
if (allocationData.type == GraphicsAllocation::AllocationType::WRITE_COMBINED) {
if (allocationData.type == AllocationType::WRITE_COMBINED) {
auto cpuAddress = lockResource(allocation.get());
auto alignedCpuAddress = alignDown(cpuAddress, 2 * MemoryConstants::megaByte);
auto offset = ptrDiff(cpuAddress, alignedCpuAddress);
@@ -1465,16 +1465,16 @@ bool DrmMemoryManager::retrieveMmapOffsetForBufferObject(uint32_t rootDeviceInde
return true;
}
bool DrmMemoryManager::allocationTypeForCompletionFence(GraphicsAllocation::AllocationType allocationType) {
bool DrmMemoryManager::allocationTypeForCompletionFence(AllocationType allocationType) {
int32_t overrideAllowAllAllocations = DebugManager.flags.UseDrmCompletionFenceForAllAllocations.get();
bool allowAllAllocations = overrideAllowAllAllocations == -1 ? false : !!overrideAllowAllAllocations;
if (allowAllAllocations) {
return true;
}
if (allocationType == GraphicsAllocation::AllocationType::COMMAND_BUFFER ||
allocationType == GraphicsAllocation::AllocationType::RING_BUFFER ||
allocationType == GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER ||
allocationType == GraphicsAllocation::AllocationType::TAG_BUFFER) {
if (allocationType == AllocationType::COMMAND_BUFFER ||
allocationType == AllocationType::RING_BUFFER ||
allocationType == AllocationType::SEMAPHORE_BUFFER ||
allocationType == AllocationType::TAG_BUFFER) {
return true;
}
return false;

View File

@@ -38,7 +38,7 @@ class DrmMemoryManager : public MemoryManager {
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override;
void closeSharedHandle(GraphicsAllocation *gfxAllocation) override;
GraphicsAllocation *createPaddedAllocation(GraphicsAllocation *inputGraphicsAllocation, size_t sizeWithPadding) override;
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, GraphicsAllocation::AllocationType allocType) override { return nullptr; }
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) override { return nullptr; }
uint64_t getSystemSharedMemory(uint32_t rootDeviceIndex) override;
uint64_t getLocalMemorySize(uint32_t rootDeviceIndex, uint32_t deviceBitfield) override;
@@ -122,7 +122,7 @@ class DrmMemoryManager : public MemoryManager {
bool createDrmAllocation(Drm *drm, DrmAllocation *allocation, uint64_t gpuAddress, size_t maxOsContextCount);
void registerAllocationInOs(GraphicsAllocation *allocation) override;
void waitOnCompletionFence(GraphicsAllocation *allocation);
bool allocationTypeForCompletionFence(GraphicsAllocation::AllocationType allocationType);
bool allocationTypeForCompletionFence(AllocationType allocationType);
Drm &getDrm(uint32_t rootDeviceIndex) const;
uint32_t getRootDeviceIndex(const Drm *drm);

View File

@@ -167,9 +167,9 @@ GmmPageTableMngr *WddmCommandStreamReceiver<GfxFamily>::createPageTableManager()
template <typename GfxFamily>
void WddmCommandStreamReceiver<GfxFamily>::kmDafLockAllocations(ResidencyContainer &allocationsForResidency) {
for (auto &graphicsAllocation : allocationsForResidency) {
if ((GraphicsAllocation::AllocationType::LINEAR_STREAM == graphicsAllocation->getAllocationType()) ||
(GraphicsAllocation::AllocationType::FILL_PATTERN == graphicsAllocation->getAllocationType()) ||
(GraphicsAllocation::AllocationType::COMMAND_BUFFER == graphicsAllocation->getAllocationType())) {
if ((AllocationType::LINEAR_STREAM == graphicsAllocation->getAllocationType()) ||
(AllocationType::FILL_PATTERN == graphicsAllocation->getAllocationType()) ||
(AllocationType::COMMAND_BUFFER == graphicsAllocation->getAllocationType())) {
wddm->kmDafLock(static_cast<WddmAllocation *>(graphicsAllocation)->getDefaultHandle());
}
}

View File

@@ -244,7 +244,7 @@ GraphicsAllocation *WddmMemoryManager::allocateSystemMemoryAndCreateGraphicsAllo
wddmAllocation->setDefaultGmm(gmm);
void *mapPtr = wddmAllocation->getAlignedCpuPtr();
if (allocationData.type == GraphicsAllocation::AllocationType::SVM_CPU) {
if (allocationData.type == AllocationType::SVM_CPU) {
//add padding in case mapPtr is not aligned
size_t reserveSizeAligned = sizeAligned + allocationData.alignment;
bool ret = getWddm(wddmAllocation->getRootDeviceIndex()).reserveValidAddressRange(reserveSizeAligned, mapPtr);
@@ -395,7 +395,7 @@ bool WddmMemoryManager::isNTHandle(osHandle handle, uint32_t rootDeviceIndex) {
return status;
}
GraphicsAllocation *WddmMemoryManager::createAllocationFromHandle(osHandle handle, bool requireSpecificBitness, bool ntHandle, GraphicsAllocation::AllocationType allocationType, uint32_t rootDeviceIndex) {
GraphicsAllocation *WddmMemoryManager::createAllocationFromHandle(osHandle handle, bool requireSpecificBitness, bool ntHandle, AllocationType allocationType, uint32_t rootDeviceIndex) {
auto allocation = std::make_unique<WddmAllocation>(rootDeviceIndex, allocationType, nullptr, 0, handle, MemoryPool::SystemCpuInaccessible, maxOsContextCount);
bool status = ntHandle ? getWddm(rootDeviceIndex).openNTHandle(reinterpret_cast<HANDLE>(static_cast<uintptr_t>(handle)), allocation.get())
@@ -434,7 +434,7 @@ GraphicsAllocation *WddmMemoryManager::createGraphicsAllocationFromSharedHandle(
return createAllocationFromHandle(handle, requireSpecificBitness, false, properties.allocationType, properties.rootDeviceIndex);
}
GraphicsAllocation *WddmMemoryManager::createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, GraphicsAllocation::AllocationType allocType) {
GraphicsAllocation *WddmMemoryManager::createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) {
return createAllocationFromHandle(toOsHandle(handle), false, true, allocType, rootDeviceIndex);
}
@@ -946,11 +946,11 @@ void splitGmmsInAllocation(GmmClientContext *clientContext, WddmAllocation *wddm
storageInfo.multiStorage = true;
}
uint32_t getPriorityForAllocation(GraphicsAllocation::AllocationType allocationType) {
uint32_t getPriorityForAllocation(AllocationType allocationType) {
if (GraphicsAllocation::isIsaAllocationType(allocationType) ||
allocationType == GraphicsAllocation::AllocationType::COMMAND_BUFFER ||
allocationType == GraphicsAllocation::AllocationType::INTERNAL_HEAP ||
allocationType == GraphicsAllocation::AllocationType::LINEAR_STREAM) {
allocationType == AllocationType::COMMAND_BUFFER ||
allocationType == AllocationType::INTERNAL_HEAP ||
allocationType == AllocationType::LINEAR_STREAM) {
return DXGI_RESOURCE_PRIORITY_HIGH;
}
return DXGI_RESOURCE_PRIORITY_NORMAL;
@@ -972,8 +972,8 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryInDevicePool(const
size_t alignment = 0;
auto numBanks = allocationData.storageInfo.getNumBanks();
bool singleBankAllocation = numBanks == 1;
if (allocationData.type == GraphicsAllocation::AllocationType::IMAGE ||
allocationData.type == GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY) {
if (allocationData.type == AllocationType::IMAGE ||
allocationData.type == AllocationType::SHARED_RESOURCE_COPY) {
allocationData.imgInfo->useLocalMemory = true;
gmm = std::make_unique<Gmm>(gmmClientContext, *allocationData.imgInfo, allocationData.storageInfo, allocationData.flags.preferCompressed);
alignment = MemoryConstants::pageSize64k;
@@ -1015,18 +1015,18 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryInDevicePool(const
wddmAllocation->needsMakeResidentBeforeLock = true;
void *requiredGpuVa = nullptr;
if (allocationData.type == GraphicsAllocation::AllocationType::SVM_GPU) {
if (allocationData.type == AllocationType::SVM_GPU) {
requiredGpuVa = const_cast<void *>(allocationData.hostPtr);
}
auto &wddm = getWddm(allocationData.rootDeviceIndex);
if (is32bit && executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->isFullRangeSvm()) {
if (allocationData.type == GraphicsAllocation::AllocationType::BUFFER ||
allocationData.type == GraphicsAllocation::AllocationType::SHARED_BUFFER ||
allocationData.type == GraphicsAllocation::AllocationType::SCRATCH_SURFACE ||
allocationData.type == GraphicsAllocation::AllocationType::LINEAR_STREAM ||
allocationData.type == GraphicsAllocation::AllocationType::PRIVATE_SURFACE) {
if (allocationData.type == AllocationType::BUFFER ||
allocationData.type == AllocationType::SHARED_BUFFER ||
allocationData.type == AllocationType::SCRATCH_SURFACE ||
allocationData.type == AllocationType::LINEAR_STREAM ||
allocationData.type == AllocationType::PRIVATE_SURFACE) {
//TODO : FOR DG2 device make sure that scratch doesn't go here
//add 2MB padding to make sure there are no overlaps between system and local memory
size_t reserveSizeAligned = sizeAligned + 2 * MemoryConstants::megaByte;
@@ -1077,7 +1077,7 @@ bool WddmMemoryManager::mapGpuVirtualAddress(WddmAllocation *allocation, const v
} else if (allocation->storageInfo.multiStorage) {
return mapMultiHandleAllocationWithRetry(allocation, requiredPtr);
}
} else if (allocation->getAllocationType() == GraphicsAllocation::AllocationType::WRITE_COMBINED) {
} else if (allocation->getAllocationType() == AllocationType::WRITE_COMBINED) {
requiredPtr = lockResource(allocation);
allocation->setCpuAddress(const_cast<void *>(requiredPtr));
}

View File

@@ -44,7 +44,7 @@ class WddmMemoryManager : public MemoryManager {
void handleFenceCompletion(GraphicsAllocation *allocation) override;
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override;
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, GraphicsAllocation::AllocationType allocType) override;
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) override;
void addAllocationToHostPtrManager(GraphicsAllocation *memory) override;
void removeAllocationFromHostPtrManager(GraphicsAllocation *memory) override;
@@ -100,7 +100,7 @@ class WddmMemoryManager : public MemoryManager {
MOCKABLE_VIRTUAL size_t getHugeGfxMemoryChunkSize(GfxMemoryAllocationMethod allocationMethod) const;
MOCKABLE_VIRTUAL GraphicsAllocation *allocateHugeGraphicsMemory(const AllocationData &allocationData, bool sharedVirtualAddress);
GraphicsAllocation *createAllocationFromHandle(osHandle handle, bool requireSpecificBitness, bool ntHandle, GraphicsAllocation::AllocationType allocationType, uint32_t rootDeviceIndex);
GraphicsAllocation *createAllocationFromHandle(osHandle handle, bool requireSpecificBitness, bool ntHandle, AllocationType allocationType, uint32_t rootDeviceIndex);
static bool validateAllocation(WddmAllocation *alloc);
MOCKABLE_VIRTUAL bool createWddmAllocation(WddmAllocation *allocation, void *requiredGpuPtr);
bool mapGpuVirtualAddress(WddmAllocation *graphicsAllocation, const void *requiredGpuPtr);

View File

@@ -118,7 +118,7 @@ int32_t KernelInfo::getArgNumByName(const char *name) const {
bool KernelInfo::createKernelAllocation(const Device &device, bool internalIsa) {
UNRECOVERABLE_IF(kernelAllocation);
auto kernelIsaSize = heapInfo.KernelHeapSize;
const auto allocType = internalIsa ? GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL : GraphicsAllocation::AllocationType::KERNEL_ISA;
const auto allocType = internalIsa ? AllocationType::KERNEL_ISA_INTERNAL : AllocationType::KERNEL_ISA;
kernelAllocation = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({device.getRootDeviceIndex(), kernelIsaSize, allocType, device.getDeviceBitfield()});
if (!kernelAllocation) {
return false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -48,7 +48,7 @@ GraphicsAllocation *allocateGlobalsSurface(NEO::SVMAllocsManager *const svmAlloc
UNRECOVERABLE_IF(svmAlloc == nullptr);
gpuAllocation = svmAlloc->gpuAllocations.getGraphicsAllocation(rootDeviceIndex);
} else {
auto allocationType = constant ? GraphicsAllocation::AllocationType::CONSTANT_SURFACE : GraphicsAllocation::AllocationType::GLOBAL_SURFACE;
auto allocationType = constant ? AllocationType::CONSTANT_SURFACE : AllocationType::GLOBAL_SURFACE;
gpuAllocation = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex,
true, // allocateMemory
size, allocationType,

View File

@@ -28,7 +28,7 @@ void SyncBufferHandler::makeResident(CommandStreamReceiver &csr) {
void SyncBufferHandler::allocateNewBuffer() {
AllocationProperties allocationProperties{device.getRootDeviceIndex(), true, bufferSize,
GraphicsAllocation::AllocationType::LINEAR_STREAM,
AllocationType::LINEAR_STREAM,
(device.getNumGenericSubDevices() > 1u), /* multiOsContextCapable */
false, device.getDeviceBitfield()};
graphicsAllocation = memoryManager.allocateGraphicsMemoryWithProperties(allocationProperties);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -23,8 +23,8 @@ class HwTimeStamps : public TagTypeBase {
ContextCompleteTS = 0;
}
static constexpr GraphicsAllocation::AllocationType getAllocationType() {
return GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER;
static constexpr AllocationType getAllocationType() {
return AllocationType::PROFILING_TAG_BUFFER;
}
static constexpr TagNodeType getTagNodeType() { return TagNodeType::HwTimeStamps; }

View File

@@ -139,95 +139,95 @@ const char *getAllocationTypeString(GraphicsAllocation const *graphicsAllocation
auto type = graphicsAllocation->getAllocationType();
switch (type) {
case GraphicsAllocation::AllocationType::BUFFER:
case AllocationType::BUFFER:
return "BUFFER";
case GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY:
case AllocationType::BUFFER_HOST_MEMORY:
return "BUFFER_HOST_MEMORY";
case GraphicsAllocation::AllocationType::COMMAND_BUFFER:
case AllocationType::COMMAND_BUFFER:
return "COMMAND_BUFFER";
case GraphicsAllocation::AllocationType::CONSTANT_SURFACE:
case AllocationType::CONSTANT_SURFACE:
return "CONSTANT_SURFACE";
case GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR:
case AllocationType::EXTERNAL_HOST_PTR:
return "EXTERNAL_HOST_PTR";
case GraphicsAllocation::AllocationType::FILL_PATTERN:
case AllocationType::FILL_PATTERN:
return "FILL_PATTERN";
case GraphicsAllocation::AllocationType::GLOBAL_SURFACE:
case AllocationType::GLOBAL_SURFACE:
return "GLOBAL_SURFACE";
case GraphicsAllocation::AllocationType::IMAGE:
case AllocationType::IMAGE:
return "IMAGE";
case GraphicsAllocation::AllocationType::INDIRECT_OBJECT_HEAP:
case AllocationType::INDIRECT_OBJECT_HEAP:
return "INDIRECT_OBJECT_HEAP";
case GraphicsAllocation::AllocationType::INSTRUCTION_HEAP:
case AllocationType::INSTRUCTION_HEAP:
return "INSTRUCTION_HEAP";
case GraphicsAllocation::AllocationType::INTERNAL_HEAP:
case AllocationType::INTERNAL_HEAP:
return "INTERNAL_HEAP";
case GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY:
case AllocationType::INTERNAL_HOST_MEMORY:
return "INTERNAL_HOST_MEMORY";
case GraphicsAllocation::AllocationType::KERNEL_ISA:
case AllocationType::KERNEL_ISA:
return "KERNEL_ISA";
case GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL:
case AllocationType::KERNEL_ISA_INTERNAL:
return "KERNEL_ISA_INTERNAL";
case GraphicsAllocation::AllocationType::LINEAR_STREAM:
case AllocationType::LINEAR_STREAM:
return "LINEAR_STREAM";
case GraphicsAllocation::AllocationType::MAP_ALLOCATION:
case AllocationType::MAP_ALLOCATION:
return "MAP_ALLOCATION";
case GraphicsAllocation::AllocationType::MCS:
case AllocationType::MCS:
return "MCS";
case GraphicsAllocation::AllocationType::PIPE:
case AllocationType::PIPE:
return "PIPE";
case GraphicsAllocation::AllocationType::PREEMPTION:
case AllocationType::PREEMPTION:
return "PREEMPTION";
case GraphicsAllocation::AllocationType::PRINTF_SURFACE:
case AllocationType::PRINTF_SURFACE:
return "PRINTF_SURFACE";
case GraphicsAllocation::AllocationType::PRIVATE_SURFACE:
case AllocationType::PRIVATE_SURFACE:
return "PRIVATE_SURFACE";
case GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER:
case AllocationType::PROFILING_TAG_BUFFER:
return "PROFILING_TAG_BUFFER";
case GraphicsAllocation::AllocationType::SCRATCH_SURFACE:
case AllocationType::SCRATCH_SURFACE:
return "SCRATCH_SURFACE";
case GraphicsAllocation::AllocationType::SHARED_BUFFER:
case AllocationType::SHARED_BUFFER:
return "SHARED_BUFFER";
case GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE:
case AllocationType::SHARED_CONTEXT_IMAGE:
return "SHARED_CONTEXT_IMAGE";
case GraphicsAllocation::AllocationType::SHARED_IMAGE:
case AllocationType::SHARED_IMAGE:
return "SHARED_IMAGE";
case GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY:
case AllocationType::SHARED_RESOURCE_COPY:
return "SHARED_RESOURCE_COPY";
case GraphicsAllocation::AllocationType::SURFACE_STATE_HEAP:
case AllocationType::SURFACE_STATE_HEAP:
return "SURFACE_STATE_HEAP";
case GraphicsAllocation::AllocationType::SVM_CPU:
case AllocationType::SVM_CPU:
return "SVM_CPU";
case GraphicsAllocation::AllocationType::SVM_GPU:
case AllocationType::SVM_GPU:
return "SVM_GPU";
case GraphicsAllocation::AllocationType::SVM_ZERO_COPY:
case AllocationType::SVM_ZERO_COPY:
return "SVM_ZERO_COPY";
case GraphicsAllocation::AllocationType::TAG_BUFFER:
case AllocationType::TAG_BUFFER:
return "TAG_BUFFER";
case GraphicsAllocation::AllocationType::GLOBAL_FENCE:
case AllocationType::GLOBAL_FENCE:
return "GLOBAL_FENCE";
case GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
case AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
return "TIMESTAMP_PACKET_TAG_BUFFER";
case GraphicsAllocation::AllocationType::UNKNOWN:
case AllocationType::UNKNOWN:
return "UNKNOWN";
case GraphicsAllocation::AllocationType::WRITE_COMBINED:
case AllocationType::WRITE_COMBINED:
return "WRITE_COMBINED";
case GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA:
case AllocationType::DEBUG_CONTEXT_SAVE_AREA:
return "DEBUG_CONTEXT_SAVE_AREA";
case GraphicsAllocation::AllocationType::DEBUG_SBA_TRACKING_BUFFER:
case AllocationType::DEBUG_SBA_TRACKING_BUFFER:
return "DEBUG_SBA_TRACKING_BUFFER";
case GraphicsAllocation::AllocationType::DEBUG_MODULE_AREA:
case AllocationType::DEBUG_MODULE_AREA:
return "DEBUG_MODULE_AREA";
case GraphicsAllocation::AllocationType::WORK_PARTITION_SURFACE:
case AllocationType::WORK_PARTITION_SURFACE:
return "WORK_PARTITION_SURFACE";
case GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER:
case AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER:
return "GPU_TIMESTAMP_DEVICE_BUFFER";
case GraphicsAllocation::AllocationType::RING_BUFFER:
case AllocationType::RING_BUFFER:
return "RING_BUFFER";
case GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER:
case AllocationType::SEMAPHORE_BUFFER:
return "SEMAPHORE_BUFFER";
case GraphicsAllocation::AllocationType::UNIFIED_SHARED_MEMORY:
case AllocationType::UNIFIED_SHARED_MEMORY:
return "UNIFIED_SHARED_MEMORY";
case GraphicsAllocation::AllocationType::SW_TAG_BUFFER:
case AllocationType::SW_TAG_BUFFER:
return "SW_TAG_BUFFER";
default:
return "ILLEGAL_VALUE";

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -20,8 +20,8 @@ class HwPerfCounter : public TagTypeBase {
report[0] = 0;
}
static constexpr GraphicsAllocation::AllocationType getAllocationType() {
return GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER;
static constexpr AllocationType getAllocationType() {
return AllocationType::PROFILING_TAG_BUFFER;
}
static constexpr TagNodeType getTagNodeType() { return TagNodeType::HwPerfCounter; }

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -31,7 +31,7 @@ void SWTagsManager::allocateBXMLHeap(Device &device) {
const AllocationProperties properties{
device.getRootDeviceIndex(),
heapSizeInBytes,
GraphicsAllocation::AllocationType::SW_TAG_BUFFER,
AllocationType::SW_TAG_BUFFER,
device.getDeviceBitfield()};
bxmlHeap = memoryManager->allocateGraphicsMemoryWithProperties(properties);
@@ -44,7 +44,7 @@ void SWTagsManager::allocateSWTagHeap(Device &device) {
const AllocationProperties properties{
device.getRootDeviceIndex(),
MAX_TAG_HEAP_SIZE,
GraphicsAllocation::AllocationType::SW_TAG_BUFFER,
AllocationType::SW_TAG_BUFFER,
device.getDeviceBitfield()};
tagHeap = memoryManager->allocateGraphicsMemoryWithProperties(properties);

View File

@@ -49,7 +49,7 @@ GraphicsAllocation *CommandStreamReceiverHw<Family>::getClearColorAllocation() {
if (clearColorAllocation == nullptr) {
auto lock = this->obtainUniqueOwnership();
if (clearColorAllocation == nullptr) {
AllocationProperties properties{rootDeviceIndex, clearColorSize, GraphicsAllocation::AllocationType::BUFFER, osContext->getDeviceBitfield()};
AllocationProperties properties{rootDeviceIndex, clearColorSize, AllocationType::BUFFER, osContext->getDeviceBitfield()};
properties.flags.readOnlyMultiStorage = true;
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = false;
clearColorAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(properties, clearColorBuffer);

View File

@@ -232,10 +232,10 @@ void HwHelperHw<Family>::setL1CachePolicy(bool useL1Cache, typename Family::REND
template <>
void HwHelperHw<Family>::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const {
if (properties.allocationType == GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER || properties.allocationType == GraphicsAllocation::AllocationType::COMMAND_BUFFER) {
if (properties.allocationType == AllocationType::TIMESTAMP_PACKET_TAG_BUFFER || properties.allocationType == AllocationType::COMMAND_BUFFER) {
allocationData.flags.useSystemMemory = false;
}
if (properties.allocationType == GraphicsAllocation::AllocationType::COMMAND_BUFFER && properties.subDevicesBitfield.count() == 1) {
if (properties.allocationType == AllocationType::COMMAND_BUFFER && properties.subDevicesBitfield.count() == 1) {
allocationData.flags.useSystemMemory = true;
}
allocationData.cacheRegion = properties.cacheRegion;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -154,7 +154,7 @@ TEST(DebugSettingsManager, givenPrintDebugSettingsEnabledOnDisabledDebugManagerW
}
TEST(AllocationInfoLogging, givenBaseGraphicsAllocationWhenGettingImplementationSpecificAllocationInfoThenReturnEmptyInfoString) {
GraphicsAllocation graphicsAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0ull, 0ull, 0, MemoryPool::MemoryNull);
GraphicsAllocation graphicsAllocation(0, AllocationType::UNKNOWN, nullptr, 0ull, 0ull, 0, MemoryPool::MemoryNull);
EXPECT_STREQ(graphicsAllocation.getAllocationInfoString().c_str(), "");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -36,7 +36,7 @@ struct DirectSubmissionDispatchBufferFixture : public DirectSubmissionFixture {
DirectSubmissionFixture::SetUp();
MemoryManager *memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
const AllocationProperties commandBufferProperties{pDevice->getRootDeviceIndex(), 0x1000,
GraphicsAllocation::AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()};
AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()};
commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandBufferProperties);
batchBuffer.endCmdPtr = &bbStart[0];

View File

@@ -236,7 +236,7 @@ HWTEST_F(BlitTests, givenMemoryWhenFillPatternWithBlitThenCommandIsProgrammed) {
uint32_t pattern[4] = {1, 0, 0, 0};
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, pattern, sizeof(uint32_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
@@ -253,7 +253,7 @@ HWTEST_F(BlitTests, givenMemorySizeBiggerThanMaxWidthButLessThanTwiceMaxWidthWhe
uint32_t pattern[4] = {1, 0, 0, 0};
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, (2 * BlitterConstants::maxBlitWidth) - 1,
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
@@ -275,7 +275,7 @@ HWTEST_F(BlitTests, givenMemoryPointerOffsetVerifyCorrectDestinationBaseAddress)
uint32_t pattern[4] = {5, 0, 0, 0};
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
@@ -303,7 +303,7 @@ HWTEST_F(BlitTests, givenMemorySizeTwiceBiggerThanMaxWidthWhenFillPatternWithBli
uint32_t pattern[4] = {1, 0, 0, 0};
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, (2 * BlitterConstants::maxBlitWidth * sizeof(uint32_t)),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, pattern, sizeof(uint32_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
@@ -331,7 +331,7 @@ HWTEST_F(BlitTests, givenMemorySizeIsLessThanTwicenMaxWidthWhenFillPatternWithBl
uint32_t pattern[4] = {1, 0, 0, 0};
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, ((BlitterConstants::maxBlitWidth + 1) * sizeof(uint32_t)),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, pattern, sizeof(uint32_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
@@ -363,7 +363,7 @@ HWTEST2_F(BlitTests, givenMemoryWhenFillPatternSizeIs4BytesThen32BitMaskISSetCor
uint32_t pattern = 1;
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint32_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -32,7 +32,7 @@ class GivenLinearStreamWhenCallDispatchBlitMemoryColorFillThenCorrectDepthIsProg
void TestBodyImpl(size_t patternSize, COLOR_DEPTH expectedDepth) {
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages);
uint32_t patternToCommand[4];

View File

@@ -77,10 +77,10 @@ HWTEST2_F(BlitTests, givenIncorrectBytePerPixelWhenAppendColorDepthThenAbortIsTh
HWTEST2_F(BlitTests, givenSrcAndDestinationImagesWhenAppendSliceOffsetsThenAdressAreCorectOffseted, IsGen12LP) {
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmClientContext());
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages);
mockAllocationSrc.setGmm(gmm.get(), 0);
@@ -115,10 +115,10 @@ HWTEST2_F(BlitTests, givenSrcAndDestinationImagesWhenAppendSliceOffsetsThenAdres
HWTEST2_F(BlitTests, givenInputAndDefaultSlicePitchWhenAppendBlitCommandsForImagesThenSlicePitchesAreCorrect, IsGen12LP) {
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages);
auto bltCmd = FamilyType::cmdInitXyCopyBlt;
@@ -179,10 +179,10 @@ HWTEST2_F(BlitTests, givenTiledSrcAndDestinationImagesWhenAppendImageCommandsThe
myResourecInfo->pitch = 0x100;
myResourecInfo->flags.Info.TiledY = 1;
gmm->gmmResourceInfo.reset(myResourecInfo.release());
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages);
mockAllocationSrc.setGmm(gmm.get(), 0);
@@ -210,10 +210,10 @@ HWTEST2_F(BlitTests, givenLinearSrcAndDestinationImagesWhenAppendImageCommandsTh
myResourecInfo->pitch = 0x100;
myResourecInfo->flags.Info.Linear = 1;
gmm->gmmResourceInfo.reset(myResourecInfo.release());
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages);
mockAllocationSrc.setGmm(gmm.get(), 0);

View File

@@ -19,7 +19,7 @@ HWTEST2_F(BlitTests, givenOneBytePatternWhenFillPatternWithBlitThenCommandIsProg
uint32_t pattern = 1;
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
@@ -35,7 +35,7 @@ HWTEST2_F(BlitTests, givenDeviceWithoutDefaultGmmWhenAppendBlitCommandsForVillBu
uint32_t pattern = 1;
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
@@ -58,7 +58,7 @@ HWTEST2_F(BlitTests, givenGmmWithDisabledCompresionWhenAppendBlitCommandsForVill
uint32_t pattern = 1;
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
mockAllocation.setGmm(gmm.get(), 0u);
@@ -82,7 +82,7 @@ HWTEST2_F(BlitTests, givenGmmWithEnabledCompresionWhenAppendBlitCommandsForVillB
uint32_t pattern = 1;
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
mockAllocation.setGmm(gmm.get(), 0u);
@@ -112,7 +112,7 @@ HWTEST2_F(BlitTests, givenOverridedMocksValueWhenAppendBlitCommandsForVillBuffer
uint32_t pattern = 1;
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
@@ -135,7 +135,7 @@ HWTEST2_F(BlitTests, givenEnableStatelessCompressionWithUnifiedMemoryAndSystemMe
uint32_t pattern = 1;
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
@@ -158,7 +158,7 @@ HWTEST2_F(BlitTests, givenEnableStatelessCompressionWithUnifiedMemoryAndLocalMem
uint32_t pattern = 1;
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
@@ -179,7 +179,7 @@ HWTEST2_F(BlitTests, givenMemorySizeBiggerThanMaxWidthButLessThanTwiceMaxWidthWh
uint32_t pattern = 1;
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, (2 * BlitterConstants::maxBlitSetWidth) - 1,
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
@@ -199,7 +199,7 @@ HWTEST2_F(BlitTests, givenMemorySizeTwiceBiggerThanMaxWidthWhenFillPatternWithBl
uint32_t pattern = 1;
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, (2 * BlitterConstants::maxBlitSetWidth),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);

View File

@@ -35,7 +35,7 @@ struct CompressionParamsSupportedMatcher {
HWTEST2_F(BlitTests, givenDeviceWithoutDefaultGmmWhenAppendBlitCommandsForFillBufferThenDstCompressionDisabled, CompressionParamsSupportedMatcher) {
using XY_COLOR_BLT = typename FamilyType::XY_COLOR_BLT;
auto blitCmd = FamilyType::cmdInitXyColorBlt;
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::appendBlitCommandsForFillBuffer(&mockAllocation, blitCmd, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
@@ -48,7 +48,7 @@ HWTEST2_F(BlitTests, givenGmmWithDisabledCompresionWhenAppendBlitCommandsForFill
auto blitCmd = FamilyType::cmdInitXyColorBlt;
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmClientContext());
gmm->isCompressionEnabled = false;
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
mockAllocation.setGmm(gmm.get(), 0);
@@ -62,7 +62,7 @@ HWTEST2_F(BlitTests, givenGmmWithEnabledCompresionWhenAppendBlitCommandsForFillB
auto blitCmd = FamilyType::cmdInitXyColorBlt;
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmClientContext());
gmm->isCompressionEnabled = true;
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
mockAllocation.setGmm(gmm.get(), 0);
@@ -78,7 +78,7 @@ HWTEST2_F(BlitTests, givenGmmWithEnabledCompresionWhenAppendBlitCommandsForFillB
auto gmmContext = pDevice->getGmmClientContext();
auto gmm = std::make_unique<MockGmm>(gmmContext);
gmm->isCompressionEnabled = true;
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast<void *>(0x1234),
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast<void *>(0x1234),
0x1000, 0, sizeof(uint32_t), MemoryPool::LocalMemory);
mockAllocation.setGmm(gmm.get(), 0);
@@ -98,7 +98,7 @@ HWTEST2_F(BlitTests, givenGmmWithEnabledCompresionAndDebugFlagSetWhenAppendBlitC
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmClientContext());
gmm->isCompressionEnabled = true;
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast<void *>(0x1234),
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast<void *>(0x1234),
0x1000, 0, sizeof(uint32_t), MemoryPool::LocalMemory);
mockAllocation.setGmm(gmm.get(), 0);
@@ -112,7 +112,7 @@ HWTEST2_F(BlitTests, givenA0StepWhenAppendBlitCommandsForFillBufferWithLocalAcce
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::CpuAccessAllowed));
auto blitCmd = FamilyType::cmdInitXyColorBlt;
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
HardwareInfo *hwInfo = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getMutableHardwareInfo();
@@ -129,7 +129,7 @@ HWTEST2_F(BlitTests, givenA0StepWhenAppendBlitCommandsForFillBufferWithLocalAcce
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::CpuAccessDisallowed));
auto blitCmd = FamilyType::cmdInitXyColorBlt;
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
HardwareInfo *hwInfo = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getMutableHardwareInfo();
@@ -146,7 +146,7 @@ HWTEST2_F(BlitTests, givenBStepWhenAppendBlitCommandsForFillBufferWithLocalAcces
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::CpuAccessAllowed));
auto blitCmd = FamilyType::cmdInitXyColorBlt;
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
HardwareInfo *hwInfo = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getMutableHardwareInfo();
@@ -163,7 +163,7 @@ HWTEST2_F(BlitTests, givenBStepWhenAppendBlitCommandsForFillBufferWithLocalAcces
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::CpuAccessDisallowed));
auto blitCmd = FamilyType::cmdInitXyColorBlt;
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
HardwareInfo *hwInfo = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getMutableHardwareInfo();
@@ -180,7 +180,7 @@ HWTEST2_F(BlitTests, givenAllocationInSystemMemWhenAppendBlitCommandsForFillBuff
using XY_COLOR_BLT = typename FamilyType::XY_COLOR_BLT;
auto blitCmd = FamilyType::cmdInitXyColorBlt;
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
HardwareInfo *hwInfo = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getMutableHardwareInfo();
@@ -197,7 +197,7 @@ HWTEST2_F(BlitTests, givenAllocationInSystemMemWhenAppendBlitCommandsForFillBuff
using XY_COLOR_BLT = typename FamilyType::XY_COLOR_BLT;
auto blitCmd = FamilyType::cmdInitXyColorBlt;
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
HardwareInfo *hwInfo = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getMutableHardwareInfo();
@@ -215,7 +215,7 @@ HWTEST2_F(BlitTests, givenOverridedMocksValueWhenAppendBlitCommandsForFillBuffer
DebugManager.flags.OverrideBlitterMocs.set(mockValue);
auto blitCmd = FamilyType::cmdInitXyColorBlt;
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::appendBlitCommandsForFillBuffer(&mockAllocation, blitCmd, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
@@ -228,7 +228,7 @@ HWTEST2_F(BlitTests, givenOverridedBliterTargetToZeroWhenAppendBlitCommandsForFi
DebugManager.flags.OverrideBlitterTargetMemory.set(0);
auto blitCmd = FamilyType::cmdInitXyColorBlt;
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::appendBlitCommandsForFillBuffer(&mockAllocation, blitCmd, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
@@ -242,7 +242,7 @@ HWTEST2_F(BlitTests, givenOverridedBliterTargetToOneWhenAppendBlitCommandsForFil
DebugManager.flags.OverrideBlitterTargetMemory.set(1);
auto blitCmd = FamilyType::cmdInitXyColorBlt;
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::appendBlitCommandsForFillBuffer(&mockAllocation, blitCmd, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
@@ -256,7 +256,7 @@ HWTEST2_F(BlitTests, givenOverridedBliterTargetToTwoWhenAppendBlitCommandsForFil
DebugManager.flags.OverrideBlitterTargetMemory.set(2);
auto blitCmd = FamilyType::cmdInitXyColorBlt;
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::appendBlitCommandsForFillBuffer(&mockAllocation, blitCmd, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
@@ -420,10 +420,10 @@ HWTEST2_F(BlitTests, givenTiled4SrcAndDestinationAppendImageCommandsThenCorrectT
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmClientContext());
auto flags = gmm->gmmResourceInfo->getResourceFlags();
flags->Info.Tile4 = true;
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockClearColor(reinterpret_cast<void *>(0x1234), sizeof(uint32_t));
@@ -446,10 +446,10 @@ HWTEST2_F(BlitTests, givenNotTiled64SrcAndDestinationAppendImageCommandsThenCorr
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmClientContext());
auto flags = gmm->gmmResourceInfo->getResourceFlags();
flags->Info.Tile64 = true;
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockClearColor(reinterpret_cast<void *>(0x1234), sizeof(uint32_t));
@@ -472,10 +472,10 @@ HWTEST2_F(BlitTests, givenNotTiledSrcAndDestinationAppendImageCommandsThenCorrec
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmClientContext());
auto flags = gmm->gmmResourceInfo->getResourceFlags();
flags->Info.Tile64 = false;
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockClearColor(reinterpret_cast<void *>(0x1234), sizeof(uint32_t));
@@ -507,10 +507,10 @@ HWTEST2_F(BlitTests, givenGmmParamsWhenAppendSurfaceTypeThenCorrectSurfaceTypeIs
auto resourceInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
resourceInfo->mockResourceCreateParams.Type = resourceType;
resourceInfo->mockResourceCreateParams.ArraySize = arraySize;
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
mockAllocationSrc.setGmm(gmm.get(), 0);
@@ -532,10 +532,10 @@ HWTEST2_F(BlitTests, givenInvalidResourceWhenAppendSurfaceTypeThenSurfaceTypeDoe
auto resourceInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
resourceInfo->mockResourceCreateParams.Type = GMM_RESOURCE_TYPE::RESOURCE_INVALID;
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
mockAllocationSrc.setGmm(gmm.get(), 0);
@@ -556,10 +556,10 @@ HWTEST2_F(BlitTests, givenInvalidResourceWhenAppendSurfaceTypeThenSurfaceTypeDoe
HWTEST2_F(BlitTests, givenResourcesWithoutGmmsWhenAppendSurfaceTypeThenSurfaceTypeDoesNotChange, IsXeHpCore) {
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
auto bltCmd = FamilyType::cmdInitXyCopyBlt;
@@ -589,7 +589,7 @@ HWTEST2_F(BlitTests, givenGmmParamsWhenGetBlitAllocationPropertiesIsCalledThenCo
auto &resInfo = resourceInfo->getResourceFlags()->Info;
resInfo.MediaCompressed = mediaCompressed;
resInfo.RenderCompressed = renderCompressed;
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
mockAllocationSrc.setGmm(gmm.get(), 0);
@@ -655,10 +655,10 @@ struct MyMockResourecInfo : public GmmResourceInfo {
};
HWTEST2_F(BlitTests, givenResourceWithoutGmmWhenAppendImageCommandsThenPitchEqualPropertiesValue, IsXeHpCore) {
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockClearColor(reinterpret_cast<void *>(0x1234), sizeof(uint32_t));
@@ -679,10 +679,10 @@ HWTEST2_F(BlitTests, givenResourceWithoutGmmWhenAppendImageCommandsThenPitchEqua
}
HWTEST2_F(BlitTests, givenInputAndDefaultSlicePitchWhenAppendBlitCommandsForImagesIsCalledThenSlicePitchIsCorrect, IsXeHpCore) {
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockClearColor;
@@ -720,10 +720,10 @@ HWTEST2_F(BlitTests, givenResourceInfoWithZeroPitchWhenAppendImageCommandsThenPi
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmClientContext());
GMM_RESCREATE_PARAMS gmmParams = {};
gmm->gmmResourceInfo.reset(new MyMockResourecInfo(pDevice->getRootDeviceEnvironment().getGmmClientContext(), &gmmParams));
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockClearColor(reinterpret_cast<void *>(0x1234), sizeof(uint32_t));
@@ -753,10 +753,10 @@ HWTEST2_F(BlitTests, givenTiledAllocationWhenAppendBlitCommandsForImagesThenBlit
gmm->gmmResourceInfo.reset(myResourecInfo.release());
auto flags = gmm->gmmResourceInfo->getResourceFlags();
flags->Info.Tile64 = true;
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockClearColor(reinterpret_cast<void *>(0x1234), sizeof(uint32_t));
@@ -782,10 +782,10 @@ HWTEST2_F(BlitTests, givenTiledAllocationWhenAppendBlitCommandsForImagesThenBlit
HWTEST2_F(BlitTests, givenAlocationsWhenAppendBlitCommandsForImagesThenSurfaceSizesAreProgrammedCorrectly, IsXeHpCore) {
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmClientContext());
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockClearColor;
@@ -820,10 +820,10 @@ HWTEST2_F(BlitTests, givenLinearResourceInfoWithNotZeroPitchWhenAppendImageComma
myResourecInfo->pitch = 0x100;
myResourecInfo->flags.Info.Linear = 1;
gmm->gmmResourceInfo.reset(myResourecInfo.release());
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockClearColor(reinterpret_cast<void *>(0x1234), sizeof(uint32_t));
@@ -850,10 +850,10 @@ HWTEST2_F(BlitTests, givenLinearResorcesWhenAppendSliceOffsetsThenAdressAreOffse
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
auto bltCmd = FamilyType::cmdInitXyCopyBlt;
BlitProperties properties = {};
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockClearColor(reinterpret_cast<void *>(0x1234), sizeof(uint32_t));
@@ -880,10 +880,10 @@ HWTEST2_F(BlitTests, givenTiledResorcesWhenAppendSliceOffsetsThenIndexsAreSet, I
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
auto bltCmd = FamilyType::cmdInitXyCopyBlt;
BlitProperties properties = {};
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
bltCmd.setSourceTiling(XY_COPY_BLT::TILING::TILING_TILE64);
@@ -902,7 +902,7 @@ HWTEST2_F(BlitTests, givenMemorySizeTwiceBiggerThanMaxWidthWhenFillPatternWithBl
uint32_t pattern[4] = {1, 0, 0, 0};
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, (2 * BlitterConstants::maxBlitWidth * sizeof(uint32_t)),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, pattern, sizeof(uint32_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);

View File

@@ -253,7 +253,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
createPerDssBackedBufferCalled++;
bool result = BaseClass::createPerDssBackedBuffer(device);
if (!perDssBackedBuffer) {
AllocationProperties properties{device.getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HEAP, device.getDeviceBitfield()};
AllocationProperties properties{device.getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::INTERNAL_HEAP, device.getDeviceBitfield()};
perDssBackedBuffer = executionEnvironment.memoryManager->allocateGraphicsMemoryWithProperties(properties);
}
return result;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -70,7 +70,7 @@ void TestedDrmMemoryManager::forceLimitedRangeAllocator(uint64_t range) {
}
void TestedDrmMemoryManager::overrideGfxPartition(GfxPartition *newGfxPartition) { gfxPartitions[0].reset(newGfxPartition); }
DrmAllocation *TestedDrmMemoryManager::allocate32BitGraphicsMemory(uint32_t rootDeviceIndex, size_t size, const void *ptr, GraphicsAllocation::AllocationType allocationType) {
DrmAllocation *TestedDrmMemoryManager::allocate32BitGraphicsMemory(uint32_t rootDeviceIndex, size_t size, const void *ptr, AllocationType allocationType) {
bool allocateMemory = ptr == nullptr;
AllocationData allocationData;
MockAllocationProperties properties(rootDeviceIndex, allocateMemory, size, allocationType);

View File

@@ -112,7 +112,7 @@ class TestedDrmMemoryManager : public MemoryManagerCreate<DrmMemoryManager> {
void forceLimitedRangeAllocator(uint64_t range);
void overrideGfxPartition(GfxPartition *newGfxPartition);
DrmAllocation *allocate32BitGraphicsMemory(uint32_t rootDeviceIndex, size_t size, const void *ptr, GraphicsAllocation::AllocationType allocationType);
DrmAllocation *allocate32BitGraphicsMemory(uint32_t rootDeviceIndex, size_t size, const void *ptr, AllocationType allocationType);
~TestedDrmMemoryManager() override;
size_t peekSharedBosSize() {
size_t size = 0;

View File

@@ -11,12 +11,12 @@
namespace NEO {
struct MockAllocationProperties : public AllocationProperties {
MockAllocationProperties(uint32_t rootDeviceIndex, size_t size) : AllocationProperties(rootDeviceIndex, true, size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, false, mockDeviceBitfield) {}
MockAllocationProperties(uint32_t rootDeviceIndex, size_t size, GraphicsAllocation::AllocationType type) : AllocationProperties(rootDeviceIndex, true, size, type, false, mockDeviceBitfield) {}
MockAllocationProperties(uint32_t rootDeviceIndex, size_t size, DeviceBitfield deviceBitfield) : AllocationProperties(rootDeviceIndex, true, size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, false, deviceBitfield) {}
MockAllocationProperties(uint32_t rootDeviceIndex, bool allocateMemory, size_t size) : AllocationProperties(rootDeviceIndex, allocateMemory, size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, false, mockDeviceBitfield) {}
MockAllocationProperties(uint32_t rootDeviceIndex, bool allocateMemory, size_t size, DeviceBitfield deviceBitfield) : AllocationProperties(rootDeviceIndex, allocateMemory, size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, false, deviceBitfield) {}
MockAllocationProperties(uint32_t rootDeviceIndex, bool allocateMemory, size_t size, GraphicsAllocation::AllocationType allocationType) : AllocationProperties(rootDeviceIndex, allocateMemory, size, allocationType, false, mockDeviceBitfield) {}
MockAllocationProperties(uint32_t rootDeviceIndex, bool allocateMemory, size_t size, GraphicsAllocation::AllocationType allocationType, DeviceBitfield deviceBitfield) : AllocationProperties(rootDeviceIndex, allocateMemory, size, allocationType, false, deviceBitfield) {}
MockAllocationProperties(uint32_t rootDeviceIndex, size_t size) : AllocationProperties(rootDeviceIndex, true, size, AllocationType::INTERNAL_HOST_MEMORY, false, mockDeviceBitfield) {}
MockAllocationProperties(uint32_t rootDeviceIndex, size_t size, AllocationType type) : AllocationProperties(rootDeviceIndex, true, size, type, false, mockDeviceBitfield) {}
MockAllocationProperties(uint32_t rootDeviceIndex, size_t size, DeviceBitfield deviceBitfield) : AllocationProperties(rootDeviceIndex, true, size, AllocationType::INTERNAL_HOST_MEMORY, false, deviceBitfield) {}
MockAllocationProperties(uint32_t rootDeviceIndex, bool allocateMemory, size_t size) : AllocationProperties(rootDeviceIndex, allocateMemory, size, AllocationType::INTERNAL_HOST_MEMORY, false, mockDeviceBitfield) {}
MockAllocationProperties(uint32_t rootDeviceIndex, bool allocateMemory, size_t size, DeviceBitfield deviceBitfield) : AllocationProperties(rootDeviceIndex, allocateMemory, size, AllocationType::INTERNAL_HOST_MEMORY, false, deviceBitfield) {}
MockAllocationProperties(uint32_t rootDeviceIndex, bool allocateMemory, size_t size, AllocationType allocationType) : AllocationProperties(rootDeviceIndex, allocateMemory, size, allocationType, false, mockDeviceBitfield) {}
MockAllocationProperties(uint32_t rootDeviceIndex, bool allocateMemory, size_t size, AllocationType allocationType, DeviceBitfield deviceBitfield) : AllocationProperties(rootDeviceIndex, allocateMemory, size, allocationType, false, deviceBitfield) {}
};
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -47,7 +47,7 @@ class MockGmm : public Gmm {
imgDesc.imageWidth = 5;
imgDesc.imageHeight = 5;
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
return memoryManager.allocateGraphicsMemoryWithProperties({mockRootDeviceIndex, true, imgInfo, GraphicsAllocation::AllocationType::IMAGE, mockDeviceBitfield});
return memoryManager.allocateGraphicsMemoryWithProperties({mockRootDeviceIndex, true, imgInfo, AllocationType::IMAGE, mockDeviceBitfield});
}
};
} // namespace NEO

View File

@@ -128,7 +128,7 @@ GraphicsAllocation *MockMemoryManager::allocateGraphicsMemoryWithAlignment(const
return OsAgnosticMemoryManager::allocateGraphicsMemoryWithAlignment(allocationData);
}
GraphicsAllocation *MockMemoryManager::allocate32BitGraphicsMemory(uint32_t rootDeviceIndex, size_t size, const void *ptr, GraphicsAllocation::AllocationType allocationType) {
GraphicsAllocation *MockMemoryManager::allocate32BitGraphicsMemory(uint32_t rootDeviceIndex, size_t size, const void *ptr, AllocationType allocationType) {
bool allocateMemory = ptr == nullptr;
AllocationData allocationData{};
MockAllocationProperties properties(rootDeviceIndex, allocateMemory, size, allocationType);

View File

@@ -133,7 +133,7 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
bool isCpuCopyRequired(const void *ptr) override { return cpuCopyRequired; }
GraphicsAllocation *allocate32BitGraphicsMemory(uint32_t rootDeviceIndex, size_t size, const void *ptr, GraphicsAllocation::AllocationType allocationType);
GraphicsAllocation *allocate32BitGraphicsMemory(uint32_t rootDeviceIndex, size_t size, const void *ptr, AllocationType allocationType);
GraphicsAllocation *allocate32BitGraphicsMemoryImpl(const AllocationData &allocationData, bool useLocalMemory) override;
bool isLimitedGPU(uint32_t rootDeviceIndex) override {
@@ -290,7 +290,7 @@ class FailMemoryManager : public MockMemoryManager {
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override {
return nullptr;
}
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, GraphicsAllocation::AllocationType allocType) override {
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) override {
return nullptr;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -41,7 +41,7 @@ const std::vector<char> &MockSipKernel::getStateSaveAreaHeader() const {
void MockSipKernel::createMockSipAllocation() {
this->mockSipMemoryAllocation =
std::make_unique<MemoryAllocation>(0u,
GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL,
AllocationType::KERNEL_ISA_INTERNAL,
nullptr,
MemoryConstants::pageSize * 10u,
0u,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -59,7 +59,7 @@ class MockWddmMemoryManager : public MemoryManagerCreate<WddmMemoryManager> {
bool validateAllocationMock(WddmAllocation *graphicsAllocation) {
return this->validateAllocation(graphicsAllocation);
}
GraphicsAllocation *allocate32BitGraphicsMemory(uint32_t rootDeviceIndex, size_t size, const void *ptr, GraphicsAllocation::AllocationType allocationType) {
GraphicsAllocation *allocate32BitGraphicsMemory(uint32_t rootDeviceIndex, size_t size, const void *ptr, AllocationType allocationType) {
bool allocateMemory = ptr == nullptr;
AllocationData allocationData;
MockAllocationProperties properties(rootDeviceIndex, allocateMemory, size, allocationType);

View File

@@ -52,7 +52,7 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenOffsetWhenProgrammingStatePre
constexpr uint64_t gpuVa = 0x100000;
constexpr uint32_t gpuVaOffset = 0x10000;
const GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER, nullptr, gpuVa, 0, 4096, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
const GraphicsAllocation allocation(0, AllocationType::BUFFER, nullptr, gpuVa, 0, 4096, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
memset(buffer, 0, sizeof(buffer));
LinearStream linearStream(buffer, sizeof(buffer));
@@ -82,7 +82,7 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenDebugVariableSetwhenProgramin
constexpr uint32_t mocsIndexForL3 = (2 << 1);
constexpr size_t numCachelines = 3;
const GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER, nullptr, gpuVa, 0, 4096, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
const GraphicsAllocation allocation(0, AllocationType::BUFFER, nullptr, gpuVa, 0, 4096, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
constexpr std::array<uint32_t, 7> expectedSizes = {{
MemoryConstants::cacheLineSize - 1,
@@ -137,7 +137,7 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenIsaAllocationWhenProgrammingP
EXPECT_EQ(sizeof(STATE_PREFETCH), EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(1));
GraphicsAllocation::AllocationType isaTypes[] = {GraphicsAllocation::AllocationType::KERNEL_ISA, GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL};
AllocationType isaTypes[] = {AllocationType::KERNEL_ISA, AllocationType::KERNEL_ISA_INTERNAL};
for (uint32_t i = 0; i < 2; i++) {
memset(buffer, 0, sizeof(STATE_PREFETCH));
@@ -162,7 +162,7 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenDebugFlagSetWhenProgramPrefet
uint8_t buffer[sizeof(STATE_PREFETCH)] = {};
GraphicsAllocation::AllocationType isaTypes[] = {GraphicsAllocation::AllocationType::KERNEL_ISA, GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL};
AllocationType isaTypes[] = {AllocationType::KERNEL_ISA, AllocationType::KERNEL_ISA_INTERNAL};
for (uint32_t i = 0; i < 2; i++) {
memset(buffer, 0, sizeof(STATE_PREFETCH));
@@ -190,7 +190,7 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenSteppingWhenProgrammingPrefet
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.platform.usRevId = 0b0100'0111; // [3:5] - BaseDie == A0;
const GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::KERNEL_ISA,
const GraphicsAllocation allocation(0, AllocationType::KERNEL_ISA,
nullptr, 1234, 0, 4096, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
uint8_t buffer[sizeof(STATE_PREFETCH)] = {};
@@ -213,7 +213,7 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenDebugFlagSetWhenProgrammingPr
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.platform.usRevId = 0b0010'1000; // [3:5] - BaseDie != A0
const GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER,
const GraphicsAllocation allocation(0, AllocationType::BUFFER,
nullptr, 1234, 0, 4096, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
uint8_t buffer[sizeof(STATE_PREFETCH)] = {};
@@ -405,7 +405,7 @@ XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenCleanHeapsAndSlmNotChangedAndU
XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenStreamWhenEncodingSystemMemoryFenceThenCorrectFenceAddressIsSet) {
using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename FamilyType::STATE_SYSTEM_MEM_FENCE_ADDRESS;
const GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN,
const GraphicsAllocation allocation(0, AllocationType::UNKNOWN,
nullptr, 1234, 0, 4096, MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
auto before = cmdContainer->getCommandStream()->getUsed();

View File

@@ -91,12 +91,12 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenCreatingCommandBufferThenCorre
cmdContainer.initialize(pDevice, nullptr);
ASSERT_NE(0u, cmdContainer.getCmdBufferAllocations().size());
EXPECT_EQ(GraphicsAllocation::AllocationType::COMMAND_BUFFER, cmdContainer.getCmdBufferAllocations()[0]->getAllocationType());
EXPECT_EQ(AllocationType::COMMAND_BUFFER, cmdContainer.getCmdBufferAllocations()[0]->getAllocationType());
cmdContainer.allocateNextCommandBuffer();
ASSERT_LE(2u, cmdContainer.getCmdBufferAllocations().size());
EXPECT_EQ(GraphicsAllocation::AllocationType::COMMAND_BUFFER, cmdContainer.getCmdBufferAllocations()[1]->getAllocationType());
EXPECT_EQ(AllocationType::COMMAND_BUFFER, cmdContainer.getCmdBufferAllocations()[1]->getAllocationType());
}
TEST_F(CommandContainerTest, givenCmdContainerWhenAllocatingHeapsThenSetCorrectAllocationTypes) {
@@ -108,10 +108,10 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenAllocatingHeapsThenSetCorrectA
auto heap = cmdContainer.getIndirectHeap(heapType);
if (HeapType::INDIRECT_OBJECT == heapType) {
EXPECT_EQ(GraphicsAllocation::AllocationType::INTERNAL_HEAP, heap->getGraphicsAllocation()->getAllocationType());
EXPECT_EQ(AllocationType::INTERNAL_HEAP, heap->getGraphicsAllocation()->getAllocationType());
EXPECT_NE(0u, heap->getHeapGpuStartOffset());
} else {
EXPECT_EQ(GraphicsAllocation::AllocationType::LINEAR_STREAM, heap->getGraphicsAllocation()->getAllocationType());
EXPECT_EQ(AllocationType::LINEAR_STREAM, heap->getGraphicsAllocation()->getAllocationType());
EXPECT_EQ(0u, heap->getHeapGpuStartOffset());
}
}
@@ -144,7 +144,7 @@ TEST_F(CommandContainerTest, givenCommandContainerWhenInitializeThenEverythingIs
TEST_F(CommandContainerTest, givenEnabledLocalMemoryAndIsaInSystemMemoryWhenCmdContainerIsInitializedThenInstructionBaseAddressIsSetToInternalHeap) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.ForceSystemMemoryPlacement.set(1 << (static_cast<uint32_t>(GraphicsAllocation::AllocationType::KERNEL_ISA) - 1));
DebugManager.flags.ForceSystemMemoryPlacement.set(1 << (static_cast<uint32_t>(AllocationType::KERNEL_ISA) - 1));
auto executionEnvironment = new NEO::ExecutionEnvironment();
const size_t numDevices = 1;

View File

@@ -51,7 +51,7 @@ HWTEST_F(CommandEncoderTests, whenEncodeMemoryPrefetchCalledThenDoNothing) {
uint8_t buffer[MemoryConstants::pageSize] = {};
LinearStream linearStream(buffer, sizeof(buffer));
GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 123, 456, 789, MemoryPool::LocalMemory);
GraphicsAllocation allocation(0, AllocationType::UNKNOWN, nullptr, 123, 456, 789, MemoryPool::LocalMemory);
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 2, 0, *defaultHwInfo);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -18,7 +18,7 @@ HWTEST2_F(CommandEncoderXeHpgCorePlusTests, givenSpecifiedL1CacheControlWhenAppe
DebugManagerStateRestore restorer;
auto memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
size_t allocationSize = MemoryConstants::pageSize;
AllocationProperties properties(pDevice->getRootDeviceIndex(), allocationSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield());
AllocationProperties properties(pDevice->getRootDeviceIndex(), allocationSize, AllocationType::BUFFER, pDevice->getDeviceBitfield());
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
auto rssCmd = FamilyType::cmdInitRenderSurfaceState;

View File

@@ -718,22 +718,22 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
const GraphicsAllocation::AllocationType onlyOneTimeAubWritableTypes[] = {
GraphicsAllocation::AllocationType::PIPE,
GraphicsAllocation::AllocationType::CONSTANT_SURFACE,
GraphicsAllocation::AllocationType::GLOBAL_SURFACE,
GraphicsAllocation::AllocationType::KERNEL_ISA,
GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL,
GraphicsAllocation::AllocationType::PRIVATE_SURFACE,
GraphicsAllocation::AllocationType::SCRATCH_SURFACE,
GraphicsAllocation::AllocationType::WORK_PARTITION_SURFACE,
GraphicsAllocation::AllocationType::BUFFER,
GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY,
GraphicsAllocation::AllocationType::IMAGE,
GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER,
GraphicsAllocation::AllocationType::MAP_ALLOCATION,
GraphicsAllocation::AllocationType::SVM_GPU,
GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
const AllocationType onlyOneTimeAubWritableTypes[] = {
AllocationType::PIPE,
AllocationType::CONSTANT_SURFACE,
AllocationType::GLOBAL_SURFACE,
AllocationType::KERNEL_ISA,
AllocationType::KERNEL_ISA_INTERNAL,
AllocationType::PRIVATE_SURFACE,
AllocationType::SCRATCH_SURFACE,
AllocationType::WORK_PARTITION_SURFACE,
AllocationType::BUFFER,
AllocationType::BUFFER_HOST_MEMORY,
AllocationType::IMAGE,
AllocationType::TIMESTAMP_PACKET_TAG_BUFFER,
AllocationType::MAP_ALLOCATION,
AllocationType::SVM_GPU,
AllocationType::EXTERNAL_HOST_PTR};
for (auto allocationType : onlyOneTimeAubWritableTypes) {
gfxAllocation->setAubWritable(true, GraphicsAllocation::defaultBank);
@@ -752,7 +752,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
aubCsr->setupContext(*pDevice->getDefaultEngine().osContext);
aubCsr->initializeEngine();
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxImageAllocation = MockGmm::allocateImage2d(*memoryManager);
@@ -773,7 +773,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
memoryManager.reset(new OsAgnosticMemoryManager(*pDevice->executionEnvironment));
aubCsr->setupContext(*pDevice->getDefaultEngine().osContext);
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
aubCsr->setAubWritable(false, *gfxBufferAllocation);
auto gfxImageAllocation = MockGmm::allocateImage2d(*memoryManager);
@@ -798,7 +798,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
memoryManager.reset(new OsAgnosticMemoryManager(*pDevice->executionEnvironment));
aubCsr->setupContext(*pDevice->getDefaultEngine().osContext);
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
aubCsr->setAubWritable(false, *gfxBufferAllocation);
auto gfxImageAllocation = MockGmm::allocateImage2d(*memoryManager);

View File

@@ -274,7 +274,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenNoCpuPtrAndNotLockableAllocationWhe
constexpr uint64_t initGpuAddress = 1234;
constexpr size_t initSize = 10;
MockGraphicsAllocation allocation(nullptr, initGpuAddress, initSize);
allocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
allocation.setAllocationType(AllocationType::BUFFER);
allocation.overrideMemoryPool(MemoryPool::LocalMemory);
aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->initGmm();
@@ -309,7 +309,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenNoCpuPtrAndLockableAllocationWhenGe
constexpr uint64_t initGpuAddress = 1234;
constexpr size_t initSize = 10;
MockGraphicsAllocation allocation(nullptr, initGpuAddress, initSize);
allocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
allocation.setAllocationType(AllocationType::BUFFER_HOST_MEMORY);
allocation.overrideMemoryPool(MemoryPool::LocalMemory);
aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->initGmm();
@@ -595,7 +595,7 @@ HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWh
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
AllocationProperties allocProperties{0u /* rootDeviceIndex */, true /* allocateMemory */,
imgInfo, GraphicsAllocation::AllocationType::IMAGE, deviceBitfield};
imgInfo, AllocationType::IMAGE, deviceBitfield};
auto imageAllocation = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr);
ASSERT_NE(nullptr, imageAllocation);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -100,7 +100,7 @@ HWTEST_F(AubCsrTest, WhenWriteWithAubManagerIsCalledThenAubManagerIsInvokedWithC
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->aubCenter.reset(new AubCenter());
executionEnvironment->initializeMemoryManager();
auto allocation = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, true, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
auto allocation = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, true, MemoryConstants::pageSize, AllocationType::COMMAND_BUFFER});
MockAubManager aubManager;
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>("", false, *executionEnvironment, rootDeviceIndex, deviceBitfield));
@@ -116,7 +116,7 @@ HWTEST_F(AubCsrTest, WhenWriteWithAubManagerIsCalledThenAubManagerIsInvokedWithC
aubManager.writeMemory2Called = false;
auto allocation2 = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, true, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::LINEAR_STREAM});
auto allocation2 = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, true, MemoryConstants::pageSize, AllocationType::LINEAR_STREAM});
aubCsr->writeMemoryWithAubManager(*allocation2);
EXPECT_TRUE(aubManager.writeMemory2Called);
@@ -272,7 +272,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
@@ -294,7 +294,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenBcsEngineWhenDumpAllocationCalledTh
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
@@ -322,7 +322,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenCompressedGraphicsAllocationWritabl
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
auto memoryManager = pDevice->getMemoryManager();
AllocationProperties properties(pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield());
AllocationProperties properties(pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield());
properties.flags.preferCompressed = true;
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
@@ -346,7 +346,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
@@ -369,7 +369,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNonWritableWhenDu
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(false);
EXPECT_FALSE(AubAllocDump::isWritableBuffer(*gfxAllocation));
@@ -393,7 +393,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNotDumpableWhenDu
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
gfxAllocation->setAllocDumpable(false, false);
@@ -418,7 +418,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationDumpableWhenDumpA
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
@@ -486,7 +486,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenDumpAllocatio
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
gfxAllocation->setAllocDumpable(false, false);
@@ -515,7 +515,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));

View File

@@ -265,7 +265,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenDumpAllocationIsCa
auto mockAubFileStream = std::make_unique<MockAubFileStream>();
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
GraphicsAllocation allocation{0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull};
GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull};
aubCsr->stream = static_cast<MockAubFileStream *>(mockAubFileStream.get());

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -35,7 +35,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryAndAllocationWithStorageIn
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
executionEnvironment.initializeMemoryManager();
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryAllocation allocation(0, AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryConstants::pageSize, 0, MemoryPool::LocalMemory, false, false, MemoryManager::maxOsContextCount);
allocation.storageInfo.memoryBanks = 0x2u;
@@ -54,7 +54,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryAndNonLocalMemoryAllocatio
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
executionEnvironment.initializeMemoryManager();
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryAllocation allocation(0, AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryConstants::pageSize, 0, MemoryPool::System4KBPages, false, false, MemoryManager::maxOsContextCount);
allocation.storageInfo.memoryBanks = 0x2u;
@@ -70,7 +70,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryAndAllocationWithStorageIn
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
executionEnvironment.initializeMemoryManager();
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryAllocation allocation(0, AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryConstants::pageSize, 0, MemoryPool::LocalMemory, false, false, MemoryManager::maxOsContextCount);
allocation.storageInfo.memoryBanks = 0x0u;
@@ -89,7 +89,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryAndNonLocalMemoryAllocatio
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
executionEnvironment.initializeMemoryManager();
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryAllocation allocation(0, AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryConstants::pageSize, 0, MemoryPool::System64KBPages, false, false, MemoryManager::maxOsContextCount);
allocation.storageInfo.memoryBanks = 0x3u;
@@ -108,7 +108,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryNoncloneableAllocationWith
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
executionEnvironment.initializeMemoryManager();
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryAllocation allocation(0, AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryConstants::pageSize, 0, MemoryPool::LocalMemory, false, false, MemoryManager::maxOsContextCount);
allocation.storageInfo.memoryBanks = 0x3u;
allocation.storageInfo.cloningOfPageTables = false;
@@ -132,7 +132,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryCloneableAllocationWithMan
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
executionEnvironment.initializeMemoryManager();
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryAllocation allocation(0, AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryConstants::pageSize, 0, MemoryPool::LocalMemory, false, false, MemoryManager::maxOsContextCount);
allocation.storageInfo.memoryBanks = 0x3u;
allocation.storageInfo.cloningOfPageTables = true;
@@ -156,7 +156,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryNoncloneableAllocationWith
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
executionEnvironment.initializeMemoryManager();
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryAllocation allocation(0, AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryConstants::pageSize, 0, MemoryPool::LocalMemory, false, false, MemoryManager::maxOsContextCount);
allocation.storageInfo.memoryBanks = 0x3u;
allocation.storageInfo.cloningOfPageTables = false;
@@ -181,7 +181,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryAndAllocationWithStorageIn
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
executionEnvironment.initializeMemoryManager();
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryAllocation allocation(0, AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
MemoryConstants::pageSize, 0, MemoryPool::LocalMemory, false, false, MemoryManager::maxOsContextCount);
allocation.storageInfo.memoryBanks = 0x0u;
@@ -308,7 +308,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenSimulatedCommandStreamReceiverWhenClo
auto mockHardwareContext = static_cast<MockHardwareContext *>(csr->hardwareContextController->hardwareContexts[0].get());
int dummy = 1;
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::UNKNOWN,
GraphicsAllocation graphicsAllocation{0, AllocationType::UNKNOWN,
&dummy, 0, 0, sizeof(dummy), MemoryPool::MemoryNull, MemoryManager::maxOsContextCount};
graphicsAllocation.storageInfo.cloningOfPageTables = true;
csr->writeMemoryWithAubManager(graphicsAllocation);
@@ -331,7 +331,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenCompressedAllocationWhenCloningPageTa
gmm.isCompressionEnabled = true;
int dummy = 1;
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::UNKNOWN,
GraphicsAllocation graphicsAllocation{0, AllocationType::UNKNOWN,
&dummy, 0, 0, sizeof(dummy), MemoryPool::MemoryNull, MemoryManager::maxOsContextCount};
graphicsAllocation.storageInfo.cloningOfPageTables = true;
@@ -358,7 +358,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenTileInstancedAllocationWhenWriteMemor
csr->multiOsContextCapable = true;
int dummy = 1;
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::UNKNOWN,
GraphicsAllocation graphicsAllocation{0, AllocationType::UNKNOWN,
&dummy, 0, 0, sizeof(dummy), MemoryPool::LocalMemory, MemoryManager::maxOsContextCount};
graphicsAllocation.storageInfo.cloningOfPageTables = false;
graphicsAllocation.storageInfo.tileInstanced = true;
@@ -390,7 +390,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenCompressedTileInstancedAllocationWhen
gmm.isCompressionEnabled = true;
int dummy = 1;
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::UNKNOWN,
GraphicsAllocation graphicsAllocation{0, AllocationType::UNKNOWN,
&dummy, 0, 0, sizeof(dummy), MemoryPool::LocalMemory, MemoryManager::maxOsContextCount};
graphicsAllocation.storageInfo.cloningOfPageTables = false;
graphicsAllocation.storageInfo.tileInstanced = true;
@@ -421,7 +421,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenTileInstancedAllocationWithMissingMem
csr->multiOsContextCapable = true;
int dummy = 1;
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::UNKNOWN,
GraphicsAllocation graphicsAllocation{0, AllocationType::UNKNOWN,
&dummy, 0, 0, sizeof(dummy), MemoryPool::LocalMemory, MemoryManager::maxOsContextCount};
graphicsAllocation.storageInfo.cloningOfPageTables = false;
graphicsAllocation.storageInfo.tileInstanced = true;
@@ -437,7 +437,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenCommandBufferAllocationWhenWriteMemor
csr->aubManager = mockManager.get();
int dummy = 1;
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::COMMAND_BUFFER,
GraphicsAllocation graphicsAllocation{0, AllocationType::COMMAND_BUFFER,
&dummy, 0, 0, sizeof(dummy), MemoryPool::MemoryNull, MemoryManager::maxOsContextCount};
graphicsAllocation.storageInfo.cloningOfPageTables = true;
csr->writeMemoryWithAubManager(graphicsAllocation);
@@ -471,7 +471,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenSpecificMemoryPoolAllocationWhenWrite
mockHardwareContext->writeMemoryPageSizePassed = 0;
mockHardwareContext->writeMemory2Called = false;
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::COMMAND_BUFFER,
GraphicsAllocation graphicsAllocation{0, AllocationType::COMMAND_BUFFER,
&dummy, 0, 0, sizeof(dummy), poolsWith4kPages[i], MemoryManager::maxOsContextCount};
graphicsAllocation.storageInfo.cloningOfPageTables = true;
csr->writeMemoryWithAubManager(graphicsAllocation);
@@ -504,7 +504,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenSpecificMemoryPoolAllocationWhenWrite
mockHardwareContext->writeMemoryPageSizePassed = 0;
mockHardwareContext->writeMemory2Called = false;
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::COMMAND_BUFFER,
GraphicsAllocation graphicsAllocation{0, AllocationType::COMMAND_BUFFER,
&dummy, 0, 0, sizeof(dummy), poolsWith64kPages[i], MemoryManager::maxOsContextCount};
graphicsAllocation.storageInfo.cloningOfPageTables = true;
csr->writeMemoryWithAubManager(graphicsAllocation);

View File

@@ -155,7 +155,7 @@ TEST_F(CommandStreamReceiverTest, givenCommandStreamReceiverWhenGetCSIsCalledThe
auto commandStreamAllocation = commandStream.getGraphicsAllocation();
ASSERT_NE(nullptr, commandStreamAllocation);
EXPECT_EQ(GraphicsAllocation::AllocationType::COMMAND_BUFFER, commandStreamAllocation->getAllocationType());
EXPECT_EQ(AllocationType::COMMAND_BUFFER, commandStreamAllocation->getAllocationType());
}
HWTEST_F(CommandStreamReceiverTest, whenStoreAllocationThenStoredAllocationHasTaskCountFromCsr) {
@@ -909,7 +909,7 @@ TEST(CommandStreamReceiverSimpleTest, givenCommandStreamReceiverWhenInitializeTa
uint32_t numRootDevices = 10u;
UltDeviceFactory deviceFactory{numRootDevices, 0};
EXPECT_NE(nullptr, deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAllocation());
EXPECT_EQ(GraphicsAllocation::AllocationType::TAG_BUFFER, deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAllocation()->getAllocationType());
EXPECT_EQ(AllocationType::TAG_BUFFER, deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAllocation()->getAllocationType());
EXPECT_TRUE(deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAddress() != nullptr);
EXPECT_EQ(*deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAddress(), initialHardwareTag);
auto tagsMultiAllocation = deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagsMultiAllocation();
@@ -928,7 +928,7 @@ TEST(CommandStreamReceiverSimpleTest, givenCommandStreamReceiverWhenInitializeTa
uint32_t numRootDevices = 10u;
UltDeviceFactory deviceFactory{numRootDevices, 0};
EXPECT_NE(nullptr, deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAllocation());
EXPECT_EQ(GraphicsAllocation::AllocationType::TAG_BUFFER, deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAllocation()->getAllocationType());
EXPECT_EQ(AllocationType::TAG_BUFFER, deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAllocation()->getAllocationType());
EXPECT_TRUE(deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAddress() != nullptr);
EXPECT_EQ(*deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAddress(), initialHardwareTag);
auto tagsMultiAllocation = deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagsMultiAllocation();
@@ -945,7 +945,7 @@ TEST(CommandStreamReceiverSimpleTest, givenCommandStreamReceiverWhenItIsDestroye
bool destructorCalled = false;
int gpuTag = 0;
auto mockGraphicsAllocation = new MockGraphicsAllocationWithDestructorTracing(0, GraphicsAllocation::AllocationType::UNKNOWN, &gpuTag, 0llu, 0llu, 1u, MemoryPool::MemoryNull);
auto mockGraphicsAllocation = new MockGraphicsAllocationWithDestructorTracing(0, AllocationType::UNKNOWN, &gpuTag, 0llu, 0llu, 1u, MemoryPool::MemoryNull);
mockGraphicsAllocation->destructorCalled = &destructorCalled;
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
auto csr = std::make_unique<MockCommandStreamReceiver>(executionEnvironment, 0, 1);
@@ -971,7 +971,7 @@ TEST(CommandStreamReceiverSimpleTest, givenCommandStreamReceiverWhenInitializeTa
EXPECT_EQ(nullptr, csr->getTagAllocation());
csr->initializeTagAllocation();
EXPECT_NE(nullptr, csr->getTagAllocation());
EXPECT_EQ(GraphicsAllocation::AllocationType::TAG_BUFFER, csr->getTagAllocation()->getAllocationType());
EXPECT_EQ(AllocationType::TAG_BUFFER, csr->getTagAllocation()->getAllocationType());
EXPECT_EQ(csr->getTagAllocation()->getUnderlyingBuffer(), csr->getTagAddress());
auto tagAddress = csr->getTagAddress();
for (uint32_t i = 0; i < 2; i++) {
@@ -991,7 +991,7 @@ TEST(CommandStreamReceiverSimpleTest, givenCommandStreamReceiverWhenInitializeTa
csr->initializeTagAllocation();
EXPECT_NE(nullptr, csr->getTagAllocation());
EXPECT_EQ(GraphicsAllocation::AllocationType::TAG_BUFFER, csr->getTagAllocation()->getAllocationType());
EXPECT_EQ(AllocationType::TAG_BUFFER, csr->getTagAllocation()->getAllocationType());
EXPECT_EQ(csr->getTagAllocation()->getUnderlyingBuffer(), csr->getTagAddress());
auto tagAddress = csr->getTagAddress();
@@ -1085,7 +1085,7 @@ TEST(CommandStreamReceiverSimpleTest, givenNewResourceFlushEnabledWhenProvidingN
DeviceBitfield deviceBitfield(1);
MockCommandStreamReceiver csr(executionEnvironment, 0, deviceBitfield);
MockGraphicsAllocation mockAllocation;
mockAllocation.setAllocationType(GraphicsAllocation::AllocationType::KERNEL_ISA);
mockAllocation.setAllocationType(AllocationType::KERNEL_ISA);
csr.useNewResourceImplicitFlush = true;
csr.newResources = false;
@@ -1216,7 +1216,7 @@ TEST(CommandStreamReceiverSimpleTest, givenMultipleActivePartitionsWhenWaitingFo
auto hostPtr = reinterpret_cast<void *>(0x1234);
size_t size = 100;
auto temporaryAllocation = std::make_unique<MemoryAllocation>(0, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0, MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
auto temporaryAllocation = std::make_unique<MemoryAllocation>(0, AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0, MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
temporaryAllocation->updateTaskCount(0u, 0u);
csr.getInternalAllocationStorage()->storeAllocationWithTaskCount(std::move(temporaryAllocation), TEMPORARY_ALLOCATION, 2u);
@@ -1320,7 +1320,7 @@ TEST_F(CreateAllocationForHostSurfaceTest, givenTemporaryAllocationWhenCreateAll
auto hostPtr = reinterpret_cast<void *>(0x1234);
size_t size = 100;
auto temporaryAllocation = std::make_unique<MemoryAllocation>(0,
GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0, MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0, MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
auto allocationPtr = temporaryAllocation.get();
temporaryAllocation->updateTaskCount(0u, 0u);
commandStreamReceiver->getInternalAllocationStorage()->storeAllocation(std::move(temporaryAllocation), TEMPORARY_ALLOCATION);
@@ -1358,7 +1358,7 @@ TEST_F(CreateAllocationForHostSurfaceTest, givenReadOnlyHostPointerWhenAllocatio
bool runPopulateOsHandlesExpects = false;
bool runAllocateGraphicsMemoryForNonSvmHostPtrExpects = false;
if (!mockMemoryManager->useNonSvmHostPtrAlloc(GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, device->getRootDeviceIndex())) {
if (!mockMemoryManager->useNonSvmHostPtrAlloc(AllocationType::EXTERNAL_HOST_PTR, device->getRootDeviceIndex())) {
runPopulateOsHandlesExpects = true;
mockMemoryManager->populateOsHandlesResult = MemoryManager::AllocationStatus::InvalidHostPointer;
} else {
@@ -1394,7 +1394,7 @@ TEST_F(CreateAllocationForHostSurfaceTest, givenReadOnlyHostPointerWhenAllocatio
bool runPopulateOsHandlesExpects = false;
bool runAllocateGraphicsMemoryForNonSvmHostPtrExpects = false;
if (!mockMemoryManager->useNonSvmHostPtrAlloc(GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, device->getRootDeviceIndex())) {
if (!mockMemoryManager->useNonSvmHostPtrAlloc(AllocationType::EXTERNAL_HOST_PTR, device->getRootDeviceIndex())) {
runPopulateOsHandlesExpects = true;
mockMemoryManager->populateOsHandlesResult = MemoryManager::AllocationStatus::InvalidHostPointer;
} else {
@@ -1439,7 +1439,7 @@ TEST_F(ReducedAddrSpaceCommandStreamReceiverTest,
}
TEST_F(CommandStreamReceiverTest, givenMinimumSizeDoesNotExceedCurrentWhenCallingEnsureCommandBufferAllocationThenDoNotReallocate) {
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), 128u, GraphicsAllocation::AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()});
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), 128u, AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()});
LinearStream commandStream{allocation};
commandStreamReceiver->ensureCommandBufferAllocation(commandStream, 100u, 0u);
@@ -1454,7 +1454,7 @@ TEST_F(CommandStreamReceiverTest, givenMinimumSizeDoesNotExceedCurrentWhenCallin
}
TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentWhenCallingEnsureCommandBufferAllocationThenReallocate) {
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), 128u, GraphicsAllocation::AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()});
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), 128u, AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()});
LinearStream commandStream{allocation};
commandStreamReceiver->ensureCommandBufferAllocation(commandStream, 129u, 0u);
@@ -1463,7 +1463,7 @@ TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentWhenCallingEnsur
}
TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentWhenCallingEnsureCommandBufferAllocationThenReallocateAndAlignSizeTo64kb) {
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), 128u, GraphicsAllocation::AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()});
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), 128u, AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()});
LinearStream commandStream{allocation};
commandStreamReceiver->ensureCommandBufferAllocation(commandStream, 129u, 0u);
@@ -1478,7 +1478,7 @@ TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentWhenCallingEnsur
}
TEST_F(CommandStreamReceiverTest, givenAdditionalAllocationSizeWhenCallingEnsureCommandBufferAllocationThenSizesOfAllocationAndCommandBufferAreCorrect) {
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), 128u, GraphicsAllocation::AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()});
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), 128u, AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()});
LinearStream commandStream{allocation};
commandStreamReceiver->ensureCommandBufferAllocation(commandStream, 129u, 350u);
@@ -1500,7 +1500,7 @@ TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentAndNoAllocations
}
TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentAndAllocationsForReuseWhenCallingEnsureCommandBufferAllocationThenObtainAllocationFromInternalAllocationStorage) {
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()});
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), MemoryConstants::pageSize64k, AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()});
internalAllocationStorage->storeAllocation(std::unique_ptr<GraphicsAllocation>{allocation}, REUSABLE_ALLOCATION);
LinearStream commandStream;
@@ -1513,7 +1513,7 @@ TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentAndAllocationsFo
}
TEST_F(CommandStreamReceiverTest, givenMinimumSizeExceedsCurrentAndNoSuitableReusableAllocationWhenCallingEnsureCommandBufferAllocationThenObtainAllocationMemoryManager) {
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()});
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({commandStreamReceiver->getRootDeviceIndex(), MemoryConstants::pageSize64k, AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()});
internalAllocationStorage->storeAllocation(std::unique_ptr<GraphicsAllocation>{allocation}, REUSABLE_ALLOCATION);
LinearStream commandStream;

View File

@@ -78,7 +78,7 @@ struct ComputeModeRequirements : public ::testing::Test {
csr = new myCsr<FamilyType>(*device->executionEnvironment, device->getDeviceBitfield());
device->resetCommandStreamReceiver(csr);
AllocationProperties properties(device->getRootDeviceIndex(), false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
AllocationProperties properties(device->getRootDeviceIndex(), false, MemoryConstants::pageSize, AllocationType::SHARED_BUFFER, false, {});
alloc = device->getMemoryManager()->createGraphicsAllocationFromSharedHandle(static_cast<osHandle>(123), properties, false, false);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -170,7 +170,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenWriteMemoryIsCa
MemoryManager *memoryManager = tbxCsr->getMemoryManager();
ASSERT_NE(nullptr, memoryManager);
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pCommandStreamReceiver->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pCommandStreamReceiver->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
ASSERT_NE(nullptr, graphicsAllocation);
EXPECT_TRUE(tbxCsr->isTbxWritable(*graphicsAllocation));
@@ -186,7 +186,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenWriteMemoryIsCa
MemoryManager *memoryManager = tbxCsr->getMemoryManager();
ASSERT_NE(nullptr, memoryManager);
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pCommandStreamReceiver->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pCommandStreamReceiver->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
ASSERT_NE(nullptr, graphicsAllocation);
tbxCsr->setTbxWritable(false, *graphicsAllocation);
@@ -777,7 +777,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenProcessResidencyIsCalledWithDumpT
memoryManager.reset(new OsAgnosticMemoryManager(*pDevice->executionEnvironment));
tbxCsr->setupContext(*pDevice->getDefaultEngine().osContext);
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
tbxCsr->setTbxWritable(false, *gfxAllocation);
tbxCsr->dumpTbxNonWritable = true;
@@ -797,7 +797,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenProcessResidencyIsCalledWithoutDu
memoryManager.reset(new OsAgnosticMemoryManager(*pDevice->executionEnvironment));
tbxCsr->setupContext(*pDevice->getDefaultEngine().osContext);
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
tbxCsr->setTbxWritable(false, *gfxAllocation);
EXPECT_FALSE(tbxCsr->dumpTbxNonWritable);
@@ -890,7 +890,7 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWhenDumpAllocationIsCalle
auto mockHardwareContext = static_cast<MockHardwareContext *>(tbxCsr.hardwareContextController->hardwareContexts[0].get());
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
tbxCsr.dumpAllocation(*gfxAllocation);
EXPECT_FALSE(mockHardwareContext->dumpSurfaceCalled);
@@ -906,7 +906,7 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWritableWhenDumpAllocatio
auto mockHardwareContext = static_cast<MockHardwareContext *>(tbxCsr.hardwareContextController->hardwareContexts[0].get());
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
@@ -928,7 +928,7 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWritableWhenDumpAllocatio
auto mockHardwareContext = static_cast<MockHardwareContext *>(tbxCsr.hardwareContextController->hardwareContexts[0].get());
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
@@ -950,7 +950,7 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWhenDumpAllocationIsCalle
auto mockHardwareContext = static_cast<MockHardwareContext *>(tbxCsr.hardwareContextController->hardwareContexts[0].get());
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
gfxAllocation->setAllocDumpable(false, false);
@@ -1022,7 +1022,7 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWhenDumpAllocationIsCalle
auto mockHardwareContext = static_cast<MockHardwareContext *>(tbxCsr.hardwareContextController->hardwareContexts[0].get());
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
gfxAllocation->setAllocDumpable(false, false);
@@ -1052,7 +1052,7 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWhenDumpAllocationIsCalle
EXPECT_EQ(nullptr, executionEnvironment.rootDeviceEnvironments[0]->aubCenter->getAubManager());
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
tbxCsr.dumpAllocation(*gfxAllocation);
EXPECT_TRUE(tbxCsr.dumpAllocationCalled);

View File

@@ -247,7 +247,7 @@ TEST_F(DeviceGetCapsTest, givenFlagEnabled64kbPagesWhenCallConstructorMemoryMana
void addAllocationToHostPtrManager(GraphicsAllocation *memory) override{};
void removeAllocationFromHostPtrManager(GraphicsAllocation *memory) override{};
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override { return nullptr; };
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, GraphicsAllocation::AllocationType allocType) override { return nullptr; };
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) override { return nullptr; };
AllocationStatus populateOsHandles(OsHandleStorage &handleStorage, uint32_t rootDeviceIndex) override { return AllocationStatus::Success; };
void cleanOsHandles(OsHandleStorage &handleStorage, uint32_t rootDeviceIndex) override{};
void freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation) override{};

View File

@@ -143,7 +143,7 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenAllocateOsResourcesFenceCreation
MemoryManager *memoryManager = device->getExecutionEnvironment()->memoryManager.get();
const auto allocationSize = MemoryConstants::pageSize;
const AllocationProperties commandStreamAllocationProperties{device->getRootDeviceIndex(), allocationSize,
GraphicsAllocation::AllocationType::RING_BUFFER, device->getDeviceBitfield()};
AllocationType::RING_BUFFER, device->getDeviceBitfield()};
GraphicsAllocation *ringBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties);
ASSERT_NE(nullptr, ringBuffer);

View File

@@ -102,7 +102,7 @@ HWTEST2_F(XeHPAndLaterCommandEncoderTest,
auto memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
size_t allocationSize = MemoryConstants::pageSize;
AllocationProperties properties(pDevice->getRootDeviceIndex(), allocationSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield());
AllocationProperties properties(pDevice->getRootDeviceIndex(), allocationSize, AllocationType::BUFFER, pDevice->getDeviceBitfield());
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
auto outSurfaceState = FamilyType::cmdInitRenderSurfaceState;

View File

@@ -193,7 +193,7 @@ HWTEST_F(CommandEncodeStatesTest, givenCreatedSurfaceStateBufferWhenAllocationPr
uint64_t gpuAddr = 0x4000u;
size_t allocSize = size;
length.Length = static_cast<uint32_t>(allocSize - 1);
GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1);
GraphicsAllocation allocation(0, AllocationType::UNKNOWN, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1);
NEO::EncodeSurfaceStateArgs args;
args.outMemory = stateBuffer;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -18,34 +18,34 @@ class AlocationHelperTests : public Test<DeviceFixture> {
HWTEST_F(AlocationHelperTests, givenKernelIsaTypeWhenUse32BitHeapCalledThenTrueReturned) {
EXPECT_TRUE(heapAssigner.use32BitHeap(GraphicsAllocation::AllocationType::KERNEL_ISA));
EXPECT_TRUE(heapAssigner.use32BitHeap(GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL));
EXPECT_TRUE(heapAssigner.use32BitHeap(AllocationType::KERNEL_ISA));
EXPECT_TRUE(heapAssigner.use32BitHeap(AllocationType::KERNEL_ISA_INTERNAL));
}
HWTEST_F(AlocationHelperTests, givenKernelIsaTypeWhenUseIternalAllocatorThenUseHeapInternal) {
auto heapIndex = heapAssigner.get32BitHeapIndex(GraphicsAllocation::AllocationType::KERNEL_ISA, true, *defaultHwInfo, false);
auto heapIndex = heapAssigner.get32BitHeapIndex(AllocationType::KERNEL_ISA, true, *defaultHwInfo, false);
EXPECT_EQ(heapIndex, NEO::HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY);
heapIndex = heapAssigner.get32BitHeapIndex(GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL, true, *defaultHwInfo, false);
heapIndex = heapAssigner.get32BitHeapIndex(AllocationType::KERNEL_ISA_INTERNAL, true, *defaultHwInfo, false);
EXPECT_EQ(heapIndex, NEO::HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY);
}
HWTEST_F(AlocationHelperTests, givenNotInternalTypeWhenUseIternalAllocatorThenUseHeapExternal) {
auto heapIndex = heapAssigner.get32BitHeapIndex(GraphicsAllocation::AllocationType::LINEAR_STREAM, true, *defaultHwInfo, false);
auto heapIndex = heapAssigner.get32BitHeapIndex(AllocationType::LINEAR_STREAM, true, *defaultHwInfo, false);
EXPECT_EQ(heapIndex, NEO::HeapIndex::HEAP_EXTERNAL_DEVICE_MEMORY);
}
HWTEST_F(AlocationHelperTests, givenKernelIsaTypesWhenUseInternalAllocatorCalledThenTrueReturned) {
EXPECT_TRUE(heapAssigner.useInternal32BitHeap(GraphicsAllocation::AllocationType::KERNEL_ISA));
EXPECT_TRUE(heapAssigner.useInternal32BitHeap(GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL));
EXPECT_TRUE(heapAssigner.useInternal32BitHeap(AllocationType::KERNEL_ISA));
EXPECT_TRUE(heapAssigner.useInternal32BitHeap(AllocationType::KERNEL_ISA_INTERNAL));
}
HWTEST_F(AlocationHelperTests, givenInternalHeapTypeWhenUseInternalAllocatorCalledThenTrueReturned) {
EXPECT_TRUE(heapAssigner.useInternal32BitHeap(GraphicsAllocation::AllocationType::INTERNAL_HEAP));
EXPECT_TRUE(heapAssigner.useInternal32BitHeap(AllocationType::INTERNAL_HEAP));
}
HWTEST_F(AlocationHelperTests, givenNotInternalHeapTypeWhenUseInternalAllocatorCalledThenFalseReturned) {
EXPECT_FALSE(heapAssigner.useInternal32BitHeap(GraphicsAllocation::AllocationType::BUFFER));
EXPECT_FALSE(heapAssigner.useInternal32BitHeap(AllocationType::BUFFER));
}
} // namespace NEO

View File

@@ -36,16 +36,16 @@ struct AppResourceTests : public MockExecutionEnvironmentTagTest {
};
TEST_F(AppResourceTests, givenIncorrectGraphicsAllocationTypeWhenGettingResourceTagThenNOTFOUNDIsReturned) {
auto tag = AppResourceHelper::getResourceTagStr(static_cast<GraphicsAllocation::AllocationType>(999));
auto tag = AppResourceHelper::getResourceTagStr(static_cast<AllocationType>(999));
EXPECT_STREQ(tag, "NOTFOUND");
}
TEST_F(AppResourceTests, givenGraphicsAllocationTypeWhenGettingResourceTagThenForEveryDefinedTypeProperTagExist) {
auto firstTypeIdx = static_cast<int>(GraphicsAllocation::AllocationType::UNKNOWN);
auto lastTypeIdx = static_cast<int>(GraphicsAllocation::AllocationType::COUNT);
auto firstTypeIdx = static_cast<int>(AllocationType::UNKNOWN);
auto lastTypeIdx = static_cast<int>(AllocationType::COUNT);
for (int typeIdx = firstTypeIdx; typeIdx < lastTypeIdx; typeIdx++) {
auto allocationType = static_cast<GraphicsAllocation::AllocationType>(typeIdx);
auto allocationType = static_cast<AllocationType>(typeIdx);
auto tag = AppResourceHelper::getResourceTagStr(allocationType);
EXPECT_LE(strlen(tag), AppResourceDefines::maxStrLen);
@@ -54,56 +54,56 @@ TEST_F(AppResourceTests, givenGraphicsAllocationTypeWhenGettingResourceTagThenFo
}
struct AllocationTypeTagTestCase {
GraphicsAllocation::AllocationType type;
AllocationType type;
const char *str;
};
AllocationTypeTagTestCase allocationTypeTagValues[static_cast<int>(GraphicsAllocation::AllocationType::COUNT)] = {
{GraphicsAllocation::AllocationType::BUFFER, "BUFFER"},
{GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, "BFHSTMEM"},
{GraphicsAllocation::AllocationType::COMMAND_BUFFER, "CMNDBUFF"},
{GraphicsAllocation::AllocationType::CONSTANT_SURFACE, "CSNTSRFC"},
{GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, "EXHSTPTR"},
{GraphicsAllocation::AllocationType::FILL_PATTERN, "FILPATRN"},
{GraphicsAllocation::AllocationType::GLOBAL_SURFACE, "GLBLSRFC"},
{GraphicsAllocation::AllocationType::IMAGE, "IMAGE"},
{GraphicsAllocation::AllocationType::INDIRECT_OBJECT_HEAP, "INOBHEAP"},
{GraphicsAllocation::AllocationType::INSTRUCTION_HEAP, "INSTHEAP"},
{GraphicsAllocation::AllocationType::INTERNAL_HEAP, "INTLHEAP"},
{GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, "INHSTMEM"},
{GraphicsAllocation::AllocationType::KERNEL_ISA, "KERNLISA"},
{GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL, "KRLISAIN"},
{GraphicsAllocation::AllocationType::LINEAR_STREAM, "LINRSTRM"},
{GraphicsAllocation::AllocationType::MAP_ALLOCATION, "MAPALLOC"},
{GraphicsAllocation::AllocationType::MCS, "MCS"},
{GraphicsAllocation::AllocationType::PIPE, "PIPE"},
{GraphicsAllocation::AllocationType::PREEMPTION, "PRMPTION"},
{GraphicsAllocation::AllocationType::PRINTF_SURFACE, "PRNTSRFC"},
{GraphicsAllocation::AllocationType::PRIVATE_SURFACE, "PRVTSRFC"},
{GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER, "PROFTGBF"},
{GraphicsAllocation::AllocationType::SCRATCH_SURFACE, "SCRHSRFC"},
{GraphicsAllocation::AllocationType::WORK_PARTITION_SURFACE, "WRPRTSRF"},
{GraphicsAllocation::AllocationType::SHARED_BUFFER, "SHRDBUFF"},
{GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE, "SRDCXIMG"},
{GraphicsAllocation::AllocationType::SHARED_IMAGE, "SHERDIMG"},
{GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY, "SRDRSCCP"},
{GraphicsAllocation::AllocationType::SURFACE_STATE_HEAP, "SRFCSTHP"},
{GraphicsAllocation::AllocationType::SVM_CPU, "SVM_CPU"},
{GraphicsAllocation::AllocationType::SVM_GPU, "SVM_GPU"},
{GraphicsAllocation::AllocationType::SVM_ZERO_COPY, "SVM0COPY"},
{GraphicsAllocation::AllocationType::TAG_BUFFER, "TAGBUFER"},
{GraphicsAllocation::AllocationType::GLOBAL_FENCE, "GLBLFENC"},
{GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER, "TSPKTGBF"},
{GraphicsAllocation::AllocationType::UNKNOWN, "UNKNOWN"},
{GraphicsAllocation::AllocationType::WRITE_COMBINED, "WRTCMBND"},
{GraphicsAllocation::AllocationType::RING_BUFFER, "RINGBUFF"},
{GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER, "SMPHRBUF"},
{GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA, "DBCXSVAR"},
{GraphicsAllocation::AllocationType::DEBUG_SBA_TRACKING_BUFFER, "DBSBATRB"},
{GraphicsAllocation::AllocationType::DEBUG_MODULE_AREA, "DBMDLARE"},
{GraphicsAllocation::AllocationType::UNIFIED_SHARED_MEMORY, "USHRDMEM"},
{GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER, "GPUTSDBF"},
{GraphicsAllocation::AllocationType::SW_TAG_BUFFER, "SWTAGBF"}};
AllocationTypeTagTestCase allocationTypeTagValues[static_cast<int>(AllocationType::COUNT)] = {
{AllocationType::BUFFER, "BUFFER"},
{AllocationType::BUFFER_HOST_MEMORY, "BFHSTMEM"},
{AllocationType::COMMAND_BUFFER, "CMNDBUFF"},
{AllocationType::CONSTANT_SURFACE, "CSNTSRFC"},
{AllocationType::EXTERNAL_HOST_PTR, "EXHSTPTR"},
{AllocationType::FILL_PATTERN, "FILPATRN"},
{AllocationType::GLOBAL_SURFACE, "GLBLSRFC"},
{AllocationType::IMAGE, "IMAGE"},
{AllocationType::INDIRECT_OBJECT_HEAP, "INOBHEAP"},
{AllocationType::INSTRUCTION_HEAP, "INSTHEAP"},
{AllocationType::INTERNAL_HEAP, "INTLHEAP"},
{AllocationType::INTERNAL_HOST_MEMORY, "INHSTMEM"},
{AllocationType::KERNEL_ISA, "KERNLISA"},
{AllocationType::KERNEL_ISA_INTERNAL, "KRLISAIN"},
{AllocationType::LINEAR_STREAM, "LINRSTRM"},
{AllocationType::MAP_ALLOCATION, "MAPALLOC"},
{AllocationType::MCS, "MCS"},
{AllocationType::PIPE, "PIPE"},
{AllocationType::PREEMPTION, "PRMPTION"},
{AllocationType::PRINTF_SURFACE, "PRNTSRFC"},
{AllocationType::PRIVATE_SURFACE, "PRVTSRFC"},
{AllocationType::PROFILING_TAG_BUFFER, "PROFTGBF"},
{AllocationType::SCRATCH_SURFACE, "SCRHSRFC"},
{AllocationType::WORK_PARTITION_SURFACE, "WRPRTSRF"},
{AllocationType::SHARED_BUFFER, "SHRDBUFF"},
{AllocationType::SHARED_CONTEXT_IMAGE, "SRDCXIMG"},
{AllocationType::SHARED_IMAGE, "SHERDIMG"},
{AllocationType::SHARED_RESOURCE_COPY, "SRDRSCCP"},
{AllocationType::SURFACE_STATE_HEAP, "SRFCSTHP"},
{AllocationType::SVM_CPU, "SVM_CPU"},
{AllocationType::SVM_GPU, "SVM_GPU"},
{AllocationType::SVM_ZERO_COPY, "SVM0COPY"},
{AllocationType::TAG_BUFFER, "TAGBUFER"},
{AllocationType::GLOBAL_FENCE, "GLBLFENC"},
{AllocationType::TIMESTAMP_PACKET_TAG_BUFFER, "TSPKTGBF"},
{AllocationType::UNKNOWN, "UNKNOWN"},
{AllocationType::WRITE_COMBINED, "WRTCMBND"},
{AllocationType::RING_BUFFER, "RINGBUFF"},
{AllocationType::SEMAPHORE_BUFFER, "SMPHRBUF"},
{AllocationType::DEBUG_CONTEXT_SAVE_AREA, "DBCXSVAR"},
{AllocationType::DEBUG_SBA_TRACKING_BUFFER, "DBSBATRB"},
{AllocationType::DEBUG_MODULE_AREA, "DBMDLARE"},
{AllocationType::UNIFIED_SHARED_MEMORY, "USHRDMEM"},
{AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER, "GPUTSDBF"},
{AllocationType::SW_TAG_BUFFER, "SWTAGBF"}};
class AllocationTypeTagString : public ::testing::TestWithParam<AllocationTypeTagTestCase> {};
TEST_P(AllocationTypeTagString, givenGraphicsAllocationTypeWhenCopyTagToStorageInfoThenCorrectTagIsReturned) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -13,15 +13,15 @@
using namespace NEO;
TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenIsCreatedThenAllInspectionIdsAreSetToZero) {
MockGraphicsAllocation graphicsAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount);
MockGraphicsAllocation graphicsAllocation(0, AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount);
for (auto i = 0u; i < MemoryManager::maxOsContextCount; i++) {
EXPECT_EQ(0u, graphicsAllocation.getInspectionId(i));
}
}
TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenIsCreatedThenTaskCountsAreInitializedProperly) {
GraphicsAllocation graphicsAllocation1(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount);
GraphicsAllocation graphicsAllocation2(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount);
GraphicsAllocation graphicsAllocation1(0, AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount);
GraphicsAllocation graphicsAllocation2(0, AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount);
for (auto i = 0u; i < MemoryManager::maxOsContextCount; i++) {
EXPECT_EQ(MockGraphicsAllocation::objectNotUsed, graphicsAllocation1.getTaskCount(i));
EXPECT_EQ(MockGraphicsAllocation::objectNotUsed, graphicsAllocation2.getTaskCount(i));
@@ -116,51 +116,51 @@ TEST(GraphicsAllocationTest, givenResidentGraphicsAllocationWhenCheckIfResidency
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsCommandBufferThenCpuAccessIsRequired) {
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::COMMAND_BUFFER));
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(AllocationType::COMMAND_BUFFER));
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsConstantSurfaceThenCpuAccessIsRequired) {
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::CONSTANT_SURFACE));
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(AllocationType::CONSTANT_SURFACE));
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsGlobalSurfaceThenCpuAccessIsRequired) {
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::GLOBAL_SURFACE));
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(AllocationType::GLOBAL_SURFACE));
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsInternalHeapThenCpuAccessIsRequired) {
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::INTERNAL_HEAP));
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(AllocationType::INTERNAL_HEAP));
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsKernelIsaThenCpuAccessIsNotRequired) {
EXPECT_FALSE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::KERNEL_ISA));
EXPECT_FALSE(GraphicsAllocation::isCpuAccessRequired(AllocationType::KERNEL_ISA));
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsKernelIsaInternalThenCpuAccessIsNotRequired) {
EXPECT_FALSE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL));
EXPECT_FALSE(GraphicsAllocation::isCpuAccessRequired(AllocationType::KERNEL_ISA_INTERNAL));
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsLinearStreamThenCpuAccessIsRequired) {
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::LINEAR_STREAM));
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(AllocationType::LINEAR_STREAM));
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsPipeThenCpuAccessIsRequired) {
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::PIPE));
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(AllocationType::PIPE));
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsTimestampPacketThenCpuAccessIsRequired) {
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER));
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(AllocationType::TIMESTAMP_PACKET_TAG_BUFFER));
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsGpuTimestampDeviceBufferThenCpuAccessIsRequired) {
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER));
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER));
}
TEST(GraphicsAllocationTest, whenAllocationRequiresCpuAccessThenAllocationIsLockable) {
auto firstAllocationIdx = static_cast<int>(GraphicsAllocation::AllocationType::UNKNOWN);
auto lastAllocationIdx = static_cast<int>(GraphicsAllocation::AllocationType::COUNT);
auto firstAllocationIdx = static_cast<int>(AllocationType::UNKNOWN);
auto lastAllocationIdx = static_cast<int>(AllocationType::COUNT);
for (int allocationIdx = firstAllocationIdx; allocationIdx != lastAllocationIdx; allocationIdx++) {
auto allocationType = static_cast<GraphicsAllocation::AllocationType>(allocationIdx);
auto allocationType = static_cast<AllocationType>(allocationIdx);
if (GraphicsAllocation::isCpuAccessRequired(allocationType)) {
EXPECT_TRUE(GraphicsAllocation::isLockable(allocationType));
}
@@ -168,32 +168,32 @@ TEST(GraphicsAllocationTest, whenAllocationRequiresCpuAccessThenAllocationIsLock
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsISAThenAllocationIsLockable) {
EXPECT_TRUE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::KERNEL_ISA));
EXPECT_TRUE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL));
EXPECT_TRUE(GraphicsAllocation::isLockable(AllocationType::KERNEL_ISA));
EXPECT_TRUE(GraphicsAllocation::isLockable(AllocationType::KERNEL_ISA_INTERNAL));
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsBufferThenAllocationIsNotLockable) {
EXPECT_FALSE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::BUFFER));
EXPECT_FALSE(GraphicsAllocation::isLockable(AllocationType::BUFFER));
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsBufferHostMemoryThenAllocationIsLockable) {
EXPECT_TRUE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY));
EXPECT_TRUE(GraphicsAllocation::isLockable(AllocationType::BUFFER_HOST_MEMORY));
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsGpuTimestampDeviceBufferThenAllocationIsLockable) {
EXPECT_TRUE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER));
EXPECT_TRUE(GraphicsAllocation::isLockable(AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER));
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsSvmGpuThenAllocationIsNotLockable) {
EXPECT_FALSE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::SVM_GPU));
EXPECT_FALSE(GraphicsAllocation::isLockable(AllocationType::SVM_GPU));
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsSharedResourceCopyThenAllocationIsLockable) {
EXPECT_TRUE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY));
EXPECT_TRUE(GraphicsAllocation::isLockable(AllocationType::SHARED_RESOURCE_COPY));
}
TEST(GraphicsAllocationTest, whenAllocationTypeIsImageThenAllocationIsNotLockable) {
EXPECT_FALSE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::IMAGE));
EXPECT_FALSE(GraphicsAllocation::isLockable(AllocationType::IMAGE));
}
TEST(GraphicsAllocationTest, givenDefaultAllocationWhenGettingNumHandlesThenOneIsReturned) {
@@ -223,7 +223,7 @@ TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenQueryingUsedPageSizeThen
MemoryPool::SystemCpuInaccessible};
for (auto pool : page4kPools) {
MockGraphicsAllocation graphicsAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0u, 0u, static_cast<osHandle>(1), pool, MemoryManager::maxOsContextCount);
MockGraphicsAllocation graphicsAllocation(0, AllocationType::UNKNOWN, nullptr, 0u, 0u, static_cast<osHandle>(1), pool, MemoryManager::maxOsContextCount);
EXPECT_EQ(MemoryConstants::pageSize, graphicsAllocation.getUsedPageSize());
}
@@ -233,7 +233,7 @@ TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenQueryingUsedPageSizeThen
MemoryPool::LocalMemory};
for (auto pool : page64kPools) {
MockGraphicsAllocation graphicsAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, pool, MemoryManager::maxOsContextCount);
MockGraphicsAllocation graphicsAllocation(0, AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, pool, MemoryManager::maxOsContextCount);
EXPECT_EQ(MemoryConstants::pageSize64k, graphicsAllocation.getUsedPageSize());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -20,7 +20,7 @@ using namespace NEO;
TEST(MultiGraphicsAllocationTest, whenCreatingMultiGraphicsAllocationThenTheAllocationIsObtainableAsADefault) {
GraphicsAllocation graphicsAllocation(1, // rootDeviceIndex
GraphicsAllocation::AllocationType::BUFFER,
AllocationType::BUFFER,
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
MockMultiGraphicsAllocation multiGraphicsAllocation(1);
@@ -36,10 +36,10 @@ TEST(MultiGraphicsAllocationTest, whenCreatingMultiGraphicsAllocationThenTheAllo
TEST(MultiGraphicsAllocationTest, givenMultiGraphicsAllocationWhenAddingMultipleGraphicsAllocationsThenTheyAreObtainableByRootDeviceIndex) {
GraphicsAllocation graphicsAllocation0(0, // rootDeviceIndex
GraphicsAllocation::AllocationType::BUFFER,
AllocationType::BUFFER,
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
GraphicsAllocation graphicsAllocation1(1, // rootDeviceIndex
GraphicsAllocation::AllocationType::BUFFER,
AllocationType::BUFFER,
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
MockMultiGraphicsAllocation multiGraphicsAllocation(1);
@@ -53,7 +53,7 @@ TEST(MultiGraphicsAllocationTest, givenMultiGraphicsAllocationWhenAddingMultiple
}
TEST(MultiGraphicsAllocationTest, givenMultiGraphicsAllocationWhenGettingAllocationTypeThenReturnAllocationTypeFromDefaultAllocation) {
auto expectedAllocationType = GraphicsAllocation::AllocationType::BUFFER;
auto expectedAllocationType = AllocationType::BUFFER;
GraphicsAllocation graphicsAllocation(1, // rootDeviceIndex
expectedAllocationType,
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
@@ -66,7 +66,7 @@ TEST(MultiGraphicsAllocationTest, givenMultiGraphicsAllocationWhenGettingAllocat
}
TEST(MultiGraphicsAllocationTest, givenMultiGraphicsAllocationWhenGettingCoherencyStatusThenReturnCoherencyStatusFromDefaultAllocation) {
auto expectedAllocationType = GraphicsAllocation::AllocationType::BUFFER;
auto expectedAllocationType = AllocationType::BUFFER;
GraphicsAllocation graphicsAllocation(1, // rootDeviceIndex
expectedAllocationType,
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
@@ -89,7 +89,7 @@ TEST(MultiGraphicsAllocationTest, WhenCreatingMultiGraphicsAllocationWithoutGrap
TEST(MultiGraphicsAllocationTest, givenMultiGraphicsAllocationWhenRemovingGraphicsAllocationThenTheAllocationIsNoLongerAvailable) {
uint32_t rootDeviceIndex = 1u;
GraphicsAllocation graphicsAllocation(rootDeviceIndex,
GraphicsAllocation::AllocationType::BUFFER,
AllocationType::BUFFER,
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
MockMultiGraphicsAllocation multiGraphicsAllocation(rootDeviceIndex);
@@ -126,7 +126,7 @@ TEST_F(MultiGraphicsAllocationTests, whenCreatingMultiGraphicsAllocationWithShar
AllocationProperties allocationProperties{0u,
true, //allocateMemory
MemoryConstants::pageSize,
GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY,
AllocationType::BUFFER_HOST_MEMORY,
false, //multiOsContextCapable
false, //isMultiStorageAllocationParam
systemMemoryBitfield};
@@ -149,7 +149,7 @@ TEST_F(MultiGraphicsAllocationTests, whenCreatingMultiGraphicsAllocationWithExis
AllocationProperties allocationProperties{0u,
false, //allocateMemory
MemoryConstants::pageSize,
GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY,
AllocationType::BUFFER_HOST_MEMORY,
false, //multiOsContextCapable
false, //isMultiStorageAllocationParam
systemMemoryBitfield};
@@ -170,7 +170,7 @@ TEST_F(MultiGraphicsAllocationTests, whenCreatingMultiGraphicsAllocationWithSepa
AllocationProperties allocationProperties{0u,
true, //allocateMemory
MemoryConstants::pageSize,
GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY,
AllocationType::BUFFER_HOST_MEMORY,
false, //multiOsContextCapable
false, //isMultiStorageAllocationParam
systemMemoryBitfield};
@@ -190,7 +190,7 @@ TEST_F(MultiGraphicsAllocationTests, givenMultiGraphicsAllocationThatRequiresMig
AllocationProperties allocationProperties{0u,
true, //allocateMemory
MemoryConstants::pageSize,
GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY,
AllocationType::BUFFER_HOST_MEMORY,
false, //multiOsContextCapable
false, //isMultiStorageAllocationParam
systemMemoryBitfield};
@@ -222,7 +222,7 @@ struct MigrationSyncDataTests : public MultiGraphicsAllocationTests {
AllocationProperties allocationProperties{0u,
true, //allocateMemory
MemoryConstants::pageSize,
GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY,
AllocationType::BUFFER_HOST_MEMORY,
false, //multiOsContextCapable
false, //isMultiStorageAllocationParam
systemMemoryBitfield};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -71,7 +71,7 @@ TEST_F(FrontWindowAllocatorTests, givenInitializedHeapsWhenUseExternalAllocatorF
}
TEST_F(FrontWindowAllocatorTests, givenLinearStreamAllocWhenSelectingHeapWithFrontWindowThenCorrectIndexReturned) {
GraphicsAllocation allocation{0, GraphicsAllocation::AllocationType::LINEAR_STREAM, nullptr, 0, 0, 0, MemoryPool::MemoryNull};
GraphicsAllocation allocation{0, AllocationType::LINEAR_STREAM, nullptr, 0, 0, 0, MemoryPool::MemoryNull};
EXPECT_EQ(HeapIndex::HEAP_EXTERNAL_FRONT_WINDOW, memManager->selectHeap(&allocation, true, true, true));
}

View File

@@ -87,6 +87,6 @@ TEST(DrmQueryTest, givenDrmAllocationWhenShouldAllocationFaultIsCalledThenReturn
executionEnvironment->prepareRootDeviceEnvironments(1);
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
MockDrmAllocation allocation(GraphicsAllocation::AllocationType::BUFFER, MemoryPool::MemoryNull);
MockDrmAllocation allocation(AllocationType::BUFFER, MemoryPool::MemoryNull);
EXPECT_FALSE(allocation.shouldAllocationPageFault(&drm));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -35,7 +35,7 @@ TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreNotExportedTh
ASSERT_EQ(initData.size(), alloc->getUnderlyingBufferSize());
EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size()));
EXPECT_EQ(nullptr, svmAllocsManager.getSVMAlloc(reinterpret_cast<void *>(static_cast<uintptr_t>(alloc->getGpuAddress()))));
EXPECT_EQ(GraphicsAllocation::AllocationType::CONSTANT_SURFACE, alloc->getAllocationType());
EXPECT_EQ(AllocationType::CONSTANT_SURFACE, alloc->getAllocationType());
device.getMemoryManager()->freeGraphicsMemory(alloc);
alloc = allocateGlobalsSurface(&svmAllocsManager, device, initData.size(), false /* constant */, nullptr /* linker input */, initData.data());
@@ -43,7 +43,7 @@ TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreNotExportedTh
ASSERT_EQ(initData.size(), alloc->getUnderlyingBufferSize());
EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size()));
EXPECT_EQ(nullptr, svmAllocsManager.getSVMAlloc(reinterpret_cast<void *>(static_cast<uintptr_t>(alloc->getGpuAddress()))));
EXPECT_EQ(GraphicsAllocation::AllocationType::GLOBAL_SURFACE, alloc->getAllocationType());
EXPECT_EQ(AllocationType::GLOBAL_SURFACE, alloc->getAllocationType());
device.getMemoryManager()->freeGraphicsMemory(alloc);
alloc = allocateGlobalsSurface(&svmAllocsManager, device, initData.size(), true /* constant */, &emptyLinkerInput, initData.data());
@@ -51,7 +51,7 @@ TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreNotExportedTh
ASSERT_EQ(initData.size(), alloc->getUnderlyingBufferSize());
EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size()));
EXPECT_EQ(nullptr, svmAllocsManager.getSVMAlloc(reinterpret_cast<void *>(static_cast<uintptr_t>(alloc->getGpuAddress()))));
EXPECT_EQ(GraphicsAllocation::AllocationType::CONSTANT_SURFACE, alloc->getAllocationType());
EXPECT_EQ(AllocationType::CONSTANT_SURFACE, alloc->getAllocationType());
device.getMemoryManager()->freeGraphicsMemory(alloc);
alloc = allocateGlobalsSurface(&svmAllocsManager, device, initData.size(), false /* constant */, &emptyLinkerInput, initData.data());
@@ -59,7 +59,7 @@ TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreNotExportedTh
ASSERT_EQ(initData.size(), alloc->getUnderlyingBufferSize());
EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size()));
EXPECT_EQ(nullptr, svmAllocsManager.getSVMAlloc(reinterpret_cast<void *>(static_cast<uintptr_t>(alloc->getGpuAddress()))));
EXPECT_EQ(GraphicsAllocation::AllocationType::GLOBAL_SURFACE, alloc->getAllocationType());
EXPECT_EQ(AllocationType::GLOBAL_SURFACE, alloc->getAllocationType());
device.getMemoryManager()->freeGraphicsMemory(alloc);
}
@@ -121,28 +121,28 @@ TEST(AllocateGlobalSurfaceTest, GivenNullSvmAllocsManagerWhenGlobalsAreExportedT
ASSERT_NE(nullptr, alloc);
ASSERT_EQ(initData.size(), alloc->getUnderlyingBufferSize());
EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size()));
EXPECT_EQ(GraphicsAllocation::AllocationType::CONSTANT_SURFACE, alloc->getAllocationType());
EXPECT_EQ(AllocationType::CONSTANT_SURFACE, alloc->getAllocationType());
device.getMemoryManager()->freeGraphicsMemory(alloc);
alloc = allocateGlobalsSurface(nullptr, device, initData.size(), true /* constant */, &linkerInputExportGlobalVariables, initData.data());
ASSERT_NE(nullptr, alloc);
ASSERT_EQ(initData.size(), alloc->getUnderlyingBufferSize());
EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size()));
EXPECT_EQ(GraphicsAllocation::AllocationType::CONSTANT_SURFACE, alloc->getAllocationType());
EXPECT_EQ(AllocationType::CONSTANT_SURFACE, alloc->getAllocationType());
device.getMemoryManager()->freeGraphicsMemory(alloc);
alloc = allocateGlobalsSurface(nullptr, device, initData.size(), false /* constant */, &linkerInputExportGlobalConstants, initData.data());
ASSERT_NE(nullptr, alloc);
ASSERT_EQ(initData.size(), alloc->getUnderlyingBufferSize());
EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size()));
EXPECT_EQ(GraphicsAllocation::AllocationType::GLOBAL_SURFACE, alloc->getAllocationType());
EXPECT_EQ(AllocationType::GLOBAL_SURFACE, alloc->getAllocationType());
device.getMemoryManager()->freeGraphicsMemory(alloc);
alloc = allocateGlobalsSurface(nullptr, device, initData.size(), false /* constant */, &linkerInputExportGlobalVariables, initData.data());
ASSERT_NE(nullptr, alloc);
ASSERT_EQ(initData.size(), alloc->getUnderlyingBufferSize());
EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size()));
EXPECT_EQ(GraphicsAllocation::AllocationType::GLOBAL_SURFACE, alloc->getAllocationType());
EXPECT_EQ(AllocationType::GLOBAL_SURFACE, alloc->getAllocationType());
device.getMemoryManager()->freeGraphicsMemory(alloc);
}
@@ -236,7 +236,7 @@ TEST(AllocateGlobalSurfaceTest, GivenAllocationInLocalMemoryWhichRequiresBlitter
nullptr /* linker input */, initData.data());
ASSERT_NE(nullptr, pAllocation);
EXPECT_EQ(nullptr, svmAllocsManager.getSVMAlloc(reinterpret_cast<void *>(static_cast<uintptr_t>(pAllocation->getGpuAddress()))));
EXPECT_EQ(GraphicsAllocation::AllocationType::CONSTANT_SURFACE, pAllocation->getAllocationType());
EXPECT_EQ(AllocationType::CONSTANT_SURFACE, pAllocation->getAllocationType());
if (pAllocation->isAllocatedInLocalMemoryPool() && (localMemoryAccessMode == LocalMemoryAccessMode::CpuAccessDisallowed)) {
expectedBlitsCount++;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -52,7 +52,7 @@ struct SoftwareTagsManagerTests : public DeviceFixture, public ::testing::Test {
const AllocationProperties properties{
pDevice->getRootDeviceIndex(),
SWTagsManager::estimateSpaceForSWTags<GfxFamily>(),
GraphicsAllocation::AllocationType::LINEAR_STREAM,
AllocationType::LINEAR_STREAM,
pDevice->getDeviceBitfield()};
GraphicsAllocation *allocation = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -24,7 +24,7 @@ XE_HPC_CORETEST_F(AubCommandStreamReceiverXeHpcCoreTests, givenLinkBcsEngineWhen
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
auto memoryManager = device->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, device->getDeviceBitfield()});
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, device->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));