refactor: extract logic of calling former ocloc to separate function

Related-To: NEO-12273
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2024-08-13 15:26:18 +00:00
committed by Compute-Runtime-Automation
parent 1cca5e24c1
commit a32bb4d9a4
3 changed files with 43 additions and 27 deletions

View File

@@ -8,7 +8,6 @@
#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"
#include <cstring>
#include <memory>
@@ -49,21 +48,8 @@ std::string SupportedDevicesHelper::extractOclocVersion(std::string_view oclocLi
}
std::string SupportedDevicesHelper::getDataFromFormerOclocVersion() const {
if (getOclocFormerLibName().empty()) {
return "";
}
std::unique_ptr<OsLibrary> oclocLib(OsLibrary::load(getOclocFormerLibName()));
if (!oclocLib ||
!oclocLib->isLoaded()) {
return "";
}
std::string retData;
auto oclocInvokeFunc = reinterpret_cast<pOclocInvoke>(oclocLib->getProcAddress("oclocInvoke"));
const char *argv[] = {"ocloc", "query", "SUPPORTED_DEVICES", "-concat"};
unsigned int numArgs = sizeof(argv) / sizeof(argv[0]);
@@ -72,19 +58,23 @@ std::string SupportedDevicesHelper::getDataFromFormerOclocVersion() const {
size_t *ouputLengths = nullptr;
char **outputNames = nullptr;
oclocInvokeFunc(numArgs, argv,
0,
nullptr,
nullptr,
nullptr,
0,
nullptr,
nullptr,
nullptr,
&numOutputs,
&dataOutputs,
&ouputLengths,
&outputNames);
auto retVal = Commands::invokeFormerOcloc(getOclocFormerLibName(),
numArgs, argv,
0,
nullptr,
nullptr,
nullptr,
0,
nullptr,
nullptr,
nullptr,
&numOutputs,
&dataOutputs,
&ouputLengths,
&outputNames);
if (!retVal) {
return "";
}
const std::string expectedSubstr = getOutputFilenameSuffix(SupportedDevicesMode::concat);