diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index fdaafc16a3..29d44da44f 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -1006,7 +1006,7 @@ ze_result_t DeviceImp::getCacheProperties(uint32_t *pCount, ze_device_cache_prop const auto &hardwareInfo = this->getHwInfo(); uint32_t subDeviceCount = std::max(this->numSubDevices, 1u); - pCacheProperties[0].cacheSize = hardwareInfo.gtSystemInfo.L3CacheSizeInKb * subDeviceCount * KB; + pCacheProperties[0].cacheSize = hardwareInfo.gtSystemInfo.L3CacheSizeInKb * subDeviceCount * MemoryConstants::kiloByte; pCacheProperties[0].flags = 0; if (pCacheProperties->pNext) { diff --git a/level_zero/core/source/kernel/kernel_imp.cpp b/level_zero/core/source/kernel/kernel_imp.cpp index 7f2cbff3e4..57bd59da3f 100644 --- a/level_zero/core/source/kernel/kernel_imp.cpp +++ b/level_zero/core/source/kernel/kernel_imp.cpp @@ -456,7 +456,7 @@ ze_result_t KernelImp::suggestMaxCooperativeGroupCount(uint32_t *totalGroupCount auto &descriptor = kernelImmData->getDescriptor(); auto availableThreadCount = helper.calculateAvailableThreadCount(hardwareInfo, descriptor.kernelAttributes.numGrfRequired); - auto availableSlmSize = static_cast(dssCount * KB * hardwareInfo.capabilityTable.slmSize); + auto availableSlmSize = static_cast(dssCount * MemoryConstants::kiloByte * hardwareInfo.capabilityTable.slmSize); auto usedSlmSize = helper.alignSlmSize(slmArgsTotalSize + descriptor.kernelAttributes.slmInlineSize); auto maxBarrierCount = static_cast(helper.getMaxBarrierRegisterPerSlice()); auto barrierCount = descriptor.kernelAttributes.barrierCount; @@ -688,7 +688,7 @@ ze_result_t KernelImp::setArgBuffer(uint32_t argIndex, size_t argSize, const voi slmOffset += static_cast(slmArgSizes[argIndex]); ++argIndex; } - slmArgsTotalSize = static_cast(alignUp(slmOffset, KB)); + slmArgsTotalSize = static_cast(alignUp(slmOffset, MemoryConstants::kiloByte)); return ZE_RESULT_SUCCESS; } diff --git a/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp b/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp index 18191b2722..bda859262d 100644 --- a/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp +++ b/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp @@ -194,7 +194,7 @@ void CommandListPrivateHeapsFixture::setUp() { CommandListStateBaseAddressFixture::setUp(); for (uint32_t i = 0; i < storeAllocations; i++) { - auto heapAllocation = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), true, 2 * MB, + auto heapAllocation = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), true, 2 * MemoryConstants::megaByte, NEO::AllocationType::LINEAR_STREAM, false, false, neoDevice->getDeviceBitfield()}); commandListImmediate->csr->getInternalAllocationStorage()->storeAllocation(std::unique_ptr(heapAllocation), REUSABLE_ALLOCATION); @@ -246,7 +246,7 @@ void ImmediateCmdListSharedHeapsFixture::setUp() { ModuleMutableCommandListFixture::setUp(); for (uint32_t i = 0; i < storeAllocations; i++) { - auto heapAllocation = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), true, 2 * MB, + auto heapAllocation = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), true, 2 * MemoryConstants::megaByte, NEO::AllocationType::LINEAR_STREAM, false, false, neoDevice->getDeviceBitfield()}); commandListImmediate->csr->getInternalAllocationStorage()->storeAllocation(std::unique_ptr(heapAllocation), REUSABLE_ALLOCATION); diff --git a/level_zero/core/test/unit_tests/fixtures/kernel_max_cooperative_groups_count_fixture.cpp b/level_zero/core/test/unit_tests/fixtures/kernel_max_cooperative_groups_count_fixture.cpp index fe10103100..3b728ae466 100644 --- a/level_zero/core/test/unit_tests/fixtures/kernel_max_cooperative_groups_count_fixture.cpp +++ b/level_zero/core/test/unit_tests/fixtures/kernel_max_cooperative_groups_count_fixture.cpp @@ -25,7 +25,7 @@ void KernelImpSuggestMaxCooperativeGroupCountFixture::setUp() { if (dssCount == 0) { dssCount = hardwareInfo.gtSystemInfo.SubSliceCount; } - availableSlm = dssCount * KB * hardwareInfo.capabilityTable.slmSize; + availableSlm = dssCount * MemoryConstants::kiloByte * hardwareInfo.capabilityTable.slmSize; maxBarrierCount = static_cast(helper.getMaxBarrierRegisterPerSlice()); kernelInfo.kernelDescriptor->kernelAttributes.simdSize = simd; diff --git a/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp index f71a94f070..e76f831ea5 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp @@ -1063,7 +1063,7 @@ TEST_F(MultiSubDeviceCachePropertiesTest, givenDeviceWithSubDevicesWhenQueriedFo auto rootDeviceIndex = device->getNEODevice()->getRootDeviceIndex(); auto &hwInfo = *device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex]->getMutableHardwareInfo(); - auto singleRootDeviceCacheSize = hwInfo.gtSystemInfo.L3CacheSizeInKb * KB; + auto singleRootDeviceCacheSize = hwInfo.gtSystemInfo.L3CacheSizeInKb * MemoryConstants::kiloByte; uint32_t count = 0; ze_result_t res = device->getCacheProperties(&count, nullptr); diff --git a/level_zero/core/test/unit_tests/sources/kernel/test_kernel_2.cpp b/level_zero/core/test/unit_tests/sources/kernel/test_kernel_2.cpp index 64420fa191..1f24c661a4 100644 --- a/level_zero/core/test/unit_tests/sources/kernel/test_kernel_2.cpp +++ b/level_zero/core/test/unit_tests/sources/kernel/test_kernel_2.cpp @@ -451,7 +451,7 @@ HWTEST_F(KernelImpSuggestMaxCooperativeGroupCountTests, GivenBarriersWhenCalcula } HWTEST_F(KernelImpSuggestMaxCooperativeGroupCountTests, GivenUsedSlmSizeWhenCalculatingMaxCooperativeGroupCountThenResultIsCalculatedWithRegardToUsedSlmSize) { - usedSlm = 64 * KB; + usedSlm = 64 * MemoryConstants::kiloByte; auto expected = availableSlm / usedSlm; EXPECT_EQ(expected, getMaxWorkGroupCount()); } diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_kernel_pvc.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_kernel_pvc.cpp index 1a35b3a3a8..dbc356a220 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_kernel_pvc.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_kernel_pvc.cpp @@ -33,7 +33,7 @@ PVCTEST_F(KernelImpSuggestMaxCooperativeGroupCountTestsPvc, GivenBarriersWhenCal } PVCTEST_F(KernelImpSuggestMaxCooperativeGroupCountTestsPvc, GivenUsedSlmSizeWhenCalculatingMaxCooperativeGroupCountThenResultIsCalculatedWithRegardToUsedSlmSize) { - usedSlm = 64 * KB; + usedSlm = 64 * MemoryConstants::kiloByte; auto expected = (availableSlm / usedSlm) / 2; EXPECT_EQ(expected, getMaxWorkGroupCount()); } diff --git a/level_zero/sysman/test/unit_tests/sources/memory/linux/mock_memory.h b/level_zero/sysman/test/unit_tests/sources/memory/linux/mock_memory.h index a010995bad..7d84114ff0 100644 --- a/level_zero/sysman/test/unit_tests/sources/memory/linux/mock_memory.h +++ b/level_zero/sysman/test/unit_tests/sources/memory/linux/mock_memory.h @@ -17,14 +17,14 @@ using namespace NEO; -constexpr uint64_t probedSizeRegionZero = 8 * GB; -constexpr uint64_t probedSizeRegionOne = 16 * GB; -constexpr uint64_t probedSizeRegionTwo = 4 * GB; -constexpr uint64_t probedSizeRegionThree = 16 * GB; -constexpr uint64_t unallocatedSizeRegionZero = 6 * GB; -constexpr uint64_t unallocatedSizeRegionOne = 12 * GB; -constexpr uint64_t unallocatedSizeRegionTwo = 25 * GB; -constexpr uint64_t unallocatedSizeRegionThree = 3 * GB; +constexpr uint64_t probedSizeRegionZero = 8 * MemoryConstants::gigaByte; +constexpr uint64_t probedSizeRegionOne = 16 * MemoryConstants::gigaByte; +constexpr uint64_t probedSizeRegionTwo = 4 * MemoryConstants::gigaByte; +constexpr uint64_t probedSizeRegionThree = 16 * MemoryConstants::gigaByte; +constexpr uint64_t unallocatedSizeRegionZero = 6 * MemoryConstants::gigaByte; +constexpr uint64_t unallocatedSizeRegionOne = 12 * MemoryConstants::gigaByte; +constexpr uint64_t unallocatedSizeRegionTwo = 25 * MemoryConstants::gigaByte; +constexpr uint64_t unallocatedSizeRegionThree = 3 * MemoryConstants::gigaByte; namespace L0 { namespace Sysman { diff --git a/level_zero/tools/source/metrics/linux/os_metric_ip_sampling_imp_linux.cpp b/level_zero/tools/source/metrics/linux/os_metric_ip_sampling_imp_linux.cpp index d21207dceb..305682d2ab 100644 --- a/level_zero/tools/source/metrics/linux/os_metric_ip_sampling_imp_linux.cpp +++ b/level_zero/tools/source/metrics/linux/os_metric_ip_sampling_imp_linux.cpp @@ -25,7 +25,7 @@ namespace L0 { -constexpr uint32_t maxDssBufferSize = 512 * KB; +constexpr uint32_t maxDssBufferSize = 512 * MemoryConstants::kiloByte; constexpr uint32_t defaultPollPeriodNs = 10000000u; constexpr uint32_t unitReportSize = 64u; diff --git a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_streamer_3.cpp b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_streamer_3.cpp index cb566a3ef7..a5112029e8 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_streamer_3.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_streamer_3.cpp @@ -223,7 +223,7 @@ TEST_F(MetricStreamerTest, givenRawReportSizeIsNotAlignedToOaBufferSizeWhenZetMe metricsSetParams.ShortName = "Metric set description"; metricsSetParams.RawReportSize = 576; - uint32_t testOaBufferSize = 128 * MB; + uint32_t testOaBufferSize = 128 * MemoryConstants::megaByte; openMetricsAdapter(); diff --git a/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/mock_memory.h b/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/mock_memory.h index ff0b354bda..4e1cd91903 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/mock_memory.h +++ b/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/mock_memory.h @@ -15,14 +15,14 @@ #include "level_zero/tools/source/sysman/memory/memory_imp.h" using namespace NEO; -constexpr uint64_t probedSizeRegionZero = 8 * GB; -constexpr uint64_t probedSizeRegionOne = 16 * GB; -constexpr uint64_t probedSizeRegionTwo = 4 * GB; -constexpr uint64_t probedSizeRegionThree = 16 * GB; -constexpr uint64_t unallocatedSizeRegionZero = 6 * GB; -constexpr uint64_t unallocatedSizeRegionOne = 12 * GB; -constexpr uint64_t unallocatedSizeRegionTwo = 25 * GB; -constexpr uint64_t unallocatedSizeRegionThree = 3 * GB; +constexpr uint64_t probedSizeRegionZero = 8 * MemoryConstants::gigaByte; +constexpr uint64_t probedSizeRegionOne = 16 * MemoryConstants::gigaByte; +constexpr uint64_t probedSizeRegionTwo = 4 * MemoryConstants::gigaByte; +constexpr uint64_t probedSizeRegionThree = 16 * MemoryConstants::gigaByte; +constexpr uint64_t unallocatedSizeRegionZero = 6 * MemoryConstants::gigaByte; +constexpr uint64_t unallocatedSizeRegionOne = 12 * MemoryConstants::gigaByte; +constexpr uint64_t unallocatedSizeRegionTwo = 25 * MemoryConstants::gigaByte; +constexpr uint64_t unallocatedSizeRegionThree = 3 * MemoryConstants::gigaByte; namespace L0 { namespace ult { diff --git a/opencl/source/cl_device/cl_device_caps.cpp b/opencl/source/cl_device/cl_device_caps.cpp index 69184c349d..c4df5c0c82 100644 --- a/opencl/source/cl_device/cl_device_caps.cpp +++ b/opencl/source/cl_device/cl_device_caps.cpp @@ -276,7 +276,7 @@ void ClDevice::initializeCaps() { const auto systemInfo = hwInfo.gtSystemInfo; const auto subDevicesCount = std::max(getNumGenericSubDevices(), 1u); - deviceInfo.globalMemCacheSize = systemInfo.L3CacheSizeInKb * KB * subDevicesCount; + deviceInfo.globalMemCacheSize = systemInfo.L3CacheSizeInKb * MemoryConstants::kiloByte * subDevicesCount; deviceInfo.grfSize = hwInfo.capabilityTable.grfSize; deviceInfo.globalMemCacheType = CL_READ_WRITE_CACHE; @@ -377,7 +377,7 @@ void ClDevice::initializeCaps() { deviceInfo.supportedThreadArbitrationPolicies[policy] = supportedThreadArbitrationPolicies[policy]; } deviceInfo.preemptionSupported = false; - deviceInfo.maxGlobalVariableSize = ocl21FeaturesEnabled ? 64 * KB : 0; + deviceInfo.maxGlobalVariableSize = ocl21FeaturesEnabled ? 64 * MemoryConstants::kiloByte : 0; deviceInfo.globalVariablePreferredTotalSize = ocl21FeaturesEnabled ? static_cast(sharedDeviceInfo.maxMemAllocSize) : 0; deviceInfo.planarYuvMaxWidth = 16384; diff --git a/opencl/source/kernel/kernel.cpp b/opencl/source/kernel/kernel.cpp index 031667a737..3262de8b22 100644 --- a/opencl/source/kernel/kernel.cpp +++ b/opencl/source/kernel/kernel.cpp @@ -1128,7 +1128,7 @@ uint32_t Kernel::getMaxWorkGroupCount(const cl_uint workDim, const size_t *local dssCount = hardwareInfo.gtSystemInfo.SubSliceCount; } auto availableThreadCount = helper.calculateAvailableThreadCount(hardwareInfo, kernelDescriptor.kernelAttributes.numGrfRequired); - auto availableSlmSize = static_cast(dssCount * KB * hardwareInfo.capabilityTable.slmSize); + auto availableSlmSize = static_cast(dssCount * MemoryConstants::kiloByte * hardwareInfo.capabilityTable.slmSize); auto usedSlmSize = helper.alignSlmSize(slmTotalSize); auto maxBarrierCount = static_cast(helper.getMaxBarrierRegisterPerSlice()); auto barrierCount = kernelDescriptor.kernelAttributes.barrierCount; @@ -1429,7 +1429,7 @@ cl_int Kernel::setArgLocal(uint32_t argIndexIn, ++argIndex; } - slmTotalSize = kernelInfo.kernelDescriptor.kernelAttributes.slmInlineSize + alignUp(slmOffset, KB); + slmTotalSize = kernelInfo.kernelDescriptor.kernelAttributes.slmInlineSize + alignUp(slmOffset, MemoryConstants::kiloByte); return CL_SUCCESS; } diff --git a/opencl/source/mem_obj/buffer.h b/opencl/source/mem_obj/buffer.h index d68af2dff3..4ac88b3a46 100644 --- a/opencl/source/mem_obj/buffer.h +++ b/opencl/source/mem_obj/buffer.h @@ -59,8 +59,8 @@ class Buffer : public MemObj { bool doNotProvidePerformanceHints; bool makeAllocationLockable; }; - constexpr static size_t maxBufferSizeForReadWriteOnCpu = 10 * MB; - constexpr static size_t maxBufferSizeForCopyOnCpu = 64 * KB; + constexpr static size_t maxBufferSizeForReadWriteOnCpu = 10 * MemoryConstants::megaByte; + constexpr static size_t maxBufferSizeForCopyOnCpu = 64 * MemoryConstants::kiloByte; constexpr static cl_ulong maskMagic = 0xFFFFFFFFFFFFFFFFLL; constexpr static cl_ulong objectMagic = MemObj::objectMagic | 0x02; bool forceDisallowCPUCopy = false; diff --git a/opencl/test/unit_test/api/cl_create_buffer_tests.cpp b/opencl/test/unit_test/api/cl_create_buffer_tests.cpp index de64ee359e..5afcb6bf4e 100644 --- a/opencl/test/unit_test/api/cl_create_buffer_tests.cpp +++ b/opencl/test/unit_test/api/cl_create_buffer_tests.cpp @@ -286,7 +286,7 @@ TEST_F(ClCreateBufferTests, GivenBufferSizeOverMaxMemAllocSizeWhenCreateBufferWi TEST_F(ClCreateBufferTests, GivenBufferSizeOverMaxMemAllocSizeAndClMemAllowUnrestirctedSizeFlagWhenCreatingBufferThenClSuccessIsReturned) { auto pDevice = pContext->getDevice(0); - uint64_t bigSize = GB * 5; + uint64_t bigSize = MemoryConstants::gigaByte * 5; size_t size = static_cast(bigSize); cl_mem_flags flags = CL_MEM_ALLOC_HOST_PTR | CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL; auto memoryManager = static_cast(pDevice->getMemoryManager()); @@ -306,7 +306,7 @@ TEST_F(ClCreateBufferTests, GivenBufferSizeOverMaxMemAllocSizeAndClMemAllowUnres TEST_F(ClCreateBufferTests, GivenBufferSizeOverMaxMemAllocSizeAndClMemAllowUnrestirctedSizeFlagWhenCreatingBufferWithPropertiesINTELThenClSuccesssIsReturned) { auto pDevice = pContext->getDevice(0); - uint64_t bigSize = GB * 5; + uint64_t bigSize = MemoryConstants::gigaByte * 5; size_t size = static_cast(bigSize); cl_mem_properties_intel properties[] = {CL_MEM_FLAGS_INTEL, CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL, 0}; diff --git a/opencl/test/unit_test/aub_tests/command_queue/aub_inline_data_local_id_tests_xehp_and_later.cpp b/opencl/test/unit_test/aub_tests/command_queue/aub_inline_data_local_id_tests_xehp_and_later.cpp index 88e3ba3571..6ea212c682 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/aub_inline_data_local_id_tests_xehp_and_later.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/aub_inline_data_local_id_tests_xehp_and_later.cpp @@ -409,7 +409,7 @@ struct HwLocalIdsWithSubGroups : AubDispatchThreadDataFixture { debugManager.flags.EnableHwGenerationLocalIds.set(1); kernelIds |= (1 << 9); - variables[0].sizeUserMemory = 16 * KB; + variables[0].sizeUserMemory = 16 * MemoryConstants::kiloByte; AubDispatchThreadDataFixture::setUp(); memset(variables[0].destMemory, 0, variables[0].sizeUserMemory); diff --git a/opencl/test/unit_test/aub_tests/command_queue/aub_multicontext_tests_xehp_and_later.cpp b/opencl/test/unit_test/aub_tests/command_queue/aub_multicontext_tests_xehp_and_later.cpp index 430d24a745..93b09d15d4 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/aub_multicontext_tests_xehp_and_later.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/aub_multicontext_tests_xehp_and_later.cpp @@ -40,7 +40,7 @@ struct MultitileMulticontextTests : public MulticontextAubFixture, public ::test template void runAubTest() { cl_int retVal = CL_SUCCESS; - const uint32_t bufferSize = 64 * KB; + const uint32_t bufferSize = 64 * MemoryConstants::kiloByte; uint8_t writePattern[bufferSize]; uint8_t initPattern[bufferSize]; std::fill(writePattern, writePattern + sizeof(writePattern), 1); diff --git a/opencl/test/unit_test/aub_tests/command_queue/compression_aub_tests_xehp_and_later.cpp b/opencl/test/unit_test/aub_tests/command_queue/compression_aub_tests_xehp_and_later.cpp index 06b9eac9dd..19a35e9e80 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/compression_aub_tests_xehp_and_later.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/compression_aub_tests_xehp_and_later.cpp @@ -122,7 +122,7 @@ void CompressionXeHPAndLater::givenCompressedImage2DFromBufferW const size_t imageWidth = 16; const size_t imageHeight = 16; - const size_t bufferSize = 64 * KB; + const size_t bufferSize = 64 * MemoryConstants::kiloByte; uint8_t writePattern[bufferSize]; std::fill(writePattern, writePattern + sizeof(writePattern), 1); diff --git a/opencl/test/unit_test/command_queue/command_queue_tests.cpp b/opencl/test/unit_test/command_queue/command_queue_tests.cpp index a2b8808deb..2368b4f33d 100644 --- a/opencl/test/unit_test/command_queue/command_queue_tests.cpp +++ b/opencl/test/unit_test/command_queue/command_queue_tests.cpp @@ -610,7 +610,7 @@ HWTEST_P(CommandQueueIndirectHeapTest, GivenIndirectHeapWhenGettingAvailableSpac size_t expectedSshUse = cmdQ.getGpgpuCommandStreamReceiver().defaultSshSize - MemoryConstants::pageSize - UnitTestHelper::getDefaultSshUsage(); EXPECT_EQ(expectedSshUse, indirectHeap.getAvailableSpace()); } else { - EXPECT_EQ(64 * KB, indirectHeap.getAvailableSpace()); + EXPECT_EQ(64 * MemoryConstants::kiloByte, indirectHeap.getAvailableSpace()); } } @@ -645,7 +645,7 @@ TEST_P(CommandQueueIndirectHeapTest, WhenGettingIndirectHeapWithNewSizeThenMaxAv TEST_P(CommandQueueIndirectHeapTest, WhenGettingIndirectHeapThenSizeIsAlignedToCacheLine) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; MockCommandQueue cmdQ(context.get(), pClDevice, props, false); - size_t minHeapSize = 64 * KB; + size_t minHeapSize = 64 * MemoryConstants::kiloByte; auto &indirectHeapInitial = cmdQ.getIndirectHeap(this->GetParam(), 2 * minHeapSize + 1); diff --git a/opencl/test/unit_test/command_queue/read_write_buffer_cpu_copy.cpp b/opencl/test/unit_test/command_queue/read_write_buffer_cpu_copy.cpp index 9c9d5f2d14..c7c69793c3 100644 --- a/opencl/test/unit_test/command_queue/read_write_buffer_cpu_copy.cpp +++ b/opencl/test/unit_test/command_queue/read_write_buffer_cpu_copy.cpp @@ -145,7 +145,7 @@ HWTEST_F(ReadWriteBufferCpuCopyTest, GivenSpecificMemoryStructuresWhenReadingWri auto unalignedBufferPtr = ptrOffset(alignedBufferPtr, 1); auto alignedHostPtr = alignedMalloc(MemoryConstants::cacheLineSize + 1, MemoryConstants::cacheLineSize); auto unalignedHostPtr = ptrOffset(alignedHostPtr, 1); - auto smallBufferPtr = alignedMalloc(1 * MB, MemoryConstants::cacheLineSize); + auto smallBufferPtr = alignedMalloc(1 * MemoryConstants::megaByte, MemoryConstants::cacheLineSize); size_t largeBufferSize = 11u * MemoryConstants::megaByte; auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); @@ -168,15 +168,15 @@ HWTEST_F(ReadWriteBufferCpuCopyTest, GivenSpecificMemoryStructuresWhenReadingWri // zeroCopy == false && unaligned hostPtr EXPECT_TRUE(buffer->isReadWriteOnCpuPreferred(unalignedHostPtr, MemoryConstants::cacheLineSize, mockDevice->getDevice())); - buffer.reset(Buffer::create(mockContext.get(), CL_MEM_USE_HOST_PTR, 1 * MB, smallBufferPtr, retVal)); + buffer.reset(Buffer::create(mockContext.get(), CL_MEM_USE_HOST_PTR, 1 * MemoryConstants::megaByte, smallBufferPtr, retVal)); // platform LP == true && size <= 10 MB mockDevice->deviceInfo.platformLP = true; - EXPECT_TRUE(buffer->isReadWriteOnCpuPreferred(smallBufferPtr, 1 * MB, mockDevice->getDevice())); + EXPECT_TRUE(buffer->isReadWriteOnCpuPreferred(smallBufferPtr, 1 * MemoryConstants::megaByte, mockDevice->getDevice())); // platform LP == false && size <= 10 MB mockDevice->deviceInfo.platformLP = false; - EXPECT_TRUE(buffer->isReadWriteOnCpuPreferred(smallBufferPtr, 1 * MB, mockDevice->getDevice())); + EXPECT_TRUE(buffer->isReadWriteOnCpuPreferred(smallBufferPtr, 1 * MemoryConstants::megaByte, mockDevice->getDevice())); buffer.reset(Buffer::create(mockContext.get(), CL_MEM_ALLOC_HOST_PTR, largeBufferSize, nullptr, retVal)); diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_1_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_1_tests.cpp index 6d6d240fff..8486c3114b 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_1_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_1_tests.cpp @@ -473,7 +473,7 @@ HWTEST_F(CommandStreamReceiverHwTest, givenCsrHwWhenTypeIsCheckedThenCsrHwIsRetu HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverHwTest, WhenCommandStreamReceiverHwIsCreatedThenDefaultSshSizeIs64KB) { auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver(); - EXPECT_EQ(64 * KB, commandStreamReceiver.defaultSshSize); + EXPECT_EQ(64 * MemoryConstants::kiloByte, commandStreamReceiver.defaultSshSize); } HWTEST_F(CommandStreamReceiverHwTest, WhenScratchSpaceIsNotRequiredThenScratchAllocationIsNotCreated) { @@ -590,7 +590,7 @@ HWTEST2_F(CommandStreamReceiverHwTest, whenProgramVFEStateIsCalledThenCorrectCom auto pHwInfo = rootDeviceEnvironment.getMutableHardwareInfo(); const auto &productHelper = pDevice->getProductHelper(); - uint8_t memory[1 * KB]{}; + uint8_t memory[1 * MemoryConstants::kiloByte]{}; auto mockCsr = std::make_unique>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); MockOsContext osContext{0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::Regular}, DeviceBitfield(0))}; diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests_xehp_and_later.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests_xehp_and_later.cpp index ebd92a4a2a..33c26c45f5 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests_xehp_and_later.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests_xehp_and_later.cpp @@ -101,7 +101,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenPream HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, WhenCommandStreamReceiverHwIsCreatedThenDefaultSshSizeIs2MB) { auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver(); - EXPECT_EQ(2 * MB, commandStreamReceiver.defaultSshSize); + EXPECT_EQ(2 * MemoryConstants::megaByte, commandStreamReceiver.defaultSshSize); } HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, WhenScratchSpaceExistsThenReturnNonZeroGpuAddressToPatch) { diff --git a/opencl/test/unit_test/device/device_caps_tests.cpp b/opencl/test/unit_test/device/device_caps_tests.cpp index 566bc4d693..a6e5d99a56 100644 --- a/opencl/test/unit_test/device/device_caps_tests.cpp +++ b/opencl/test/unit_test/device/device_caps_tests.cpp @@ -197,9 +197,9 @@ TEST_F(DeviceGetCapsTest, WhenCreatingDeviceThenCapsArePopulatedCorrectly) { EXPECT_LE(sharedCaps.maxReadImageArgs * sizeof(cl_mem), sharedCaps.maxParameterSize); EXPECT_LE(sharedCaps.maxWriteImageArgs * sizeof(cl_mem), sharedCaps.maxParameterSize); - EXPECT_LE(128u * MB, sharedCaps.maxMemAllocSize); + EXPECT_LE(128u * MemoryConstants::megaByte, sharedCaps.maxMemAllocSize); if (!device->areSharedSystemAllocationsAllowed()) { - EXPECT_GE((4 * GB) - (8 * KB), sharedCaps.maxMemAllocSize); + EXPECT_GE((4 * MemoryConstants::gigaByte) - (8 * MemoryConstants::kiloByte), sharedCaps.maxMemAllocSize); } EXPECT_LE(65536u, sharedCaps.imageMaxBufferSize); @@ -394,7 +394,7 @@ TEST_F(DeviceGetCapsTest, givenForce32bitAddressingWhenCapsAreCreatedThenDeviceR } else { EXPECT_FALSE(sharedCaps.force32BitAddressess); } - auto expectedSize = (cl_ulong)(4 * memSizePercent * GB); + auto expectedSize = (cl_ulong)(4 * memSizePercent * MemoryConstants::gigaByte); EXPECT_LE(sharedCaps.globalMemSize, expectedSize); EXPECT_LE(sharedCaps.maxMemAllocSize, expectedSize); EXPECT_LE(caps.maxConstantBufferSize, expectedSize); @@ -431,7 +431,7 @@ TEST_F(DeviceGetCapsTest, Given32bitAddressingWhenDeviceIsCreatedThenGlobalMemSi memSize = (cl_ulong)((double)memSize * memSizePercent) - internalResourcesSize; if (addressing32Bit) { - memSize = std::min(memSize, (uint64_t)(4 * GB * memSizePercent)); + memSize = std::min(memSize, (uint64_t)(4 * MemoryConstants::gigaByte * memSizePercent)); } cl_ulong expectedSize = alignDown(memSize, MemoryConstants::pageSize); @@ -454,7 +454,7 @@ TEST_F(DeviceGetCapsTest, givenDeviceCapsWhenLocalMemoryIsEnabledThenCalculateGl auto memSize = std::min(localMem, maxAppAddrSpace); memSize = static_cast(memSize * memSizePercent); if (addressing32Bit) { - memSize = std::min(memSize, static_cast(4 * GB * memSizePercent)); + memSize = std::min(memSize, static_cast(4 * MemoryConstants::gigaByte * memSizePercent)); } cl_ulong expectedSize = alignDown(memSize, MemoryConstants::pageSize); @@ -1578,7 +1578,7 @@ TEST(Device_UseCaps, givenOverrideSlmSizeWhenWhenInitializeDeviceThenSlmSizeInDe auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&hardwareInfo)); auto &deviceInfoWithoutForceSlmFlag = device->getSharedDeviceInfo(); - EXPECT_EQ(defaultSlmSize, static_cast(deviceInfoWithoutForceSlmFlag.localMemSize / KB)); + EXPECT_EQ(defaultSlmSize, static_cast(deviceInfoWithoutForceSlmFlag.localMemSize / MemoryConstants::kiloByte)); uint32_t newSlmSize = 1; EXPECT_NE(defaultSlmSize, newSlmSize); @@ -1587,7 +1587,7 @@ TEST(Device_UseCaps, givenOverrideSlmSizeWhenWhenInitializeDeviceThenSlmSizeInDe device.reset(new MockClDevice{MockDevice::createWithNewExecutionEnvironment(&hardwareInfo)}); auto &deviceInfoWithForceSlmFlag = device->getSharedDeviceInfo(); - EXPECT_EQ(newSlmSize, static_cast(deviceInfoWithForceSlmFlag.localMemSize / KB)); + EXPECT_EQ(newSlmSize, static_cast(deviceInfoWithForceSlmFlag.localMemSize / MemoryConstants::kiloByte)); } TEST_F(DeviceGetCapsTest, givenClDeviceWhenInitializingCapsThenUseGetQueueFamilyCapabilitiesMethod) { diff --git a/opencl/test/unit_test/kernel/kernel_slm_arg_tests.cpp b/opencl/test/unit_test/kernel/kernel_slm_arg_tests.cpp index 8271ab14f9..867050b643 100644 --- a/opencl/test/unit_test/kernel/kernel_slm_arg_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_slm_arg_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -42,7 +42,7 @@ class KernelSlmArgTest : public MultiRootDeviceWithSubDevicesFixture { pKernelInfo->addArgLocal(2, 0x30, 0x10); - pKernelInfo->kernelDescriptor.kernelAttributes.slmInlineSize = 3 * KB; + pKernelInfo->kernelDescriptor.kernelAttributes.slmInlineSize = 3 * MemoryConstants::kiloByte; for (auto &rootDeviceIndex : this->context->getRootDeviceIndices()) { pKernel[rootDeviceIndex] = new MockKernel(program.get(), *pKernelInfo, *deviceFactory->rootDevices[rootDeviceIndex]); @@ -88,7 +88,7 @@ TEST_F(KernelSlmArgTest, WhenSettingSizeThenAlignmentOfHigherSlmArgsIsUpdated) { slmOffset = ptrOffset(crossThreadData, 0x30); EXPECT_EQ(0x200u, *slmOffset); - EXPECT_EQ(4 * KB, pKernel[rootDeviceIndex]->slmTotalSize); + EXPECT_EQ(4 * MemoryConstants::kiloByte, pKernel[rootDeviceIndex]->slmTotalSize); } } @@ -107,6 +107,6 @@ TEST_F(KernelSlmArgTest, GivenReverseOrderWhenSettingSizeThenAlignmentOfHigherSl slmOffset = ptrOffset(crossThreadData, 0x30); EXPECT_EQ(0x200u, *slmOffset); - EXPECT_EQ(4 * KB, pKernel[rootDeviceIndex]->slmTotalSize); + EXPECT_EQ(4 * MemoryConstants::kiloByte, pKernel[rootDeviceIndex]->slmTotalSize); } } diff --git a/opencl/test/unit_test/kernel/kernel_slm_tests.cpp b/opencl/test/unit_test/kernel/kernel_slm_tests.cpp index 5ee21a3e80..f9897ef626 100644 --- a/opencl/test/unit_test/kernel/kernel_slm_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_slm_tests.cpp @@ -63,7 +63,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, KernelSLMAndBarrierTest, GivenStaticSlmSizeWhenProgr DefaultWalkerType walkerCmd{}; // define kernel info kernelInfo.kernelDescriptor.kernelAttributes.barrierCount = 1; - kernelInfo.kernelDescriptor.kernelAttributes.slmInlineSize = GetParam() * KB; + kernelInfo.kernelDescriptor.kernelAttributes.slmInlineSize = GetParam() * MemoryConstants::kiloByte; MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); diff --git a/opencl/test/unit_test/mem_obj/image_from_subbuffer_tests.cpp b/opencl/test/unit_test/mem_obj/image_from_subbuffer_tests.cpp index 5a384afa26..f932a002e6 100644 --- a/opencl/test/unit_test/mem_obj/image_from_subbuffer_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image_from_subbuffer_tests.cpp @@ -98,7 +98,7 @@ TEST_F(ImageFromSubBufferTest, GivenSubBufferWithOffsetGreaterThan4gbWhenCreatin cl_buffer_region region = {0, size / 2}; if constexpr (is64bit) { - offsetExpected = 8 * GB; + offsetExpected = 8 * MemoryConstants::gigaByte; region = {static_cast(offsetExpected), size / 2}; } diff --git a/opencl/test/unit_test/mem_obj/image_set_arg_tests.cpp b/opencl/test/unit_test/mem_obj/image_set_arg_tests.cpp index 6f2bcde86c..439c4972cd 100644 --- a/opencl/test/unit_test/mem_obj/image_set_arg_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image_set_arg_tests.cpp @@ -1159,7 +1159,7 @@ HWTEST_F(ImageSetArgTest, givenImageWithOffsetGreaterThan4GBWhenSurfaceStateIsPr typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE; RENDER_SURFACE_STATE surfaceState; - uint64_t surfaceOffset = 8 * GB; + uint64_t surfaceOffset = 8 * MemoryConstants::gigaByte; srcImage->setSurfaceOffsets(surfaceOffset, 0, 0, 0); srcImage->setImageArg(&surfaceState, false, 0, pClDevice->getRootDeviceIndex(), false); diff --git a/opencl/test/unit_test/os_interface/linux/cl_drm_memory_manager_tests.cpp b/opencl/test/unit_test/os_interface/linux/cl_drm_memory_manager_tests.cpp index 9abd57f9ce..102a8adec6 100644 --- a/opencl/test/unit_test/os_interface/linux/cl_drm_memory_manager_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/cl_drm_memory_manager_tests.cpp @@ -210,7 +210,7 @@ TEST_F(ClDrmMemoryManagerTest, GivenSizeAbove2GBWhenUseHostPtrAndAllocHostPtrAre MockContext context(pClDevice); memoryManager->setForce32BitAllocations(true); - size_t size = 2 * GB; + size_t size = 2 * MemoryConstants::gigaByte; void *ptr = reinterpret_cast(0x100000000000); auto retVal = CL_SUCCESS; @@ -221,7 +221,7 @@ TEST_F(ClDrmMemoryManagerTest, GivenSizeAbove2GBWhenUseHostPtrAndAllocHostPtrAre ptr, retVal); - size_t size2 = 4 * GB - MemoryConstants::pageSize; // Keep size aligned + size_t size2 = 4 * MemoryConstants::gigaByte - MemoryConstants::pageSize; // Keep size aligned auto buffer2 = Buffer::create( &context, @@ -251,7 +251,7 @@ TEST_F(ClDrmMemoryManagerTest, GivenSizeAbove2GBWhenAllocHostPtrAndUseHostPtrAre MockContext context(pClDevice); memoryManager->setForce32BitAllocations(true); - size_t size = 2 * GB; + size_t size = 2 * MemoryConstants::gigaByte; void *ptr = reinterpret_cast(0x100000000000); auto retVal = CL_SUCCESS; @@ -262,7 +262,7 @@ TEST_F(ClDrmMemoryManagerTest, GivenSizeAbove2GBWhenAllocHostPtrAndUseHostPtrAre nullptr, retVal); - size_t size2 = 4 * GB - MemoryConstants::pageSize; // Keep size aligned + size_t size2 = 4 * MemoryConstants::gigaByte - MemoryConstants::pageSize; // Keep size aligned auto buffer2 = Buffer::create( &context, diff --git a/opencl/test/unit_test/xe_hpc_core/copy_engine_tests_xe_hpc_core.cpp b/opencl/test/unit_test/xe_hpc_core/copy_engine_tests_xe_hpc_core.cpp index c6e68215f5..e4e6fbffba 100644 --- a/opencl/test/unit_test/xe_hpc_core/copy_engine_tests_xe_hpc_core.cpp +++ b/opencl/test/unit_test/xe_hpc_core/copy_engine_tests_xe_hpc_core.cpp @@ -142,7 +142,7 @@ XE_HPC_CORETEST_F(BlitXeHpcCoreTests, givenTransferLargerThenHalfOfL3WhenItIsPro cl_int retVal = CL_SUCCESS; auto buffer = clUniquePtr(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal)); - size_t transferSize = static_cast(clDevice->getHardwareInfo().gtSystemInfo.L3CacheSizeInKb * KB / 2 + 1); + size_t transferSize = static_cast(clDevice->getHardwareInfo().gtSystemInfo.L3CacheSizeInKb * MemoryConstants::kiloByte / 2 + 1); auto blitProperties = BlitProperties::constructPropertiesForCopy(buffer->getGraphicsAllocation(clDevice->getRootDeviceIndex()), buffer->getGraphicsAllocation(clDevice->getRootDeviceIndex()), diff --git a/shared/source/command_container/command_encoder_bdw_and_later.inl b/shared/source/command_container/command_encoder_bdw_and_later.inl index 8a773c8473..cac0002261 100644 --- a/shared/source/command_container/command_encoder_bdw_and_later.inl +++ b/shared/source/command_container/command_encoder_bdw_and_later.inl @@ -624,7 +624,7 @@ size_t EncodeDispatchKernel::additionalSizeRequiredDsh(uint32_t iddCount template size_t EncodeStates::getSshHeapSize() { - return 64 * KB; + return 64 * MemoryConstants::kiloByte; } } // namespace NEO diff --git a/shared/source/command_container/command_encoder_xehp_and_later.inl b/shared/source/command_container/command_encoder_xehp_and_later.inl index fee52859e9..b8e724eeb6 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -869,7 +869,7 @@ size_t EncodeDispatchKernel::additionalSizeRequiredDsh(uint32_t iddCount template size_t EncodeStates::getSshHeapSize() { - return 2 * MB; + return 2 * MemoryConstants::megaByte; } } // namespace NEO diff --git a/shared/source/command_stream/aub_command_stream_receiver_hw_base.inl b/shared/source/command_stream/aub_command_stream_receiver_hw_base.inl index a8e561970c..3640c4336c 100644 --- a/shared/source/command_stream/aub_command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/aub_command_stream_receiver_hw_base.inl @@ -90,7 +90,7 @@ AUBCommandStreamReceiverHw::AUBCommandStreamReceiverHw(const std::str this->aubDeviceId = debugDeviceId == -1 ? this->peekHwInfo().capabilityTable.aubDeviceId : static_cast(debugDeviceId); - this->defaultSshSize = 64 * KB; + this->defaultSshSize = 64 * MemoryConstants::kiloByte; } template diff --git a/shared/source/device/device_caps.cpp b/shared/source/device/device_caps.cpp index 5dc20a34da..f101408a64 100644 --- a/shared/source/device/device_caps.cpp +++ b/shared/source/device/device_caps.cpp @@ -77,7 +77,7 @@ void Device::initializeCaps() { if (debugManager.flags.Force32bitAddressing.get() || addressing32bitAllowed || is32bit) { double percentOfGlobalMemoryAvailable = getPercentOfGlobalMemoryAvailable(); - deviceInfo.globalMemSize = std::min(deviceInfo.globalMemSize, static_cast(4 * GB * percentOfGlobalMemoryAvailable)); + deviceInfo.globalMemSize = std::min(deviceInfo.globalMemSize, static_cast(4 * MemoryConstants::gigaByte * percentOfGlobalMemoryAvailable)); deviceInfo.addressBits = 32; deviceInfo.force32BitAddressess = is64bit; } @@ -159,9 +159,9 @@ void Device::initializeCaps() { deviceInfo.computeUnitsUsedForScratch = gfxCoreHelper.getComputeUnitsUsedForScratch(this->getRootDeviceEnvironment()); deviceInfo.maxFrontEndThreads = gfxCoreHelper.getMaxThreadsForVfe(hwInfo); - deviceInfo.localMemSize = hwInfo.capabilityTable.slmSize * KB; + deviceInfo.localMemSize = hwInfo.capabilityTable.slmSize * MemoryConstants::kiloByte; if (debugManager.flags.OverrideSlmSize.get() != -1) { - deviceInfo.localMemSize = debugManager.flags.OverrideSlmSize.get() * KB; + deviceInfo.localMemSize = debugManager.flags.OverrideSlmSize.get() * MemoryConstants::kiloByte; } deviceInfo.imageSupport = hwInfo.capabilityTable.supportsImages; @@ -170,7 +170,7 @@ void Device::initializeCaps() { deviceInfo.image3DMaxDepth = 2048; deviceInfo.imageMaxArraySize = 2048; - deviceInfo.printfBufferSize = 4 * MB; + deviceInfo.printfBufferSize = 4 * MemoryConstants::megaByte; deviceInfo.maxClockFrequency = hwInfo.capabilityTable.maxRenderFrequency; deviceInfo.maxSubGroups = gfxCoreHelper.getDeviceSubGroupSizes(); diff --git a/shared/source/gen8/gfx_core_helper_gen8.cpp b/shared/source/gen8/gfx_core_helper_gen8.cpp index b8f4a6fe32..be4568d428 100644 --- a/shared/source/gen8/gfx_core_helper_gen8.cpp +++ b/shared/source/gen8/gfx_core_helper_gen8.cpp @@ -31,7 +31,7 @@ uint32_t GfxCoreHelperHw::alignSlmSize(uint32_t slmSize) const { template <> uint32_t GfxCoreHelperHw::computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize) const { - slmSize += (4 * KB - 1); + slmSize += (4 * MemoryConstants::kiloByte - 1); slmSize = slmSize >> 12; slmSize = std::min(slmSize, 15u); slmSize = slmSizeId[slmSize]; diff --git a/shared/source/helpers/constants.h b/shared/source/helpers/constants.h index dfd8964dbb..845c02e3df 100644 --- a/shared/source/helpers/constants.h +++ b/shared/source/helpers/constants.h @@ -58,10 +58,6 @@ inline constexpr size_t chunkThreshold = MemoryConstants::pageSize64k; } // namespace MemoryConstants -inline constexpr uint64_t KB = MemoryConstants::kiloByte; -inline constexpr uint64_t MB = MemoryConstants::megaByte; -inline constexpr uint64_t GB = MemoryConstants::gigaByte; - namespace BlitterConstants { inline constexpr uint64_t maxBlitWidth = 0x4000; inline constexpr uint64_t maxBlitHeight = 0x4000; diff --git a/shared/source/helpers/gfx_core_helper_base.inl b/shared/source/helpers/gfx_core_helper_base.inl index 8cd418694e..952b55037d 100644 --- a/shared/source/helpers/gfx_core_helper_base.inl +++ b/shared/source/helpers/gfx_core_helper_base.inl @@ -37,7 +37,7 @@ bool GfxCoreHelperHw::isBufferSizeSuitableForCompression(const size_t si if (debugManager.flags.OverrideBufferSuitableForRenderCompression.get() != -1) { return !!debugManager.flags.OverrideBufferSuitableForRenderCompression.get(); } - return size > KB; + return size > MemoryConstants::kiloByte; } template @@ -404,7 +404,7 @@ uint32_t GfxCoreHelperHw::alignSlmSize(uint32_t slmSize) const { } slmSize = std::max(slmSize, 1024u); slmSize = Math::nextPowerOfTwo(slmSize); - UNRECOVERABLE_IF(slmSize > 64u * KB); + UNRECOVERABLE_IF(slmSize > 64u * MemoryConstants::kiloByte); return slmSize; } @@ -600,7 +600,7 @@ void GfxCoreHelperHw::setSipKernelData(uint32_t *&sipKernelBinary, si template size_t GfxCoreHelperHw::getSipKernelMaxDbgSurfaceSize(const HardwareInfo &hwInfo) const { - return 24 * MB; + return 24 * MemoryConstants::megaByte; } template diff --git a/shared/source/helpers/gfx_core_helper_bdw_and_later.inl b/shared/source/helpers/gfx_core_helper_bdw_and_later.inl index 2a6676f620..a9e2693f0b 100644 --- a/shared/source/helpers/gfx_core_helper_bdw_and_later.inl +++ b/shared/source/helpers/gfx_core_helper_bdw_and_later.inl @@ -133,7 +133,7 @@ bool GfxCoreHelperHw::isScratchSpaceSurfaceStateAccessible() const { template uint32_t GfxCoreHelperHw::getMaxScratchSize() const { - return 2 * MB; + return 2 * MemoryConstants::megaByte; } template diff --git a/shared/source/helpers/gfx_core_helper_xehp_and_later.inl b/shared/source/helpers/gfx_core_helper_xehp_and_later.inl index df2f4d4ca2..e41d5c30ce 100644 --- a/shared/source/helpers/gfx_core_helper_xehp_and_later.inl +++ b/shared/source/helpers/gfx_core_helper_xehp_and_later.inl @@ -166,7 +166,7 @@ bool GfxCoreHelperHw::isScratchSpaceSurfaceStateAccessible() const { } template uint32_t GfxCoreHelperHw::getMaxScratchSize() const { - return 256 * KB; + return 256 * MemoryConstants::kiloByte; } template diff --git a/shared/source/helpers/ray_tracing_helper.h b/shared/source/helpers/ray_tracing_helper.h index 1425a7110a..a2f1dcf48d 100644 --- a/shared/source/helpers/ray_tracing_helper.h +++ b/shared/source/helpers/ray_tracing_helper.h @@ -23,7 +23,7 @@ class RayTracingHelper : public NonCopyableOrMovableClass { static constexpr uint32_t stackDssMultiplier = 2048; static constexpr uint32_t hitInfoSize = 64; static constexpr uint32_t bvhStackSize = 96; - static constexpr uint32_t memoryBackedFifoSizePerDss = 8 * KB; + static constexpr uint32_t memoryBackedFifoSizePerDss = 8 * MemoryConstants::kiloByte; static constexpr uint32_t maxBvhLevels = 8; static size_t getDispatchGlobalSize() { @@ -39,7 +39,7 @@ class RayTracingHelper : public NonCopyableOrMovableClass { } static size_t getMemoryBackedFifoSizeToPatch() { - return static_cast(Math::log2(memoryBackedFifoSizePerDss / KB) - 1); + return static_cast(Math::log2(memoryBackedFifoSizePerDss / MemoryConstants::kiloByte) - 1); } static uint32_t getNumRtStacks(const Device &device) { diff --git a/shared/source/indirect_heap/heap_size.h b/shared/source/indirect_heap/heap_size.h index 5f26450e10..c2c497f680 100644 --- a/shared/source/indirect_heap/heap_size.h +++ b/shared/source/indirect_heap/heap_size.h @@ -11,7 +11,7 @@ namespace NEO { namespace HeapSize { -inline constexpr size_t defaultHeapSize = 64 * KB; +inline constexpr size_t defaultHeapSize = 64 * MemoryConstants::kiloByte; size_t getDefaultHeapSize(size_t defaultValue); diff --git a/shared/source/memory_manager/os_agnostic_memory_manager.cpp b/shared/source/memory_manager/os_agnostic_memory_manager.cpp index b965f00d5c..53f757b023 100644 --- a/shared/source/memory_manager/os_agnostic_memory_manager.cpp +++ b/shared/source/memory_manager/os_agnostic_memory_manager.cpp @@ -38,7 +38,7 @@ OsAgnosticMemoryManager::OsAgnosticMemoryManager(bool aubUsage, ExecutionEnviron void OsAgnosticMemoryManager::initialize(bool aubUsage) { // 4 x sizeof(Heap32) + 2 x sizeof(Standard/Standard64k) - size_t reservedCpuAddressRangeSize = (4 * 4 + 2 * (aubUsage ? 32 : 4)) * GB; + size_t reservedCpuAddressRangeSize = (4 * 4 + 2 * (aubUsage ? 32 : 4)) * MemoryConstants::gigaByte; for (uint32_t rootDeviceIndex = 0; rootDeviceIndex < gfxPartitions.size(); ++rootDeviceIndex) { auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo(); @@ -344,7 +344,7 @@ void OsAgnosticMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllo } uint64_t OsAgnosticMemoryManager::getSystemSharedMemory(uint32_t rootDeviceIndex) { - return 16 * GB; + return 16 * MemoryConstants::gigaByte; } GraphicsAllocation *OsAgnosticMemoryManager::createGraphicsAllocation(OsHandleStorage &handleStorage, const AllocationData &allocationData) { diff --git a/shared/source/memory_manager/os_agnostic_memory_manager.h b/shared/source/memory_manager/os_agnostic_memory_manager.h index 26bc298685..380cbfbc3b 100644 --- a/shared/source/memory_manager/os_agnostic_memory_manager.h +++ b/shared/source/memory_manager/os_agnostic_memory_manager.h @@ -11,7 +11,7 @@ namespace NEO { class MemoryAllocation; -constexpr size_t bigAllocation = 1 * MB; +constexpr size_t bigAllocation = 1 * MemoryConstants::megaByte; constexpr uint64_t dummyAddress = 0xFFFFF000u; class OsAgnosticMemoryManager : public MemoryManager { diff --git a/shared/source/program/sync_buffer_handler.h b/shared/source/program/sync_buffer_handler.h index f14721786b..6ad9686298 100644 --- a/shared/source/program/sync_buffer_handler.h +++ b/shared/source/program/sync_buffer_handler.h @@ -35,7 +35,7 @@ class SyncBufferHandler : NonCopyableOrMovableClass { Device &device; MemoryManager &memoryManager; GraphicsAllocation *graphicsAllocation; - const size_t bufferSize = 64 * KB; + const size_t bufferSize = 64 * MemoryConstants::kiloByte; size_t usedBufferSize = 0; std::mutex mutex; }; diff --git a/shared/source/utilities/buffer_pool_allocator.h b/shared/source/utilities/buffer_pool_allocator.h index effdf929f2..6ac36b3bae 100644 --- a/shared/source/utilities/buffer_pool_allocator.h +++ b/shared/source/utilities/buffer_pool_allocator.h @@ -25,8 +25,8 @@ class MemoryManager; template struct SmallBuffersParams { protected: - static constexpr auto aggregatedSmallBuffersPoolSize = 2 * MB; - static constexpr auto smallBufferThreshold = 4 * KB; + static constexpr auto aggregatedSmallBuffersPoolSize = 2 * MemoryConstants::megaByte; + static constexpr auto smallBufferThreshold = 4 * MemoryConstants::kiloByte; static constexpr auto chunkAlignment = 512u; static constexpr auto startingOffset = chunkAlignment; }; diff --git a/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp b/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp index f019f1cb4f..3b1460e275 100644 --- a/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp @@ -332,10 +332,10 @@ void EncodeDispatchKernel::appendAdditionalIDDFields(InterfaceDescriptor const std::array ranges = {{ // upper limit, retVal {0, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_0K}, - {16 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K}, - {32 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_32K}, - {64 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_64K}, - {96 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_96K}, + {16 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K}, + {32 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_32K}, + {64 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_64K}, + {96 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_96K}, }}; auto programmableIdPreferredSlmSize = PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K; diff --git a/shared/source/xe_hpc_core/command_stream_receiver_hw_xe_hpc_core.cpp b/shared/source/xe_hpc_core/command_stream_receiver_hw_xe_hpc_core.cpp index 20bd758822..f8cc3c5266 100644 --- a/shared/source/xe_hpc_core/command_stream_receiver_hw_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/command_stream_receiver_hw_xe_hpc_core.cpp @@ -86,7 +86,7 @@ void BlitCommandsHelper::appendBlitCommandsMemCopy(const BlitProperties auto cachePolicy = GMM_RESOURCE_USAGE_OCL_BUFFER; // if transfer size bigger then L3 size, copy with L3 disabled - if (blitProperites.copySize.x * blitProperites.copySize.y * blitProperites.copySize.z * blitProperites.bytesPerPixel >= (rootDeviceEnvironment.getHardwareInfo()->gtSystemInfo.L3CacheSizeInKb * KB / 2)) { + if (blitProperites.copySize.x * blitProperites.copySize.y * blitProperites.copySize.z * blitProperites.bytesPerPixel >= (rootDeviceEnvironment.getHardwareInfo()->gtSystemInfo.L3CacheSizeInKb * MemoryConstants::kiloByte / 2)) { cachePolicy = GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED; } diff --git a/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp b/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp index 8606860835..31a3ba23d7 100644 --- a/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp @@ -263,17 +263,17 @@ template <> uint32_t GfxCoreHelperHw::alignSlmSize(uint32_t slmSize) const { const uint32_t alignedSlmSizes[] = { 0u, - 1u * KB, - 2u * KB, - 4u * KB, - 8u * KB, - 16u * KB, - 24u * KB, - 32u * KB, - 48u * KB, - 64u * KB, - 96u * KB, - 128u * KB, + 1u * MemoryConstants::kiloByte, + 2u * MemoryConstants::kiloByte, + 4u * MemoryConstants::kiloByte, + 8u * MemoryConstants::kiloByte, + 16u * MemoryConstants::kiloByte, + 24u * MemoryConstants::kiloByte, + 32u * MemoryConstants::kiloByte, + 48u * MemoryConstants::kiloByte, + 64u * MemoryConstants::kiloByte, + 96u * MemoryConstants::kiloByte, + 128u * MemoryConstants::kiloByte, }; for (auto &alignedSlmSize : alignedSlmSizes) { @@ -293,36 +293,36 @@ uint32_t GfxCoreHelperHw::computeSlmValues(const HardwareInfo &hwInfo, u return SHARED_LOCAL_MEMORY_SIZE::SHARED_LOCAL_MEMORY_SIZE_ENCODES_0K; } - UNRECOVERABLE_IF(slmSize > 128u * KB); + UNRECOVERABLE_IF(slmSize > 128u * MemoryConstants::kiloByte); - if (slmSize > 96u * KB) { + if (slmSize > 96u * MemoryConstants::kiloByte) { return SHARED_LOCAL_MEMORY_SIZE::SHARED_LOCAL_MEMORY_SIZE_ENCODES_128K; } - if (slmSize > 64u * KB) { + if (slmSize > 64u * MemoryConstants::kiloByte) { return SHARED_LOCAL_MEMORY_SIZE::SHARED_LOCAL_MEMORY_SIZE_ENCODES_96K; } - if (slmSize > 48u * KB) { + if (slmSize > 48u * MemoryConstants::kiloByte) { return SHARED_LOCAL_MEMORY_SIZE::SHARED_LOCAL_MEMORY_SIZE_ENCODES_64K; } - if (slmSize > 32u * KB) { + if (slmSize > 32u * MemoryConstants::kiloByte) { return SHARED_LOCAL_MEMORY_SIZE::SHARED_LOCAL_MEMORY_SIZE_ENCODES_48K; } - if (slmSize > 24u * KB) { + if (slmSize > 24u * MemoryConstants::kiloByte) { return SHARED_LOCAL_MEMORY_SIZE::SHARED_LOCAL_MEMORY_SIZE_ENCODES_32K; } - if (slmSize > 16u * KB) { + if (slmSize > 16u * MemoryConstants::kiloByte) { return SHARED_LOCAL_MEMORY_SIZE::SHARED_LOCAL_MEMORY_SIZE_ENCODES_24K; } - if (slmSize > 8u * KB) { + if (slmSize > 8u * MemoryConstants::kiloByte) { return SHARED_LOCAL_MEMORY_SIZE::SHARED_LOCAL_MEMORY_SIZE_ENCODES_16K; } - if (slmSize > 4u * KB) { + if (slmSize > 4u * MemoryConstants::kiloByte) { return SHARED_LOCAL_MEMORY_SIZE::SHARED_LOCAL_MEMORY_SIZE_ENCODES_8K; } - if (slmSize > 2u * KB) { + if (slmSize > 2u * MemoryConstants::kiloByte) { return SHARED_LOCAL_MEMORY_SIZE::SHARED_LOCAL_MEMORY_SIZE_ENCODES_4K; } - if (slmSize > 1u * KB) { + if (slmSize > 1u * MemoryConstants::kiloByte) { return SHARED_LOCAL_MEMORY_SIZE::SHARED_LOCAL_MEMORY_SIZE_ENCODES_2K; } return SHARED_LOCAL_MEMORY_SIZE::SHARED_LOCAL_MEMORY_SIZE_ENCODES_1K; @@ -362,7 +362,7 @@ uint32_t GfxCoreHelperHw::getComputeUnitsUsedForScratch(const RootDevice template <> size_t GfxCoreHelperHw::getSipKernelMaxDbgSurfaceSize(const HardwareInfo &hwInfo) const { - return 40 * MB; + return 40 * MemoryConstants::megaByte; } template <> diff --git a/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp b/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp index 5d856fc7f8..d84bac8413 100644 --- a/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp @@ -62,10 +62,10 @@ void EncodeDispatchKernel::appendAdditionalIDDFields(InterfaceDescriptor const std::array ranges = {{ // upper limit, retVal {0, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_0K}, - {16 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K}, - {32 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_32K}, - {64 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_64K}, - {96 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_96K}, + {16 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K}, + {32 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_32K}, + {64 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_64K}, + {96 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_96K}, }}; auto programmableIdPreferredSlmSize = PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K; diff --git a/shared/test/common/mocks/linux/mock_ioctl_helper.h b/shared/test/common/mocks/linux/mock_ioctl_helper.h index 2d693d98f0..4036ca60bf 100644 --- a/shared/test/common/mocks/linux/mock_ioctl_helper.h +++ b/shared/test/common/mocks/linux/mock_ioctl_helper.h @@ -17,12 +17,12 @@ namespace NEO { -constexpr uint64_t probedSizeRegionZero = 8 * GB; -constexpr uint64_t probedSizeRegionOne = 16 * GB; -constexpr uint64_t probedSizeRegionFour = 32 * GB; -constexpr uint64_t unallocatedSizeRegionZero = 6 * GB; -constexpr uint64_t unallocatedSizeRegionOne = 12 * GB; -constexpr uint64_t unallocatedSizeRegionFour = 4 * GB; +constexpr uint64_t probedSizeRegionZero = 8 * MemoryConstants::gigaByte; +constexpr uint64_t probedSizeRegionOne = 16 * MemoryConstants::gigaByte; +constexpr uint64_t probedSizeRegionFour = 32 * MemoryConstants::gigaByte; +constexpr uint64_t unallocatedSizeRegionZero = 6 * MemoryConstants::gigaByte; +constexpr uint64_t unallocatedSizeRegionOne = 12 * MemoryConstants::gigaByte; +constexpr uint64_t unallocatedSizeRegionFour = 4 * MemoryConstants::gigaByte; class MockIoctlHelper : public IoctlHelperPrelim20 { public: diff --git a/shared/test/common/os_interface/linux/create_drm_memory_manager.cpp b/shared/test/common/os_interface/linux/create_drm_memory_manager.cpp index 9a695a4744..42e21b6fa4 100644 --- a/shared/test/common/os_interface/linux/create_drm_memory_manager.cpp +++ b/shared/test/common/os_interface/linux/create_drm_memory_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 Intel Corporation + * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -21,6 +21,6 @@ std::unique_ptr MemoryManager::createMemoryManager(ExecutionEnvir } size_t getSizeToReserve() { // 4 x sizeof(Heap32) + 2 x sizeof(Standard/Standard64k) - return (4 * 4 + 2 * 4) * GB; + return (4 * 4 + 2 * 4) * MemoryConstants::gigaByte; } } // namespace NEO diff --git a/shared/test/common/os_interface/linux/drm_memory_manager_fixture.cpp b/shared/test/common/os_interface/linux/drm_memory_manager_fixture.cpp index 68eeff043e..b9e9166606 100644 --- a/shared/test/common/os_interface/linux/drm_memory_manager_fixture.cpp +++ b/shared/test/common/os_interface/linux/drm_memory_manager_fixture.cpp @@ -142,9 +142,9 @@ void DrmMemoryManagerFixtureWithoutQuietIoctlExpectation::setUp(bool enableLocal mock = static_cast(executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface->getDriverModel()->as()); std::vector 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; mock->memoryInfo.reset(new MockedMemoryInfo(regionInfo, *mock)); executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*mock, 0u, false); memoryManager.reset(new TestedDrmMemoryManager(enableLocalMem, false, false, *executionEnvironment)); diff --git a/shared/test/common/os_interface/linux/drm_mock_memory_info.h b/shared/test/common/os_interface/linux/drm_mock_memory_info.h index 68b7b1958d..611a70b17f 100644 --- a/shared/test/common/os_interface/linux/drm_mock_memory_info.h +++ b/shared/test/common/os_interface/linux/drm_mock_memory_info.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,19 +14,19 @@ #include const std::vector memoryRegions = { - {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0}, 64 * GB, 0}, - {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}, 8 * GB, 0}}; + {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0}, 64 * MemoryConstants::gigaByte, 0}, + {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}, 8 * MemoryConstants::gigaByte, 0}}; struct MockMemoryInfo : public NEO::MemoryInfo { MockMemoryInfo(const NEO::Drm &drm) : MemoryInfo(memoryRegions, drm) {} }; const std::vector extendedMemoryRegions = { - {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 1}, 64 * GB, 0}, - {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0x100}, 8 * GB, 0}, - {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0x200}, 8 * GB, 0}, - {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0x400}, 8 * GB, 0}, - {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0x800}, 8 * GB, 0}}; + {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 1}, 64 * MemoryConstants::gigaByte, 0}, + {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0x100}, 8 * MemoryConstants::gigaByte, 0}, + {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0x200}, 8 * MemoryConstants::gigaByte, 0}, + {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0x400}, 8 * MemoryConstants::gigaByte, 0}, + {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0x800}, 8 * MemoryConstants::gigaByte, 0}}; struct MockExtendedMemoryInfo : public NEO::MemoryInfo { MockExtendedMemoryInfo(const NEO::Drm &drm) : MemoryInfo(extendedMemoryRegions, drm) {} diff --git a/shared/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp b/shared/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp index 79e73179af..45b2bc4657 100644 --- a/shared/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp +++ b/shared/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp @@ -1011,7 +1011,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenObtaini HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenSshSizeIsObtainedThenReturn64KB) { auto aubCsr = std::make_unique>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - EXPECT_EQ(64 * KB, aubCsr->defaultSshSize); + EXPECT_EQ(64 * MemoryConstants::kiloByte, aubCsr->defaultSshSize); } HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenPhysicalAddressAllocatorIsCreatedThenItIsNotNull) { diff --git a/shared/test/unit_test/encoders/test_encode_dispatch_kernel_dg2_and_later.cpp b/shared/test/unit_test/encoders/test_encode_dispatch_kernel_dg2_and_later.cpp index b230f902df..201ea0ae3f 100644 --- a/shared/test/unit_test/encoders/test_encode_dispatch_kernel_dg2_and_later.cpp +++ b/shared/test/unit_test/encoders/test_encode_dispatch_kernel_dg2_and_later.cpp @@ -82,10 +82,10 @@ HWTEST2_F(CommandEncodeStatesTestDg2AndLater, GivenVariousSlmTotalSizesAndSettin const std::vector> valuesToTest = { {0, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_0K}, - {16 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K}, - {32 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_32K}, + {16 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K}, + {32 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_32K}, // since we can't set 48KB as SLM size for workgroup, we need to ask for 64KB here. - {64 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_64K}, + {64 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_64K}, }; const std::array revs{REVISION_A0, REVISION_B, REVISION_C, REVISION_D, REVISION_K}; @@ -109,8 +109,8 @@ HWTEST2_F(CommandEncodeStatesTestDg2AndLater, GivenDebugOverrideWhenSetAdditiona debugManager.flags.OverridePreferredSlmAllocationSizePerDss.set(debugOverrideValue); const std::vector> valuesToTest = { {0, debugOverrideValue}, - {32 * KB, debugOverrideValue}, - {64 * KB, debugOverrideValue}, + {32 * MemoryConstants::kiloByte, debugOverrideValue}, + {64 * MemoryConstants::kiloByte, debugOverrideValue}, }; verifyPreferredSlmValues(valuesToTest, pDevice->getRootDeviceEnvironment()); } diff --git a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp index 3624d117f7..2ab512774d 100644 --- a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp +++ b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp @@ -902,13 +902,13 @@ HWTEST_F(GfxCoreHelperTest, givenDebugFlagWhenCheckingIfBufferIsSuitableForCompr debugManager.flags.OverrideBufferSuitableForRenderCompression.set(0); EXPECT_FALSE(gfxCoreHelper.isBufferSizeSuitableForCompression(0)); - EXPECT_FALSE(gfxCoreHelper.isBufferSizeSuitableForCompression(KB)); - EXPECT_FALSE(gfxCoreHelper.isBufferSizeSuitableForCompression(KB + 1)); + EXPECT_FALSE(gfxCoreHelper.isBufferSizeSuitableForCompression(MemoryConstants::kiloByte)); + EXPECT_FALSE(gfxCoreHelper.isBufferSizeSuitableForCompression(MemoryConstants::kiloByte + 1)); debugManager.flags.OverrideBufferSuitableForRenderCompression.set(1); EXPECT_TRUE(gfxCoreHelper.isBufferSizeSuitableForCompression(0)); - EXPECT_TRUE(gfxCoreHelper.isBufferSizeSuitableForCompression(KB)); - EXPECT_TRUE(gfxCoreHelper.isBufferSizeSuitableForCompression(KB + 1)); + EXPECT_TRUE(gfxCoreHelper.isBufferSizeSuitableForCompression(MemoryConstants::kiloByte)); + EXPECT_TRUE(gfxCoreHelper.isBufferSizeSuitableForCompression(MemoryConstants::kiloByte + 1)); } HWTEST_F(GfxCoreHelperTest, WhenIsBankOverrideRequiredIsCalledThenFalseIsReturned) { diff --git a/shared/test/unit_test/helpers/kernel_helpers_tests.cpp b/shared/test/unit_test/helpers/kernel_helpers_tests.cpp index 3afce36b32..a7490994a9 100644 --- a/shared/test/unit_test/helpers/kernel_helpers_tests.cpp +++ b/shared/test/unit_test/helpers/kernel_helpers_tests.cpp @@ -20,7 +20,7 @@ struct KernelHelperMaxWorkGroupsTests : ::testing::Test { uint32_t simd = 8; uint32_t threadCount = 8 * 1024; uint32_t dssCount = 16; - uint32_t availableSlm = 64 * KB; + uint32_t availableSlm = 64 * MemoryConstants::kiloByte; uint32_t usedSlm = 0; uint32_t maxBarrierCount = 32; uint32_t numberOfBarriers = 0; @@ -54,14 +54,14 @@ TEST_F(KernelHelperMaxWorkGroupsTests, GivenBarriersWhenCalculatingMaxWorkGroups } TEST_F(KernelHelperMaxWorkGroupsTests, GivenUsedSlmSizeWhenCalculatingMaxWorkGroupsCountThenResultIsCalculatedWithRegardToUsedSlmSize) { - usedSlm = 4 * KB; + usedSlm = 4 * MemoryConstants::kiloByte; auto expected = availableSlm / usedSlm; EXPECT_EQ(expected, getMaxWorkGroupCount()); } TEST_F(KernelHelperMaxWorkGroupsTests, GivenVariousValuesWhenCalculatingMaxWorkGroupsCountThenLowestResultIsAlwaysReturned) { - usedSlm = 1 * KB; + usedSlm = 1 * MemoryConstants::kiloByte; numberOfBarriers = 1; dssCount = 1; diff --git a/shared/test/unit_test/helpers/ray_tracing_helper_tests.cpp b/shared/test/unit_test/helpers/ray_tracing_helper_tests.cpp index a5f66080f8..6fff00c378 100644 --- a/shared/test/unit_test/helpers/ray_tracing_helper_tests.cpp +++ b/shared/test/unit_test/helpers/ray_tracing_helper_tests.cpp @@ -17,7 +17,7 @@ TEST(RayTracingHelperTests, whenGetMemoryBackedFifoSizeToPatchIsCalledCorrectVal size_t expectedSize = RayTracingHelper::memoryBackedFifoSizePerDss == 0 ? 0 - : Math::log2(RayTracingHelper::memoryBackedFifoSizePerDss / KB) - 1; + : Math::log2(RayTracingHelper::memoryBackedFifoSizePerDss / MemoryConstants::kiloByte) - 1; EXPECT_EQ(expectedSize, fifoSize); } diff --git a/shared/test/unit_test/memory_manager/gfx_partition_tests.cpp b/shared/test/unit_test/memory_manager/gfx_partition_tests.cpp index 3c87502db2..3e8aa7634e 100644 --- a/shared/test/unit_test/memory_manager/gfx_partition_tests.cpp +++ b/shared/test/unit_test/memory_manager/gfx_partition_tests.cpp @@ -63,7 +63,7 @@ class CpuInfoOverrideVirtualAddressSizeAndFlags { using namespace NEO; -constexpr size_t reservedCpuAddressRangeSize = is64bit ? (6 * 4 * GB) : 0; +constexpr size_t reservedCpuAddressRangeSize = is64bit ? (6 * 4 * MemoryConstants::gigaByte) : 0; constexpr uint64_t sizeHeap32 = 4 * MemoryConstants::gigaByte; void testGfxPartition(MockGfxPartition &gfxPartition, uint64_t gfxBase, uint64_t gfxTop, uint64_t svmTop) { diff --git a/shared/test/unit_test/memory_manager/storage_info_tests.cpp b/shared/test/unit_test/memory_manager/storage_info_tests.cpp index 6e75363a79..f43f09add8 100644 --- a/shared/test/unit_test/memory_manager/storage_info_tests.cpp +++ b/shared/test/unit_test/memory_manager/storage_info_tests.cpp @@ -388,7 +388,7 @@ TEST_F(MultiDeviceStorageInfoTest, givenReadOnlyBufferToBeCopiedAcrossTilesWhenD debugManager.flags.OverrideMultiStoragePlacement.set(proposedTiles.to_ulong()); - AllocationProperties properties{mockRootDeviceIndex, false, 64 * KB * 40, AllocationType::BUFFER, true, allTilesMask}; + AllocationProperties properties{mockRootDeviceIndex, false, 64 * MemoryConstants::kiloByte * 40, AllocationType::BUFFER, true, allTilesMask}; auto storageInfo = memoryManager->createStorageInfoFromProperties(properties); EXPECT_EQ(proposedTiles, storageInfo.memoryBanks); @@ -404,7 +404,7 @@ TEST_F(MultiDeviceStorageInfoTest, givenUnifiedSharedMemoryWhenMultiStoragePlace debugManager.flags.OverrideMultiStoragePlacement.set(proposedTiles.to_ulong()); - AllocationProperties properties{mockRootDeviceIndex, false, 512 * KB, AllocationType::UNIFIED_SHARED_MEMORY, true, allTilesMask}; + AllocationProperties properties{mockRootDeviceIndex, false, 512 * MemoryConstants::kiloByte, AllocationType::UNIFIED_SHARED_MEMORY, true, allTilesMask}; auto storageInfo = memoryManager->createStorageInfoFromProperties(properties); @@ -415,7 +415,7 @@ TEST_F(MultiDeviceStorageInfoTest, givenUnifiedSharedMemoryOnMultiTileWhenKmdMig DebugManagerStateRestore restorer; debugManager.flags.UseKmdMigration.set(1); - AllocationProperties properties{mockRootDeviceIndex, false, 512 * KB, AllocationType::UNIFIED_SHARED_MEMORY, true, allTilesMask}; + AllocationProperties properties{mockRootDeviceIndex, false, 512 * MemoryConstants::kiloByte, AllocationType::UNIFIED_SHARED_MEMORY, true, allTilesMask}; auto storageInfo = memoryManager->createStorageInfoFromProperties(properties); diff --git a/shared/test/unit_test/os_interface/linux/allocator_helper_tests.cpp b/shared/test/unit_test/os_interface/linux/allocator_helper_tests.cpp index 2947cc0ae3..08116f340a 100644 --- a/shared/test/unit_test/os_interface/linux/allocator_helper_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/allocator_helper_tests.cpp @@ -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()); } diff --git a/shared/test/unit_test/os_interface/linux/drm_memory_info_prelim_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_memory_info_prelim_tests.cpp index a525ff128f..2139a53919 100644 --- a/shared/test/unit_test/os_interface/linux/drm_memory_info_prelim_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_memory_info_prelim_tests.cpp @@ -214,11 +214,11 @@ TEST_F(MultiTileMemoryInfoPrelimTest, givenMemoryInfoWithRegionsWhenGettingMemor debugManager.flags.EnableLocalMemory.set(1); std::vector 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 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 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 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 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 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(); auto drm = std::make_unique(*executionEnvironment->rootDeviceEnvironments[0]); @@ -387,9 +387,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithSingleRegionThe std::vector 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(); auto drm = std::make_unique(*executionEnvironment->rootDeviceEnvironments[0]); @@ -415,9 +415,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithPairHandleThenR std::vector 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(); executionEnvironment->prepareRootDeviceEnvironments(1); @@ -444,9 +444,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithChunkingButSize std::vector 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(); executionEnvironment->prepareRootDeviceEnvironments(1); @@ -470,9 +470,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithChunkingWithSiz std::vector 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(); executionEnvironment->prepareRootDeviceEnvironments(1); @@ -499,9 +499,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsAndPrivateBOSupportWhenCreatingGemExt std::vector 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(); auto drm = std::make_unique(*executionEnvironment->rootDeviceEnvironments[0]); @@ -529,9 +529,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsAndNoPrivateBOSupportWhenCreatingGemE std::vector 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(); auto drm = std::make_unique(*executionEnvironment->rootDeviceEnvironments[0]); @@ -558,9 +558,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsAndPrivateBOSupportedAndIsPerContextV std::vector 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(); auto drm = std::make_unique(*executionEnvironment->rootDeviceEnvironments[0]); @@ -586,15 +586,15 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithMultipleRegions std::vector 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(); auto drm = std::make_unique(*executionEnvironment->rootDeviceEnvironments[0]); @@ -626,15 +626,15 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCallingCreatingGemExtWithMultiple std::vector 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(); auto drm = std::make_unique(*executionEnvironment->rootDeviceEnvironments[0]); @@ -653,15 +653,15 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCallingCreatingGemExtWithMultiple std::vector 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(); auto drm = std::make_unique(*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); -} \ No newline at end of file +} diff --git a/shared/test/unit_test/os_interface/linux/drm_memory_info_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_memory_info_tests.cpp index 5b6f3ee3c4..3bbfc308eb 100644 --- a/shared/test/unit_test/os_interface/linux/drm_memory_info_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_memory_info_tests.cpp @@ -85,9 +85,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsAndLocalMemoryEnabledWhenGettingMemor debugManager.flags.EnableLocalMemory.set(1); std::vector 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(); auto drm = std::make_unique(*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 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(); auto drm = std::make_unique(*executionEnvironment->rootDeviceEnvironments[0]); auto memoryInfo = std::make_unique(regionInfo, *drm); @@ -123,9 +123,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsAndLocalMemoryDisabledWhenGettingMemo debugManager.flags.EnableLocalMemory.set(0); std::vector 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(); auto drm = std::make_unique(*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 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(); auto drm = std::make_unique(*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 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(); auto drm = std::make_unique(*executionEnvironment->rootDeviceEnvironments[0]); @@ -223,9 +223,9 @@ using MemoryInfoTest = ::testing::Test; HWTEST2_F(MemoryInfoTest, givenMemoryInfoWithRegionsWhenCreatingGemWithExtensionsThenReturnCorrectValues, NonDefaultIoctlsSupported) { std::vector 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(); auto drm = std::make_unique(*executionEnvironment->rootDeviceEnvironments[0]); @@ -248,9 +248,9 @@ HWTEST2_F(MemoryInfoTest, givenMemoryInfoWithRegionsWhenCreatingGemExtWithSingle debugManager.flags.EnableLocalMemory.set(1); std::vector 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(); auto drm = std::make_unique(*executionEnvironment->rootDeviceEnvironments[0]); diff --git a/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp index 0a9c6d38e8..a367355f67 100644 --- a/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp @@ -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(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(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(0x10000000); auto allocation0 = static_cast(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(0x30000000); allocation0 = static_cast(memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData)); - EXPECT_EQ(static_cast(allocation0->getBO()->peekSize()), 4 * MB + 12 * 1024); + EXPECT_EQ(static_cast(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(0x100000000000); EXPECT_FALSE(memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData)); } @@ -3258,7 +3258,7 @@ TEST_F(DrmMemoryManagerBasic, givenDrmMemoryManagerWhenAllocateGraphicsMemoryFor TEST_F(DrmMemoryManagerBasic, givenDrmMemoryManagerWhenAllocateGraphicsMemoryForNonSvmHostPtrFailsThenNullPtrReturnedAndAllocationIsNotRegistered) { std::unique_ptr 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(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->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) { diff --git a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp index c34498ac79..2ddef37bdc 100644 --- a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp @@ -51,9 +51,9 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGemCreateExtWithRegionsThen std::vector 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 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; diff --git a/shared/test/unit_test/os_interface/windows/wddm20_tests.cpp b/shared/test/unit_test/os_interface/windows/wddm20_tests.cpp index ad27a3233e..e2a3e90e3c 100644 --- a/shared/test/unit_test/os_interface/windows/wddm20_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm20_tests.cpp @@ -255,7 +255,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSiz } TEST_F(Wddm20WithMockGdiDllTests, givenReserveCallWhenItIsCalledWithProperParamtersThenAddressInRangeIsReturend) { - auto sizeAlignedTo64Kb = 64 * KB; + auto sizeAlignedTo64Kb = 64 * MemoryConstants::kiloByte; D3DGPU_VIRTUAL_ADDRESS reservationAddress; auto status = wddm->reserveGpuVirtualAddress(0ull, wddm->getGfxPartition().Heap32[0].Base, wddm->getGfxPartition().Heap32[0].Limit, @@ -275,7 +275,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenReserveCallWhenItIsCalledWithProperParamt } TEST_F(Wddm20WithMockGdiDllTests, givenReserveCallWhenItIsCalledWithInvalidBaseThenFailureIsReturned) { - auto sizeAlignedTo64Kb = 64 * KB; + auto sizeAlignedTo64Kb = 64 * MemoryConstants::kiloByte; D3DGPU_VIRTUAL_ADDRESS reservationAddress; auto status = wddm->reserveGpuVirtualAddress(0x1234, wddm->getGfxPartition().Heap32[0].Base, wddm->getGfxPartition().Heap32[0].Limit, @@ -284,7 +284,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenReserveCallWhenItIsCalledWithInvalidBaseT } TEST_F(Wddm20WithMockGdiDllTests, givenReserveCallWhenItIsCalledWithAttemptBaseAddressWithValidBaseThenAddressInRangeIsReturned) { - auto sizeAlignedTo64Kb = 64 * KB; + auto sizeAlignedTo64Kb = 64 * MemoryConstants::kiloByte; D3DGPU_VIRTUAL_ADDRESS previousReservationAddress; D3DGPU_VIRTUAL_ADDRESS reservationAddress; NTSTATUS status; @@ -542,7 +542,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledWithMapPointerThenGraphicsAllocationWithSharedPropertiesIsCreated) { void *pSysMem = (void *)0x1000; - size_t sizeAlignedTo64Kb = 64 * KB; + size_t sizeAlignedTo64Kb = 64 * MemoryConstants::kiloByte; void *reservedAddress; EXPECT_TRUE(wddm->reserveValidAddressRange(sizeAlignedTo64Kb, reservedAddress)); GmmRequirements gmmRequirements{}; diff --git a/shared/test/unit_test/utilities/buffer_pool_allocator_tests.cpp b/shared/test/unit_test/utilities/buffer_pool_allocator_tests.cpp index 11d8a86c44..2c86672fad 100644 --- a/shared/test/unit_test/utilities/buffer_pool_allocator_tests.cpp +++ b/shared/test/unit_test/utilities/buffer_pool_allocator_tests.cpp @@ -26,8 +26,8 @@ struct DummyBuffer { template <> struct NEO::SmallBuffersParams { - static constexpr auto aggregatedSmallBuffersPoolSize = 32 * KB; - static constexpr auto smallBufferThreshold = 2 * KB; + static constexpr auto aggregatedSmallBuffersPoolSize = 32 * MemoryConstants::kiloByte; + static constexpr auto smallBufferThreshold = 2 * MemoryConstants::kiloByte; static constexpr auto chunkAlignment = 1024u; static constexpr auto startingOffset = chunkAlignment; }; diff --git a/shared/test/unit_test/xe_hpc_core/gfx_core_helper_xe_hpc_core_tests.cpp b/shared/test/unit_test/xe_hpc_core/gfx_core_helper_xe_hpc_core_tests.cpp index d1dfb620be..7013132b28 100644 --- a/shared/test/unit_test/xe_hpc_core/gfx_core_helper_xe_hpc_core_tests.cpp +++ b/shared/test/unit_test/xe_hpc_core/gfx_core_helper_xe_hpc_core_tests.cpp @@ -20,29 +20,29 @@ using GfxCoreHelperXeHpcCoreTest = ::testing::Test; XE_HPC_CORETEST_F(GfxCoreHelperXeHpcCoreTest, givenSlmSizeWhenEncodingThenReturnCorrectValues) { ComputeSlmTestInput computeSlmValuesXeHpcTestsInput[] = { - {0, 0 * KB}, - {1, 0 * KB + 1}, - {1, 1 * KB}, - {2, 1 * KB + 1}, - {2, 2 * KB}, - {3, 2 * KB + 1}, - {3, 4 * KB}, - {4, 4 * KB + 1}, - {4, 8 * KB}, - {5, 8 * KB + 1}, - {5, 16 * KB}, - {8, 16 * KB + 1}, - {8, 24 * KB}, - {6, 24 * KB + 1}, - {6, 32 * KB}, - {9, 32 * KB + 1}, - {9, 48 * KB}, - {7, 48 * KB + 1}, - {7, 64 * KB}, - {10, 64 * KB + 1}, - {10, 96 * KB}, - {11, 96 * KB + 1}, - {11, 128 * KB}}; + {0, 0 * MemoryConstants::kiloByte}, + {1, 0 * MemoryConstants::kiloByte + 1}, + {1, 1 * MemoryConstants::kiloByte}, + {2, 1 * MemoryConstants::kiloByte + 1}, + {2, 2 * MemoryConstants::kiloByte}, + {3, 2 * MemoryConstants::kiloByte + 1}, + {3, 4 * MemoryConstants::kiloByte}, + {4, 4 * MemoryConstants::kiloByte + 1}, + {4, 8 * MemoryConstants::kiloByte}, + {5, 8 * MemoryConstants::kiloByte + 1}, + {5, 16 * MemoryConstants::kiloByte}, + {8, 16 * MemoryConstants::kiloByte + 1}, + {8, 24 * MemoryConstants::kiloByte}, + {6, 24 * MemoryConstants::kiloByte + 1}, + {6, 32 * MemoryConstants::kiloByte}, + {9, 32 * MemoryConstants::kiloByte + 1}, + {9, 48 * MemoryConstants::kiloByte}, + {7, 48 * MemoryConstants::kiloByte + 1}, + {7, 64 * MemoryConstants::kiloByte}, + {10, 64 * MemoryConstants::kiloByte + 1}, + {10, 96 * MemoryConstants::kiloByte}, + {11, 96 * MemoryConstants::kiloByte + 1}, + {11, 128 * MemoryConstants::kiloByte}}; auto hwInfo = *defaultHwInfo; MockExecutionEnvironment mockExecutionEnvironment{}; @@ -52,7 +52,7 @@ XE_HPC_CORETEST_F(GfxCoreHelperXeHpcCoreTest, givenSlmSizeWhenEncodingThenReturn EXPECT_EQ(testInput.expected, gfxCoreHelper.computeSlmValues(hwInfo, testInput.slmSize)); } - EXPECT_THROW(gfxCoreHelper.computeSlmValues(hwInfo, 129 * KB), std::exception); + EXPECT_THROW(gfxCoreHelper.computeSlmValues(hwInfo, 129 * MemoryConstants::kiloByte), std::exception); } XE_HPC_CORETEST_F(GfxCoreHelperXeHpcCoreTest, WhenGettingIsCpuImageTransferPreferredThenTrueIsReturned) { diff --git a/shared/test/unit_test/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp index e1340f7fbb..b174740729 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp @@ -142,20 +142,20 @@ PVCTEST_F(CommandEncodeStatesTestPvc, GivenVariousSlmTotalSizesAndSettingRevIDTo const std::vector> valuesToTest = { {0, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_0K}, - {16 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K}, - {32 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_32K}, - {64 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_64K}, - {96 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_96K}, - {128 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K}, + {16 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K}, + {32 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_32K}, + {64 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_64K}, + {96 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_96K}, + {128 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K}, }; const std::vector> valuesToTestForPvcAStep = { {0, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K}, - {16 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K}, - {32 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_32K}, - {64 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_64K}, - {96 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_96K}, - {128 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K}, + {16 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K}, + {32 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_32K}, + {64 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_64K}, + {96 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_96K}, + {128 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K}, }; const std::array revs{REVISION_A0, REVISION_B, REVISION_C, REVISION_D, REVISION_K}; diff --git a/shared/test/unit_test/xe_hpg_core/dg2/test_encode_dispatch_kernel_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/test_encode_dispatch_kernel_dg2.cpp index 27c3d5dcdf..c26de17482 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/test_encode_dispatch_kernel_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/test_encode_dispatch_kernel_dg2.cpp @@ -72,17 +72,17 @@ DG2TEST_F(CommandEncodeStatesDg2Test, GivenVariousSlmTotalSizesAndSettingRevIDTo const std::vector> valuesToTest = { {0, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_0K}, - {16 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K}, - {32 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_32K}, + {16 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K}, + {32 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_32K}, // since we can't set 48KB as SLM size for workgroup, we need to ask for 64KB here. - {64 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_64K}, + {64 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_64K}, }; const std::vector> valuesToTestForDg2G10AStep = { {0, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K}, - {16 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K}, - {32 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K}, - {64 * KB, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K}, + {16 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K}, + {32 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K}, + {64 * MemoryConstants::kiloByte, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K}, }; MockExecutionEnvironment executionEnvironment{}; diff --git a/shared/test/unit_test/xe_hpg_core/gfx_core_helper_tests_xe_hpg_core.cpp b/shared/test/unit_test/xe_hpg_core/gfx_core_helper_tests_xe_hpg_core.cpp index 73ce26e58c..b7954bf96d 100644 --- a/shared/test/unit_test/xe_hpg_core/gfx_core_helper_tests_xe_hpg_core.cpp +++ b/shared/test/unit_test/xe_hpg_core/gfx_core_helper_tests_xe_hpg_core.cpp @@ -305,21 +305,21 @@ XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore, givenGfxCoreHelperWhenCallCopyThro } constexpr ComputeSlmTestInput computeSlmValuesXeHpgTestsInput[] = { - {0, 0 * KB}, - {1, 0 * KB + 1}, - {1, 1 * KB}, - {2, 1 * KB + 1}, - {2, 2 * KB}, - {3, 2 * KB + 1}, - {3, 4 * KB}, - {4, 4 * KB + 1}, - {4, 8 * KB}, - {5, 8 * KB + 1}, - {5, 16 * KB}, - {6, 16 * KB + 1}, - {6, 32 * KB}, - {7, 32 * KB + 1}, - {7, 64 * KB}}; + {0, 0 * MemoryConstants::kiloByte}, + {1, 0 * MemoryConstants::kiloByte + 1}, + {1, 1 * MemoryConstants::kiloByte}, + {2, 1 * MemoryConstants::kiloByte + 1}, + {2, 2 * MemoryConstants::kiloByte}, + {3, 2 * MemoryConstants::kiloByte + 1}, + {3, 4 * MemoryConstants::kiloByte}, + {4, 4 * MemoryConstants::kiloByte + 1}, + {4, 8 * MemoryConstants::kiloByte}, + {5, 8 * MemoryConstants::kiloByte + 1}, + {5, 16 * MemoryConstants::kiloByte}, + {6, 16 * MemoryConstants::kiloByte + 1}, + {6, 32 * MemoryConstants::kiloByte}, + {7, 32 * MemoryConstants::kiloByte + 1}, + {7, 64 * MemoryConstants::kiloByte}}; XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore, GivenVariousValuesWhenComputeSlmSizeIsCalledThenCorrectValueIsReturned) { const auto &gfxCoreHelper = getHelper();