mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
refactor: define ocloc current and former names in shared ocloc file
ensure both names are different Related-To: NEO-12273 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
6d486459fe
commit
0eec0cdf57
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_api.h"
|
||||
#include "shared/offline_compiler/source/ocloc_interface.h"
|
||||
#include "shared/offline_compiler/source/ocloc_supported_devices_helper.h"
|
||||
#include "shared/source/os_interface/os_library.h"
|
||||
|
||||
@@ -23,22 +24,6 @@ std::string SupportedDevicesHelper::getOclocCurrentVersionOutputFilename() const
|
||||
return getOclocCurrentVersion() + getOutputFilenameSuffix(mode);
|
||||
}
|
||||
|
||||
std::string SupportedDevicesHelper::getOclocCurrentLibName() const {
|
||||
#ifdef NEO_OCLOC_CURRENT_LIB_NAME
|
||||
return std::string(NEO_OCLOC_CURRENT_LIB_NAME);
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string SupportedDevicesHelper::getOclocFormerLibName() const {
|
||||
#ifdef NEO_OCLOC_FORMER_LIB_NAME
|
||||
return std::string(NEO_OCLOC_FORMER_LIB_NAME);
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string SupportedDevicesHelper::getOclocCurrentVersion() const {
|
||||
return extractOclocVersion(getOclocCurrentLibName());
|
||||
}
|
||||
@@ -64,8 +49,7 @@ std::string SupportedDevicesHelper::extractOclocVersion(std::string_view oclocLi
|
||||
}
|
||||
|
||||
std::string SupportedDevicesHelper::getDataFromFormerOclocVersion() const {
|
||||
if (getOclocFormerLibName().empty() ||
|
||||
getOclocFormerLibName() == getOclocCurrentLibName()) {
|
||||
if (getOclocFormerLibName().empty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -116,4 +100,4 @@ std::string SupportedDevicesHelper::getDataFromFormerOclocVersion() const {
|
||||
return retData;
|
||||
}
|
||||
|
||||
} // namespace Ocloc
|
||||
} // namespace Ocloc
|
||||
|
||||
@@ -116,6 +116,14 @@ void printOclocOptionsReadFromFile(OclocArgHelper &wrapper, OfflineCompiler *pCo
|
||||
}
|
||||
}
|
||||
|
||||
std::string oclocCurrentLibName = std::string(NEO_OCLOC_CURRENT_LIB_NAME);
|
||||
std::string oclocFormerLibName = std::string(NEO_OCLOC_FORMER_LIB_NAME);
|
||||
|
||||
static_assert(std::string_view(NEO_OCLOC_CURRENT_LIB_NAME) != std::string_view(NEO_OCLOC_FORMER_LIB_NAME), "Ocloc current and former names cannot be same");
|
||||
|
||||
const std::string &getOclocCurrentLibName() { return oclocCurrentLibName; }
|
||||
const std::string &getOclocFormerLibName() { return oclocFormerLibName; }
|
||||
|
||||
namespace Commands {
|
||||
|
||||
int compile(OclocArgHelper *argHelper, const std::vector<std::string> &args) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "shared/source/utilities/const_stringref.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class OclocArgHelper;
|
||||
@@ -16,6 +17,9 @@ namespace Ocloc {
|
||||
void printOclocCmdLine(OclocArgHelper &wrapper, const std::vector<std::string> &args);
|
||||
void printHelp(OclocArgHelper &wrapper);
|
||||
|
||||
const std::string &getOclocCurrentLibName();
|
||||
const std::string &getOclocFormerLibName();
|
||||
|
||||
namespace CommandNames {
|
||||
inline constexpr NEO::ConstStringRef compile = "compile";
|
||||
inline constexpr NEO::ConstStringRef link = "link";
|
||||
|
||||
@@ -67,8 +67,6 @@ class SupportedDevicesHelper {
|
||||
MOCKABLE_VIRTUAL std::string getDataFromFormerOclocVersion() const;
|
||||
|
||||
protected:
|
||||
MOCKABLE_VIRTUAL std::string getOclocCurrentLibName() const;
|
||||
MOCKABLE_VIRTUAL std::string getOclocFormerLibName() const;
|
||||
MOCKABLE_VIRTUAL std::string getOclocCurrentVersion() const;
|
||||
std::string getOclocFormerVersion() const;
|
||||
std::string extractOclocVersion(std::string_view oclocLibNameWithVersion) const;
|
||||
@@ -101,4 +99,4 @@ inline std::string toStr(SupportedDevicesMode mode) {
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
} // namespace Ocloc
|
||||
} // namespace Ocloc
|
||||
|
||||
@@ -21,14 +21,6 @@ std::string SupportedDevicesHelper::getOclocCurrentVersionOutputFilename() const
|
||||
return getOclocCurrentVersion() + getOutputFilenameSuffix(SupportedDevicesMode::unknown);
|
||||
}
|
||||
|
||||
std::string SupportedDevicesHelper::getOclocCurrentLibName() const {
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string SupportedDevicesHelper::getOclocFormerLibName() const {
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string SupportedDevicesHelper::getOclocCurrentVersion() const {
|
||||
return "ocloc";
|
||||
}
|
||||
@@ -44,4 +36,4 @@ std::string SupportedDevicesHelper::extractOclocVersion(std::string_view oclocLi
|
||||
std::string SupportedDevicesHelper::getDataFromFormerOclocVersion() const {
|
||||
return "";
|
||||
}
|
||||
} // namespace Ocloc
|
||||
} // namespace Ocloc
|
||||
|
||||
Reference in New Issue
Block a user