Skip to content

Commit 5d640e7

Browse files
Remove multiOsContextCapable flag from GraphicsAllocation
Change-Id: I3ebeef39befdc2a3e0f9d7d76ae531622ecf1a42 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
1 parent 0337b58 commit 5d640e7

31 files changed

+148
-205
lines changed

runtime/command_stream/aub_command_stream_receiver_hw_base.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxA
659659

660660
template <typename GfxFamily>
661661
bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(AllocationView &allocationView) {
662-
GraphicsAllocation gfxAllocation(GraphicsAllocation::AllocationType::UNKNOWN, reinterpret_cast<void *>(allocationView.first), allocationView.first, 0llu, allocationView.second, MemoryPool::MemoryNull, false);
662+
GraphicsAllocation gfxAllocation(GraphicsAllocation::AllocationType::UNKNOWN, reinterpret_cast<void *>(allocationView.first), allocationView.first, 0llu, allocationView.second, MemoryPool::MemoryNull);
663663
return writeMemory(gfxAllocation);
664664
}
665665

runtime/memory_manager/graphics_allocation.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,23 @@ void GraphicsAllocation::setAllocationType(AllocationType allocationType) {
1818
}
1919

2020
GraphicsAllocation::GraphicsAllocation(AllocationType allocationType, void *cpuPtrIn, uint64_t gpuAddress, uint64_t baseAddress,
21-
size_t sizeIn, MemoryPool::Type pool, bool multiOsContextCapable)
21+
size_t sizeIn, MemoryPool::Type pool)
2222
: gpuBaseAddress(baseAddress),
2323
gpuAddress(gpuAddress),
2424
size(sizeIn),
2525
cpuPtr(cpuPtrIn),
2626
memoryPool(pool),
2727
allocationType(allocationType) {
28-
allocationInfo.flags.multiOsContextCapable = multiOsContextCapable;
2928
}
3029

3130
GraphicsAllocation::GraphicsAllocation(AllocationType allocationType, void *cpuPtrIn, size_t sizeIn, osHandle sharedHandleIn,
32-
MemoryPool::Type pool, bool multiOsContextCapable)
31+
MemoryPool::Type pool)
3332
: gpuAddress(castToUint64(cpuPtrIn)),
3433
size(sizeIn),
3534
cpuPtr(cpuPtrIn),
3635
memoryPool(pool),
3736
allocationType(allocationType) {
3837
sharingInfo.sharedHandle = sharedHandleIn;
39-
allocationInfo.flags.multiOsContextCapable = multiOsContextCapable;
4038
}
4139

4240
GraphicsAllocation::~GraphicsAllocation() = default;

runtime/memory_manager/graphics_allocation.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
8080
GraphicsAllocation &operator=(const GraphicsAllocation &) = delete;
8181
GraphicsAllocation(const GraphicsAllocation &) = delete;
8282

83-
GraphicsAllocation(AllocationType allocationType, void *cpuPtrIn, uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn, MemoryPool::Type pool, bool multiOsContextCapable);
83+
GraphicsAllocation(AllocationType allocationType, void *cpuPtrIn, uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn, MemoryPool::Type pool);
8484

85-
GraphicsAllocation(AllocationType allocationType, void *cpuPtrIn, size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool, bool multiOsContextCapable);
85+
GraphicsAllocation(AllocationType allocationType, void *cpuPtrIn, size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool);
8686

8787
void *getUnderlyingBuffer() const { return cpuPtr; }
8888
void *getDriverAllocatedCpuPtr() const { return driverAllocatedCpuPointer; }
@@ -128,7 +128,6 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
128128
bool peekEvictable() const { return allocationInfo.flags.evictable; }
129129
bool isFlushL3Required() const { return allocationInfo.flags.flushL3Required; }
130130
void setFlushL3Required(bool flushL3Required) { allocationInfo.flags.flushL3Required = flushL3Required; }
131-
bool isMultiOsContextCapable() const { return allocationInfo.flags.multiOsContextCapable; }
132131
bool is32BitAllocation() const { return allocationInfo.flags.is32BitAllocation; }
133132
void set32BitAllocation(bool is32BitAllocation) { allocationInfo.flags.is32BitAllocation = is32BitAllocation; }
134133

