mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 14:33:04 +08:00
Refactoring of internal options extraction
Change-Id: Ice53746e696ba6de5bb2c901e713594ee90bf99c Signed-off-by: Pawel Wilma <pawel.wilma@intel.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
13
runtime/program/internal_options.cpp
Normal file
13
runtime/program/internal_options.cpp
Normal 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"};
|
||||
};
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user