refactor: add wrapper for max product enum value

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2025-11-19 14:05:39 +00:00
committed by Compute-Runtime-Automation
parent 794798d858
commit 8db92240fc
35 changed files with 69 additions and 68 deletions

View File

@@ -39,8 +39,8 @@ void CommandList::setPatchingPreamble(bool patching, bool saveWait) {
} }
} }
CommandListAllocatorFn commandListFactory[IGFX_MAX_PRODUCT] = {}; CommandListAllocatorFn commandListFactory[NEO::maxProductEnumValue] = {};
CommandListAllocatorFn commandListFactoryImmediate[IGFX_MAX_PRODUCT] = {}; CommandListAllocatorFn commandListFactoryImmediate[NEO::maxProductEnumValue] = {};
ze_result_t CommandListImp::destroy() { ze_result_t CommandListImp::destroy() {
if (this->isBcsSplitNeeded) { 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, ze_command_list_flags_t flags, ze_result_t &returnValue,
bool internalUsage) { bool internalUsage) {
CommandListAllocatorFn allocator = nullptr; CommandListAllocatorFn allocator = nullptr;
if (productFamily < IGFX_MAX_PRODUCT) { if (productFamily < NEO::maxProductEnumValue) {
allocator = commandListFactory[productFamily]; allocator = commandListFactory[productFamily];
} }
@@ -170,7 +170,7 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
cmdQdesc.mode = static_cast<ze_command_queue_mode_t>(overrideImmediateCmdListSyncMode); cmdQdesc.mode = static_cast<ze_command_queue_mode_t>(overrideImmediateCmdListSyncMode);
} }
CommandListAllocatorFn allocator = nullptr; CommandListAllocatorFn allocator = nullptr;
if (productFamily < IGFX_MAX_PRODUCT) { if (productFamily < NEO::maxProductEnumValue) {
allocator = commandListFactoryImmediate[productFamily]; allocator = commandListFactoryImmediate[productFamily];
} }

View File

@@ -33,7 +33,7 @@
namespace L0 { namespace L0 {
CommandQueueAllocatorFn commandQueueFactory[IGFX_MAX_PRODUCT] = {}; CommandQueueAllocatorFn commandQueueFactory[NEO::maxProductEnumValue] = {};
bool CommandQueue::frontEndTrackingEnabled() const { bool CommandQueue::frontEndTrackingEnabled() const {
return NEO::debugManager.flags.AllowPatchingVfeStateInCommandLists.get() || this->frontEndStateTracking; 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, 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) { const ze_command_queue_desc_t *desc, bool isCopyOnly, bool isInternal, bool immediateCmdListQueue, ze_result_t &returnValue) {
CommandQueueAllocatorFn allocator = nullptr; CommandQueueAllocatorFn allocator = nullptr;
if (productFamily < IGFX_MAX_PRODUCT) { if (productFamily < NEO::maxProductEnumValue) {
allocator = commandQueueFactory[productFamily]; allocator = commandQueueFactory[productFamily];
} }

View File

@@ -25,7 +25,7 @@
#include "neo_igfxfmid.h" #include "neo_igfxfmid.h"
namespace L0 { namespace L0 {
ImageAllocatorFn imageFactory[IGFX_MAX_PRODUCT] = {}; ImageAllocatorFn imageFactory[NEO::maxProductEnumValue] = {};
bool isImportedWin32Handle(const ze_image_desc_t *imgDesc) { bool isImportedWin32Handle(const ze_image_desc_t *imgDesc) {
const ze_base_desc_t *extendedDesc = reinterpret_cast<const ze_base_desc_t *>(imgDesc->pNext); const ze_base_desc_t *extendedDesc = reinterpret_cast<const ze_base_desc_t *>(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 Image::create(uint32_t productFamily, Device *device, const ze_image_desc_t *desc, Image **pImage) {
ze_result_t result = ZE_RESULT_SUCCESS; ze_result_t result = ZE_RESULT_SUCCESS;
ImageAllocatorFn allocator = nullptr; ImageAllocatorFn allocator = nullptr;
if (productFamily < IGFX_MAX_PRODUCT) { if (productFamily < NEO::maxProductEnumValue) {
allocator = imageFactory[productFamily]; allocator = imageFactory[productFamily];
} }

View File

@@ -11,6 +11,6 @@
namespace L0 { namespace L0 {
KernelAllocatorFn kernelFactory[IGFX_MAX_PRODUCT] = {}; KernelAllocatorFn kernelFactory[NEO::maxProductEnumValue] = {};
} // namespace L0 } // namespace L0

View File

@@ -1457,7 +1457,7 @@ void KernelImp::patchGlobalOffset() {
Kernel *Kernel::create(uint32_t productFamily, Module *module, Kernel *Kernel::create(uint32_t productFamily, Module *module,
const ze_kernel_desc_t *desc, ze_result_t *res) { 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]; KernelAllocatorFn allocator = kernelFactory[productFamily];
auto kernel = static_cast<KernelImp *>(allocator(module)); auto kernel = static_cast<KernelImp *>(allocator(module));
*res = kernel->initialize(desc); *res = kernel->initialize(desc);

View File

@@ -82,7 +82,7 @@ void MutableResidencyAllocations::cleanResidencyContainer() {
immutableResidencySize = 0; immutableResidencySize = 0;
} }
MutableCommandListAllocFn mutableCommandListFactory[IGFX_MAX_PRODUCT] = {}; MutableCommandListAllocFn mutableCommandListFactory[NEO::maxProductEnumValue] = {};
MutableCommandList *MutableCommandList::fromHandle(ze_command_list_handle_t handle) { MutableCommandList *MutableCommandList::fromHandle(ze_command_list_handle_t handle) {
return static_cast<MutableCommandList *>(L0::CommandList::fromHandle(handle)->asMutable()); return static_cast<MutableCommandList *>(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, CommandList *MutableCommandList::create(uint32_t productFamily, Device *device, NEO::EngineGroupType engineGroupType,
ze_command_list_flags_t flags, ze_result_t &resultValue, bool useInternalEngineType) { ze_command_list_flags_t flags, ze_result_t &resultValue, bool useInternalEngineType) {
MutableCommandListAllocFn allocator = nullptr; MutableCommandListAllocFn allocator = nullptr;
if (productFamily < IGFX_MAX_PRODUCT) { if (productFamily < NEO::maxProductEnumValue) {
allocator = mutableCommandListFactory[productFamily]; allocator = mutableCommandListFactory[productFamily];
} }
if (allocator == nullptr) { if (allocator == nullptr) {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2020-2021 Intel Corporation * Copyright (C) 2020-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -11,7 +11,7 @@
namespace L0 { namespace L0 {
SamplerAllocatorFn samplerFactory[IGFX_MAX_PRODUCT] = {}; SamplerAllocatorFn samplerFactory[NEO::maxProductEnumValue] = {};
ze_result_t SamplerImp::destroy() { ze_result_t SamplerImp::destroy() {
delete this; 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) { Sampler *Sampler::create(uint32_t productFamily, Device *device, const ze_sampler_desc_t *desc) {
SamplerAllocatorFn allocator = nullptr; SamplerAllocatorFn allocator = nullptr;
if (productFamily < IGFX_MAX_PRODUCT) { if (productFamily < NEO::maxProductEnumValue) {
allocator = samplerFactory[productFamily]; allocator = samplerFactory[productFamily];
} }

View File

@@ -125,7 +125,7 @@ TEST_F(DefaultDescriptorWithoutBlitterTest, givenDeviceWithoutBlitterSupportWhen
TEST_F(CommandListCreateTests, whenCommandListIsCreatedWithInvalidProductFamilyThenFailureIsReturned) { TEST_F(CommandListCreateTests, whenCommandListIsCreatedWithInvalidProductFamilyThenFailureIsReturned) {
ze_result_t returnValue; ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(CommandList::create(PRODUCT_FAMILY::IGFX_MAX_PRODUCT, device, NEO::EngineGroupType::renderCompute, 0u, returnValue, false)); std::unique_ptr<L0::CommandList> commandList(CommandList::create(NEO::maxProductEnumValue, device, NEO::EngineGroupType::renderCompute, 0u, returnValue, false));
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, returnValue); EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, returnValue);
ASSERT_EQ(nullptr, commandList); ASSERT_EQ(nullptr, commandList);
} }
@@ -134,7 +134,7 @@ TEST_F(CommandListCreateTests, whenCommandListImmediateIsCreatedWithInvalidProdu
ze_result_t returnValue; ze_result_t returnValue;
const ze_command_queue_desc_t desc = {}; const ze_command_queue_desc_t desc = {};
bool internalEngine = true; bool internalEngine = true;
std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(PRODUCT_FAMILY::IGFX_MAX_PRODUCT, std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(NEO::maxProductEnumValue,
device, device,
&desc, &desc,
internalEngine, internalEngine,

View File

@@ -291,7 +291,7 @@ TEST_F(CommandQueueCreate, whenCreatingCommandQueueWithInvalidProductFamilyThenF
ze_result_t returnValue; ze_result_t returnValue;
auto csr = std::unique_ptr<NEO::CommandStreamReceiver>(neoDevice->createCommandStreamReceiver()); auto csr = std::unique_ptr<NEO::CommandStreamReceiver>(neoDevice->createCommandStreamReceiver());
csr->setupContext(*neoDevice->getDefaultEngine().osContext); csr->setupContext(*neoDevice->getDefaultEngine().osContext);
L0::CommandQueue *commandQueue = CommandQueue::create(PRODUCT_FAMILY::IGFX_MAX_PRODUCT, L0::CommandQueue *commandQueue = CommandQueue::create(NEO::maxProductEnumValue,
device, device,
csr.get(), csr.get(),
&desc, &desc,

View File

@@ -30,7 +30,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE,
givenInvalidProductWhenCreatingCommandListThenNoObjectCreated) { givenInvalidProductWhenCreatingCommandListThenNoObjectCreated) {
ze_result_t returnValue; 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(nullptr, mcl);
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, returnValue); EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, returnValue);
} }

View File

@@ -184,7 +184,7 @@ HWTEST2_F(ContextCreateSamplerTest, givenInvalidHardwareFamilyThenSamplerIsNotCr
desc.filterMode = filterMode; desc.filterMode = filterMode;
desc.isNormalized = isNormalized; 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); EXPECT_EQ(nullptr, sampler);
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2023 Intel Corporation * Copyright (C) 2023-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -10,7 +10,7 @@
namespace L0 { namespace L0 {
namespace Sysman { namespace Sysman {
SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[IGFX_MAX_PRODUCT] = {}; SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[NEO::maxProductEnumValue] = {};
} }
} // namespace L0 } // namespace L0

View File

@@ -35,7 +35,7 @@ enum class RasInterfaceType;
enum class SysfsValueUnit; enum class SysfsValueUnit;
using SysmanProductHelperCreateFunctionType = std::unique_ptr<SysmanProductHelper> (*)(); using SysmanProductHelperCreateFunctionType = std::unique_ptr<SysmanProductHelper> (*)();
extern SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[IGFX_MAX_PRODUCT]; extern SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[NEO::maxProductEnumValue];
class SysmanProductHelper { class SysmanProductHelper {
public: public:

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2024 Intel Corporation * Copyright (C) 2024-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -10,7 +10,7 @@
namespace L0 { namespace L0 {
namespace Sysman { namespace Sysman {
SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[IGFX_MAX_PRODUCT] = {}; SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[NEO::maxProductEnumValue] = {};
} }
} // namespace L0 } // namespace L0

View File

@@ -29,7 +29,7 @@ class SysmanProductHelper;
class WddmSysmanImp; class WddmSysmanImp;
using SysmanProductHelperCreateFunctionType = std::unique_ptr<SysmanProductHelper> (*)(); using SysmanProductHelperCreateFunctionType = std::unique_ptr<SysmanProductHelper> (*)();
extern SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[IGFX_MAX_PRODUCT]; extern SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[NEO::maxProductEnumValue];
static const std::map<zes_power_domain_t, KmdSysman::PowerDomainsType> powerGroupToDomainTypeMap = { static const std::map<zes_power_domain_t, KmdSysman::PowerDomainsType> powerGroupToDomainTypeMap = {
{ZES_POWER_DOMAIN_CARD, KmdSysman::PowerDomainsType::powerDomainCard}, {ZES_POWER_DOMAIN_CARD, KmdSysman::PowerDomainsType::powerDomainCard},
{ZES_POWER_DOMAIN_PACKAGE, KmdSysman::PowerDomainsType::powerDomainPackage}, {ZES_POWER_DOMAIN_PACKAGE, KmdSysman::PowerDomainsType::powerDomainPackage},

View File

@@ -307,7 +307,7 @@ TEST_F(IgaWrapperTest, GivenIgcWrapperWhenCallingSetGfxCoreMultipleTimesThenFirs
TEST_F(IgaWrapperTest, GivenIgcWrapperWhenCallingSetProductFamilyMultipleTimesThenFirstValidProductFamilyIsPreserved) { TEST_F(IgaWrapperTest, GivenIgcWrapperWhenCallingSetProductFamilyMultipleTimesThenFirstValidProductFamilyIsPreserved) {
ASSERT_FALSE(testedIgaWrapper.isKnownPlatform()); ASSERT_FALSE(testedIgaWrapper.isKnownPlatform());
constexpr auto invalidProductFamily = IGFX_MAX_PRODUCT; constexpr auto invalidProductFamily = NEO::maxProductEnumValue;
testedIgaWrapper.setProductFamily(invalidProductFamily); testedIgaWrapper.setProductFamily(invalidProductFamily);
EXPECT_FALSE(testedIgaWrapper.isKnownPlatform()); EXPECT_FALSE(testedIgaWrapper.isKnownPlatform());

View File

@@ -136,7 +136,7 @@ int main(int argc, char **argv) {
} }
uint16_t revision = 0; 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::hardwarePrefix[productId] && (0 == strcmp(devicePrefix.c_str(), NEO::hardwarePrefix[productId]))) {
if (NEO::hardwareInfoTable[productId]) { if (NEO::hardwareInfoTable[productId]) {
renderCoreFamily = NEO::hardwareInfoTable[productId]->platform.eRenderCoreFamily; renderCoreFamily = NEO::hardwareInfoTable[productId]->platform.eRenderCoreFamily;

View File

@@ -92,7 +92,7 @@ size_t findPos(const std::vector<std::string> &lines, const std::string &whatToF
} }
PRODUCT_FAMILY getProductFamilyFromDeviceName(const std::string &deviceName) { 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 && if (NEO::hardwarePrefix[productId] != nullptr &&
deviceName == NEO::hardwarePrefix[productId]) { deviceName == NEO::hardwarePrefix[productId]) {
return static_cast<PRODUCT_FAMILY>(productId); return static_cast<PRODUCT_FAMILY>(productId);

View File

@@ -51,7 +51,7 @@ enum class AILEnumeration : uint32_t {
class AILConfiguration; class AILConfiguration;
using AILConfigurationCreateFunctionType = std::unique_ptr<AILConfiguration> (*)(); using AILConfigurationCreateFunctionType = std::unique_ptr<AILConfiguration> (*)();
extern AILConfigurationCreateFunctionType ailConfigurationFactory[IGFX_MAX_PRODUCT]; extern AILConfigurationCreateFunctionType ailConfigurationFactory[NEO::maxProductEnumValue];
class AILConfiguration { class AILConfiguration {
public: public:

View File

@@ -46,7 +46,7 @@ const std::set<std::string_view> applicationsMicrosecontResolutionAdjustment = {
const uint32_t microsecondAdjustment = 1000; const uint32_t microsecondAdjustment = 1000;
AILConfigurationCreateFunctionType ailConfigurationFactory[IGFX_MAX_PRODUCT]; AILConfigurationCreateFunctionType ailConfigurationFactory[NEO::maxProductEnumValue];
void AILConfiguration::apply(HardwareInfo &hwInfo) { void AILConfiguration::apply(HardwareInfo &hwInfo) {
auto search = applicationMap.find(processName); auto search = applicationMap.find(processName);

View File

@@ -11,4 +11,5 @@
namespace NEO { namespace NEO {
constexpr GFXCORE_FAMILY xe3pCoreEnumValue = static_cast<GFXCORE_FAMILY>(0x2300); // NOLINT(clang-analyzer-optin.core.EnumCastOutOfRange), NEO-16649 constexpr GFXCORE_FAMILY xe3pCoreEnumValue = static_cast<GFXCORE_FAMILY>(0x2300); // NOLINT(clang-analyzer-optin.core.EnumCastOutOfRange), NEO-16649
} constexpr PRODUCT_FAMILY maxProductEnumValue = IGFX_MAX_PRODUCT;
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021-2023 Intel Corporation * Copyright (C) 2021-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -11,7 +11,7 @@
namespace NEO { namespace NEO {
CompilerProductHelperCreateFunctionType compilerProductHelperFactory[IGFX_MAX_PRODUCT] = {}; CompilerProductHelperCreateFunctionType compilerProductHelperFactory[NEO::maxProductEnumValue] = {};
uint32_t CompilerProductHelper::getHwIpVersion(const HardwareInfo &hwInfo) const { uint32_t CompilerProductHelper::getHwIpVersion(const HardwareInfo &hwInfo) const {
if (debugManager.flags.OverrideHwIpVersion.get() != -1) { if (debugManager.flags.OverrideHwIpVersion.get() != -1) {

View File

@@ -41,7 +41,7 @@ constexpr bool operator>=(OclCVersion lhs, OclCVersion rhs) {
} }
using CompilerProductHelperCreateFunctionType = std::unique_ptr<CompilerProductHelper> (*)(); using CompilerProductHelperCreateFunctionType = std::unique_ptr<CompilerProductHelper> (*)();
extern CompilerProductHelperCreateFunctionType compilerProductHelperFactory[IGFX_MAX_PRODUCT]; extern CompilerProductHelperCreateFunctionType compilerProductHelperFactory[NEO::maxProductEnumValue];
class CompilerProductHelper { class CompilerProductHelper {
public: public:

View File

@@ -22,7 +22,7 @@ HardwareInfo::HardwareInfo(const PLATFORM *platform, const FeatureTable *feature
} }
// Global table of hardware prefixes // Global table of hardware prefixes
const char *hardwarePrefix[IGFX_MAX_PRODUCT] = { const char *hardwarePrefix[NEO::maxProductEnumValue] = {
nullptr, nullptr,
}; };
@@ -31,12 +31,12 @@ bool familyEnabled[IGFX_MAX_CORE] = {
false, false,
}; };
const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT] = {}; const HardwareInfo *hardwareInfoTable[NEO::maxProductEnumValue] = {};
void (*hardwareInfoSetup[IGFX_MAX_PRODUCT])(HardwareInfo *, bool, uint64_t, const ReleaseHelper *) = { void (*hardwareInfoSetup[NEO::maxProductEnumValue])(HardwareInfo *, bool, uint64_t, const ReleaseHelper *) = {
0x0, 0x0,
}; };
void (*hardwareInfoBaseSetup[IGFX_MAX_PRODUCT])(HardwareInfo *, bool, const ReleaseHelper *) = { void (*hardwareInfoBaseSetup[NEO::maxProductEnumValue])(HardwareInfo *, bool, const ReleaseHelper *) = {
0x0, 0x0,
}; };
@@ -47,7 +47,7 @@ bool getHwInfoForPlatformString(std::string &platform, const HardwareInfo *&hwIn
return true; return true;
} }
bool ret = false; bool ret = false;
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) { for (int j = 0; j < NEO::maxProductEnumValue; j++) {
if (hardwarePrefix[j] == nullptr) { if (hardwarePrefix[j] == nullptr) {
continue; continue;
} }

View File

@@ -71,10 +71,10 @@ struct HardwareInfo { // NOLINT(clang-analyzer-optin.performance.Padding)
// Global table of hardware prefixes // Global table of hardware prefixes
extern bool familyEnabled[IGFX_MAX_CORE]; extern bool familyEnabled[IGFX_MAX_CORE];
extern const char *hardwarePrefix[IGFX_MAX_PRODUCT]; extern const char *hardwarePrefix[NEO::maxProductEnumValue];
extern const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT]; extern const HardwareInfo *hardwareInfoTable[NEO::maxProductEnumValue];
extern void (*hardwareInfoSetup[IGFX_MAX_PRODUCT])(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable, uint64_t hwInfoConfig, const ReleaseHelper *releaseHelper); extern void (*hardwareInfoSetup[NEO::maxProductEnumValue])(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable, uint64_t hwInfoConfig, const ReleaseHelper *releaseHelper);
extern void (*hardwareInfoBaseSetup[IGFX_MAX_PRODUCT])(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable, const ReleaseHelper *releaseHelper); extern void (*hardwareInfoBaseSetup[NEO::maxProductEnumValue])(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable, const ReleaseHelper *releaseHelper);
template <GFXCORE_FAMILY gfxFamily> template <GFXCORE_FAMILY gfxFamily>
struct EnableGfxFamilyHw { struct EnableGfxFamilyHw {

View File

@@ -251,7 +251,7 @@ PRODUCT_FAMILY ProductConfigHelper::getProductFamilyFromDeviceName(const std::st
std::vector<NEO::ConstStringRef> ProductConfigHelper::getDeprecatedAcronyms() { std::vector<NEO::ConstStringRef> ProductConfigHelper::getDeprecatedAcronyms() {
std::vector<NEO::ConstStringRef> prefixes{}, deprecatedAcronyms{}; std::vector<NEO::ConstStringRef> prefixes{}, deprecatedAcronyms{};
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) { for (int j = 0; j < NEO::maxProductEnumValue; j++) {
if (NEO::hardwarePrefix[j] == nullptr) { if (NEO::hardwarePrefix[j] == nullptr) {
continue; continue;
} }

View File

@@ -28,7 +28,7 @@
namespace NEO { namespace NEO {
std::optional<std::function<std::unique_ptr<IoctlHelper>(Drm &drm)>> ioctlHelperFactory[IGFX_MAX_PRODUCT] = {}; std::optional<std::function<std::unique_ptr<IoctlHelper>(Drm &drm)>> ioctlHelperFactory[NEO::maxProductEnumValue] = {};
void IoctlHelper::setExternalContext(ExternalCtx *ctx) { void IoctlHelper::setExternalContext(ExternalCtx *ctx) {
externalCtx = ctx; externalCtx = ctx;
} }

View File

@@ -475,5 +475,5 @@ class IoctlHelperPrelim20 : public IoctlHelperI915 {
uint64_t uuid = 0; uint64_t uuid = 0;
}; };
extern std::optional<std::function<std::unique_ptr<IoctlHelper>(Drm &drm)>> ioctlHelperFactory[IGFX_MAX_PRODUCT]; extern std::optional<std::function<std::unique_ptr<IoctlHelper>(Drm &drm)>> ioctlHelperFactory[NEO::maxProductEnumValue];
} // namespace NEO } // namespace NEO

View File

@@ -18,7 +18,7 @@
namespace NEO { namespace NEO {
ProductHelperCreateFunctionType productHelperFactory[IGFX_MAX_PRODUCT] = {}; ProductHelperCreateFunctionType productHelperFactory[NEO::maxProductEnumValue] = {};
void ProductHelper::setupPreemptionSurfaceSize(HardwareInfo &hwInfo, const RootDeviceEnvironment &rootDeviceEnvironment) { void ProductHelper::setupPreemptionSurfaceSize(HardwareInfo &hwInfo, const RootDeviceEnvironment &rootDeviceEnvironment) {
if (debugManager.flags.OverridePreemptionSurfaceSizeInMb.get() >= 0) { if (debugManager.flags.OverridePreemptionSurfaceSizeInMb.get() >= 0) {

View File

@@ -10,8 +10,8 @@
#include "shared/source/helpers/common_types.h" #include "shared/source/helpers/common_types.h"
#include "aubstream/engine_node.h" #include "aubstream/engine_node.h"
#include "neo_igfxfmid.h"
#include <igfxfmid.h>
#include <memory> #include <memory>
#include <optional> #include <optional>
#include <string> #include <string>
@@ -56,7 +56,7 @@ enum class CachePolicy : uint32_t;
enum class LocalMemAllocationMode : uint32_t; enum class LocalMemAllocationMode : uint32_t;
using ProductHelperCreateFunctionType = std::unique_ptr<ProductHelper> (*)(); using ProductHelperCreateFunctionType = std::unique_ptr<ProductHelper> (*)();
extern ProductHelperCreateFunctionType productHelperFactory[IGFX_MAX_PRODUCT]; extern ProductHelperCreateFunctionType productHelperFactory[NEO::maxProductEnumValue];
enum class UsmAccessCapabilities { enum class UsmAccessCapabilities {
host = 0, host = 0,

View File

@@ -237,7 +237,7 @@ int main(int argc, char **argv) {
if (i < argc) { if (i < argc) {
if (::isdigit(argv[i][0])) { if (::isdigit(argv[i][0])) {
int productValue = atoi(argv[i]); 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<PRODUCT_FAMILY>(productValue); productFamily = static_cast<PRODUCT_FAMILY>(productValue);
} else { } else {
productFamily = IGFX_UNKNOWN; productFamily = IGFX_UNKNOWN;
@@ -245,7 +245,7 @@ int main(int argc, char **argv) {
} else { } else {
bool selectAllProducts = (strcmp("*", argv[i]) == 0); bool selectAllProducts = (strcmp("*", argv[i]) == 0);
productFamily = IGFX_UNKNOWN; productFamily = IGFX_UNKNOWN;
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) { for (int j = 0; j < NEO::maxProductEnumValue; j++) {
if (hardwarePrefix[j] == nullptr) { if (hardwarePrefix[j] == nullptr) {
continue; continue;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021-2023 Intel Corporation * Copyright (C) 2021-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -12,7 +12,7 @@
#include "shared/source/os_interface/product_helper.h" #include "shared/source/os_interface/product_helper.h"
namespace NEO { namespace NEO {
extern ProductHelperCreateFunctionType productHelperFactory[IGFX_MAX_PRODUCT]; extern ProductHelperCreateFunctionType productHelperFactory[NEO::maxProductEnumValue];
template <typename MockProductHelper> template <typename MockProductHelper>
class RAIIProductHelperFactory { class RAIIProductHelperFactory {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021-2024 Intel Corporation * Copyright (C) 2021-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -33,21 +33,21 @@ constexpr bool ignoreInvalidTestExcludes = false;
#define IS_TEST_EXCLUDED(test_suite_name, test_name) \ #define IS_TEST_EXCLUDED(test_suite_name, test_name) \
NEO::TestExcludes::isTestExcluded(#test_suite_name #test_name, ::productFamily, ::renderCoreFamily) NEO::TestExcludes::isTestExcluded(#test_suite_name #test_name, ::productFamily, ::renderCoreFamily)
#define CALL_IF_MATCH(match_core, match_product, expr) \ #define CALL_IF_MATCH(match_core, match_product, expr) \
auto matchCore = match_core; \ auto matchCore = match_core; \
auto matchProduct = match_product; \ auto matchProduct = match_product; \
if ((::renderCoreFamily == matchCore) && \ if ((::renderCoreFamily == matchCore) && \
(IGFX_MAX_PRODUCT == matchProduct || ::productFamily == matchProduct)) { \ (NEO::maxProductEnumValue == matchProduct || ::productFamily == matchProduct)) { \
expr; \ expr; \
} }
#define GENTEST_F(gfx_core, test_fixture, test_name) \ #define GENTEST_F(gfx_core, test_fixture, test_name) \
FAMILYTEST_TEST_(test_fixture, test_name, test_fixture, \ FAMILYTEST_TEST_(test_fixture, test_name, test_fixture, \
::testing::internal::GetTypeId<test_fixture>(), \ ::testing::internal::GetTypeId<test_fixture>(), \
gfx_core, IGFX_MAX_PRODUCT) gfx_core, NEO::maxProductEnumValue)
#define GENTEST_P(gfx_core, test_suite_name, test_name) \ #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) \ #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) \ CHECK_TEST_NAME_LENGTH(test_suite_name, test_name) \

View File

@@ -197,7 +197,7 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsForDepreca
EXPECT_TRUE(ret); EXPECT_TRUE(ret);
EXPECT_NE(nullptr, hwInfo); EXPECT_NE(nullptr, hwInfo);
for (i = 0; i < IGFX_MAX_PRODUCT; i++) { for (i = 0; i < NEO::maxProductEnumValue; i++) {
auto hardwareInfo = hardwareInfoTable[i]; auto hardwareInfo = hardwareInfoTable[i];
if (hardwareInfo == nullptr) { if (hardwareInfo == nullptr) {
continue; 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]); ASSERT_NE(nullptr, hardwarePrefix[i]);
HardwareInfo hwInfoFromTable = *hardwareInfoTable[i]; HardwareInfo hwInfoFromTable = *hardwareInfoTable[i];
@@ -379,7 +379,7 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsAndUnknown
case CommandStreamReceiverType::tbxWithAub: { case CommandStreamReceiverType::tbxWithAub: {
EXPECT_TRUE(ret); EXPECT_TRUE(ret);
EXPECT_NE(nullptr, hwInfo); EXPECT_NE(nullptr, hwInfo);
for (i = 0; i < IGFX_MAX_PRODUCT; i++) { for (i = 0; i < NEO::maxProductEnumValue; i++) {
auto hardwareInfo = hardwareInfoTable[i]; auto hardwareInfo = hardwareInfoTable[i];
if (hardwareInfo == nullptr) { if (hardwareInfo == nullptr) {
continue; continue;
@@ -388,7 +388,7 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsAndUnknown
break; break;
} }
} }
EXPECT_TRUE(i < IGFX_MAX_PRODUCT); EXPECT_TRUE(i < NEO::maxProductEnumValue);
ASSERT_NE(nullptr, hardwarePrefix[i]); ASSERT_NE(nullptr, hardwarePrefix[i]);
HardwareInfo baseHwInfo = *defaultHwInfo; HardwareInfo baseHwInfo = *defaultHwInfo;
baseHwInfo.featureTable = {}; baseHwInfo.featureTable = {};

View File

@@ -6931,7 +6931,7 @@ TEST(ValidateTargetDeviceTests, givenMismatchedProductFamilyWhenValidatingTarget
Zebin::Elf::ZebinTargetFlags targetMetadata; Zebin::Elf::ZebinTargetFlags targetMetadata;
auto mismatchedPlatformFamily = IGFX_UNKNOWN; 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]; const auto hwInfo = NEO::hardwareInfoTable[i];
if (nullptr != hwInfo && hwInfo->platform.eRenderCoreFamily != renderCoreFamily) { if (nullptr != hwInfo && hwInfo->platform.eRenderCoreFamily != renderCoreFamily) {
mismatchedPlatformFamily = hwInfo->platform.eProductFamily; mismatchedPlatformFamily = hwInfo->platform.eProductFamily;