mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
Fix calculating maxMemAllocSize
Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
f293b409ff
commit
42c5f2235b
@@ -503,8 +503,8 @@ TEST_F(DeviceGetCapsTest, givenDeviceCapsWhenLocalMemoryIsEnabledThenCalculateGl
|
||||
TEST_F(DeviceGetCapsTest, givenGlobalMemSizeAndSharedSystemAllocationsNotSupportedWhenCalculatingMaxAllocSizeThenAdjustToHWCap) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.EnableSharedSystemUsmSupport.set(0);
|
||||
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
const auto &caps = device->getDeviceInfo();
|
||||
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
const auto &caps = device->getSharedDeviceInfo();
|
||||
|
||||
HardwareCapabilities hwCaps = {0};
|
||||
auto &hwHelper = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
|
||||
@@ -515,18 +515,13 @@ TEST_F(DeviceGetCapsTest, givenGlobalMemSizeAndSharedSystemAllocationsNotSupport
|
||||
EXPECT_EQ(caps.maxMemAllocSize, expectedSize);
|
||||
}
|
||||
|
||||
TEST_F(DeviceGetCapsTest, givenGlobalMemSizeAndSharedSystemAllocationsSupportedWhenCalculatingMaxAllocSizeThenAdjustToGlobalMemSize) {
|
||||
TEST_F(DeviceGetCapsTest, givenGlobalMemSizeAndSharedSystemAllocationsSupportedWhenCalculatingMaxAllocSizeThenEqualsToGlobalMemSize) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.EnableSharedSystemUsmSupport.set(1);
|
||||
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
const auto &caps = device->getDeviceInfo();
|
||||
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
const auto &caps = device->getSharedDeviceInfo();
|
||||
|
||||
HardwareCapabilities hwCaps = {0};
|
||||
auto &hwHelper = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
|
||||
hwHelper.setupHardwareCapabilities(&hwCaps, *defaultHwInfo);
|
||||
|
||||
uint64_t expectedSize = std::max((caps.globalMemSize / 2), static_cast<uint64_t>(128ULL * MemoryConstants::megaByte));
|
||||
EXPECT_EQ(caps.maxMemAllocSize, expectedSize);
|
||||
EXPECT_EQ(caps.maxMemAllocSize, caps.globalMemSize);
|
||||
}
|
||||
|
||||
TEST_F(DeviceGetCapsTest, whenDriverModelHasLimitationForMaxMemoryAllocationSizeThenTakeItIntoAccount) {
|
||||
@@ -1732,3 +1727,23 @@ HWTEST_F(DeviceGetCapsTest, givenDSSCountEqualZeroWhenDeviceCreatedThenMaxEuPerD
|
||||
|
||||
EXPECT_EQ(device->sharedDeviceInfo.maxNumEUsPerSubSlice, device->sharedDeviceInfo.maxNumEUsPerDualSubSlice);
|
||||
}
|
||||
|
||||
TEST_F(DeviceGetCapsTest, givenGlobalMemSizeAndSharedSystemAllocationSupportWhenReduceMaxMemAllocSizeThenValidValueIsSet) {
|
||||
HardwareCapabilities hwCaps = {0};
|
||||
auto &hwHelper = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
|
||||
hwHelper.setupHardwareCapabilities(&hwCaps, *defaultHwInfo);
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
|
||||
DebugManager.flags.EnableSharedSystemUsmSupport.set(0);
|
||||
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
auto globalMemSize = device->getSharedDeviceInfo().globalMemSize;
|
||||
device->getDevice().reduceMaxMemAllocSize();
|
||||
auto expectedSize = std::min(globalMemSize / 2, hwCaps.maxMemAllocSize);
|
||||
expectedSize = std::max(expectedSize, static_cast<uint64_t>(128llu * MB));
|
||||
EXPECT_EQ(device->getSharedDeviceInfo().maxMemAllocSize, expectedSize);
|
||||
|
||||
DebugManager.flags.EnableSharedSystemUsmSupport.set(1);
|
||||
device.reset(new MockClDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get())));
|
||||
device->getDevice().reduceMaxMemAllocSize();
|
||||
EXPECT_EQ(device->getSharedDeviceInfo().maxMemAllocSize, globalMemSize);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user