@@ -236,8 +235,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
236235
uint32_t evictable : 1;
237236
uint32_t flushL3Required : 1;
238237
uint32_t is32BitAllocation : 1;
239-
uint32_t multiOsContextCapable : 1;
240-
uint32_t reserved : 27;
238+
uint32_t reserved : 28;
241239
} flags;
242240
uint32_t allFlags = 0u;
243241
};
@@ -247,7 +245,6 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
247245
flags.evictable = true;
248246
flags.flushL3Required = true;
249247
flags.is32BitAllocation = false;
250-
flags.multiOsContextCapable = false;
251248
}
252249
};
253250

runtime/memory_manager/os_agnostic_memory_manager.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,14 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryWithAlignment
4747
if (fakeBigAllocations && allocationData.size > bigAllocation) {
4848
memoryAllocation = createMemoryAllocation(
4949
allocationData.type, nullptr, (void *)dummyAddress, static_cast<uint64_t>(dummyAddress), allocationData.size, counter,
50-
MemoryPool::System4KBPages, allocationData.flags.multiOsContextCapable, allocationData.flags.uncacheable,
51-
allocationData.flags.flushL3, false);
50+
MemoryPool::System4KBPages, allocationData.flags.uncacheable, allocationData.flags.flushL3, false);
5251
counter++;
5352
return memoryAllocation;
5453
}
5554
auto ptr = allocateSystemMemory(sizeAligned, allocationData.alignment ? alignUp(allocationData.alignment, MemoryConstants::pageSize) : MemoryConstants::pageSize);
5655
if (ptr != nullptr) {
5756
memoryAllocation = createMemoryAllocation(allocationData.type, ptr, ptr, reinterpret_cast<uint64_t>(ptr), allocationData.size,
58-
counter, MemoryPool::System4KBPages, allocationData.flags.multiOsContextCapable,
59-
allocationData.flags.uncacheable, allocationData.flags.flushL3, false);
57+
counter, MemoryPool::System4KBPages, allocationData.flags.uncacheable, allocationData.flags.flushL3, false);
6058

6159
if (allocationData.type == GraphicsAllocation::AllocationType::SVM_CPU) {
6260
//add 2MB padding in case mapPtr is not 2MB aligned
@@ -82,7 +80,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryForNonSvmHost
8280

8381
auto memoryAllocation = createMemoryAllocation(allocationData.type, nullptr, const_cast<void *>(allocationData.hostPtr),
8482
reinterpret_cast<uint64_t>(alignedPtr), allocationData.size, counter,
85-
MemoryPool::System4KBPages, false, false, allocationData.flags.flushL3, false);
83+
MemoryPool::System4KBPages, false, allocationData.flags.flushL3, false);
8684

8785
memoryAllocation->setAllocationOffset(offsetInPage);
8886

@@ -112,7 +110,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemoryImpl(con
112110
uint64_t offset = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(allocationData.hostPtr) & MemoryConstants::pageMask);
113111
MemoryAllocation *memAlloc = new MemoryAllocation(
114112
allocationData.type, nullptr, const_cast<void *>(allocationData.hostPtr), GmmHelper::canonize(gpuVirtualAddress + offset),
115-
allocationData.size, counter, MemoryPool::System4KBPagesWith32BitGpuAddressing, false, false, false);
113+
allocationData.size, counter, MemoryPool::System4KBPagesWith32BitGpuAddressing, false, false);
116114

