mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 07:14:10 +08:00
refactor: improve constexpr array usage
Gcc with o2 flag will allocate constexpr array on stack. Static constexpr std::array will be initialized at compile time. Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
dfc69c746a
commit
ef8921247c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -558,10 +558,10 @@ TEST_F(KernelArgBufferTest, givenSetUnifiedMemoryExecInfoOnKernelWithIndirectSta
|
||||
|
||||
pKernelInfo->kernelDescriptor.kernelAttributes.hasIndirectStatelessAccess = true;
|
||||
|
||||
constexpr std::array<AllocationTypeHelper, 4> allocationTypes = {{{AllocationType::buffer, false},
|
||||
{AllocationType::buffer, true},
|
||||
{AllocationType::bufferHostMemory, false},
|
||||
{AllocationType::svmGpu, true}}};
|
||||
static constexpr std::array<AllocationTypeHelper, 4> allocationTypes = {{{AllocationType::buffer, false},
|
||||
{AllocationType::buffer, true},
|
||||
{AllocationType::bufferHostMemory, false},
|
||||
{AllocationType::svmGpu, true}}};
|
||||
GmmRequirements gmmRequirements{};
|
||||
gmmRequirements.allowLargePages = true;
|
||||
gmmRequirements.preferCompressed = false;
|
||||
@@ -600,10 +600,10 @@ TEST_F(KernelArgBufferTest, givenSVMAllocsManagerWithCompressedSVMAllocationsWhe
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
debugManager.flags.EnableStatelessCompression.set(1);
|
||||
|
||||
constexpr std::array<AllocationTypeHelper, 4> allocationTypes = {{{AllocationType::buffer, false},
|
||||
{AllocationType::buffer, true},
|
||||
{AllocationType::bufferHostMemory, false},
|
||||
{AllocationType::svmGpu, true}}};
|
||||
static constexpr std::array<AllocationTypeHelper, 4> allocationTypes = {{{AllocationType::buffer, false},
|
||||
{AllocationType::buffer, true},
|
||||
{AllocationType::bufferHostMemory, false},
|
||||
{AllocationType::svmGpu, true}}};
|
||||
GmmRequirements gmmRequirements{};
|
||||
gmmRequirements.allowLargePages = true;
|
||||
gmmRequirements.preferCompressed = false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
* Copyright (C) 2020-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -753,7 +753,7 @@ TEST(OclocApiTests, GivenCommandWithoutArgsWhenOclocIsInvokedThenHelpIsPrinted)
|
||||
}
|
||||
|
||||
TEST(OclocApiTests, GivenHelpArgumentWhenOclocIsInvokedThenHelpIsPrinted) {
|
||||
constexpr std::array flagsToTest = {"-h", "--help"};
|
||||
static constexpr std::array flagsToTest = {"-h", "--help"};
|
||||
for (const auto helpFlag : flagsToTest) {
|
||||
const char *argv[] = {
|
||||
"ocloc",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -115,7 +115,7 @@ TEST_F(OclocIgcFacadeTest, GivenFailingCreationOfIgcDeviceContextWhenPreparingIg
|
||||
}
|
||||
|
||||
TEST_F(OclocIgcFacadeTest, GivenInvalidIgcDeviceContextWhenPreparingIgcThenFailureIsReported) {
|
||||
constexpr std::array invalidReturnFlags = {
|
||||
static constexpr std::array invalidReturnFlags = {
|
||||
&MockOclocIgcFacade::shouldReturnInvalidIgcPlatformHandle,
|
||||
&MockOclocIgcFacade::shouldReturnInvalidGTSystemInfoHandle,
|
||||
&MockOclocIgcFacade::shouldReturnInvalidIgcFeaturesAndWorkaroundsHandle};
|
||||
|
||||
Reference in New Issue
Block a user