This commit is contained in:
Herman Semenoff 2025-05-29 00:18:03 +08:00 committed by GitHub
commit 2c276491b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 24 additions and 21 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -237,7 +237,7 @@ void BinaryDecoder::parseTokens() {
break;
} else if (patchList[i].find("PATCH_TOKEN") == std::string::npos) {
continue;
} else if (patchList[i].find("@") == std::string::npos) {
} else if (patchList[i].find('@') == std::string::npos) {
continue;
}
@ -254,7 +254,7 @@ void BinaryDecoder::parseTokens() {
nameEndPos = patchList[i].find(',', nameStartPos);
patchTokenPtr->name = patchList[i].substr(nameStartPos, nameEndPos - nameStartPos);
nameStartPos = patchList[i].find("@");
nameStartPos = patchList[i].find('@');
nameEndPos = patchList[i].find('@', nameStartPos + 1);
if (nameEndPos == std::string::npos) {
continue;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 Intel Corporation
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -189,7 +189,7 @@ int MultiCommand::splitLineInSeparateArgs(std::vector<std::string> &qargs, const
continue;
} else {
start = i;
end = commandsLine.find(" ", start);
end = commandsLine.find(' ', start);
end = (end == std::string::npos) ? commandsLine.length() : end;
}
if (end == std::string::npos) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -306,7 +306,7 @@ int buildFatBinaryForTarget(int retVal, const std::vector<std::string> &argsCopy
}
std::string entryName("");
if (product.find(".") != std::string::npos) {
if (product.find('.') != std::string::npos) {
entryName = product;
} else {
auto productConfig = argHelper->productConfigHelper->getProductConfigFromDeviceName(product);

View File

@ -250,7 +250,7 @@ std::string formatNameVersionString(std::vector<NameVersionPair> extensions, boo
for (const auto &ext : extensions) {
formatedExtensions.push_back({});
auto it = formatedExtensions.rbegin();
bool needsQuoutes = (nullptr != strstr(ext.name, " "));
bool needsQuoutes = (nullptr != strchr(ext.name, ' '));
it->reserve(strnlen_s(ext.name, sizeof(ext.name)) + (needsQuoutes ? 2 : 0) + (needVersions ? 16 : 0));
if (needsQuoutes) {
it->append("\"");
@ -885,7 +885,7 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
if (options.empty()) {
// try to read options from file if not provided by commandline
size_t extStart = inputFile.find_last_of(".");
size_t extStart = inputFile.find_last_of('.');
if (extStart != std::string::npos) {
std::string oclocOptionsFileName = inputFile.substr(0, extStart);
oclocOptionsFileName.append("_ocloc_options.txt");
@ -1274,7 +1274,7 @@ std::string OfflineCompiler::parseBinAsCharArray(uint8_t *binary, size_t size, s
std::string OfflineCompiler::getFileNameTrunk(std::string &filePath) {
size_t slashPos = filePath.find_last_of("\\/", filePath.size()) + 1;
size_t extPos = filePath.find_last_of(".", filePath.size());
size_t extPos = filePath.find_last_of('.', filePath.size());
if (extPos == std::string::npos) {
extPos = filePath.size();
}
@ -1623,7 +1623,7 @@ void OfflineCompiler::writeOutAllFiles() {
if (outputFile.empty()) {
elfOutputFile = generateFilePath(outputDirectory, fileBase, ".bin");
} else {
size_t extPos = fileBase.find_last_of(".", fileBase.size());
size_t extPos = fileBase.find_last_of('.', fileBase.size());
std::string fileExt = ".bin";
if (extPos != std::string::npos) {
auto existingExt = fileBase.substr(extPos, fileBase.size());

View File

@ -367,7 +367,7 @@ void populateKernelMiscInfo(KernelDescriptor &dst, KernelMiscArgInfos &kernelMis
dstTypeTraits.typeQualifiers = KernelArgMetadata::parseTypeQualifiers(dstMetadata.typeQualifiers);
dst.payloadMappings.explicitArgs.at(srcMetadata.index).getTraits() = std::move(dstTypeTraits);
dstMetadata.type = dstMetadata.type.substr(0U, dstMetadata.type.find(";"));
dstMetadata.type = dstMetadata.type.substr(0U, dstMetadata.type.find(';'));
dst.explicitArgsExtendedMetadata.at(srcMetadata.index) = std::move(dstMetadata);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2024 Intel Corporation
* Copyright (C) 2022-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -47,7 +47,7 @@ void ProductConfigHelper::adjustDeviceName(std::string &device) {
device = device.substr(0, findCore);
}
auto findUnderscore = device.find("_");
auto findUnderscore = device.find('_');
if (findUnderscore != std::string::npos) {
device.erase(std::remove(device.begin(), device.end(), '_'), device.end());
}
@ -146,7 +146,7 @@ bool ProductConfigHelper::isSupportedProductConfig(uint32_t config) const {
AOT::PRODUCT_CONFIG ProductConfigHelper::getProductConfigFromDeviceName(const std::string &device) const {
uint32_t config = AOT::UNKNOWN_ISA;
if (device.find(".") != std::string::npos) {
if (device.find('.') != std::string::npos) {
config = getProductConfigFromVersionValue(device);
} else if (std::all_of(device.begin(), device.end(), (::isdigit))) {
config = static_cast<uint32_t>(std::stoul(device));
@ -212,7 +212,7 @@ std::vector<NEO::ConstStringRef> ProductConfigHelper::getAllProductAcronyms() {
PRODUCT_FAMILY ProductConfigHelper::getProductFamilyFromDeviceName(const std::string &device) const {
std::vector<DeviceAotInfo>::const_iterator it;
if (device.find(".") != std::string::npos) {
if (device.find('.') != std::string::npos) {
it = std::find_if(deviceAotInfo.begin(), deviceAotInfo.end(), findProductConfig(getProductConfigFromVersionValue(device)));
} else {
it = std::find_if(deviceAotInfo.begin(), deviceAotInfo.end(), findAcronym(device));
@ -271,13 +271,13 @@ int ProductConfigHelper::parseProductConfigFromString(const std::string &device,
}
uint32_t ProductConfigHelper::getProductConfigFromVersionValue(const std::string &device) {
auto majorPos = device.find(".");
auto majorPos = device.find('.');
auto major = parseProductConfigFromString(device, 0, majorPos);
if (major == ConfigStatus::MismatchedValue || majorPos == std::string::npos) {
return AOT::UNKNOWN_ISA;
}
auto minorPos = device.find(".", ++majorPos);
auto minorPos = device.find('.', ++majorPos);
auto minor = parseProductConfigFromString(device, majorPos, minorPos);
if (minor == ConfigStatus::MismatchedValue || minorPos == std::string::npos) {

View File

@ -1,3 +1,4 @@
/*
* Copyright (C) 2018-2025 Intel Corporation
*
@ -691,16 +692,18 @@ std::vector<std::unique_ptr<HwDeviceId>> Drm::discoverDevices(ExecutionEnvironme
}
do {
const char *renderDeviceSuffix = "-render";
constexpr const char *renderDeviceSuffix = "-render";
size_t renderDevSufSize = std::char_traits<char>::length(renderDeviceSuffix);
size_t pciDevDirLen = std::char_traits<char>::length(Os::pciDevicesDirectory);
for (std::vector<std::string>::iterator file = files.begin(); file != files.end(); ++file) {
std::string_view devicePathView(file->c_str(), file->size());
devicePathView = devicePathView.substr(strlen(Os::pciDevicesDirectory));
devicePathView = devicePathView.substr(pciDevDirLen);
auto rdsPos = devicePathView.rfind(renderDeviceSuffix);
if (rdsPos == std::string::npos) {
continue;
}
if (rdsPos < devicePathView.size() - strlen(renderDeviceSuffix)) {
if (rdsPos < devicePathView.size() - renderDevSufSize) {
continue;
}
// at least 'pci-0000:00:00.0' -> 16