117115
memAlloc->set32BitAllocation(true);
118116
memAlloc->setGpuBaseAddress(GmmHelper::canonize(gfxPartition->getHeapBase(heap)));
@@ -137,7 +135,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemoryImpl(con
137135
MemoryAllocation *memoryAllocation = nullptr;
138136
if (ptrAlloc != nullptr) {
139137
memoryAllocation = new MemoryAllocation(allocationData.type, ptrAlloc, ptrAlloc, GmmHelper::canonize(gpuAddress),
140-
allocationData.size, counter, MemoryPool::System4KBPagesWith32BitGpuAddressing, false,
138+
allocationData.size, counter, MemoryPool::System4KBPagesWith32BitGpuAddressing,
141139
false, allocationData.flags.flushL3);
142140

143141
memoryAllocation->set32BitAllocation(true);
@@ -150,7 +148,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemoryImpl(con
150148

151149
GraphicsAllocation *OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness) {
152150
auto graphicsAllocation = createMemoryAllocation(properties.allocationType, nullptr, reinterpret_cast<void *>(1), 1,
153-
4096u, static_cast<uint64_t>(handle), MemoryPool::SystemCpuInaccessible, false,
151+
4096u, static_cast<uint64_t>(handle), MemoryPool::SystemCpuInaccessible,
154152
false, false, requireSpecificBitness);
155153
graphicsAllocation->setSharedHandle(handle);
156154
graphicsAllocation->set32BitAllocation(requireSpecificBitness);
@@ -230,7 +228,7 @@ uint64_t OsAgnosticMemoryManager::getSystemSharedMemory() {
230228
GraphicsAllocation *OsAgnosticMemoryManager::createGraphicsAllocation(OsHandleStorage &handleStorage, const AllocationData &allocationData) {
231229
auto allocation = createMemoryAllocation(allocationData.type, nullptr, const_cast<void *>(allocationData.hostPtr),
232230
reinterpret_cast<uint64_t>(allocationData.hostPtr), allocationData.size, counter++,
233-
MemoryPool::System4KBPages, false, false, false, false);
231+
MemoryPool::System4KBPages, false, false, false);
234232

235233
allocation->fragmentsStorage = handleStorage;
236234
return allocation;
@@ -282,7 +280,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryForImageImpl(
282280
auto ptr = allocateSystemMemory(alignUp(allocationData.imgInfo->size, MemoryConstants::pageSize), MemoryConstants::pageSize);
283281
if (ptr != nullptr) {
284282
alloc = createMemoryAllocation(allocationData.type, ptr, ptr, reinterpret_cast<uint64_t>(ptr), allocationData.imgInfo->size,
285-
counter, MemoryPool::SystemCpuInaccessible, false, allocationData.flags.uncacheable, allocationData.flags.flushL3, false);
283+
counter, MemoryPool::SystemCpuInaccessible, allocationData.flags.uncacheable, allocationData.flags.flushL3, false);
286284
counter++;
287285
}
288286

@@ -304,11 +302,11 @@ void OsAgnosticMemoryManager::releaseReservedCpuAddressRange(void *reserved, siz
304302

305303
MemoryAllocation *OsAgnosticMemoryManager::createMemoryAllocation(GraphicsAllocation::AllocationType allocationType, void *driverAllocatedCpuPointer,
306304
void *pMem, uint64_t gpuAddress, size_t memSize, uint64_t count,
307-
MemoryPool::Type pool, bool multiOsContextCapable, bool uncacheable,
305+
MemoryPool::Type pool, bool uncacheable,
308306
bool flushL3Required, bool requireSpecificBitness) {
309307
if (!isLimitedRange()) {
310308
return new MemoryAllocation(allocationType, driverAllocatedCpuPointer, pMem, gpuAddress, memSize,
311-
count, pool, multiOsContextCapable, uncacheable, flushL3Required);
309+
count, pool, uncacheable, flushL3Required);
312310
}
313311

314312
size_t alignedSize = alignSizeWholePage(pMem, memSize);
@@ -318,7 +316,7 @@ MemoryAllocation *OsAgnosticMemoryManager::createMemoryAllocation(GraphicsAlloca
318316
uint64_t limitedGpuAddress = gfxPartition->heapAllocate(heap, alignedSize);
319317

320318
auto memoryAllocation = new MemoryAllocation(allocationType, driverAllocatedCpuPointer, pMem, limitedGpuAddress, memSize,
321-
count, pool, multiOsContextCapable, uncacheable, flushL3Required);
319+
count, pool, uncacheable, flushL3Required);
322320

323321
if (heap == HeapIndex::HEAP_EXTERNAL) {
324322
memoryAllocation->setGpuBaseAddress(GmmHelper::canonize(gfxPartition->getHeapBase(heap)));

runtime/memory_manager/os_agnostic_memory_manager.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ class MemoryAllocation : public GraphicsAllocation {
2121
void setSharedHandle(osHandle handle) { sharingInfo.sharedHandle = handle; }
2222

2323
MemoryAllocation(AllocationType allocationType, void *cpuPtrIn, uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn,
24-
MemoryPool::Type pool, bool multiOsContextCapable)
25-
: GraphicsAllocation(allocationType, cpuPtrIn, gpuAddress, baseAddress, sizeIn, pool, multiOsContextCapable),
24+
MemoryPool::Type pool)
25+
: GraphicsAllocation(allocationType, cpuPtrIn, gpuAddress, baseAddress, sizeIn, pool),
2626
id(0), uncacheable(false) {}
2727

28-
MemoryAllocation(AllocationType allocationType, void *cpuPtrIn, size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool, bool multiOsContextCapable)
29-
: GraphicsAllocation(allocationType, cpuPtrIn, sizeIn, sharedHandleIn, pool, multiOsContextCapable),
28+
MemoryAllocation(AllocationType allocationType, void *cpuPtrIn, size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool)
29+
: GraphicsAllocation(allocationType, cpuPtrIn, sizeIn, sharedHandleIn, pool),
3030
id(0), uncacheable(false) {}
3131

3232
MemoryAllocation(AllocationType allocationType, void *driverAllocatedCpuPointer, void *pMem, uint64_t gpuAddress, size_t memSize,
33-
uint64_t count, MemoryPool::Type pool, bool multiOsContextCapable, bool uncacheable, bool flushL3Required)
34-
: GraphicsAllocation(allocationType, pMem, gpuAddress, 0u, memSize, pool, multiOsContextCapable),
33+
uint64_t count, MemoryPool::Type pool, bool uncacheable, bool flushL3Required)
34+
: GraphicsAllocation(allocationType, pMem, gpuAddress, 0u, memSize, pool),
3535
id(count), uncacheable(uncacheable) {
3636

3737
this->driverAllocatedCpuPointer = driverAllocatedCpuPointer;
@@ -79,7 +79,7 @@ class OsAgnosticMemoryManager : public MemoryManager {
7979
GraphicsAllocation *allocate32BitGraphicsMemoryImpl(const AllocationData &allocationData) override;
8080
GraphicsAllocation *allocateGraphicsMemoryInDevicePool(const AllocationData &allocationData, AllocationStatus &status) override;
8181
MemoryAllocation *createMemoryAllocation(GraphicsAllocation::AllocationType allocationType, void *driverAllocatedCpuPointer, void *pMem, uint64_t gpuAddress, size_t memSize,
82-
uint64_t count, MemoryPool::Type pool, bool multiOsContextCapable, bool uncacheable, bool flushL3Required, bool requireSpecificBitness);
82+
uint64_t count, MemoryPool::Type pool, bool uncacheable, bool flushL3Required, bool requireSpecificBitness);
8383

8484
private:
8585
unsigned long long counter = 0;

runtime/memory_manager/os_agnostic_memory_manager_allocate_in_device_pool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryInDevicePool(
2323
return nullptr;
2424
}
2525
uint64_t gpuAddress = reinterpret_cast<uint64_t>(allocationData.hostPtr);
26-
allocation = new MemoryAllocation(allocationData.type, cpuAllocation, cpuAllocation, gpuAddress, allocationData.size, counter++, MemoryPool::LocalMemory, false, false, false);
26+
allocation = new MemoryAllocation(allocationData.type, cpuAllocation, cpuAllocation, gpuAddress, allocationData.size, counter++, MemoryPool::LocalMemory, false, false);
2727
} else {
2828
allocation = allocateGraphicsMemory(allocationData);
2929
}

runtime/os_interface/linux/drm_allocation.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ using BufferObjects = std::array<BufferObject *, maxHandleCount>;
1919

2020
class DrmAllocation : public GraphicsAllocation {
2121
public:
22-
DrmAllocation(AllocationType allocationType, BufferObject *bo, void *ptrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool, bool multiOsContextCapable)
23-
: GraphicsAllocation(allocationType, ptrIn, sizeIn, sharedHandle, pool, multiOsContextCapable),
22+
DrmAllocation(AllocationType allocationType, BufferObject *bo, void *ptrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool)
23+
: GraphicsAllocation(allocationType, ptrIn, sizeIn, sharedHandle, pool),
2424
bufferObjects({{bo}}) {
2525
}
2626

27-
DrmAllocation(AllocationType allocationType, BufferObject *bo, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool::Type pool, bool multiOsContextCapable)
28-
: GraphicsAllocation(allocationType, ptrIn, gpuAddress, 0, sizeIn, pool, multiOsContextCapable),
27+
DrmAllocation(AllocationType allocationType, BufferObject *bo, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool::Type pool)
28+
: GraphicsAllocation(allocationType, ptrIn, gpuAddress, 0, sizeIn, pool),
2929
bufferObjects({{bo}}) {
3030
}
3131

32-
DrmAllocation(AllocationType allocationType, BufferObjects &bos, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool::Type pool, bool multiOsContextCapable)
33-
: GraphicsAllocation(allocationType, ptrIn, gpuAddress, 0, sizeIn, pool, multiOsContextCapable),
32+
DrmAllocation(AllocationType allocationType, BufferObjects &bos, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool::Type pool)
33+
: GraphicsAllocation(allocationType, ptrIn, gpuAddress, 0, sizeIn, pool),
3434
bufferObjects(bos) {
3535
}
3636

0 commit comments

Comments
 (0)