mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 01:35:20 +08:00
Update Program::extractInternalOptions
Change-Id: Ie67a8ef7b6f010a44b252666e9d9ef48fdeac9e0 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
0193b3ea69
commit
5bed747e33
@@ -18,6 +18,8 @@
|
||||
#include "runtime/source_level_debugger/source_level_debugger.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -198,14 +200,27 @@ cl_int Program::build(const cl_device_id device, const char *buildOptions, bool
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Program::extractInternalOptions(std::string &options) {
|
||||
void Program::extractInternalOptions(const std::string &options) {
|
||||
std::istringstream inputStringStream(options);
|
||||
std::vector<std::string> optionsVector{std::istream_iterator<std::string>{inputStringStream},
|
||||
std::istream_iterator<std::string>{}};
|
||||
for (auto &optionString : internalOptionsToExtract) {
|
||||
size_t pos = options.find(optionString);
|
||||
if (pos != std::string::npos) {
|
||||
options.erase(pos, optionString.length());
|
||||
auto element = std::find(optionsVector.begin(), optionsVector.end(), optionString);
|
||||
if (element == optionsVector.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isFlagOption(optionString)) {
|
||||
internalOptions.append(optionString);
|
||||
internalOptions.append(" ");
|
||||
} else if ((element + 1 != optionsVector.end()) &&
|
||||
isOptionValueValid(optionString, *(element + 1))) {
|
||||
internalOptions.append(optionString);
|
||||
internalOptions.append(" ");
|
||||
internalOptions.append(*(element + 1));
|
||||
internalOptions.append(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -10,5 +10,15 @@
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
const std::vector<std::string> Program::internalOptionsToExtract = {"-cl-intel-gtpin-rera", "-cl-intel-greater-than-4GB-buffer-required"};
|
||||
};
|
||||
|
||||
bool Program::isFlagOption(const std::string &option) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Program::isOptionValueValid(const std::string &option, const std::string &value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}; // namespace NEO
|
||||
|
||||
@@ -273,7 +273,9 @@ class Program : public BaseObject<_cl_program> {
|
||||
void updateNonUniformFlag();
|
||||
void updateNonUniformFlag(const Program **inputProgram, size_t numInputPrograms);
|
||||
|
||||
void extractInternalOptions(std::string &options);
|
||||
void extractInternalOptions(const std::string &options);
|
||||
MOCKABLE_VIRTUAL bool isFlagOption(const std::string &option);
|
||||
MOCKABLE_VIRTUAL bool isOptionValueValid(const std::string &option, const std::string &value);
|
||||
MOCKABLE_VIRTUAL void applyAdditionalOptions();
|
||||
|
||||
MOCKABLE_VIRTUAL bool appendKernelDebugOptions();
|
||||
|
||||
Reference in New Issue
Block a user