Refactoring of internal options extraction

Change-Id: Ice53746e696ba6de5bb2c901e713594ee90bf99c
Signed-off-by: Pawel Wilma <pawel.wilma@intel.com>
This commit is contained in:
Pawel Wilma
2018-10-02 15:08:23 +02:00
committed by sys_ocldev
parent 7d93fedbab
commit 5cd7ca460c
7 changed files with 58 additions and 9 deletions

View File

@@ -14,6 +14,7 @@ set(RUNTIME_SRCS_PROGRAM
${CMAKE_CURRENT_SOURCE_DIR}/create.inl
${CMAKE_CURRENT_SOURCE_DIR}/get_info.cpp
${CMAKE_CURRENT_SOURCE_DIR}/heap_info.h
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/internal_options.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel_arg_info.h
${CMAKE_CURRENT_SOURCE_DIR}/kernel_info.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel_info.h

View File

@@ -56,15 +56,7 @@ cl_int Program::build(
buildStatus = CL_BUILD_IN_PROGRESS;
options = (buildOptions) ? buildOptions : "";
std::string reraStr = "-cl-intel-gtpin-rera";
size_t pos = options.find(reraStr);
if (pos != std::string::npos) {
// build option "-cl-intel-gtpin-rera" is present, move it to internalOptions
size_t reraLen = reraStr.length();
options.erase(pos, reraLen);
internalOptions.append(reraStr);
internalOptions.append(" ");
}
extractInternalOptions(options);
CompilerInterface *pCompilerInterface = this->executionEnvironment.getCompilerInterface();
if (!pCompilerInterface) {
@@ -176,4 +168,15 @@ cl_int Program::build(
return retVal;
}
void Program::extractInternalOptions(std::string &options) {
for (auto &optionString : internalOptionsToExtract) {
size_t pos = options.find(optionString);
if (pos != std::string::npos) {
options.erase(pos, optionString.length());
internalOptions.append(optionString);
internalOptions.append(" ");
}
}
}
} // namespace OCLRT

View File

@@ -0,0 +1,13 @@
/*
* Copyright (C) 2017-2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/program/program.h"
#include <vector>
namespace OCLRT {
const std::vector<std::string> Program::internalOptionsToExtract = {"-cl-intel-gtpin-rera"};
};

View File

@@ -265,6 +265,8 @@ class Program : public BaseObject<_cl_program> {
void updateNonUniformFlag();
void updateNonUniformFlag(const Program **inputProgram, size_t numInputPrograms);
void extractInternalOptions(std::string &options);
static const std::string clOptNameClVer;
static const std::string clOptNameUniformWgs;
// clang-format off
@@ -302,6 +304,7 @@ class Program : public BaseObject<_cl_program> {
std::string sourceCode;
std::string options;
std::string internalOptions;
static const std::vector<std::string> internalOptionsToExtract;
std::string hashFileName;
std::string hashFilePath;