Allow debug flag to apply allocation alignment for heaps

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2022-08-29 13:30:21 +00:00
committed by Compute-Runtime-Automation
parent 841e536bc2
commit 4809a2a9b3
4 changed files with 34 additions and 6 deletions

View File

@@ -1393,10 +1393,24 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenSipKernelTypeWhenAllocatingTh
memoryManager->freeGraphicsMemory(sipAllocation);
}
TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenDebugVariableSetWhenAllocatingThenForceHeapAlignment) {
DebugManager.flags.ExperimentalEnableCustomLocalMemoryAlignment.set(static_cast<int32_t>(MemoryConstants::megaByte * 2));
const auto allocType = AllocationType::KERNEL_ISA_INTERNAL;
AllocationProperties properties = {rootDeviceIndex, 0x1000, allocType, device->getDeviceBitfield()};
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
EXPECT_TRUE(isAligned(allocation->getGpuAddress(), MemoryConstants::megaByte * 2));
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
memoryManager->freeGraphicsMemory(allocation);
}
using DrmMemoryManagerFailInjectionPrelimTest = Test<DrmMemoryManagerFixturePrelim>;
TEST_F(DrmMemoryManagerFailInjectionPrelimTest, givenEnabledLocalMemoryWhenNewFailsThenAllocateInDevicePoolReturnsStatusErrorAndNullallocation) {
mock->ioctl_expected.total = -1; //don't care
mock->ioctl_expected.total = -1; // don't care
class MockGfxPartition : public GfxPartition {
public:
MockGfxPartition() : GfxPartition(reservedCpuAddressRange) {