mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Add debug flag to control alignment.
Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
c06ddfc7b8
commit
d9762c0337
@ -303,6 +303,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, SplitBcsCopy, -1, "-1: default, 0:disabled, 1: e
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, SplitBcsMask, 0, "0: default, >0: bitmask: indicates bcs engines for split")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, ReuseKernelBinaries, -1, "-1: default, 0:disabled, 1: enabled. If enabled, driver reuses kernel binaries.")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, SetAmountOfReusableAllocations, -1, "-1: default, 0:disabled, > 1: enabled. If enabled, driver will fill reusable allocation lists with given amount of command buffers and heaps at initialization of immediate command list.")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, UseHighAlignmentForHeapExtended, -1, "-1: default, 0:disabled, > 1: enabled. If enabled, driver aligns HEAP_EXTENDED allocations to GPU VA that is next power of 2 for a given size, if disables GPU VA is using 2MB/64KB alignment.")
|
||||
|
||||
/*DIRECT SUBMISSION FLAGS*/
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, EnableDirectSubmission, -1, "-1: default (disabled), 0: disable, 1:enable. Enables direct submission of command buffers bypassing KMD")
|
||||
|
@ -1364,7 +1364,15 @@ uint64_t getGpuAddress(const AlignmentSelector &alignmentSelector, HeapAssigner
|
||||
default:
|
||||
AlignmentSelector::CandidateAlignment alignment = alignmentSelector.selectAlignment(sizeAllocated);
|
||||
if (gfxPartition->getHeapLimit(HeapIndex::HEAP_EXTENDED) > 0 && !resource48Bit) {
|
||||
alignment.alignment = Math::nextPowerOfTwo(sizeAllocated);
|
||||
auto alignSize = true;
|
||||
if (DebugManager.flags.UseHighAlignmentForHeapExtended.get() != -1) {
|
||||
alignSize = !!DebugManager.flags.UseHighAlignmentForHeapExtended.get();
|
||||
}
|
||||
|
||||
if (alignSize) {
|
||||
alignment.alignment = Math::nextPowerOfTwo(sizeAllocated);
|
||||
}
|
||||
|
||||
alignment.heap = HeapIndex::HEAP_EXTENDED;
|
||||
}
|
||||
gpuAddress = gmmHelper.canonize(gfxPartition->heapAllocateWithCustomAlignment(alignment.heap, sizeAllocated, alignment.alignment));
|
||||
|
@ -481,3 +481,4 @@ ExperimentalSmallBufferPoolAllocator = -1
|
||||
ForceZeDeviceCanAccessPerReturnValue = -1
|
||||
AdjustThreadGroupDispatchSize = -1
|
||||
ForceNonblockingExecbufferCalls = -1
|
||||
UseHighAlignmentForHeapExtended = -1
|
@ -5069,6 +5069,40 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenHeapExte
|
||||
memoryManager->freeGraphicsMemory(allocation2);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenDebugVariableToDisableAddressAlignmentWhenAllocationsAreMadeTheyAreAlignedTo2MB) {
|
||||
if (!memoryManager->getGfxPartition(rootDeviceIndex)->getHeapLimit(HeapIndex::HEAP_EXTENDED)) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseHighAlignmentForHeapExtended.set(0);
|
||||
|
||||
auto size = 16 * MemoryConstants::megaByte;
|
||||
|
||||
auto status = MemoryManager::AllocationStatus::Error;
|
||||
AllocationData allocData;
|
||||
allocData.size = size;
|
||||
allocData.type = AllocationType::BUFFER;
|
||||
allocData.rootDeviceIndex = rootDeviceIndex;
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryInDevicePool(allocData, status);
|
||||
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(allocData.size, allocation->getUnderlyingBufferSize());
|
||||
EXPECT_EQ(allocData.size, static_cast<DrmAllocation *>(allocation)->getBO()->peekSize());
|
||||
EXPECT_TRUE(allocation->getGpuAddress() % MemoryConstants::pageSize2Mb == 0u);
|
||||
|
||||
size = 32 * MemoryConstants::megaByte;
|
||||
allocData.size = size;
|
||||
auto allocation2 = memoryManager->allocateGraphicsMemoryInDevicePool(allocData, status);
|
||||
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
|
||||
ASSERT_NE(nullptr, allocation2);
|
||||
EXPECT_EQ(allocData.size, allocation2->getUnderlyingBufferSize());
|
||||
EXPECT_EQ(allocData.size, static_cast<DrmAllocation *>(allocation2)->getBO()->peekSize());
|
||||
EXPECT_TRUE(allocation2->getGpuAddress() % MemoryConstants::pageSize2Mb == 0u);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
memoryManager->freeGraphicsMemory(allocation2);
|
||||
}
|
||||
|
||||
struct DrmMemoryManagerToTestCopyMemoryToAllocationBanks : public DrmMemoryManager {
|
||||
DrmMemoryManagerToTestCopyMemoryToAllocationBanks(ExecutionEnvironment &executionEnvironment, size_t lockableLocalMemorySize)
|
||||
: DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerInactive, false, false, executionEnvironment) {
|
||||
|
Reference in New Issue
Block a user