Revert "fix: use full size for HEAP_EXTENDED initialization"

This reverts commit 5afc63df93.

Related-To: GSD-8948
Signed-off-by: Jaroslaw Warchulski <jaroslaw.warchulski@intel.com>
This commit is contained in:
Jaroslaw Warchulski
2024-10-22 18:15:13 +00:00
committed by Compute-Runtime-Automation
parent 45e78fea76
commit 2ba5ee2f6b
5 changed files with 21 additions and 13 deletions

View File

@@ -102,15 +102,14 @@ GfxPartition::~GfxPartition() {
osMemory->releaseCpuAddressRange(reservedCpuAddressRangeForHeapExtended);
}
void GfxPartition::Heap::init(HeapIndex heapIndex, uint64_t base, uint64_t size, size_t allocationAlignment) {
void GfxPartition::Heap::init(uint64_t base, uint64_t size, size_t allocationAlignment) {
this->base = base;
this->size = size;
auto heapGranularity = GfxPartition::heapGranularity;
if (heapIndex == HeapIndex::heapExtended)
heapGranularity = 0;
else if (allocationAlignment > heapGranularity)
if (allocationAlignment > heapGranularity) {
heapGranularity = GfxPartition::heapGranularity2MB;
}
// Exclude very first and very last 64K from GPU address range allocation
if (size > 2 * heapGranularity) {

View File

@@ -42,11 +42,11 @@ class GfxPartition {
MOCKABLE_VIRTUAL bool init(uint64_t gpuAddressSpace, size_t cpuAddressRangeSizeToReserve, uint32_t rootDeviceIndex, size_t numRootDevices, bool useExternalFrontWindowPool, uint64_t systemMemorySize, uint64_t gfxTop);
void heapInit(HeapIndex heapIndex, uint64_t base, uint64_t size) {
getHeap(heapIndex).init(heapIndex, base, size, MemoryConstants::pageSize);
getHeap(heapIndex).init(base, size, MemoryConstants::pageSize);
}
void heapInitWithAllocationAlignment(HeapIndex heapIndex, uint64_t base, uint64_t size, size_t allocationAlignment) {
getHeap(heapIndex).init(heapIndex, base, size, allocationAlignment);
getHeap(heapIndex).init(base, size, allocationAlignment);
}
void heapInitExternalWithFrontWindow(HeapIndex heapIndex, uint64_t base, uint64_t size) {
@@ -109,7 +109,7 @@ class GfxPartition {
class Heap {
public:
Heap() = default;
void init(HeapIndex heapIndex, uint64_t base, uint64_t size, size_t allocationAlignment);
void init(uint64_t base, uint64_t size, size_t allocationAlignment);
void initExternalWithFrontWindow(uint64_t base, uint64_t size);
void initWithFrontWindow(uint64_t base, uint64_t size, uint64_t frontWindowSize);
void initFrontWindow(uint64_t base, uint64_t size);

View File

@@ -68,7 +68,7 @@ class MockGfxPartition : public GfxPartition {
}
}
void initHeap(HeapIndex heapIndex, uint64_t base, uint64_t size, size_t allocationAlignment) {
getHeap(heapIndex).init(heapIndex, base, size, allocationAlignment);
getHeap(heapIndex).init(base, size, allocationAlignment);
}
uint32_t freeGpuAddressRangeCalled = 0u;

View File

@@ -876,7 +876,7 @@ HWTEST2_F(MemoryManagerDirectSubmissionImplicitScalingTest, givenDirectSubmissio
}
}
TEST(MemoryManagerTest, givenDebugVariableToToggleGpuVaBitsWhenAllocatingResourceInHeapExtendedThenCorrectGpuVaIsSet) {
TEST(MemoryManagerTest, givenDebugVariableToToggleGpuVaBitsWhenAllocatingResourceInHeapExtendedThenSpecificBitIsToggled) {
if (defaultHwInfo->capabilityTable.gpuAddressSpace < maxNBitValue(57)) {
GTEST_SKIP();
}
@@ -905,7 +905,10 @@ TEST(MemoryManagerTest, givenDebugVariableToToggleGpuVaBitsWhenAllocatingResourc
ASSERT_NE(nullptr, allocation);
auto gpuVA = allocation->getGpuAddress();
EXPECT_EQ(gpuVA, 0xff0000ffffff0000);
EXPECT_TRUE(isBitSet(gpuVA, 56));
EXPECT_FALSE(isBitSet(gpuVA, 55));
EXPECT_TRUE(isBitSet(gpuVA, 32));
memoryManager.freeGraphicsMemory(allocation);
}
@@ -916,7 +919,10 @@ TEST(MemoryManagerTest, givenDebugVariableToToggleGpuVaBitsWhenAllocatingResourc
ASSERT_NE(nullptr, allocation);
auto gpuVA = allocation->getGpuAddress();
EXPECT_EQ(gpuVA, 0xff8000fffffe0000);
EXPECT_TRUE(isBitSet(gpuVA, 56));
EXPECT_TRUE(isBitSet(gpuVA, 55));
EXPECT_TRUE(isBitSet(gpuVA, 32));
memoryManager.freeGraphicsMemory(allocation);
}
@@ -928,7 +934,10 @@ TEST(MemoryManagerTest, givenDebugVariableToToggleGpuVaBitsWhenAllocatingResourc
ASSERT_NE(nullptr, allocation);
auto gpuVA = allocation->getGpuAddress();
EXPECT_EQ(gpuVA, 0xff0000fefffd0000);
EXPECT_TRUE(isBitSet(gpuVA, 56));
EXPECT_FALSE(isBitSet(gpuVA, 55));
EXPECT_FALSE(isBitSet(gpuVA, 32));
memoryManager.freeGraphicsMemory(allocation);
}

View File

@@ -6722,7 +6722,7 @@ struct DrmMemoryManagerLocalMemoryAlignmentTest : DrmMemoryManagerWithLocalMemor
bool isAllocationWithinHeap(MemoryManager &memoryManager, const GraphicsAllocation &allocation, HeapIndex heap) {
const auto allocationStart = allocation.getGpuAddress();
const auto allocationEnd = allocationStart + allocation.getUnderlyingBufferSize() - 1;
const auto allocationEnd = allocationStart + allocation.getUnderlyingBufferSize();
const auto gmmHelper = device->getGmmHelper();
const auto heapStart = gmmHelper->canonize(memoryManager.getGfxPartition(rootDeviceIndex)->getHeapBase(heap));
const auto heapEnd = gmmHelper->canonize(memoryManager.getGfxPartition(rootDeviceIndex)->getHeapLimit(heap));