Revert "refactor: remove excess cast to C-string and add const reference"

This reverts commit 34ee40393f.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2025-01-15 02:11:43 +01:00
committed by Compute-Runtime-Automation
parent 6a7bee67e9
commit 242a31a024
7 changed files with 13 additions and 13 deletions

View File

@@ -936,7 +936,7 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
}
}
retVal = deviceName.empty() ? OCLOC_SUCCESS : initHardwareInfo(deviceName);
retVal = deviceName.empty() ? OCLOC_SUCCESS : initHardwareInfo(deviceName.c_str());
if (retVal != OCLOC_SUCCESS) {
argHelper->printf("Error: Cannot get HW Info for device %s.\n", deviceName.c_str());
return retVal;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2025 Intel Corporation
* Copyright (C) 2023-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -63,7 +63,7 @@ bool CompilerCache::evictCache(uint64_t &bytesEvicted) {
for (int i = 0; i < filesCount; ++i) {
ElementsStruct fileElement = {};
fileElement.path = joinPath(config.cacheDir, files[i]->d_name);
if (NEO::SysCalls::stat(fileElement.path, &fileElement.statEl) == 0) {
if (NEO::SysCalls::stat(fileElement.path.c_str(), &fileElement.statEl) == 0) {
cacheFiles.push_back(std::move(fileElement));
}
free(files[i]);
@@ -177,7 +177,7 @@ void CompilerCache::lockConfigFileAndReadSize(const std::string &configFilePath,
if (fileName.find(config.cacheFileExtension) != fileName.npos) {
ElementsStruct fileElement = {};
fileElement.path = joinPath(config.cacheDir, files[i]->d_name);
if (NEO::SysCalls::stat(fileElement.path, &fileElement.statEl) == 0) {
if (NEO::SysCalls::stat(fileElement.path.c_str(), &fileElement.statEl) == 0) {
cacheFiles.push_back(std::move(fileElement));
}
}

View File

@@ -42,16 +42,16 @@ void ExecutionEnvironment::configureCcsMode() {
return;
}
const std::string &drmPath = "/sys/class/drm";
const std::string drmPath = "/sys/class/drm";
std::string expectedFilePrefix = drmPath + "/card";
const auto &files = Directory::getFiles(drmPath);
auto files = Directory::getFiles(drmPath.c_str());
for (const auto &file : files) {
if (file.find(expectedFilePrefix.c_str()) == std::string::npos) {
continue;
}
std::string gtPath = file + "/gt";
const auto &gtFiles = Directory::getFiles(gtPath);
auto gtFiles = Directory::getFiles(gtPath.c_str());
expectedFilePrefix = gtPath + "/gt";
for (const auto &gtFile : gtFiles) {
if (gtFile.find(expectedFilePrefix.c_str()) == std::string::npos) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2025 Intel Corporation
* Copyright (C) 2024-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -15,7 +15,7 @@ namespace NEO {
bool pathExists(const std::string &path) {
struct stat statbuf = {};
if (NEO::SysCalls::stat(path, &statbuf) == -1) {
if (NEO::SysCalls::stat(path.c_str(), &statbuf) == -1) {
return false;
}

View File

@@ -113,7 +113,7 @@ void populateKernelDescriptor(KernelDescriptor &dst, const SPatchDataParameterSt
void populateKernelDescriptor(KernelDescriptor &dst, const SPatchKernelAttributesInfo &token) {
constexpr ConstStringRef attributeReqdSubGroupSizeBeg = "intel_reqd_sub_group_size(";
const auto &attributes = std::string(reinterpret_cast<const char *>(&token + 1), token.AttributesSize);
std::string attributes = std::string(reinterpret_cast<const char *>(&token + 1), token.AttributesSize).c_str();
dst.kernelMetadata.kernelLanguageAttributes = attributes;
auto it = attributes.find(attributeReqdSubGroupSizeBeg.begin());
if (it != std::string::npos) {
@@ -460,7 +460,7 @@ void populateArgDescriptor(KernelDescriptor &dst, size_t argNum, const PatchToke
void populateKernelDescriptor(KernelDescriptor &dst, const PatchTokenBinary::KernelFromPatchtokens &src, uint32_t gpuPointerSizeInBytes) {
UNRECOVERABLE_IF(nullptr == src.header);
dst.kernelMetadata.kernelName = std::string(src.name.begin(), src.name.end());
dst.kernelMetadata.kernelName = std::string(src.name.begin(), src.name.end()).c_str();
populateKernelDescriptorIfNotNull(dst, src.tokens.executionEnvironment);
populateKernelDescriptorIfNotNull(dst, src.tokens.samplerStateArray);
populateKernelDescriptorIfNotNull(dst, src.tokens.bindingTableState);

View File

@@ -189,7 +189,7 @@ bool Drm::readSysFsAsString(const std::string &relativeFilePath, std::string &re
return false;
}
const std::string &fileName = devicePath + relativeFilePath;
const std::string fileName = devicePath + relativeFilePath;
int fd = SysCalls::open(fileName.c_str(), O_RDONLY);
if (fd < 0) {
return false;

View File

@@ -302,7 +302,7 @@ bool Wddm::queryAdapterInfo() {
memcpy_s(&gfxPartition, sizeof(gfxPartition), &adapterInfo.GfxPartition, sizeof(GMM_GFX_PARTITIONING));
memcpy_s(&adapterBDF, sizeof(adapterBDF), &adapterInfo.stAdapterBDF, sizeof(ADAPTER_BDF));
deviceRegistryPath = std::string(adapterInfo.DeviceRegistryPath, sizeof(adapterInfo.DeviceRegistryPath));
deviceRegistryPath = std::string(adapterInfo.DeviceRegistryPath, sizeof(adapterInfo.DeviceRegistryPath)).c_str();
systemSharedMemory = adapterInfo.SystemSharedMemory;
dedicatedVideoMemory = adapterInfo.DedicatedVideoMemory;