Skip to content

Commit 8db9224

Browse files
refactor: add wrapper for max product enum value
Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent 794798d commit 8db9224

File tree

35 files changed

+69
-68
lines changed

35 files changed

+69
-68
lines changed

level_zero/core/source/cmdlist/cmdlist_imp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ void CommandList::setPatchingPreamble(bool patching, bool saveWait) {
3939
}
4040
}
4141

42-
CommandListAllocatorFn commandListFactory[IGFX_MAX_PRODUCT] = {};
43-
CommandListAllocatorFn commandListFactoryImmediate[IGFX_MAX_PRODUCT] = {};
42+
CommandListAllocatorFn commandListFactory[NEO::maxProductEnumValue] = {};
43+
CommandListAllocatorFn commandListFactoryImmediate[NEO::maxProductEnumValue] = {};
4444

4545
ze_result_t CommandListImp::destroy() {
4646
if (this->isBcsSplitNeeded) {
@@ -104,7 +104,7 @@ CommandList *CommandList::create(uint32_t productFamily, Device *device, NEO::En
104104
ze_command_list_flags_t flags, ze_result_t &returnValue,
105105
bool internalUsage) {
106106
CommandListAllocatorFn allocator = nullptr;
107-
if (productFamily < IGFX_MAX_PRODUCT) {
107+
if (productFamily < NEO::maxProductEnumValue) {
108108
allocator = commandListFactory[productFamily];
109109
}
110110

@@ -170,7 +170,7 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
170170
cmdQdesc.mode = static_cast<ze_command_queue_mode_t>(overrideImmediateCmdListSyncMode);
171171
}
172172
CommandListAllocatorFn allocator = nullptr;
173-
if (productFamily < IGFX_MAX_PRODUCT) {
173+
if (productFamily < NEO::maxProductEnumValue) {
174174
allocator = commandListFactoryImmediate[productFamily];
175175
}
176176

level_zero/core/source/cmdqueue/cmdqueue.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
namespace L0 {
3535

36-
CommandQueueAllocatorFn commandQueueFactory[IGFX_MAX_PRODUCT] = {};
36+
CommandQueueAllocatorFn commandQueueFactory[NEO::maxProductEnumValue] = {};
3737

3838
bool CommandQueue::frontEndTrackingEnabled() const {
3939
return NEO::debugManager.flags.AllowPatchingVfeStateInCommandLists.get() || this->frontEndStateTracking;
@@ -234,7 +234,7 @@ void CommandQueueImp::postSyncOperations(bool hangDetected) {
234234
CommandQueue *CommandQueue::create(uint32_t productFamily, Device *device, NEO::CommandStreamReceiver *csr,
235235
const ze_command_queue_desc_t *desc, bool isCopyOnly, bool isInternal, bool immediateCmdListQueue, ze_result_t &returnValue) {
236236
CommandQueueAllocatorFn allocator = nullptr;
237-
if (productFamily < IGFX_MAX_PRODUCT) {
237+
if (productFamily < NEO::maxProductEnumValue) {
238238
allocator = commandQueueFactory[productFamily];
239239
}
240240

level_zero/core/source/image/image_imp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "neo_igfxfmid.h"
2626

2727
namespace L0 {
28-
ImageAllocatorFn imageFactory[IGFX_MAX_PRODUCT] = {};
28+
ImageAllocatorFn imageFactory[NEO::maxProductEnumValue] = {};
2929

3030
bool isImportedWin32Handle(const ze_image_desc_t *imgDesc) {
3131
const ze_base_desc_t *extendedDesc = reinterpret_cast<const ze_base_desc_t *>(imgDesc->pNext);
@@ -178,7 +178,7 @@ NEO::SurfaceStateInHeapInfo *ImageImp::getBindlessSlot() {
178178
ze_result_t Image::create(uint32_t productFamily, Device *device, const ze_image_desc_t *desc, Image **pImage) {
179179
ze_result_t result = ZE_RESULT_SUCCESS;
180180
ImageAllocatorFn allocator = nullptr;
181-
if (productFamily < IGFX_MAX_PRODUCT) {
181+
if (productFamily < NEO::maxProductEnumValue) {
182182
allocator = imageFactory[productFamily];
183183
}
184184

level_zero/core/source/kernel/kernel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
namespace L0 {
1313

14-
KernelAllocatorFn kernelFactory[IGFX_MAX_PRODUCT] = {};
14+
KernelAllocatorFn kernelFactory[NEO::maxProductEnumValue] = {};
1515

1616
} // namespace L0

level_zero/core/source/kernel/kernel_imp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,7 @@ void KernelImp::patchGlobalOffset() {
14571457

14581458
Kernel *Kernel::create(uint32_t productFamily, Module *module,
14591459
const ze_kernel_desc_t *desc, ze_result_t *res) {
1460-
UNRECOVERABLE_IF(productFamily >= IGFX_MAX_PRODUCT);
1460+
UNRECOVERABLE_IF(productFamily >= NEO::maxProductEnumValue);
14611461
KernelAllocatorFn allocator = kernelFactory[productFamily];
14621462
auto kernel = static_cast<KernelImp *>(allocator(module));
14631463
*res = kernel->initialize(desc);

level_zero/core/source/mutable_cmdlist/mutable_cmdlist_imp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void MutableResidencyAllocations::cleanResidencyContainer() {
8282
immutableResidencySize = 0;
8383
}
8484

85-
MutableCommandListAllocFn mutableCommandListFactory[IGFX_MAX_PRODUCT] = {};
85+
MutableCommandListAllocFn mutableCommandListFactory[NEO::maxProductEnumValue] = {};
8686

8787
MutableCommandList *MutableCommandList::fromHandle(ze_command_list_handle_t handle) {
8888
return static_cast<MutableCommandList *>(L0::CommandList::fromHandle(handle)->asMutable());
@@ -91,7 +91,7 @@ MutableCommandList *MutableCommandList::fromHandle(ze_command_list_handle_t hand
9191
CommandList *MutableCommandList::create(uint32_t productFamily, Device *device, NEO::EngineGroupType engineGroupType,
9292
ze_command_list_flags_t flags, ze_result_t &resultValue, bool useInternalEngineType) {
9393
MutableCommandListAllocFn allocator = nullptr;
94-
if (productFamily < IGFX_MAX_PRODUCT) {
94+
if (productFamily < NEO::maxProductEnumValue) {
9595
allocator = mutableCommandListFactory[productFamily];
9696
}
9797
if (allocator == nullptr) {

level_zero/core/source/sampler/sampler_imp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2021 Intel Corporation
2+
* Copyright (C) 2020-2025 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -11,7 +11,7 @@
1111

1212
namespace L0 {
1313

14-
SamplerAllocatorFn samplerFactory[IGFX_MAX_PRODUCT] = {};
14+
SamplerAllocatorFn samplerFactory[NEO::maxProductEnumValue] = {};
1515

1616
ze_result_t SamplerImp::destroy() {
1717
delete this;
@@ -25,7 +25,7 @@ ze_result_t SamplerImp::initialize(Device *device, const ze_sampler_desc_t *desc
2525

2626
Sampler *Sampler::create(uint32_t productFamily, Device *device, const ze_sampler_desc_t *desc) {
2727
SamplerAllocatorFn allocator = nullptr;
28-
if (productFamily < IGFX_MAX_PRODUCT) {
28+
if (productFamily < NEO::maxProductEnumValue) {
2929
allocator = samplerFactory[productFamily];
3030
}
3131

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ TEST_F(DefaultDescriptorWithoutBlitterTest, givenDeviceWithoutBlitterSupportWhen
125125

126126
TEST_F(CommandListCreateTests, whenCommandListIsCreatedWithInvalidProductFamilyThenFailureIsReturned) {
127127
ze_result_t returnValue;
128-
std::unique_ptr<L0::CommandList> commandList(CommandList::create(PRODUCT_FAMILY::IGFX_MAX_PRODUCT, device, NEO::EngineGroupType::renderCompute, 0u, returnValue, false));
128+
std::unique_ptr<L0::CommandList> commandList(CommandList::create(NEO::maxProductEnumValue, device, NEO::EngineGroupType::renderCompute, 0u, returnValue, false));
129129
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, returnValue);
130130
ASSERT_EQ(nullptr, commandList);
131131
}
@@ -134,7 +134,7 @@ TEST_F(CommandListCreateTests, whenCommandListImmediateIsCreatedWithInvalidProdu
134134
ze_result_t returnValue;
135135
const ze_command_queue_desc_t desc = {};
136136
bool internalEngine = true;
137-
std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(PRODUCT_FAMILY::IGFX_MAX_PRODUCT,
137+
std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(NEO::maxProductEnumValue,
138138
device,
139139
&desc,
140140
internalEngine,

level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ TEST_F(CommandQueueCreate, whenCreatingCommandQueueWithInvalidProductFamilyThenF
291291
ze_result_t returnValue;
292292
auto csr = std::unique_ptr<NEO::CommandStreamReceiver>(neoDevice->createCommandStreamReceiver());
293293
csr->setupContext(*neoDevice->getDefaultEngine().osContext);
294-
L0::CommandQueue *commandQueue = CommandQueue::create(PRODUCT_FAMILY::IGFX_MAX_PRODUCT,
294+
L0::CommandQueue *commandQueue = CommandQueue::create(NEO::maxProductEnumValue,
295295
device,
296296
csr.get(),
297297
&desc,

level_zero/core/test/unit_tests/sources/mutable_cmdlist/tests/mutable_cmdlist_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE,
3030
givenInvalidProductWhenCreatingCommandListThenNoObjectCreated) {
3131
ze_result_t returnValue;
3232

33-
auto mcl = MutableCommandList::create(IGFX_MAX_PRODUCT, device, this->engineGroupType, 0, returnValue, false);
33+
auto mcl = MutableCommandList::create(NEO::maxProductEnumValue, device, this->engineGroupType, 0, returnValue, false);
3434
EXPECT_EQ(nullptr, mcl);
3535
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, returnValue);
3636
}

0 commit comments

Comments
 (0)