Revert "fix: support alignments in WSL2 device and shared memory allocation"

This reverts commit ae86635307.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2023-11-11 16:04:44 +01:00
committed by Compute-Runtime-Automation
parent 5e3cc2ca3b
commit b3a7f5dccb
2 changed files with 2 additions and 63 deletions

View File

@@ -236,7 +236,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryUsingKmdAndMapItToC
if (alignGpuAddressTo64KB) {
void *tempCPUPtr = cpuPtr;
cpuPtr = alignUp(cpuPtr, std::max(alignUp(allocationData.alignment, MemoryConstants::pageSize64k), MemoryConstants::pageSize64k));
cpuPtr = alignUp(cpuPtr, MemoryConstants::pageSize64k);
wddmAllocation->setGpuAddress(wddmAllocation->getGpuAddress() + ptrDiff(cpuPtr, tempCPUPtr));
}
}
@@ -1328,7 +1328,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryInDevicePool(const
alignment = MemoryConstants::pageSize64k;
sizeAligned = allocationData.imgInfo->size;
} else {
alignment = std::max(allocationData.alignment, alignmentSelector.selectAlignment(allocationData.size).alignment);
alignment = alignmentSelector.selectAlignment(allocationData.size).alignment;
sizeAligned = alignUp(allocationData.size, alignment);
if (singleBankAllocation) {

View File

@@ -370,36 +370,6 @@ TEST_F(WddmMemoryManagerTests, givenAllocateGraphicsMemoryUsingKmdAndMapItToCpuV
EXPECT_GT(reinterpret_cast<MockGmmClientContextBase *>(gmmHelper->getClientContext())->freeGpuVirtualAddressCalled, 0u);
}
TEST_F(WddmMemoryManagerTests, givenAllocateGraphicsMemoryUsingKmdAndMapItToCpuVAWhenCreatingSVMAllocationThenAllocationIsAligned) {
if constexpr (is32bit) {
GTEST_SKIP();
}
NEO::AllocationData allocData{};
allocData.flags.allocateMemory = 1;
allocData.flags.useSystemMemory = 1;
allocData.type = NEO::AllocationType::SVM_CPU;
allocData.usmInitialPlacement = NEO::GraphicsAllocation::DEFAULT;
allocData.allocationMethod = NEO::GfxMemoryAllocationMethod::AllocateByKmd;
allocData.size = 1;
allocData.forceKMDAllocation = true;
allocData.makeGPUVaDifferentThanCPUPtr = true;
allocData.useMmapObject = true;
memoryManager->callBaseAllocateGraphicsMemoryUsingKmdAndMapItToCpuVA = true;
size_t alignment = 8 * MemoryConstants::megaByte;
do {
alignment >>= 1;
allocData.alignment = alignment;
auto allocation = memoryManager->allocateGraphicsMemoryUsingKmdAndMapItToCpuVA(allocData, false);
const auto cpuPtr = allocation->getUnderlyingBuffer();
EXPECT_NE(nullptr, cpuPtr);
if (alignment != 0) {
EXPECT_EQ(reinterpret_cast<uintptr_t>(cpuPtr) & (~(alignment - 1)), reinterpret_cast<uintptr_t>(cpuPtr));
}
memoryManager->freeGraphicsMemory(allocation);
} while (alignment != 0);
}
TEST_F(WddmMemoryManagerAllocPathTests, givenAllocateGraphicsMemoryUsingKmdAndMapItToCpuVAWhen32bitThenProperAddressSet) {
if constexpr (is64bit) {
GTEST_SKIP();
@@ -1680,37 +1650,6 @@ TEST_F(WddmMemoryManagerSimpleTest, whenAlignmentRequirementExceedsPageSizeThenA
}
}
TEST_F(WddmMemoryManagerSimpleTest, givenAlignmentWhenAllocatingGraphicsMemoryInDevicePoolThenTheAllocationIsAligned) {
const bool enable64kbPages = false;
const bool localMemoryEnabled = true;
memoryManager = std::make_unique<MockWddmMemoryManager>(enable64kbPages, localMemoryEnabled, executionEnvironment);
AllocationData allocData{};
allocData.flags.allocateMemory = 1;
allocData.flags.allow64kbPages = 1;
allocData.flags.allow32Bit = 1;
allocData.flags.shareable = 1;
allocData.flags.isUSMDeviceMemory = 1;
allocData.type = NEO::AllocationType::BUFFER;
allocData.usmInitialPlacement = NEO::GraphicsAllocation::DEFAULT;
allocData.allocationMethod = NEO::GfxMemoryAllocationMethod::AllocateByKmd;
allocData.size = 1;
allocData.useMmapObject = true;
size_t alignment = 8 * MemoryConstants::megaByte;
do {
alignment >>= 1;
allocData.alignment = alignment;
auto status = MemoryManager::AllocationStatus::Error;
auto allocation = memoryManager->allocateGraphicsMemoryInDevicePool(allocData, status);
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
EXPECT_NE(nullptr, allocation);
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
EXPECT_LE(alignment, allocation->getUnderlyingBufferSize());
memoryManager->freeGraphicsMemory(allocation);
} while (alignment != 0);
}
TEST_F(WddmMemoryManagerSimpleTest, givenUseSystemMemorySetToTrueWhenAllocateInDevicePoolIsCalledThenNullptrIsReturned) {
memoryManager.reset(new MockWddmMemoryManager(false, false, executionEnvironment));
MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Success;