From 8db92240fc3f7a7cd9493ba36e7ac6f9ed08ba31 Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Wed, 19 Nov 2025 14:05:39 +0000 Subject: [PATCH] refactor: add wrapper for max product enum value Signed-off-by: Mateusz Jablonski --- level_zero/core/source/cmdlist/cmdlist_imp.cpp | 8 ++++---- level_zero/core/source/cmdqueue/cmdqueue.cpp | 4 ++-- level_zero/core/source/image/image_imp.cpp | 4 ++-- level_zero/core/source/kernel/kernel.cpp | 2 +- level_zero/core/source/kernel/kernel_imp.cpp | 2 +- .../mutable_cmdlist/mutable_cmdlist_imp.cpp | 4 ++-- level_zero/core/source/sampler/sampler_imp.cpp | 6 +++--- .../sources/cmdlist/test_cmdlist_1.cpp | 4 ++-- .../sources/cmdqueue/test_cmdqueue_1.cpp | 2 +- .../tests/mutable_cmdlist_tests.cpp | 2 +- .../sources/sampler/test_sampler.cpp | 2 +- .../product_helper/sysman_product_helper.cpp | 4 ++-- .../product_helper/sysman_product_helper.h | 2 +- .../product_helper/sysman_product_helper.cpp | 4 ++-- .../product_helper/sysman_product_helper.h | 2 +- .../decoder/iga_wrapper_tests.cpp | 2 +- .../test/unit_test/offline_compiler/main.cpp | 2 +- .../offline_compiler/source/decoder/helper.cpp | 2 +- shared/source/ail/ail_configuration.h | 2 +- shared/source/ail/ail_configuration_extra.cpp | 2 +- .../gmm_helper/igfxfmid_wrapper/neo_igfxfmid.h | 3 ++- .../source/helpers/compiler_product_helper.cpp | 4 ++-- .../source/helpers/compiler_product_helper.h | 2 +- shared/source/helpers/hw_info.cpp | 10 +++++----- shared/source/helpers/hw_info.h | 8 ++++---- .../source/helpers/product_config_helper.cpp | 2 +- .../source/os_interface/linux/ioctl_helper.cpp | 2 +- .../source/os_interface/linux/ioctl_helper.h | 2 +- shared/source/os_interface/product_helper.cpp | 2 +- shared/source/os_interface/product_helper.h | 4 ++-- shared/test/common/common_main.cpp | 4 ++-- .../test/common/helpers/raii_product_helper.h | 4 ++-- shared/test/common/test_macros/hw_test_base.h | 18 +++++++++--------- .../command_stream/get_devices_tests.cpp | 8 ++++---- .../zebin_decoder_tests.cpp | 2 +- 35 files changed, 69 insertions(+), 68 deletions(-) diff --git a/level_zero/core/source/cmdlist/cmdlist_imp.cpp b/level_zero/core/source/cmdlist/cmdlist_imp.cpp index 3a7e4f9724..fbe5fc0eb5 100644 --- a/level_zero/core/source/cmdlist/cmdlist_imp.cpp +++ b/level_zero/core/source/cmdlist/cmdlist_imp.cpp @@ -39,8 +39,8 @@ void CommandList::setPatchingPreamble(bool patching, bool saveWait) { } } -CommandListAllocatorFn commandListFactory[IGFX_MAX_PRODUCT] = {}; -CommandListAllocatorFn commandListFactoryImmediate[IGFX_MAX_PRODUCT] = {}; +CommandListAllocatorFn commandListFactory[NEO::maxProductEnumValue] = {}; +CommandListAllocatorFn commandListFactoryImmediate[NEO::maxProductEnumValue] = {}; ze_result_t CommandListImp::destroy() { if (this->isBcsSplitNeeded) { @@ -104,7 +104,7 @@ CommandList *CommandList::create(uint32_t productFamily, Device *device, NEO::En ze_command_list_flags_t flags, ze_result_t &returnValue, bool internalUsage) { CommandListAllocatorFn allocator = nullptr; - if (productFamily < IGFX_MAX_PRODUCT) { + if (productFamily < NEO::maxProductEnumValue) { allocator = commandListFactory[productFamily]; } @@ -170,7 +170,7 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device cmdQdesc.mode = static_cast(overrideImmediateCmdListSyncMode); } CommandListAllocatorFn allocator = nullptr; - if (productFamily < IGFX_MAX_PRODUCT) { + if (productFamily < NEO::maxProductEnumValue) { allocator = commandListFactoryImmediate[productFamily]; } diff --git a/level_zero/core/source/cmdqueue/cmdqueue.cpp b/level_zero/core/source/cmdqueue/cmdqueue.cpp index 76dbe8fcec..71adcee617 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue.cpp +++ b/level_zero/core/source/cmdqueue/cmdqueue.cpp @@ -33,7 +33,7 @@ namespace L0 { -CommandQueueAllocatorFn commandQueueFactory[IGFX_MAX_PRODUCT] = {}; +CommandQueueAllocatorFn commandQueueFactory[NEO::maxProductEnumValue] = {}; bool CommandQueue::frontEndTrackingEnabled() const { return NEO::debugManager.flags.AllowPatchingVfeStateInCommandLists.get() || this->frontEndStateTracking; @@ -234,7 +234,7 @@ void CommandQueueImp::postSyncOperations(bool hangDetected) { CommandQueue *CommandQueue::create(uint32_t productFamily, Device *device, NEO::CommandStreamReceiver *csr, const ze_command_queue_desc_t *desc, bool isCopyOnly, bool isInternal, bool immediateCmdListQueue, ze_result_t &returnValue) { CommandQueueAllocatorFn allocator = nullptr; - if (productFamily < IGFX_MAX_PRODUCT) { + if (productFamily < NEO::maxProductEnumValue) { allocator = commandQueueFactory[productFamily]; } diff --git a/level_zero/core/source/image/image_imp.cpp b/level_zero/core/source/image/image_imp.cpp index 1a68d14da2..e6217e52af 100644 --- a/level_zero/core/source/image/image_imp.cpp +++ b/level_zero/core/source/image/image_imp.cpp @@ -25,7 +25,7 @@ #include "neo_igfxfmid.h" namespace L0 { -ImageAllocatorFn imageFactory[IGFX_MAX_PRODUCT] = {}; +ImageAllocatorFn imageFactory[NEO::maxProductEnumValue] = {}; bool isImportedWin32Handle(const ze_image_desc_t *imgDesc) { const ze_base_desc_t *extendedDesc = reinterpret_cast(imgDesc->pNext); @@ -178,7 +178,7 @@ NEO::SurfaceStateInHeapInfo *ImageImp::getBindlessSlot() { ze_result_t Image::create(uint32_t productFamily, Device *device, const ze_image_desc_t *desc, Image **pImage) { ze_result_t result = ZE_RESULT_SUCCESS; ImageAllocatorFn allocator = nullptr; - if (productFamily < IGFX_MAX_PRODUCT) { + if (productFamily < NEO::maxProductEnumValue) { allocator = imageFactory[productFamily]; } diff --git a/level_zero/core/source/kernel/kernel.cpp b/level_zero/core/source/kernel/kernel.cpp index 457892d503..64bc02c492 100644 --- a/level_zero/core/source/kernel/kernel.cpp +++ b/level_zero/core/source/kernel/kernel.cpp @@ -11,6 +11,6 @@ namespace L0 { -KernelAllocatorFn kernelFactory[IGFX_MAX_PRODUCT] = {}; +KernelAllocatorFn kernelFactory[NEO::maxProductEnumValue] = {}; } // namespace L0 diff --git a/level_zero/core/source/kernel/kernel_imp.cpp b/level_zero/core/source/kernel/kernel_imp.cpp index f0029c2f75..a4d6bf8a4c 100644 --- a/level_zero/core/source/kernel/kernel_imp.cpp +++ b/level_zero/core/source/kernel/kernel_imp.cpp @@ -1457,7 +1457,7 @@ void KernelImp::patchGlobalOffset() { Kernel *Kernel::create(uint32_t productFamily, Module *module, const ze_kernel_desc_t *desc, ze_result_t *res) { - UNRECOVERABLE_IF(productFamily >= IGFX_MAX_PRODUCT); + UNRECOVERABLE_IF(productFamily >= NEO::maxProductEnumValue); KernelAllocatorFn allocator = kernelFactory[productFamily]; auto kernel = static_cast(allocator(module)); *res = kernel->initialize(desc); diff --git a/level_zero/core/source/mutable_cmdlist/mutable_cmdlist_imp.cpp b/level_zero/core/source/mutable_cmdlist/mutable_cmdlist_imp.cpp index 4ff5a609fa..89e1d4929b 100644 --- a/level_zero/core/source/mutable_cmdlist/mutable_cmdlist_imp.cpp +++ b/level_zero/core/source/mutable_cmdlist/mutable_cmdlist_imp.cpp @@ -82,7 +82,7 @@ void MutableResidencyAllocations::cleanResidencyContainer() { immutableResidencySize = 0; } -MutableCommandListAllocFn mutableCommandListFactory[IGFX_MAX_PRODUCT] = {}; +MutableCommandListAllocFn mutableCommandListFactory[NEO::maxProductEnumValue] = {}; MutableCommandList *MutableCommandList::fromHandle(ze_command_list_handle_t handle) { return static_cast(L0::CommandList::fromHandle(handle)->asMutable()); @@ -91,7 +91,7 @@ MutableCommandList *MutableCommandList::fromHandle(ze_command_list_handle_t hand CommandList *MutableCommandList::create(uint32_t productFamily, Device *device, NEO::EngineGroupType engineGroupType, ze_command_list_flags_t flags, ze_result_t &resultValue, bool useInternalEngineType) { MutableCommandListAllocFn allocator = nullptr; - if (productFamily < IGFX_MAX_PRODUCT) { + if (productFamily < NEO::maxProductEnumValue) { allocator = mutableCommandListFactory[productFamily]; } if (allocator == nullptr) { diff --git a/level_zero/core/source/sampler/sampler_imp.cpp b/level_zero/core/source/sampler/sampler_imp.cpp index 81c77e8c28..4a643ec5d2 100644 --- a/level_zero/core/source/sampler/sampler_imp.cpp +++ b/level_zero/core/source/sampler/sampler_imp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -11,7 +11,7 @@ namespace L0 { -SamplerAllocatorFn samplerFactory[IGFX_MAX_PRODUCT] = {}; +SamplerAllocatorFn samplerFactory[NEO::maxProductEnumValue] = {}; ze_result_t SamplerImp::destroy() { delete this; @@ -25,7 +25,7 @@ ze_result_t SamplerImp::initialize(Device *device, const ze_sampler_desc_t *desc Sampler *Sampler::create(uint32_t productFamily, Device *device, const ze_sampler_desc_t *desc) { SamplerAllocatorFn allocator = nullptr; - if (productFamily < IGFX_MAX_PRODUCT) { + if (productFamily < NEO::maxProductEnumValue) { allocator = samplerFactory[productFamily]; } diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp index aff6ed26dc..bec75308c7 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp @@ -125,7 +125,7 @@ TEST_F(DefaultDescriptorWithoutBlitterTest, givenDeviceWithoutBlitterSupportWhen TEST_F(CommandListCreateTests, whenCommandListIsCreatedWithInvalidProductFamilyThenFailureIsReturned) { ze_result_t returnValue; - std::unique_ptr commandList(CommandList::create(PRODUCT_FAMILY::IGFX_MAX_PRODUCT, device, NEO::EngineGroupType::renderCompute, 0u, returnValue, false)); + std::unique_ptr commandList(CommandList::create(NEO::maxProductEnumValue, device, NEO::EngineGroupType::renderCompute, 0u, returnValue, false)); EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, returnValue); ASSERT_EQ(nullptr, commandList); } @@ -134,7 +134,7 @@ TEST_F(CommandListCreateTests, whenCommandListImmediateIsCreatedWithInvalidProdu ze_result_t returnValue; const ze_command_queue_desc_t desc = {}; bool internalEngine = true; - std::unique_ptr commandList(CommandList::createImmediate(PRODUCT_FAMILY::IGFX_MAX_PRODUCT, + std::unique_ptr commandList(CommandList::createImmediate(NEO::maxProductEnumValue, device, &desc, internalEngine, diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp index 1fac84a848..8b07d33f19 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp @@ -291,7 +291,7 @@ TEST_F(CommandQueueCreate, whenCreatingCommandQueueWithInvalidProductFamilyThenF ze_result_t returnValue; auto csr = std::unique_ptr(neoDevice->createCommandStreamReceiver()); csr->setupContext(*neoDevice->getDefaultEngine().osContext); - L0::CommandQueue *commandQueue = CommandQueue::create(PRODUCT_FAMILY::IGFX_MAX_PRODUCT, + L0::CommandQueue *commandQueue = CommandQueue::create(NEO::maxProductEnumValue, device, csr.get(), &desc, diff --git a/level_zero/core/test/unit_tests/sources/mutable_cmdlist/tests/mutable_cmdlist_tests.cpp b/level_zero/core/test/unit_tests/sources/mutable_cmdlist/tests/mutable_cmdlist_tests.cpp index d1ef172442..179f4c6194 100644 --- a/level_zero/core/test/unit_tests/sources/mutable_cmdlist/tests/mutable_cmdlist_tests.cpp +++ b/level_zero/core/test/unit_tests/sources/mutable_cmdlist/tests/mutable_cmdlist_tests.cpp @@ -30,7 +30,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, givenInvalidProductWhenCreatingCommandListThenNoObjectCreated) { ze_result_t returnValue; - auto mcl = MutableCommandList::create(IGFX_MAX_PRODUCT, device, this->engineGroupType, 0, returnValue, false); + auto mcl = MutableCommandList::create(NEO::maxProductEnumValue, device, this->engineGroupType, 0, returnValue, false); EXPECT_EQ(nullptr, mcl); EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, returnValue); } diff --git a/level_zero/core/test/unit_tests/sources/sampler/test_sampler.cpp b/level_zero/core/test/unit_tests/sources/sampler/test_sampler.cpp index b9e4a688fa..34e572ae77 100644 --- a/level_zero/core/test/unit_tests/sources/sampler/test_sampler.cpp +++ b/level_zero/core/test/unit_tests/sources/sampler/test_sampler.cpp @@ -184,7 +184,7 @@ HWTEST2_F(ContextCreateSamplerTest, givenInvalidHardwareFamilyThenSamplerIsNotCr desc.filterMode = filterMode; desc.isNormalized = isNormalized; - L0::Sampler *sampler = Sampler::create(IGFX_MAX_PRODUCT, device, &desc); + L0::Sampler *sampler = Sampler::create(NEO::maxProductEnumValue, device, &desc); EXPECT_EQ(nullptr, sampler); } diff --git a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.cpp b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.cpp index faf146cee3..2ef2f90a32 100644 --- a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.cpp +++ b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,7 +10,7 @@ namespace L0 { namespace Sysman { -SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[IGFX_MAX_PRODUCT] = {}; +SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[NEO::maxProductEnumValue] = {}; } } // namespace L0 \ No newline at end of file diff --git a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h index 3da30f31ca..7df60086cd 100644 --- a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h +++ b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h @@ -35,7 +35,7 @@ enum class RasInterfaceType; enum class SysfsValueUnit; using SysmanProductHelperCreateFunctionType = std::unique_ptr (*)(); -extern SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[IGFX_MAX_PRODUCT]; +extern SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[NEO::maxProductEnumValue]; class SysmanProductHelper { public: diff --git a/level_zero/sysman/source/shared/windows/product_helper/sysman_product_helper.cpp b/level_zero/sysman/source/shared/windows/product_helper/sysman_product_helper.cpp index 92b6ac3ce1..9235f80fad 100644 --- a/level_zero/sysman/source/shared/windows/product_helper/sysman_product_helper.cpp +++ b/level_zero/sysman/source/shared/windows/product_helper/sysman_product_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,7 +10,7 @@ namespace L0 { namespace Sysman { -SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[IGFX_MAX_PRODUCT] = {}; +SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[NEO::maxProductEnumValue] = {}; } } // namespace L0 \ No newline at end of file diff --git a/level_zero/sysman/source/shared/windows/product_helper/sysman_product_helper.h b/level_zero/sysman/source/shared/windows/product_helper/sysman_product_helper.h index 7275633739..6dd3671388 100644 --- a/level_zero/sysman/source/shared/windows/product_helper/sysman_product_helper.h +++ b/level_zero/sysman/source/shared/windows/product_helper/sysman_product_helper.h @@ -29,7 +29,7 @@ class SysmanProductHelper; class WddmSysmanImp; using SysmanProductHelperCreateFunctionType = std::unique_ptr (*)(); -extern SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[IGFX_MAX_PRODUCT]; +extern SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[NEO::maxProductEnumValue]; static const std::map powerGroupToDomainTypeMap = { {ZES_POWER_DOMAIN_CARD, KmdSysman::PowerDomainsType::powerDomainCard}, {ZES_POWER_DOMAIN_PACKAGE, KmdSysman::PowerDomainsType::powerDomainPackage}, diff --git a/opencl/test/unit_test/offline_compiler/decoder/iga_wrapper_tests.cpp b/opencl/test/unit_test/offline_compiler/decoder/iga_wrapper_tests.cpp index b301e185f9..ca483133e6 100644 --- a/opencl/test/unit_test/offline_compiler/decoder/iga_wrapper_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/decoder/iga_wrapper_tests.cpp @@ -307,7 +307,7 @@ TEST_F(IgaWrapperTest, GivenIgcWrapperWhenCallingSetGfxCoreMultipleTimesThenFirs TEST_F(IgaWrapperTest, GivenIgcWrapperWhenCallingSetProductFamilyMultipleTimesThenFirstValidProductFamilyIsPreserved) { ASSERT_FALSE(testedIgaWrapper.isKnownPlatform()); - constexpr auto invalidProductFamily = IGFX_MAX_PRODUCT; + constexpr auto invalidProductFamily = NEO::maxProductEnumValue; testedIgaWrapper.setProductFamily(invalidProductFamily); EXPECT_FALSE(testedIgaWrapper.isKnownPlatform()); diff --git a/opencl/test/unit_test/offline_compiler/main.cpp b/opencl/test/unit_test/offline_compiler/main.cpp index 2193167af2..e206da9a14 100644 --- a/opencl/test/unit_test/offline_compiler/main.cpp +++ b/opencl/test/unit_test/offline_compiler/main.cpp @@ -136,7 +136,7 @@ int main(int argc, char **argv) { } uint16_t revision = 0; - for (unsigned int productId = 0; productId < IGFX_MAX_PRODUCT; ++productId) { + for (unsigned int productId = 0; productId < NEO::maxProductEnumValue; ++productId) { if (NEO::hardwarePrefix[productId] && (0 == strcmp(devicePrefix.c_str(), NEO::hardwarePrefix[productId]))) { if (NEO::hardwareInfoTable[productId]) { renderCoreFamily = NEO::hardwareInfoTable[productId]->platform.eRenderCoreFamily; diff --git a/shared/offline_compiler/source/decoder/helper.cpp b/shared/offline_compiler/source/decoder/helper.cpp index 091a3c59c3..d57e03bef8 100644 --- a/shared/offline_compiler/source/decoder/helper.cpp +++ b/shared/offline_compiler/source/decoder/helper.cpp @@ -92,7 +92,7 @@ size_t findPos(const std::vector &lines, const std::string &whatToF } PRODUCT_FAMILY getProductFamilyFromDeviceName(const std::string &deviceName) { - for (unsigned int productId = 0; productId < IGFX_MAX_PRODUCT; ++productId) { + for (unsigned int productId = 0; productId < NEO::maxProductEnumValue; ++productId) { if (NEO::hardwarePrefix[productId] != nullptr && deviceName == NEO::hardwarePrefix[productId]) { return static_cast(productId); diff --git a/shared/source/ail/ail_configuration.h b/shared/source/ail/ail_configuration.h index ea94597bd9..e12e76e611 100644 --- a/shared/source/ail/ail_configuration.h +++ b/shared/source/ail/ail_configuration.h @@ -51,7 +51,7 @@ enum class AILEnumeration : uint32_t { class AILConfiguration; using AILConfigurationCreateFunctionType = std::unique_ptr (*)(); -extern AILConfigurationCreateFunctionType ailConfigurationFactory[IGFX_MAX_PRODUCT]; +extern AILConfigurationCreateFunctionType ailConfigurationFactory[NEO::maxProductEnumValue]; class AILConfiguration { public: diff --git a/shared/source/ail/ail_configuration_extra.cpp b/shared/source/ail/ail_configuration_extra.cpp index 172e47c317..15825748d3 100644 --- a/shared/source/ail/ail_configuration_extra.cpp +++ b/shared/source/ail/ail_configuration_extra.cpp @@ -46,7 +46,7 @@ const std::set applicationsMicrosecontResolutionAdjustment = { const uint32_t microsecondAdjustment = 1000; -AILConfigurationCreateFunctionType ailConfigurationFactory[IGFX_MAX_PRODUCT]; +AILConfigurationCreateFunctionType ailConfigurationFactory[NEO::maxProductEnumValue]; void AILConfiguration::apply(HardwareInfo &hwInfo) { auto search = applicationMap.find(processName); diff --git a/shared/source/gmm_helper/igfxfmid_wrapper/neo_igfxfmid.h b/shared/source/gmm_helper/igfxfmid_wrapper/neo_igfxfmid.h index aaccef8861..064480ae92 100644 --- a/shared/source/gmm_helper/igfxfmid_wrapper/neo_igfxfmid.h +++ b/shared/source/gmm_helper/igfxfmid_wrapper/neo_igfxfmid.h @@ -11,4 +11,5 @@ namespace NEO { constexpr GFXCORE_FAMILY xe3pCoreEnumValue = static_cast(0x2300); // NOLINT(clang-analyzer-optin.core.EnumCastOutOfRange), NEO-16649 -} +constexpr PRODUCT_FAMILY maxProductEnumValue = IGFX_MAX_PRODUCT; +} // namespace NEO diff --git a/shared/source/helpers/compiler_product_helper.cpp b/shared/source/helpers/compiler_product_helper.cpp index 740d29e9da..2cd4e515a3 100644 --- a/shared/source/helpers/compiler_product_helper.cpp +++ b/shared/source/helpers/compiler_product_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -11,7 +11,7 @@ namespace NEO { -CompilerProductHelperCreateFunctionType compilerProductHelperFactory[IGFX_MAX_PRODUCT] = {}; +CompilerProductHelperCreateFunctionType compilerProductHelperFactory[NEO::maxProductEnumValue] = {}; uint32_t CompilerProductHelper::getHwIpVersion(const HardwareInfo &hwInfo) const { if (debugManager.flags.OverrideHwIpVersion.get() != -1) { diff --git a/shared/source/helpers/compiler_product_helper.h b/shared/source/helpers/compiler_product_helper.h index 26ffae89dc..c560d6299e 100644 --- a/shared/source/helpers/compiler_product_helper.h +++ b/shared/source/helpers/compiler_product_helper.h @@ -41,7 +41,7 @@ constexpr bool operator>=(OclCVersion lhs, OclCVersion rhs) { } using CompilerProductHelperCreateFunctionType = std::unique_ptr (*)(); -extern CompilerProductHelperCreateFunctionType compilerProductHelperFactory[IGFX_MAX_PRODUCT]; +extern CompilerProductHelperCreateFunctionType compilerProductHelperFactory[NEO::maxProductEnumValue]; class CompilerProductHelper { public: diff --git a/shared/source/helpers/hw_info.cpp b/shared/source/helpers/hw_info.cpp index 88690ac9a3..4b10d6f31f 100644 --- a/shared/source/helpers/hw_info.cpp +++ b/shared/source/helpers/hw_info.cpp @@ -22,7 +22,7 @@ HardwareInfo::HardwareInfo(const PLATFORM *platform, const FeatureTable *feature } // Global table of hardware prefixes -const char *hardwarePrefix[IGFX_MAX_PRODUCT] = { +const char *hardwarePrefix[NEO::maxProductEnumValue] = { nullptr, }; @@ -31,12 +31,12 @@ bool familyEnabled[IGFX_MAX_CORE] = { false, }; -const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT] = {}; -void (*hardwareInfoSetup[IGFX_MAX_PRODUCT])(HardwareInfo *, bool, uint64_t, const ReleaseHelper *) = { +const HardwareInfo *hardwareInfoTable[NEO::maxProductEnumValue] = {}; +void (*hardwareInfoSetup[NEO::maxProductEnumValue])(HardwareInfo *, bool, uint64_t, const ReleaseHelper *) = { 0x0, }; -void (*hardwareInfoBaseSetup[IGFX_MAX_PRODUCT])(HardwareInfo *, bool, const ReleaseHelper *) = { +void (*hardwareInfoBaseSetup[NEO::maxProductEnumValue])(HardwareInfo *, bool, const ReleaseHelper *) = { 0x0, }; @@ -47,7 +47,7 @@ bool getHwInfoForPlatformString(std::string &platform, const HardwareInfo *&hwIn return true; } bool ret = false; - for (int j = 0; j < IGFX_MAX_PRODUCT; j++) { + for (int j = 0; j < NEO::maxProductEnumValue; j++) { if (hardwarePrefix[j] == nullptr) { continue; } diff --git a/shared/source/helpers/hw_info.h b/shared/source/helpers/hw_info.h index 3fb89cba59..7a5767f508 100644 --- a/shared/source/helpers/hw_info.h +++ b/shared/source/helpers/hw_info.h @@ -71,10 +71,10 @@ struct HardwareInfo { // NOLINT(clang-analyzer-optin.performance.Padding) // Global table of hardware prefixes extern bool familyEnabled[IGFX_MAX_CORE]; -extern const char *hardwarePrefix[IGFX_MAX_PRODUCT]; -extern const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT]; -extern void (*hardwareInfoSetup[IGFX_MAX_PRODUCT])(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable, uint64_t hwInfoConfig, const ReleaseHelper *releaseHelper); -extern void (*hardwareInfoBaseSetup[IGFX_MAX_PRODUCT])(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable, const ReleaseHelper *releaseHelper); +extern const char *hardwarePrefix[NEO::maxProductEnumValue]; +extern const HardwareInfo *hardwareInfoTable[NEO::maxProductEnumValue]; +extern void (*hardwareInfoSetup[NEO::maxProductEnumValue])(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable, uint64_t hwInfoConfig, const ReleaseHelper *releaseHelper); +extern void (*hardwareInfoBaseSetup[NEO::maxProductEnumValue])(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable, const ReleaseHelper *releaseHelper); template struct EnableGfxFamilyHw { diff --git a/shared/source/helpers/product_config_helper.cpp b/shared/source/helpers/product_config_helper.cpp index 480e445c27..4304c2a3bf 100644 --- a/shared/source/helpers/product_config_helper.cpp +++ b/shared/source/helpers/product_config_helper.cpp @@ -251,7 +251,7 @@ PRODUCT_FAMILY ProductConfigHelper::getProductFamilyFromDeviceName(const std::st std::vector ProductConfigHelper::getDeprecatedAcronyms() { std::vector prefixes{}, deprecatedAcronyms{}; - for (int j = 0; j < IGFX_MAX_PRODUCT; j++) { + for (int j = 0; j < NEO::maxProductEnumValue; j++) { if (NEO::hardwarePrefix[j] == nullptr) { continue; } diff --git a/shared/source/os_interface/linux/ioctl_helper.cpp b/shared/source/os_interface/linux/ioctl_helper.cpp index d845d6a451..f8e567cf30 100644 --- a/shared/source/os_interface/linux/ioctl_helper.cpp +++ b/shared/source/os_interface/linux/ioctl_helper.cpp @@ -28,7 +28,7 @@ namespace NEO { -std::optional(Drm &drm)>> ioctlHelperFactory[IGFX_MAX_PRODUCT] = {}; +std::optional(Drm &drm)>> ioctlHelperFactory[NEO::maxProductEnumValue] = {}; void IoctlHelper::setExternalContext(ExternalCtx *ctx) { externalCtx = ctx; } diff --git a/shared/source/os_interface/linux/ioctl_helper.h b/shared/source/os_interface/linux/ioctl_helper.h index f939b5345f..f5ec4cada9 100644 --- a/shared/source/os_interface/linux/ioctl_helper.h +++ b/shared/source/os_interface/linux/ioctl_helper.h @@ -475,5 +475,5 @@ class IoctlHelperPrelim20 : public IoctlHelperI915 { uint64_t uuid = 0; }; -extern std::optional(Drm &drm)>> ioctlHelperFactory[IGFX_MAX_PRODUCT]; +extern std::optional(Drm &drm)>> ioctlHelperFactory[NEO::maxProductEnumValue]; } // namespace NEO diff --git a/shared/source/os_interface/product_helper.cpp b/shared/source/os_interface/product_helper.cpp index 4bd1536306..b990aa8671 100644 --- a/shared/source/os_interface/product_helper.cpp +++ b/shared/source/os_interface/product_helper.cpp @@ -18,7 +18,7 @@ namespace NEO { -ProductHelperCreateFunctionType productHelperFactory[IGFX_MAX_PRODUCT] = {}; +ProductHelperCreateFunctionType productHelperFactory[NEO::maxProductEnumValue] = {}; void ProductHelper::setupPreemptionSurfaceSize(HardwareInfo &hwInfo, const RootDeviceEnvironment &rootDeviceEnvironment) { if (debugManager.flags.OverridePreemptionSurfaceSizeInMb.get() >= 0) { diff --git a/shared/source/os_interface/product_helper.h b/shared/source/os_interface/product_helper.h index c1ed4cca4c..c9ba2acdfc 100644 --- a/shared/source/os_interface/product_helper.h +++ b/shared/source/os_interface/product_helper.h @@ -10,8 +10,8 @@ #include "shared/source/helpers/common_types.h" #include "aubstream/engine_node.h" +#include "neo_igfxfmid.h" -#include #include #include #include @@ -56,7 +56,7 @@ enum class CachePolicy : uint32_t; enum class LocalMemAllocationMode : uint32_t; using ProductHelperCreateFunctionType = std::unique_ptr (*)(); -extern ProductHelperCreateFunctionType productHelperFactory[IGFX_MAX_PRODUCT]; +extern ProductHelperCreateFunctionType productHelperFactory[NEO::maxProductEnumValue]; enum class UsmAccessCapabilities { host = 0, diff --git a/shared/test/common/common_main.cpp b/shared/test/common/common_main.cpp index 3874fafabe..71943fd6e4 100644 --- a/shared/test/common/common_main.cpp +++ b/shared/test/common/common_main.cpp @@ -237,7 +237,7 @@ int main(int argc, char **argv) { if (i < argc) { if (::isdigit(argv[i][0])) { int productValue = atoi(argv[i]); - if (productValue > 0 && productValue < IGFX_MAX_PRODUCT && hardwarePrefix[productValue] != nullptr) { + if (productValue > 0 && productValue < NEO::maxProductEnumValue && hardwarePrefix[productValue] != nullptr) { productFamily = static_cast(productValue); } else { productFamily = IGFX_UNKNOWN; @@ -245,7 +245,7 @@ int main(int argc, char **argv) { } else { bool selectAllProducts = (strcmp("*", argv[i]) == 0); productFamily = IGFX_UNKNOWN; - for (int j = 0; j < IGFX_MAX_PRODUCT; j++) { + for (int j = 0; j < NEO::maxProductEnumValue; j++) { if (hardwarePrefix[j] == nullptr) { continue; } diff --git a/shared/test/common/helpers/raii_product_helper.h b/shared/test/common/helpers/raii_product_helper.h index 22d1fd46c4..1d1daad7ed 100644 --- a/shared/test/common/helpers/raii_product_helper.h +++ b/shared/test/common/helpers/raii_product_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -12,7 +12,7 @@ #include "shared/source/os_interface/product_helper.h" namespace NEO { -extern ProductHelperCreateFunctionType productHelperFactory[IGFX_MAX_PRODUCT]; +extern ProductHelperCreateFunctionType productHelperFactory[NEO::maxProductEnumValue]; template class RAIIProductHelperFactory { diff --git a/shared/test/common/test_macros/hw_test_base.h b/shared/test/common/test_macros/hw_test_base.h index 78241ab6d9..4bf7650a50 100644 --- a/shared/test/common/test_macros/hw_test_base.h +++ b/shared/test/common/test_macros/hw_test_base.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -33,21 +33,21 @@ constexpr bool ignoreInvalidTestExcludes = false; #define IS_TEST_EXCLUDED(test_suite_name, test_name) \ NEO::TestExcludes::isTestExcluded(#test_suite_name #test_name, ::productFamily, ::renderCoreFamily) -#define CALL_IF_MATCH(match_core, match_product, expr) \ - auto matchCore = match_core; \ - auto matchProduct = match_product; \ - if ((::renderCoreFamily == matchCore) && \ - (IGFX_MAX_PRODUCT == matchProduct || ::productFamily == matchProduct)) { \ - expr; \ +#define CALL_IF_MATCH(match_core, match_product, expr) \ + auto matchCore = match_core; \ + auto matchProduct = match_product; \ + if ((::renderCoreFamily == matchCore) && \ + (NEO::maxProductEnumValue == matchProduct || ::productFamily == matchProduct)) { \ + expr; \ } #define GENTEST_F(gfx_core, test_fixture, test_name) \ FAMILYTEST_TEST_(test_fixture, test_name, test_fixture, \ ::testing::internal::GetTypeId(), \ - gfx_core, IGFX_MAX_PRODUCT) + gfx_core, NEO::maxProductEnumValue) #define GENTEST_P(gfx_core, test_suite_name, test_name) \ - FAMILYTEST_TEST_P(test_suite_name, test_name, gfx_core, IGFX_MAX_PRODUCT) + FAMILYTEST_TEST_P(test_suite_name, test_name, gfx_core, NEO::maxProductEnumValue) #define FAMILYTEST_TEST_(test_suite_name, test_name, parent_class, parent_id, match_core, match_product) \ CHECK_TEST_NAME_LENGTH(test_suite_name, test_name) \ diff --git a/shared/test/unit_test/command_stream/get_devices_tests.cpp b/shared/test/unit_test/command_stream/get_devices_tests.cpp index b36f1aaa5a..1fe17d0868 100644 --- a/shared/test/unit_test/command_stream/get_devices_tests.cpp +++ b/shared/test/unit_test/command_stream/get_devices_tests.cpp @@ -197,7 +197,7 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsForDepreca EXPECT_TRUE(ret); EXPECT_NE(nullptr, hwInfo); - for (i = 0; i < IGFX_MAX_PRODUCT; i++) { + for (i = 0; i < NEO::maxProductEnumValue; i++) { auto hardwareInfo = hardwareInfoTable[i]; if (hardwareInfo == nullptr) { continue; @@ -207,7 +207,7 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsForDepreca } } - EXPECT_TRUE(i < IGFX_MAX_PRODUCT); + EXPECT_TRUE(i < NEO::maxProductEnumValue); ASSERT_NE(nullptr, hardwarePrefix[i]); HardwareInfo hwInfoFromTable = *hardwareInfoTable[i]; @@ -379,7 +379,7 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsAndUnknown case CommandStreamReceiverType::tbxWithAub: { EXPECT_TRUE(ret); EXPECT_NE(nullptr, hwInfo); - for (i = 0; i < IGFX_MAX_PRODUCT; i++) { + for (i = 0; i < NEO::maxProductEnumValue; i++) { auto hardwareInfo = hardwareInfoTable[i]; if (hardwareInfo == nullptr) { continue; @@ -388,7 +388,7 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsAndUnknown break; } } - EXPECT_TRUE(i < IGFX_MAX_PRODUCT); + EXPECT_TRUE(i < NEO::maxProductEnumValue); ASSERT_NE(nullptr, hardwarePrefix[i]); HardwareInfo baseHwInfo = *defaultHwInfo; baseHwInfo.featureTable = {}; diff --git a/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp b/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp index d788ce4fad..3bce9ecd5b 100644 --- a/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp +++ b/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp @@ -6931,7 +6931,7 @@ TEST(ValidateTargetDeviceTests, givenMismatchedProductFamilyWhenValidatingTarget Zebin::Elf::ZebinTargetFlags targetMetadata; auto mismatchedPlatformFamily = IGFX_UNKNOWN; - for (int i = 0; i < IGFX_MAX_PRODUCT; i++) { + for (int i = 0; i < NEO::maxProductEnumValue; i++) { const auto hwInfo = NEO::hardwareInfoTable[i]; if (nullptr != hwInfo && hwInfo->platform.eRenderCoreFamily != renderCoreFamily) { mismatchedPlatformFamily = hwInfo->platform.eProductFamily;