Skip to content

Commit b937b54

Browse files
Remove 32 bit code.
- Enable local memory in 32 bit scenarios. Change-Id: I091570a3d0aa6043febf2721480196425e058978 Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
1 parent 102bceb commit b937b54

File tree

12 files changed

+20
-35
lines changed

12 files changed

+20
-35
lines changed

core/memory_manager/gfx_partition.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ enum class HeapIndex : uint32_t {
2727
TOTAL_HEAPS
2828
};
2929

30-
constexpr auto internalHeapIndex = is32bit ? HeapIndex::HEAP_INTERNAL : HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY;
31-
3230
class GfxPartition {
3331
public:
3432
GfxPartition();

runtime/dll/windows/os_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
#include "core/memory_manager/memory_constants.h"
1111
namespace NEO {
1212

13-
bool OSInterface::osEnableLocalMemory = true && is64bit;
13+
bool OSInterface::osEnableLocalMemory = true;
1414

1515
} // namespace NEO

runtime/memory_manager/memory_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ void MemoryManager::unlockResource(GraphicsAllocation *graphicsAllocation) {
429429
HeapIndex MemoryManager::selectHeap(const GraphicsAllocation *allocation, bool hasPointer, bool isFullRangeSVM) {
430430
if (allocation) {
431431
if (useInternal32BitAllocator(allocation->getAllocationType())) {
432-
return internalHeapIndex;
432+
return HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY;
433433
}
434434
if (allocation->is32BitAllocation()) {
435435
return HeapIndex::HEAP_EXTERNAL;

runtime/memory_manager/memory_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class MemoryManager {
103103
virtual uint64_t getLocalMemorySize() = 0;
104104

105105
uint64_t getMaxApplicationAddress() { return is64bit ? MemoryConstants::max64BitAppAddress : MemoryConstants::max32BitAppAddress; };
106-
uint64_t getInternalHeapBaseAddress(uint32_t rootDeviceIndex) { return getGfxPartition(rootDeviceIndex)->getHeapBase(internalHeapIndex); }
106+
uint64_t getInternalHeapBaseAddress(uint32_t rootDeviceIndex) { return getGfxPartition(rootDeviceIndex)->getHeapBase(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY); }
107107
uint64_t getExternalHeapBaseAddress(uint32_t rootDeviceIndex) { return getGfxPartition(rootDeviceIndex)->getHeapBase(HeapIndex::HEAP_EXTERNAL); }
108108

109109
bool isLimitedRange(uint32_t rootDeviceIndex) { return getGfxPartition(rootDeviceIndex)->isLimitedRange(); }

runtime/memory_manager/os_agnostic_memory_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemory64kb(const Al
104104
}
105105

106106
GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemoryImpl(const AllocationData &allocationData) {
107-
auto heap = useInternal32BitAllocator(allocationData.type) ? internalHeapIndex : HeapIndex::HEAP_EXTERNAL;
107+
auto heap = useInternal32BitAllocator(allocationData.type) ? HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY : HeapIndex::HEAP_EXTERNAL;
108108
auto gfxPartition = getGfxPartition(allocationData.rootDeviceIndex);
109109
if (allocationData.hostPtr) {
110110
auto allocationSize = alignSizeWholePage(allocationData.hostPtr, allocationData.size);

runtime/os_interface/linux/drm_memory_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForImageImpl(const A
305305

306306
DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemoryImpl(const AllocationData &allocationData) {
307307
auto internal = useInternal32BitAllocator(allocationData.type);
308-
auto allocatorToUse = internal ? internalHeapIndex : HeapIndex::HEAP_EXTERNAL;
308+
auto allocatorToUse = internal ? HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY : HeapIndex::HEAP_EXTERNAL;
309309

310310
if (allocationData.hostPtr) {
311311
uintptr_t inputPtr = reinterpret_cast<uintptr_t>(allocationData.hostPtr);

unit_tests/libult/os_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
namespace NEO {
1313

14-
bool OSInterface::osEnableLocalMemory = true && is64bit;
14+
bool OSInterface::osEnableLocalMemory = true;
1515

1616
} // namespace NEO

unit_tests/memory_manager/memory_manager_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,13 +1797,13 @@ TEST(MemoryManagerTest, givenAllocationTypesThatMayNeedL3FlushWhenCallingGetAllo
17971797
TEST(HeapSelectorTest, given32bitInternalAllocationWhenSelectingHeapThenInternalHeapIsUsed) {
17981798
GraphicsAllocation allocation{0, GraphicsAllocation::AllocationType::KERNEL_ISA, nullptr, 0, 0, 0, MemoryPool::MemoryNull};
17991799
allocation.set32BitAllocation(true);
1800-
EXPECT_EQ(internalHeapIndex, MemoryManager::selectHeap(&allocation, false, false));
1800+
EXPECT_EQ(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY, MemoryManager::selectHeap(&allocation, false, false));
18011801
}
18021802

18031803
TEST(HeapSelectorTest, givenNon32bitInternalAllocationWhenSelectingHeapThenInternalHeapIsUsed) {
18041804
GraphicsAllocation allocation{0, GraphicsAllocation::AllocationType::KERNEL_ISA, nullptr, 0, 0, 0, MemoryPool::MemoryNull};
18051805
allocation.set32BitAllocation(false);
1806-
EXPECT_EQ(internalHeapIndex, MemoryManager::selectHeap(&allocation, false, false));
1806+
EXPECT_EQ(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY, MemoryManager::selectHeap(&allocation, false, false));
18071807
}
18081808

18091809
TEST(HeapSelectorTest, given32bitExternalAllocationWhenSelectingHeapThenExternalHeapIsUsed) {

unit_tests/os_interface/linux/drm_memory_manager_tests.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -907,10 +907,10 @@ TEST_F(DrmMemoryManagerTest, givenMemoryManagerWhenLimitedRangeAllocatorSetThenH
907907
EXPECT_GT(memoryManager->getGfxPartition(0)->getHeapLimit(HeapIndex::HEAP_STANDARD), gpuAddressLimitedRange + sizeBig);
908908
EXPECT_EQ(memoryManager->getGfxPartition(0)->getHeapMinimalAddress(HeapIndex::HEAP_STANDARD), gpuAddressLimitedRange);
909909

910-
auto gpuInternal32BitAlloc = memoryManager->getGfxPartition(0)->heapAllocate(internalHeapIndex, sizeBig);
911-
EXPECT_LT(memoryManager->getGfxPartition(0)->getHeapBase(internalHeapIndex), gpuInternal32BitAlloc);
912-
EXPECT_GT(memoryManager->getGfxPartition(0)->getHeapLimit(internalHeapIndex), gpuInternal32BitAlloc + sizeBig);
913-
EXPECT_EQ(memoryManager->getGfxPartition(0)->getHeapMinimalAddress(internalHeapIndex), gpuInternal32BitAlloc);
910+
auto gpuInternal32BitAlloc = memoryManager->getGfxPartition(0)->heapAllocate(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY, sizeBig);
911+
EXPECT_LT(memoryManager->getGfxPartition(0)->getHeapBase(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY), gpuInternal32BitAlloc);
912+
EXPECT_GT(memoryManager->getGfxPartition(0)->getHeapLimit(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY), gpuInternal32BitAlloc + sizeBig);
913+
EXPECT_EQ(memoryManager->getGfxPartition(0)->getHeapMinimalAddress(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY), gpuInternal32BitAlloc);
914914
}
915915

916916
TEST_F(DrmMemoryManagerTest, givenMemoryManagerWhenAskedForAllocationWithAlignmentAndLimitedRangeAllocatorSetAndAcquireGpuRangeFailsThenNullIsReturned) {
@@ -1088,7 +1088,7 @@ TEST_F(DrmMemoryManagerTest, Given32BitDeviceWithMemoryManagerWhenInternalHeapIs
10881088
std::unique_ptr<Device> pDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
10891089

10901090
size_t size = MemoryConstants::pageSize64k;
1091-
auto alloc = memoryManager->getGfxPartition(0)->heapAllocate(internalHeapIndex, size);
1091+
auto alloc = memoryManager->getGfxPartition(0)->heapAllocate(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY, size);
10921092
EXPECT_NE(0llu, alloc);
10931093

10941094
size_t allocationSize = 4 * GB;
@@ -2379,7 +2379,7 @@ TEST_F(DrmMemoryManagerBasic, givenDefaultDrmMemoryManagerWhenItIsQueriedForInte
23792379
true,
23802380
true,
23812381
executionEnvironment));
2382-
auto heapBase = memoryManager->getGfxPartition(0)->getHeapBase(internalHeapIndex);
2382+
auto heapBase = memoryManager->getGfxPartition(0)->getHeapBase(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY);
23832383
EXPECT_EQ(heapBase, memoryManager->getInternalHeapBaseAddress(0));
23842384
}
23852385

unit_tests/os_interface/windows/wddm20_tests.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ TEST_F(Wddm20Tests, givenGraphicsAllocationWhenItIsMappedInHeap0ThenItHasGpuAddr
307307
size_t alignedSize = 0x2000;
308308
std::unique_ptr<Gmm> gmm(GmmHelperFunctions::getGmm(alignedPtr, alignedSize));
309309
uint64_t gpuAddress = 0u;
310-
auto heapBase = wddm->getGfxPartition().Heap32[static_cast<uint32_t>(internalHeapIndex)].Base;
311-
auto heapLimit = wddm->getGfxPartition().Heap32[static_cast<uint32_t>(internalHeapIndex)].Limit;
310+
auto heapBase = wddm->getGfxPartition().Heap32[static_cast<uint32_t>(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY)].Base;
311+
auto heapLimit = wddm->getGfxPartition().Heap32[static_cast<uint32_t>(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY)].Limit;
312312

313313
bool ret = wddm->mapGpuVirtualAddress(gmm.get(), ALLOCATION_HANDLE, heapBase, heapLimit, 0u, gpuAddress);
314314
EXPECT_TRUE(ret);
@@ -1022,19 +1022,6 @@ TEST_F(WddmLockWithMakeResidentTests, whenAlllocationNeedsBlockingMakeResidentBe
10221022
EXPECT_EQ(1u, wddm->lockResult.uint64ParamPassed);
10231023
memoryManager.unlockResource(&allocation);
10241024
}
1025-
1026-
TEST(WddmInternalHeapTest, whenConfigurationIs64BitThenInternalHeapIndexIsHeapInternalDeviceMemory) {
1027-
if (is64bit) {
1028-
EXPECT_EQ(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY, internalHeapIndex);
1029-
}
1030-
}
1031-
1032-
TEST(WddmInternalHeapTest, whenConfigurationIs32BitThenInternalHeapIndexIsHeapInternal) {
1033-
if (is32bit) {
1034-
EXPECT_EQ(HeapIndex::HEAP_INTERNAL, internalHeapIndex);
1035-
}
1036-
}
1037-
10381025
using WddmGfxPartitionTest = Wddm20Tests;
10391026

10401027
TEST_F(WddmGfxPartitionTest, initGfxPartition) {

0 commit comments

Comments
 (0)