Add type alias for spec const values map

Change-Id: I77c006f3b3953b108091914fec1f7ba040c7590b
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2020-03-20 12:04:47 +01:00
committed by sys_ocldev
parent c2d812be89
commit 38f53cab8a
6 changed files with 10 additions and 10 deletions

View File

@ -109,7 +109,7 @@ cl_int Program::build(
inputArgs.apiOptions = ArrayRef<const char>(options.c_str(), options.length());
inputArgs.internalOptions = ArrayRef<const char>(internalOptions.c_str(), internalOptions.length());
inputArgs.GTPinInput = gtpinGetIgcInit();
inputArgs.specConstants.specializedValues = this->specConstantsValues;
inputArgs.specializedValues = this->specConstantsValues;
DBG_LOG(LogApiCalls,
"Build Options", inputArgs.apiOptions.begin(),
"\nBuild Internal Options", inputArgs.internalOptions.begin());

View File

@ -18,7 +18,6 @@
#include "cif/builtins/memory/buffer/buffer.h"
#include "patch_list.h"
#include <map>
#include <string>
#include <vector>
@ -330,7 +329,7 @@ class Program : public BaseObject<_cl_program> {
bool areSpecializationConstantsInitialized = false;
CIF::RAII::UPtr_t<CIF::Builtins::BufferSimple> specConstantsIds;
CIF::RAII::UPtr_t<CIF::Builtins::BufferSimple> specConstantsSizes;
std::map<uint32_t, uint64_t> specConstantsValues;
specConstValuesMap specConstantsValues;
BlockKernelManager *blockKernelManager = nullptr;
ExecutionEnvironment &executionEnvironment;

View File

@ -59,7 +59,7 @@ struct UpdateSpecConstantsTest : public ::testing::Test {
char val1 = 5;
uint16_t val2 = 50;
int val3 = 500;
std::map<uint32_t, uint64_t> *values;
specConstValuesMap *values;
};
TEST_F(UpdateSpecConstantsTest, givenNewSpecConstValueWhenUpdateSpecializationConstantThenProperValueIsCopiedAndUpdated) {

View File

@ -82,7 +82,7 @@ TranslationOutput::ErrorCode CompilerInterface::build(
auto idsBuffer = CIF::Builtins::CreateConstBuffer(igcMain.get(), nullptr, 0);
auto valuesBuffer = CIF::Builtins::CreateConstBuffer(igcMain.get(), nullptr, 0);
for (const auto &specConst : input.specConstants.specializedValues) {
for (const auto &specConst : input.specializedValues) {
idsBuffer->PushBackRawCopy(specConst.first);
valuesBuffer->PushBackRawCopy(specConst.second);
}

View File

@ -19,10 +19,13 @@
#include "ocl_igc_interface/igc_ocl_device_ctx.h"
#include <map>
#include <unordered_map>
namespace NEO {
class Device;
using specConstValuesMap = std::unordered_map<uint32_t, uint64_t>;
struct TranslationInput {
TranslationInput(IGC::CodeType::CodeType_t srcType, IGC::CodeType::CodeType_t outType, IGC::CodeType::CodeType_t preferredIntermediateType = IGC::CodeType::undefined)
: srcType(srcType), preferredIntermediateType(preferredIntermediateType), outType(outType) {
@ -40,9 +43,7 @@ struct TranslationInput {
IGC::CodeType::CodeType_t outType = IGC::CodeType::invalid;
void *GTPinInput = nullptr;
struct SpecConstants {
std::map<uint32_t, uint64_t> specializedValues;
} specConstants;
specConstValuesMap specializedValues;
};
struct TranslationOutput {

View File

@ -746,8 +746,8 @@ TEST_F(CompilerInterfaceTest, givenUpdatedSpecConstValuesWhenBuildProgramThenPro
auto specConstCtx = CIF::RAII::UPtr(new MockCompilerDeviceCtx<MockIgcOclDeviceCtx, MockTranslationContextSpecConst>());
pCompilerInterface->setDeviceCtx(*pDevice, specConstCtx.get());
std::map<uint32_t, uint64_t> specConst{{10, 100}};
inputArgs.specConstants.specializedValues = specConst;
specConstValuesMap specConst{{10, 100}};
inputArgs.specializedValues = specConst;
TranslationOutput translationOutput;
auto err = pCompilerInterface->build(*pDevice, inputArgs, translationOutput);