Skip to content

Commit 3ed2823

Browse files
Revert "Always reserve 48 bit window on 57 bit CPU"
This reverts commit 8f10db0c7ff13a72526141269ad09142a5d74e5f. Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
1 parent 60c9bbe commit 3ed2823

File tree

4 files changed

+5
-35
lines changed

4 files changed

+5
-35
lines changed

opencl/test/unit_test/memory_manager/gfx_partition_tests.inl

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,11 @@
99
#include "shared/source/helpers/basic_math.h"
1010
#include "shared/source/helpers/ptr_math.h"
1111
#include "shared/source/os_interface/os_memory.h"
12-
#include "shared/source/utilities/cpu_info.h"
1312

1413
#include "opencl/test/unit_test/mocks/mock_gfx_partition.h"
1514

1615
#include "gtest/gtest.h"
1716

18-
// CpuInfo is a singleton object so we have to patch it in place
19-
class CpuInfoOverrideCpuVirtualAddressSize {
20-
public:
21-
class MockCpuInfo : public CpuInfo {
22-
public:
23-
using CpuInfo::virtualAddressSize;
24-
} *mockCpuInfo = reinterpret_cast<MockCpuInfo *>(const_cast<CpuInfo *>(&CpuInfo::getInstance()));
25-
CpuInfoOverrideCpuVirtualAddressSize(uint32_t newCpuVirtualAddressSize) {
26-
virtualAddressSizeSave = mockCpuInfo->getVirtualAddressSize();
27-
mockCpuInfo->virtualAddressSize = newCpuVirtualAddressSize;
28-
}
29-
~CpuInfoOverrideCpuVirtualAddressSize() {
30-
mockCpuInfo->virtualAddressSize = virtualAddressSizeSave;
31-
}
32-
uint32_t virtualAddressSizeSave = 0;
33-
};
34-
3517
using namespace NEO;
3618

3719
constexpr size_t reservedCpuAddressRangeSize = is64bit ? (6 * 4 * GB) : 0;
@@ -159,16 +141,6 @@ TEST(GfxPartitionTest, testGfxPartitionUnsupportedRange) {
159141
EXPECT_FALSE(gfxPartition.init(maxNBitValue(48 + 1), reservedCpuAddressRangeSize, 0, 1));
160142
}
161143

162-
TEST(GfxPartitionTest, testGfxPartitionUnsupportedCpuVirualAddressSize) {
163-
if (is32bit) {
164-
GTEST_SKIP();
165-
}
166-
167-
CpuInfoOverrideCpuVirtualAddressSize overrideCpuVirtualAddressSize(48 + 1);
168-
MockGfxPartition gfxPartition;
169-
EXPECT_FALSE(gfxPartition.init(maxNBitValue(48), reservedCpuAddressRangeSize, 0, 1));
170-
}
171-
172144
TEST(GfxPartitionTest, testGfxPartitionFullRange48BitSVMHeap64KBSplit) {
173145
uint32_t rootDeviceIndex = 3;
174146
size_t numRootDevices = 5;
@@ -358,4 +330,4 @@ TEST(GfxPartitionTest, givenInternalHeapWhenAllocatingSmallOrBigChunkThenAddress
358330
EXPECT_EQ(gfxPartition.getHeapBase(heaps[i]) + GfxPartition::internalFrontWindowPoolSize, address);
359331
gfxPartition.heapFree(heaps[i], address, sizeToAlloc);
360332
}
361-
}
333+
}

shared/source/memory_manager/gfx_partition.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "shared/source/helpers/aligned_memory.h"
1111
#include "shared/source/helpers/heap_assigner.h"
1212
#include "shared/source/memory_manager/memory_manager.h"
13-
#include "shared/source/utilities/cpu_info.h"
1413

1514
namespace NEO {
1615

@@ -139,8 +138,7 @@ bool GfxPartition::init(uint64_t gpuAddressSpace, size_t cpuAddressRangeSizeToRe
139138
gfxBase = maxNBitValue(32) + 1;
140139
heapInit(HeapIndex::HEAP_SVM, 0ull, gfxBase);
141140
} else {
142-
auto cpuVirtualAddressSize = CpuInfo::getInstance().getVirtualAddressSize();
143-
if (cpuVirtualAddressSize == 48 && gpuAddressSpace == maxNBitValue(48)) {
141+
if (gpuAddressSpace == maxNBitValue(48)) {
144142
gfxBase = maxNBitValue(48 - 1) + 1;
145143
heapInit(HeapIndex::HEAP_SVM, 0ull, gfxBase);
146144
} else if (gpuAddressSpace == maxNBitValue(47)) {
@@ -163,7 +161,7 @@ bool GfxPartition::init(uint64_t gpuAddressSpace, size_t cpuAddressRangeSizeToRe
163161
gfxBase = 0ull;
164162
heapInit(HeapIndex::HEAP_SVM, 0ull, 0ull);
165163
} else {
166-
if (!initAdditionalRange(cpuVirtualAddressSize, gpuAddressSpace, gfxBase, gfxTop, rootDeviceIndex, numRootDevices)) {
164+
if (!initAdditionalRange(gpuAddressSpace, gfxBase, gfxTop, rootDeviceIndex, numRootDevices)) {
167165
return false;
168166
}
169167
}

shared/source/memory_manager/gfx_partition.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class GfxPartition {
107107
static const std::array<HeapIndex, 7> heapNonSvmNames;
108108

109109
protected:
110-
bool initAdditionalRange(uint32_t cpuAddressWidth, uint64_t gpuAddressSpace, uint64_t &gfxBase, uint64_t &gfxTop, uint32_t rootDeviceIndex, size_t numRootDevices);
110+
bool initAdditionalRange(uint64_t gpuAddressSpace, uint64_t &gfxBase, uint64_t &gfxTop, uint32_t rootDeviceIndex, size_t numRootDevices);
111111

112112
class Heap {
113113
public:

shared/source/memory_manager/gfx_partition_init_additional_range.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace NEO {
1111

12-
bool GfxPartition::initAdditionalRange(uint32_t cpuVirtualAddressSize, uint64_t gpuAddressSpace, uint64_t &gfxBase, uint64_t &gfxTop, uint32_t rootDeviceIndex, size_t numRootDevices) {
12+
bool GfxPartition::initAdditionalRange(uint64_t gpuAddressSpace, uint64_t &gfxBase, uint64_t &gfxTop, uint32_t rootDeviceIndex, size_t numRootDevices) {
1313
return false;
1414
}
1515

0 commit comments

Comments
 (0)