Pass maxOsContextCount to GraphicsAllocation

Change-Id: I4f327866433fe9b0cc0a6191336b54a9d2282702
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-08-20 13:48:47 +02:00
committed by sys_ocldev
parent dcb5353200
commit 6870104a1a
22 changed files with 86 additions and 79 deletions

View File

@@ -19,7 +19,7 @@ void GraphicsAllocation::setAllocationType(AllocationType allocationType) {
}
GraphicsAllocation::GraphicsAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn, uint64_t gpuAddress,
uint64_t baseAddress, size_t sizeIn, MemoryPool::Type pool)
uint64_t baseAddress, size_t sizeIn, MemoryPool::Type pool, size_t maxOsContextCount)
: rootDeviceIndex(rootDeviceIndex),
gpuBaseAddress(baseAddress),
gpuAddress(gpuAddress),
@@ -27,19 +27,19 @@ GraphicsAllocation::GraphicsAllocation(uint32_t rootDeviceIndex, size_t numGmms,
cpuPtr(cpuPtrIn),
memoryPool(pool),
allocationType(allocationType),
usageInfos(MemoryManager::maxOsContextCount) {
usageInfos(maxOsContextCount) {
gmms.resize(numGmms);
}
GraphicsAllocation::GraphicsAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn, size_t sizeIn,
osHandle sharedHandleIn, MemoryPool::Type pool)
osHandle sharedHandleIn, MemoryPool::Type pool, size_t maxOsContextCount)
: rootDeviceIndex(rootDeviceIndex),
gpuAddress(castToUint64(cpuPtrIn)),
size(sizeIn),
cpuPtr(cpuPtrIn),
memoryPool(pool),
allocationType(allocationType),
usageInfos(MemoryManager::maxOsContextCount) {
usageInfos(maxOsContextCount) {
sharingInfo.sharedHandle = sharedHandleIn;
gmms.resize(numGmms);
}

View File

@@ -101,18 +101,18 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
GraphicsAllocation(const GraphicsAllocation &) = delete;
GraphicsAllocation(uint32_t rootDeviceIndex, AllocationType allocationType, void *cpuPtrIn,
uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn, MemoryPool::Type pool)
: GraphicsAllocation(rootDeviceIndex, 1, allocationType, cpuPtrIn, gpuAddress, baseAddress, sizeIn, pool) {}
uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn, MemoryPool::Type pool, size_t maxOsContextCount)
: GraphicsAllocation(rootDeviceIndex, 1, allocationType, cpuPtrIn, gpuAddress, baseAddress, sizeIn, pool, maxOsContextCount) {}
GraphicsAllocation(uint32_t rootDeviceIndex, AllocationType allocationType, void *cpuPtrIn,
size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool)
: GraphicsAllocation(rootDeviceIndex, 1, allocationType, cpuPtrIn, sizeIn, sharedHandleIn, pool) {}
size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool, size_t maxOsContextCount)
: GraphicsAllocation(rootDeviceIndex, 1, allocationType, cpuPtrIn, sizeIn, sharedHandleIn, pool, maxOsContextCount) {}
GraphicsAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn,
uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn, MemoryPool::Type pool);
uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn, MemoryPool::Type pool, size_t maxOsContextCount);
GraphicsAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn,
size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool);
size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool, size_t maxOsContextCount);
uint32_t getRootDeviceIndex() const { return rootDeviceIndex; }
void *getUnderlyingBuffer() const { return cpuPtr; }

View File

@@ -7,6 +7,7 @@
#pragma once
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/source/memory_manager/memory_manager.h"
namespace NEO {
class BufferObject;
@@ -24,7 +25,7 @@ class DrmAllocation : public GraphicsAllocation {
: DrmAllocation(rootDeviceIndex, 1, allocationType, bo, ptrIn, sizeIn, sharedHandle, pool) {}
DrmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, BufferObject *bo, void *ptrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool)
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, sizeIn, sharedHandle, pool),
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, sizeIn, sharedHandle, pool, MemoryManager::maxOsContextCount),
bufferObjects({{bo}}) {
}
@@ -32,7 +33,7 @@ class DrmAllocation : public GraphicsAllocation {
: DrmAllocation(rootDeviceIndex, 1, allocationType, bo, ptrIn, gpuAddress, sizeIn, pool) {}
DrmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, BufferObject *bo, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool::Type pool)
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, gpuAddress, 0, sizeIn, pool),
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, gpuAddress, 0, sizeIn, pool, MemoryManager::maxOsContextCount),
bufferObjects({{bo}}) {
}
@@ -40,7 +41,7 @@ class DrmAllocation : public GraphicsAllocation {
: DrmAllocation(rootDeviceIndex, 1, allocationType, bos, ptrIn, gpuAddress, sizeIn, pool) {}
DrmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, BufferObjects &bos, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool::Type pool)
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, gpuAddress, 0, sizeIn, pool),
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, gpuAddress, 0, sizeIn, pool, MemoryManager::maxOsContextCount),
bufferObjects(bos) {
}

View File

@@ -31,7 +31,8 @@ class WddmAllocation : public GraphicsAllocation {
WddmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn, size_t sizeIn,
void *reservedAddr, MemoryPool::Type pool, uint32_t shareable, size_t maxOsContextCount)
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, cpuPtrIn, castToUint64(cpuPtrIn), 0llu, sizeIn, pool), shareable(shareable), residency(maxOsContextCount), trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) {
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, cpuPtrIn, castToUint64(cpuPtrIn), 0llu, sizeIn, pool, maxOsContextCount),
shareable(shareable), residency(maxOsContextCount), trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) {
reservedAddressRangeInfo.addressPtr = reservedAddr;
reservedAddressRangeInfo.rangeSize = sizeIn;
handles.resize(gmms.size());
@@ -42,7 +43,8 @@ class WddmAllocation : public GraphicsAllocation {
WddmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn, size_t sizeIn,
osHandle sharedHandle, MemoryPool::Type pool, size_t maxOsContextCount)
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, cpuPtrIn, sizeIn, sharedHandle, pool), residency(maxOsContextCount), trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) {
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, cpuPtrIn, sizeIn, sharedHandle, pool, maxOsContextCount),
residency(maxOsContextCount), trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) {
handles.resize(gmms.size());
}