mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
refactor: remove redundant definitions KB/MB/GB
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
878a95aaf9
commit
6849d33326
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -11,5 +11,5 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
TEST(AllocatorHelper, givenExpectedSizeToReserveWhenGetSizeToReserveCalledThenExpectedValueReturned) {
|
||||
EXPECT_EQ((4 * 4 + 2 * 4) * GB, NEO::getSizeToReserve());
|
||||
EXPECT_EQ((4 * 4 + 2 * 4) * MemoryConstants::gigaByte, NEO::getSizeToReserve());
|
||||
}
|
||||
|
||||
@@ -214,11 +214,11 @@ TEST_F(MultiTileMemoryInfoPrelimTest, givenMemoryInfoWithRegionsWhenGettingMemor
|
||||
debugManager.flags.EnableLocalMemory.set(1);
|
||||
std::vector<MemoryRegion> regionInfo(3);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 1};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, DrmMockHelper::getEngineOrMemoryInstanceValue(0, 0)};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
regionInfo[2].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, DrmMockHelper::getEngineOrMemoryInstanceValue(1, 0)};
|
||||
regionInfo[2].probedSize = 32 * GB;
|
||||
regionInfo[2].probedSize = 32 * MemoryConstants::gigaByte;
|
||||
|
||||
setupMemoryInfo(regionInfo, 2);
|
||||
|
||||
@@ -226,19 +226,19 @@ TEST_F(MultiTileMemoryInfoPrelimTest, givenMemoryInfoWithRegionsWhenGettingMemor
|
||||
EXPECT_EQ(regionInfo[0].region.memoryClass, regionClassAndInstance.memoryClass);
|
||||
EXPECT_EQ(regionInfo[0].region.memoryInstance, regionClassAndInstance.memoryInstance);
|
||||
auto regionSize = memoryInfo->getMemoryRegionSize(MemoryBanks::mainBank);
|
||||
EXPECT_EQ(8 * GB, regionSize);
|
||||
EXPECT_EQ(8 * MemoryConstants::gigaByte, regionSize);
|
||||
|
||||
regionClassAndInstance = memoryInfo->getMemoryRegionClassAndInstance(MemoryBanks::getBankForLocalMemory(0), *pHwInfo);
|
||||
EXPECT_EQ(regionInfo[1].region.memoryClass, regionClassAndInstance.memoryClass);
|
||||
EXPECT_EQ(regionInfo[1].region.memoryInstance, regionClassAndInstance.memoryInstance);
|
||||
regionSize = memoryInfo->getMemoryRegionSize(MemoryBanks::getBankForLocalMemory(0));
|
||||
EXPECT_EQ(16 * GB, regionSize);
|
||||
EXPECT_EQ(16 * MemoryConstants::gigaByte, regionSize);
|
||||
|
||||
regionClassAndInstance = memoryInfo->getMemoryRegionClassAndInstance(MemoryBanks::getBankForLocalMemory(1), *pHwInfo);
|
||||
EXPECT_EQ(regionInfo[2].region.memoryClass, regionClassAndInstance.memoryClass);
|
||||
EXPECT_EQ(regionInfo[2].region.memoryInstance, regionClassAndInstance.memoryInstance);
|
||||
regionSize = memoryInfo->getMemoryRegionSize(MemoryBanks::getBankForLocalMemory(1));
|
||||
EXPECT_EQ(32 * GB, regionSize);
|
||||
EXPECT_EQ(32 * MemoryConstants::gigaByte, regionSize);
|
||||
}
|
||||
|
||||
TEST_F(MultiTileMemoryInfoPrelimTest, givenDisabledLocalMemoryAndMemoryInfoWithRegionsWhenGettingMemoryRegionClassAndInstanceThenReturnSystemMemoryRegion) {
|
||||
@@ -246,11 +246,11 @@ TEST_F(MultiTileMemoryInfoPrelimTest, givenDisabledLocalMemoryAndMemoryInfoWithR
|
||||
debugManager.flags.EnableLocalMemory.set(0);
|
||||
std::vector<MemoryRegion> regionInfo(3);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 1};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, DrmMockHelper::getEngineOrMemoryInstanceValue(0, 0)};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
regionInfo[2].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, DrmMockHelper::getEngineOrMemoryInstanceValue(1, 0)};
|
||||
regionInfo[2].probedSize = 32 * GB;
|
||||
regionInfo[2].probedSize = 32 * MemoryConstants::gigaByte;
|
||||
|
||||
setupMemoryInfo(regionInfo, 2);
|
||||
|
||||
@@ -272,11 +272,11 @@ TEST_F(MultiTileMemoryInfoPrelimTest, givenMemoryInfoWithRegionsWhenGettingMemor
|
||||
debugManager.flags.EnableLocalMemory.set(1);
|
||||
std::vector<MemoryRegion> regionInfo(3);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 1};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, DrmMockHelper::getEngineOrMemoryInstanceValue(0, 0)};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
regionInfo[2].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, DrmMockHelper::getEngineOrMemoryInstanceValue(1, 0)};
|
||||
regionInfo[2].probedSize = 32 * GB;
|
||||
regionInfo[2].probedSize = 32 * MemoryConstants::gigaByte;
|
||||
|
||||
setupMemoryInfo(regionInfo, 2);
|
||||
// route to tile1 banks
|
||||
@@ -287,7 +287,7 @@ TEST_F(MultiTileMemoryInfoPrelimTest, givenMemoryInfoWithRegionsWhenGettingMemor
|
||||
EXPECT_EQ(regionInfo[0].region.memoryClass, regionClassAndInstance.memoryClass);
|
||||
EXPECT_EQ(regionInfo[0].region.memoryInstance, regionClassAndInstance.memoryInstance);
|
||||
auto regionSize = memoryInfo->getMemoryRegionSize(MemoryBanks::mainBank);
|
||||
EXPECT_EQ(8 * GB, regionSize);
|
||||
EXPECT_EQ(8 * MemoryConstants::gigaByte, regionSize);
|
||||
|
||||
// overrite route to tile 1
|
||||
regionClassAndInstance = memoryInfo->getMemoryRegionClassAndInstance(MemoryBanks::getBankForLocalMemory(0), *pHwInfo);
|
||||
@@ -331,7 +331,7 @@ TEST_F(MultiTileMemoryInfoPrelimTest, givenMemoryInfoWithoutRegionsWhenGettingMe
|
||||
debugManager.flags.EnableLocalMemory.set(1);
|
||||
std::vector<MemoryRegion> regionInfo(1);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 1};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
|
||||
setupMemoryInfo(regionInfo, 0);
|
||||
|
||||
@@ -345,13 +345,13 @@ TEST_F(MultiTileMemoryInfoPrelimTest, whenDebugVariablePrintMemoryRegionSizeIsSe
|
||||
|
||||
std::vector<MemoryRegion> regionInfo(1);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 1};
|
||||
regionInfo[0].probedSize = 16 * GB;
|
||||
regionInfo[0].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
setupMemoryInfo(regionInfo, 0);
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
auto regionSize = memoryInfo->getMemoryRegionSize(MemoryBanks::mainBank);
|
||||
EXPECT_EQ(16 * GB, regionSize);
|
||||
EXPECT_EQ(16 * MemoryConstants::gigaByte, regionSize);
|
||||
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
std::string expectedOutput("Memory type: 0, memory instance: 1, region size: 17179869184\n");
|
||||
@@ -361,9 +361,9 @@ TEST_F(MultiTileMemoryInfoPrelimTest, whenDebugVariablePrintMemoryRegionSizeIsSe
|
||||
TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemWithExtensionsThenReturnCorrectValues) {
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
@@ -387,9 +387,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithSingleRegionThe
|
||||
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
@@ -415,9 +415,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithPairHandleThenR
|
||||
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
@@ -444,9 +444,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithChunkingButSize
|
||||
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
@@ -470,9 +470,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithChunkingWithSiz
|
||||
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
@@ -499,9 +499,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsAndPrivateBOSupportWhenCreatingGemExt
|
||||
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
@@ -529,9 +529,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsAndNoPrivateBOSupportWhenCreatingGemE
|
||||
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
@@ -558,9 +558,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsAndPrivateBOSupportedAndIsPerContextV
|
||||
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
@@ -586,15 +586,15 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithMultipleRegions
|
||||
|
||||
std::vector<MemoryRegion> regionInfo(5);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
regionInfo[2].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 1};
|
||||
regionInfo[2].probedSize = 16 * GB;
|
||||
regionInfo[2].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
regionInfo[3].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 2};
|
||||
regionInfo[3].probedSize = 16 * GB;
|
||||
regionInfo[3].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
regionInfo[4].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 3};
|
||||
regionInfo[4].probedSize = 16 * GB;
|
||||
regionInfo[4].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
@@ -626,15 +626,15 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCallingCreatingGemExtWithMultiple
|
||||
|
||||
std::vector<MemoryRegion> regionInfo(5);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
regionInfo[2].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 1};
|
||||
regionInfo[2].probedSize = 16 * GB;
|
||||
regionInfo[2].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
regionInfo[3].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 2};
|
||||
regionInfo[3].probedSize = 16 * GB;
|
||||
regionInfo[3].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
regionInfo[4].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 3};
|
||||
regionInfo[4].probedSize = 16 * GB;
|
||||
regionInfo[4].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
@@ -653,15 +653,15 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCallingCreatingGemExtWithMultiple
|
||||
|
||||
std::vector<MemoryRegion> regionInfo(5);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
regionInfo[2].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 1};
|
||||
regionInfo[2].probedSize = 16 * GB;
|
||||
regionInfo[2].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
regionInfo[3].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 2};
|
||||
regionInfo[3].probedSize = 16 * GB;
|
||||
regionInfo[3].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
regionInfo[4].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 3};
|
||||
regionInfo[4].probedSize = 16 * GB;
|
||||
regionInfo[4].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
@@ -687,4 +687,4 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCallingCreatingGemExtWithMultiple
|
||||
EXPECT_EQ(drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, createExt->memoryRegions[2].memoryClass);
|
||||
EXPECT_EQ(3u, createExt->memoryRegions[2].memoryInstance);
|
||||
EXPECT_EQ(size, drm->context.receivedCreateGemExt->size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,9 +85,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsAndLocalMemoryEnabledWhenGettingMemor
|
||||
debugManager.flags.EnableLocalMemory.set(1);
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
@@ -98,19 +98,19 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsAndLocalMemoryEnabledWhenGettingMemor
|
||||
EXPECT_EQ(regionInfo[0].region.memoryClass, regionClassAndInstance.memoryClass);
|
||||
EXPECT_EQ(regionInfo[0].region.memoryInstance, regionClassAndInstance.memoryInstance);
|
||||
auto regionSize = memoryInfo->getMemoryRegionSize(MemoryBanks::mainBank);
|
||||
EXPECT_EQ(8 * GB, regionSize);
|
||||
EXPECT_EQ(8 * MemoryConstants::gigaByte, regionSize);
|
||||
|
||||
regionClassAndInstance = memoryInfo->getMemoryRegionClassAndInstance(MemoryBanks::getBankForLocalMemory(0), *defaultHwInfo);
|
||||
EXPECT_EQ(regionInfo[1].region.memoryClass, regionClassAndInstance.memoryClass);
|
||||
EXPECT_EQ(regionInfo[1].region.memoryInstance, regionClassAndInstance.memoryInstance);
|
||||
regionSize = memoryInfo->getMemoryRegionSize(MemoryBanks::getBankForLocalMemory(0));
|
||||
EXPECT_EQ(16 * GB, regionSize);
|
||||
EXPECT_EQ(16 * MemoryConstants::gigaByte, regionSize);
|
||||
}
|
||||
|
||||
TEST(MemoryInfo, givenMemoryInfoWithoutDeviceRegionWhenGettingDeviceRegionSizeThenReturnCorrectSize) {
|
||||
std::vector<MemoryRegion> regionInfo(1);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto memoryInfo = std::make_unique<MemoryInfo>(regionInfo, *drm);
|
||||
@@ -123,9 +123,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsAndLocalMemoryDisabledWhenGettingMemo
|
||||
debugManager.flags.EnableLocalMemory.set(0);
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
@@ -136,13 +136,13 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsAndLocalMemoryDisabledWhenGettingMemo
|
||||
EXPECT_EQ(regionInfo[0].region.memoryClass, regionClassAndInstance.memoryClass);
|
||||
EXPECT_EQ(regionInfo[0].region.memoryInstance, regionClassAndInstance.memoryInstance);
|
||||
auto regionSize = memoryInfo->getMemoryRegionSize(MemoryBanks::mainBank);
|
||||
EXPECT_EQ(8 * GB, regionSize);
|
||||
EXPECT_EQ(8 * MemoryConstants::gigaByte, regionSize);
|
||||
|
||||
regionClassAndInstance = memoryInfo->getMemoryRegionClassAndInstance(MemoryBanks::getBankForLocalMemory(0), *defaultHwInfo);
|
||||
EXPECT_EQ(regionInfo[0].region.memoryClass, regionClassAndInstance.memoryClass);
|
||||
EXPECT_EQ(regionInfo[0].region.memoryInstance, regionClassAndInstance.memoryInstance);
|
||||
regionSize = memoryInfo->getMemoryRegionSize(MemoryBanks::getBankForLocalMemory(0));
|
||||
EXPECT_EQ(16 * GB, regionSize);
|
||||
EXPECT_EQ(16 * MemoryConstants::gigaByte, regionSize);
|
||||
}
|
||||
|
||||
TEST(MemoryInfo, whenDebugVariablePrintMemoryRegionSizeIsSetAndGetMemoryRegionSizeIsCalledThenMessagePrintedToStdOutput) {
|
||||
@@ -151,7 +151,7 @@ TEST(MemoryInfo, whenDebugVariablePrintMemoryRegionSizeIsSetAndGetMemoryRegionSi
|
||||
|
||||
std::vector<MemoryRegion> regionInfo(1);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 1};
|
||||
regionInfo[0].probedSize = 16 * GB;
|
||||
regionInfo[0].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
@@ -160,7 +160,7 @@ TEST(MemoryInfo, whenDebugVariablePrintMemoryRegionSizeIsSetAndGetMemoryRegionSi
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
auto regionSize = memoryInfo->getMemoryRegionSize(MemoryBanks::mainBank);
|
||||
EXPECT_EQ(16 * GB, regionSize);
|
||||
EXPECT_EQ(16 * MemoryConstants::gigaByte, regionSize);
|
||||
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
std::string expectedOutput("Memory type: 0, memory instance: 1, region size: 17179869184\n");
|
||||
@@ -172,11 +172,11 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenGettingMemoryRegionClassAndInstan
|
||||
debugManager.flags.EnableLocalMemory.set(1);
|
||||
std::vector<MemoryRegion> regionInfo(3);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
regionInfo[2].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 1};
|
||||
regionInfo[2].probedSize = 32 * GB;
|
||||
regionInfo[2].probedSize = 32 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
@@ -223,9 +223,9 @@ using MemoryInfoTest = ::testing::Test;
|
||||
HWTEST2_F(MemoryInfoTest, givenMemoryInfoWithRegionsWhenCreatingGemWithExtensionsThenReturnCorrectValues, NonDefaultIoctlsSupported) {
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
@@ -248,9 +248,9 @@ HWTEST2_F(MemoryInfoTest, givenMemoryInfoWithRegionsWhenCreatingGemExtWithSingle
|
||||
debugManager.flags.EnableLocalMemory.set(1);
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
|
||||
@@ -940,7 +940,7 @@ TEST_F(DrmMemoryManagerTest, WhenAskedAndAllowedAndBigAllocationHostPtrThenPinAf
|
||||
}
|
||||
ASSERT_NE(nullptr, memoryManager->pinBBs[rootDeviceIndex]);
|
||||
|
||||
allocationData.size = 10 * MB;
|
||||
allocationData.size = 10 * MemoryConstants::megaByte;
|
||||
allocationData.hostPtr = ::alignedMalloc(allocationData.size, 4096);
|
||||
allocationData.flags.forcePin = true;
|
||||
auto alloc = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithHostPtr(allocationData));
|
||||
@@ -1945,7 +1945,7 @@ TEST_F(DrmMemoryManagerTest, GivenExhaustedInternalHeapWhenAllocate32BitIsCalled
|
||||
auto alloc = memoryManager->getGfxPartition(rootDeviceIndex)->heapAllocate(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY, size);
|
||||
EXPECT_NE(0llu, alloc);
|
||||
|
||||
size_t allocationSize = 4 * GB;
|
||||
size_t allocationSize = 4 * MemoryConstants::gigaByte;
|
||||
auto graphicsAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, allocationSize, nullptr, AllocationType::INTERNAL_HEAP);
|
||||
EXPECT_EQ(nullptr, graphicsAllocation);
|
||||
}
|
||||
@@ -2600,7 +2600,7 @@ TEST_F(DrmMemoryManagerTest, givenMemoryManagerWhenAskedForInternalAllocationWit
|
||||
auto gpuPtr = drmAllocation->getGpuAddress();
|
||||
auto gmmHelper = device->getGmmHelper();
|
||||
auto heapBase = gmmHelper->canonize(memoryManager->getInternalHeapBaseAddress(drmAllocation->getRootDeviceIndex(), drmAllocation->isAllocatedInLocalMemoryPool()));
|
||||
auto heapSize = 4 * GB;
|
||||
auto heapSize = 4 * MemoryConstants::gigaByte;
|
||||
|
||||
EXPECT_GE(gpuPtr, heapBase);
|
||||
EXPECT_LE(gpuPtr, heapBase + heapSize);
|
||||
@@ -2633,7 +2633,7 @@ TEST_F(DrmMemoryManagerTest, givenLimitedRangeAllocatorWhenAskedForInternalAlloc
|
||||
auto gpuPtr = drmAllocation->getGpuAddress();
|
||||
auto gmmHelper = device->getGmmHelper();
|
||||
auto heapBase = gmmHelper->canonize(memoryManager->getInternalHeapBaseAddress(drmAllocation->getRootDeviceIndex(), drmAllocation->isAllocatedInLocalMemoryPool()));
|
||||
auto heapSize = 4 * GB;
|
||||
auto heapSize = 4 * MemoryConstants::gigaByte;
|
||||
|
||||
EXPECT_GE(gpuPtr, heapBase);
|
||||
EXPECT_LE(gpuPtr, heapBase + heapSize);
|
||||
@@ -2690,7 +2690,7 @@ TEST_F(DrmMemoryManagerTest, givenMemoryManagerWhenAskedForInternalAllocationWit
|
||||
auto gpuPtr = drmAllocation->getGpuAddress();
|
||||
auto gmmHelper = device->getGmmHelper();
|
||||
auto heapBase = gmmHelper->canonize(memoryManager->getInternalHeapBaseAddress(drmAllocation->getRootDeviceIndex(), drmAllocation->isAllocatedInLocalMemoryPool()));
|
||||
auto heapSize = 4 * GB;
|
||||
auto heapSize = 4 * MemoryConstants::gigaByte;
|
||||
|
||||
EXPECT_GE(gpuPtr, heapBase);
|
||||
EXPECT_LE(gpuPtr, heapBase + heapSize);
|
||||
@@ -3065,7 +3065,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenValidateHostPtrMemoryE
|
||||
}
|
||||
ASSERT_NE(nullptr, memoryManager->pinBBs[device->getRootDeviceIndex()]);
|
||||
|
||||
size_t size = 10 * MB;
|
||||
size_t size = 10 * MemoryConstants::megaByte;
|
||||
void *ptr = ::alignedMalloc(size, 4096);
|
||||
auto alloc = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), false, size}, ptr));
|
||||
ASSERT_NE(nullptr, alloc);
|
||||
@@ -3206,7 +3206,7 @@ TEST_F(DrmMemoryManagerBasic, givenDrmMemoryManagerWhenAllocateGraphicsMemoryFor
|
||||
|
||||
memoryManager->forceLimitedRangeAllocator(0xFFFFFFFFF);
|
||||
|
||||
allocationData.size = 4 * MB + 16 * 1024;
|
||||
allocationData.size = 4 * MemoryConstants::megaByte + 16 * 1024;
|
||||
allocationData.hostPtr = reinterpret_cast<const void *>(0x10000000);
|
||||
auto allocation0 = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData));
|
||||
|
||||
@@ -3215,11 +3215,11 @@ TEST_F(DrmMemoryManagerBasic, givenDrmMemoryManagerWhenAllocateGraphicsMemoryFor
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation0);
|
||||
|
||||
allocationData.size = 4 * MB + 12 * 1024;
|
||||
allocationData.size = 4 * MemoryConstants::megaByte + 12 * 1024;
|
||||
allocationData.hostPtr = reinterpret_cast<const void *>(0x30000000);
|
||||
allocation0 = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData));
|
||||
|
||||
EXPECT_EQ(static_cast<uint64_t>(allocation0->getBO()->peekSize()), 4 * MB + 12 * 1024);
|
||||
EXPECT_EQ(static_cast<uint64_t>(allocation0->getBO()->peekSize()), 4 * MemoryConstants::megaByte + 12 * 1024);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation0);
|
||||
memoryManager->freeGraphicsMemory(allocation1);
|
||||
@@ -3250,7 +3250,7 @@ TEST_F(DrmMemoryManagerBasic, givenDrmMemoryManagerWhenAllocateGraphicsMemoryFor
|
||||
|
||||
memoryManager->forceLimitedRangeAllocator(0xFFFFFFFFF);
|
||||
|
||||
allocationData.size = 64 * GB;
|
||||
allocationData.size = 64 * MemoryConstants::gigaByte;
|
||||
allocationData.hostPtr = reinterpret_cast<const void *>(0x100000000000);
|
||||
EXPECT_FALSE(memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData));
|
||||
}
|
||||
@@ -3258,7 +3258,7 @@ TEST_F(DrmMemoryManagerBasic, givenDrmMemoryManagerWhenAllocateGraphicsMemoryFor
|
||||
TEST_F(DrmMemoryManagerBasic, givenDrmMemoryManagerWhenAllocateGraphicsMemoryForNonSvmHostPtrFailsThenNullPtrReturnedAndAllocationIsNotRegistered) {
|
||||
std::unique_ptr<TestedDrmMemoryManager> memoryManager(new (std::nothrow) TestedDrmMemoryManager(false, false, false, executionEnvironment));
|
||||
memoryManager->forceLimitedRangeAllocator(0xFFFFFFFFF);
|
||||
MockAllocationProperties properties(0u, 64 * GB);
|
||||
MockAllocationProperties properties(0u, 64 * MemoryConstants::gigaByte);
|
||||
|
||||
auto ptr = reinterpret_cast<const void *>(0x100000000000);
|
||||
EXPECT_FALSE(memoryManager->allocateGraphicsMemoryInPreferredPool(properties, ptr));
|
||||
@@ -3319,7 +3319,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenForcePinNotAllowedAndH
|
||||
mock->ioctlExpected.gemWait = 1;
|
||||
|
||||
AllocationData allocationData;
|
||||
allocationData.size = 10 * MB; // bigger than threshold
|
||||
allocationData.size = 10 * MemoryConstants::megaByte; // bigger than threshold
|
||||
allocationData.hostPtr = ::alignedMalloc(allocationData.size, 4096);
|
||||
allocationData.flags.forcePin = true;
|
||||
allocationData.rootDeviceIndex = device->getRootDeviceIndex();
|
||||
@@ -3757,7 +3757,7 @@ TEST_F(DrmMemoryManagerTest, givenSvmCpuAllocationWhenSizeAndAlignmentProvidedBu
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndReleaseGpuRangeIsCalledThenGpuAddressIsDecanonized) {
|
||||
constexpr size_t reservedCpuAddressRangeSize = is64bit ? (6 * 4 * GB) : 0;
|
||||
constexpr size_t reservedCpuAddressRangeSize = is64bit ? (6 * 4 * MemoryConstants::gigaByte) : 0;
|
||||
auto hwInfo = defaultHwInfo.get();
|
||||
auto mockGfxPartition = std::make_unique<MockGfxPartition>();
|
||||
mockGfxPartition->init(hwInfo->capabilityTable.gpuAddressSpace, reservedCpuAddressRangeSize, 0, 1, false, 0u);
|
||||
@@ -4834,7 +4834,7 @@ TEST(DrmMemoryManagerSimpleTest, givenDrmMemoryManagerWhenAllocateInDevicePoolIs
|
||||
}
|
||||
|
||||
TEST(DrmMemoryManagerSimpleTest, givenDrmMemoryManagerWhenDeviceHeapIsDepletedThenNullptrReturnedAndStatusIsError) {
|
||||
constexpr size_t reservedCpuAddressRangeSize = is64bit ? (6 * 4 * GB) : 0;
|
||||
constexpr size_t reservedCpuAddressRangeSize = is64bit ? (6 * 4 * MemoryConstants::gigaByte) : 0;
|
||||
|
||||
auto hwInfo = defaultHwInfo.get();
|
||||
auto executionEnvironment = MockExecutionEnvironment{hwInfo};
|
||||
@@ -4978,7 +4978,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenFreeingNonImportedMemoryTh
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenGetLocalMemoryIsCalledThenSizeOfLocalMemoryIsReturned) {
|
||||
EXPECT_EQ(0 * GB, memoryManager->getLocalMemorySize(rootDeviceIndex, 0xF));
|
||||
EXPECT_EQ(0 * MemoryConstants::gigaByte, memoryManager->getLocalMemorySize(rootDeviceIndex, 0xF));
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSetMemAdviseIsCalledThenUpdateCachePolicyInBufferObject) {
|
||||
|
||||
@@ -51,9 +51,9 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGemCreateExtWithRegionsThen
|
||||
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
regionInfo[0].region = {0, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {1, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
MemRegionsVec memRegions = {regionInfo[0].region, regionInfo[1].region};
|
||||
|
||||
uint32_t handle = 0u;
|
||||
@@ -72,9 +72,9 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGemCreateExtWithRegionsAndV
|
||||
|
||||
std::vector<MemoryRegion> regionInfo(2);
|
||||
regionInfo[0].region = {0, 0};
|
||||
regionInfo[0].probedSize = 8 * GB;
|
||||
regionInfo[0].probedSize = 8 * MemoryConstants::gigaByte;
|
||||
regionInfo[1].region = {1, 0};
|
||||
regionInfo[1].probedSize = 16 * GB;
|
||||
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
|
||||
MemRegionsVec memRegions = {regionInfo[0].region, regionInfo[1].region};
|
||||
|
||||
uint32_t handle = 0u;
|
||||
|
||||
Reference in New Issue
Block a user