mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
Add option to change GRF mode
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
334802c9ba
commit
16d9000429
54
shared/source/compiler_interface/compiler_options.cpp
Normal file
54
shared/source/compiler_interface/compiler_options.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/compiler_interface/compiler_options.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace NEO {
|
||||
namespace CompilerOptions {
|
||||
|
||||
bool contains(const char *options, ConstStringRef optionToFind) {
|
||||
auto it = strstr(options, optionToFind.data());
|
||||
while (it != nullptr) {
|
||||
const auto delimiter = it[optionToFind.size()];
|
||||
if ((' ' == delimiter) || ('\0' == delimiter)) {
|
||||
if ((it == options) || (it[-1] == ' ')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
it = strstr(it + 1, optionToFind.data());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool contains(const std::string &options, ConstStringRef optionToFind) {
|
||||
return contains(options.c_str(), optionToFind);
|
||||
}
|
||||
|
||||
TokenizedString tokenize(ConstStringRef src, char sperator) {
|
||||
TokenizedString ret;
|
||||
const char *it = src.begin();
|
||||
while (it < src.end()) {
|
||||
const char *beg = it;
|
||||
while ((beg < src.end()) && (*beg == sperator)) {
|
||||
++beg;
|
||||
}
|
||||
const char *end = beg;
|
||||
while ((end < src.end()) && (*end != sperator)) {
|
||||
++end;
|
||||
}
|
||||
it = end;
|
||||
if (end != beg) {
|
||||
ret.push_back(ConstStringRef(beg, end - beg));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
} // namespace CompilerOptions
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user