mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 08:53:55 +08:00
Revert "feature usm: allocate host / shared USM in HEAP_EXTENDED"
This reverts commit 2d0c61aa33.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
299985f15e
commit
7785a27f2f
@@ -1960,13 +1960,7 @@ DrmAllocation *DrmMemoryManager::createAllocWithAlignment(const AllocationData &
|
||||
|
||||
if (useBooMmap) {
|
||||
auto totalSizeToAlloc = alignedSize + alignment;
|
||||
uint64_t preferredAddress = 0;
|
||||
auto gfxPartition = getGfxPartition(allocationData.rootDeviceIndex);
|
||||
if (allocationData.flags.isUSMHostAllocation && gfxPartition->getHeapLimit(HeapIndex::HEAP_EXTENDED) > 0u) {
|
||||
preferredAddress = acquireGpuRange(totalSizeToAlloc, allocationData.rootDeviceIndex, HeapIndex::HEAP_EXTENDED);
|
||||
}
|
||||
|
||||
auto cpuPointer = this->mmapFunction(reinterpret_cast<void *>(preferredAddress), totalSizeToAlloc, PROT_NONE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
|
||||
auto cpuPointer = this->mmapFunction(0, totalSizeToAlloc, PROT_NONE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
|
||||
|
||||
auto cpuBasePointer = cpuPointer;
|
||||
cpuPointer = alignUp(cpuPointer, alignment);
|
||||
@@ -1976,7 +1970,6 @@ DrmAllocation *DrmMemoryManager::createAllocWithAlignment(const AllocationData &
|
||||
reinterpret_cast<uintptr_t>(cpuPointer), alignedSize, 0u, maxOsContextCount, -1));
|
||||
|
||||
if (!bo) {
|
||||
releaseGpuRange(reinterpret_cast<void *>(preferredAddress), totalSizeToAlloc, allocationData.rootDeviceIndex);
|
||||
this->munmapFunction(cpuBasePointer, totalSizeToAlloc);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -1985,7 +1978,6 @@ DrmAllocation *DrmMemoryManager::createAllocWithAlignment(const AllocationData &
|
||||
auto ioctlHelper = drm.getIoctlHelper();
|
||||
uint64_t mmapOffsetWb = ioctlHelper->getDrmParamValue(DrmParam::MmapOffsetWb);
|
||||
if (!retrieveMmapOffsetForBufferObject(allocationData.rootDeviceIndex, *bo, mmapOffsetWb, offset)) {
|
||||
releaseGpuRange(reinterpret_cast<void *>(preferredAddress), totalSizeToAlloc, allocationData.rootDeviceIndex);
|
||||
this->munmapFunction(cpuPointer, size);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -2001,7 +1993,6 @@ DrmAllocation *DrmMemoryManager::createAllocWithAlignment(const AllocationData &
|
||||
auto allocation = std::make_unique<DrmAllocation>(allocationData.rootDeviceIndex, allocationData.type, bo.get(), cpuPointer, canonizedGpuAddress, alignedSize, MemoryPool::System4KBPages);
|
||||
allocation->setMmapPtr(cpuPointer);
|
||||
allocation->setMmapSize(alignedSize);
|
||||
allocation->setReservedAddressRange(reinterpret_cast<void *>(preferredAddress), totalSizeToAlloc);
|
||||
if (pointerDiff != 0) {
|
||||
allocation->registerMemoryToUnmap(cpuBasePointer, pointerDiff, this->munmapFunction);
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ std::atomic<int> lseekCalledCount(0);
|
||||
std::atomic<int> closeInputFd(0);
|
||||
std::atomic<int> closeCalledCount(0);
|
||||
std::vector<void *> mmapVector(64);
|
||||
std::vector<void *> mmapCapturedExtendedPointers(64);
|
||||
bool captureExtendedPointers = false;
|
||||
|
||||
TestedDrmMemoryManager::TestedDrmMemoryManager(ExecutionEnvironment &executionEnvironment) : MemoryManagerCreate(gemCloseWorkerMode::gemCloseWorkerInactive,
|
||||
false,
|
||||
|
||||
@@ -20,16 +20,8 @@ extern std::atomic<int> lseekCalledCount;
|
||||
extern std::atomic<int> closeInputFd;
|
||||
extern std::atomic<int> closeCalledCount;
|
||||
extern std::vector<void *> mmapVector;
|
||||
extern std::vector<void *> mmapCapturedExtendedPointers;
|
||||
extern bool captureExtendedPointers;
|
||||
|
||||
inline void *mmapMock(void *addr, size_t length, int prot, int flags, int fd, off_t offset) noexcept {
|
||||
if (reinterpret_cast<uint64_t>(addr) > maxNBitValue(48)) {
|
||||
if (captureExtendedPointers) {
|
||||
mmapCapturedExtendedPointers.push_back(addr);
|
||||
}
|
||||
addr = nullptr;
|
||||
}
|
||||
if (addr) {
|
||||
return addr;
|
||||
}
|
||||
|
||||
@@ -6184,30 +6184,3 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenDrmMemoryManagerWhenGp
|
||||
EXPECT_GT(memoryManager->getGfxPartition(1)->getHeapLimit(HeapIndex::HEAP_STANDARD), gmmHelper->decanonize(addressRange.address));
|
||||
memoryManager->freeGpuAddress(addressRange, 1);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, given57bAddressSpaceWhenAllocatingHostUSMThenAddressFromExtendedHeapIsTaken) {
|
||||
if (defaultHwInfo->capabilityTable.gpuAddressSpace < maxNBitValue(57)) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
captureExtendedPointers = true;
|
||||
mmapCapturedExtendedPointers.clear();
|
||||
std::vector<MemoryRegion> regionInfo(1);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
|
||||
auto &drm = static_cast<DrmMockCustom &>(memoryManager->getDrm(mockRootDeviceIndex));
|
||||
drm.memoryInfo.reset(new MemoryInfo(regionInfo, drm));
|
||||
AllocationProperties allocationProperties(mockRootDeviceIndex, MemoryConstants::cacheLineSize, AllocationType::SVM_CPU, {});
|
||||
allocationProperties.flags.isUSMHostAllocation = true;
|
||||
auto hostUSM = memoryManager->allocateGraphicsMemoryInPreferredPool(allocationProperties, nullptr);
|
||||
captureExtendedPointers = false;
|
||||
EXPECT_NE(nullptr, hostUSM);
|
||||
|
||||
EXPECT_EQ(1u, mmapCapturedExtendedPointers.size());
|
||||
auto gpuAddress = reinterpret_cast<uint64_t>(mmapCapturedExtendedPointers[0]);
|
||||
mmapCapturedExtendedPointers.clear();
|
||||
auto gmmHelper = memoryManager->getGmmHelper(mockRootDeviceIndex);
|
||||
EXPECT_LE(memoryManager->getGfxPartition(mockRootDeviceIndex)->getHeapBase(HeapIndex::HEAP_EXTENDED), gmmHelper->decanonize(gpuAddress));
|
||||
EXPECT_GT(memoryManager->getGfxPartition(mockRootDeviceIndex)->getHeapLimit(HeapIndex::HEAP_EXTENDED), gmmHelper->decanonize(gpuAddress));
|
||||
|
||||
memoryManager->freeGraphicsMemory(hostUSM);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user