mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
ocloc - argHelper support for MultiCommand and FatBinary
Change-Id: If4a4e6292609ce544a6534ebd4937ffe1cc09e67
This commit is contained in:
@ -18,9 +18,9 @@ set(IGDRCL_SRCS_offline_compiler_mock
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/decoder/mock/mock_decoder.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/decoder/mock/mock_encoder.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/decoder/mock/mock_iga_wrapper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock/mock_argument_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock/mock_offline_compiler.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock/mock_sip_ocloc_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock/mock_argument_helper.h
|
||||
)
|
||||
|
||||
set(CLOC_LIB_SRCS_UTILITIES
|
||||
|
@ -17,7 +17,8 @@ struct MockDecoder : public BinaryDecoder {
|
||||
: BinaryDecoder(file, patch, dump) {
|
||||
this->iga.reset(new MockIgaWrapper);
|
||||
setMessagePrinter(MessagePrinter{true});
|
||||
argHelper = std::make_unique<OclocArgHelper>();
|
||||
uniqueHelper = std::make_unique<OclocArgHelper>();
|
||||
argHelper = uniqueHelper.get();
|
||||
};
|
||||
using BinaryDecoder::binaryFile;
|
||||
using BinaryDecoder::decode;
|
||||
@ -34,6 +35,8 @@ struct MockDecoder : public BinaryDecoder {
|
||||
using BinaryDecoder::readPatchTokens;
|
||||
using BinaryDecoder::readStructFields;
|
||||
|
||||
std::unique_ptr<OclocArgHelper> uniqueHelper;
|
||||
|
||||
MockIgaWrapper *getMockIga() const {
|
||||
return static_cast<MockIgaWrapper *>(iga.get());
|
||||
}
|
||||
|
@ -22,7 +22,8 @@ struct MockEncoder : public BinaryEncoder {
|
||||
: BinaryEncoder(dump, elf) {
|
||||
this->iga.reset(new MockIgaWrapper);
|
||||
setMessagePrinter(MessagePrinter{true});
|
||||
this->argHelper.reset(new MockOclocArgHelper(filesMap));
|
||||
uniqueHelper = std::make_unique<MockOclocArgHelper>(filesMap);
|
||||
argHelper = uniqueHelper.get();
|
||||
};
|
||||
|
||||
std::map<std::string, std::string> filesMap;
|
||||
@ -51,6 +52,8 @@ struct MockEncoder : public BinaryEncoder {
|
||||
using BinaryEncoder::write;
|
||||
using BinaryEncoder::writeDeviceBinary;
|
||||
|
||||
std::unique_ptr<OclocArgHelper> uniqueHelper;
|
||||
|
||||
MockIgaWrapper *getMockIga() const {
|
||||
return static_cast<MockIgaWrapper *>(iga.get());
|
||||
}
|
||||
|
@ -31,8 +31,8 @@ class MockOfflineCompiler : public OfflineCompiler {
|
||||
using OfflineCompiler::useOptionsSuffix;
|
||||
|
||||
MockOfflineCompiler() : OfflineCompiler() {
|
||||
argHelper.reset(new OclocArgHelper(
|
||||
0, nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr));
|
||||
uniqueHelper = std::make_unique<OclocArgHelper>();
|
||||
argHelper = uniqueHelper.get();
|
||||
}
|
||||
|
||||
int initialize(size_t numArgs, const std::vector<std::string> &argv) {
|
||||
@ -90,5 +90,7 @@ class MockOfflineCompiler : public OfflineCompiler {
|
||||
size_t getGenBinarySize() {
|
||||
return genBinarySize;
|
||||
}
|
||||
|
||||
std::unique_ptr<OclocArgHelper> uniqueHelper;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
@ -62,7 +62,7 @@ TEST_F(MultiCommandTests, MultiCommandSuccessfulBuildTest) {
|
||||
int numOfBuild = 4;
|
||||
createFileWithArgs(singleArgs, numOfBuild);
|
||||
|
||||
auto pMultiCommand = std::unique_ptr<MultiCommand>(MultiCommand::create(argv, retVal));
|
||||
auto pMultiCommand = std::unique_ptr<MultiCommand>(MultiCommand::create(argv, retVal, uniqueHelper.get()));
|
||||
|
||||
EXPECT_NE(nullptr, pMultiCommand);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
@ -87,7 +87,7 @@ TEST_F(MultiCommandTests, MultiCommandSuccessfulBuildWithOutputFileTest) {
|
||||
int numOfBuild = 4;
|
||||
createFileWithArgs(singleArgs, numOfBuild);
|
||||
|
||||
auto pMultiCommand = std::unique_ptr<MultiCommand>(MultiCommand::create(argv, retVal));
|
||||
auto pMultiCommand = std::unique_ptr<MultiCommand>(MultiCommand::create(argv, retVal, uniqueHelper.get()));
|
||||
|
||||
EXPECT_NE(nullptr, pMultiCommand);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
@ -99,11 +99,6 @@ TEST_F(MultiCommandTests, MultiCommandSuccessfulBuildWithOutputFileTest) {
|
||||
EXPECT_TRUE(compilerOutputExists(outFileName, "bin"));
|
||||
}
|
||||
|
||||
for (OfflineCompiler *pSingle : pMultiCommand->singleBuilds) {
|
||||
std::string buildLog = pSingle->getBuildLog();
|
||||
EXPECT_STREQ(buildLog.c_str(), "");
|
||||
}
|
||||
|
||||
deleteFileWithArgs();
|
||||
}
|
||||
TEST_F(MultiCommandTests, GoodMultiBuildTestWithspecifiedOutputDir) {
|
||||
@ -126,7 +121,7 @@ TEST_F(MultiCommandTests, GoodMultiBuildTestWithspecifiedOutputDir) {
|
||||
int numOfBuild = 4;
|
||||
createFileWithArgs(singleArgs, numOfBuild);
|
||||
|
||||
pMultiCommand = MultiCommand::create(argv, retVal);
|
||||
pMultiCommand = MultiCommand::create(argv, retVal, uniqueHelper.get());
|
||||
|
||||
EXPECT_NE(nullptr, pMultiCommand);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
@ -151,12 +146,12 @@ TEST_F(MultiCommandTests, LackOfTxtFileWithArgsMultiTest) {
|
||||
};
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
auto pMultiCommand = std::unique_ptr<MultiCommand>(MultiCommand::create(argv, retVal));
|
||||
auto pMultiCommand = std::unique_ptr<MultiCommand>(MultiCommand::create(argv, retVal, uniqueHelper.get()));
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_STRNE(output.c_str(), "");
|
||||
EXPECT_EQ(nullptr, pMultiCommand);
|
||||
EXPECT_EQ(INVALID_COMMAND_LINE, retVal);
|
||||
EXPECT_EQ(INVALID_FILE, retVal);
|
||||
DebugManager.flags.PrintDebugMessages.set(false);
|
||||
}
|
||||
TEST_F(MultiCommandTests, LackOfClFilePointedInTxtFileMultiTest) {
|
||||
@ -177,7 +172,7 @@ TEST_F(MultiCommandTests, LackOfClFilePointedInTxtFileMultiTest) {
|
||||
int numOfBuild = 4;
|
||||
createFileWithArgs(singleArgs, numOfBuild);
|
||||
testing::internal::CaptureStdout();
|
||||
auto pMultiCommand = std::unique_ptr<MultiCommand>(MultiCommand::create(argv, retVal));
|
||||
auto pMultiCommand = std::unique_ptr<MultiCommand>(MultiCommand::create(argv, retVal, uniqueHelper.get()));
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_STRNE(output.c_str(), "");
|
||||
@ -207,7 +202,7 @@ TEST_F(MultiCommandTests, GoodMultiBuildTestWithOutputFileListFlag) {
|
||||
int numOfBuild = 4;
|
||||
createFileWithArgs(singleArgs, numOfBuild);
|
||||
|
||||
pMultiCommand = MultiCommand::create(argv, retVal);
|
||||
pMultiCommand = MultiCommand::create(argv, retVal, uniqueHelper.get());
|
||||
|
||||
EXPECT_NE(nullptr, pMultiCommand);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
@ -233,7 +228,7 @@ TEST_F(OfflineCompilerTests, GoodArgTest) {
|
||||
"-device",
|
||||
gEnvironment->devicePrefix.c_str()};
|
||||
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, uniqueHelper.get());
|
||||
|
||||
EXPECT_NE(nullptr, pOfflineCompiler);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
@ -262,7 +257,7 @@ TEST_F(OfflineCompilerTests, GoodBuildTest) {
|
||||
"-device",
|
||||
gEnvironment->devicePrefix.c_str()};
|
||||
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, uniqueHelper.get());
|
||||
|
||||
EXPECT_NE(nullptr, pOfflineCompiler);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
@ -290,7 +285,7 @@ TEST_F(OfflineCompilerTests, GoodBuildTestWithLlvmText) {
|
||||
gEnvironment->devicePrefix.c_str(),
|
||||
"-llvm_text"};
|
||||
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, uniqueHelper.get());
|
||||
|
||||
EXPECT_NE(nullptr, pOfflineCompiler);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
@ -328,7 +323,7 @@ TEST_F(OfflineCompilerTests, GoodParseBinToCharArray) {
|
||||
"-device",
|
||||
gEnvironment->devicePrefix.c_str()};
|
||||
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, uniqueHelper.get());
|
||||
// clang-format off
|
||||
uint8_t binary[] = {
|
||||
0x02, 0x23, 0x3, 0x40, 0x56, 0x7, 0x80, 0x90, 0x1, 0x03,
|
||||
@ -372,7 +367,7 @@ TEST_F(OfflineCompilerTests, GoodBuildTestWithCppFile) {
|
||||
gEnvironment->devicePrefix.c_str(),
|
||||
"-cpp_file"};
|
||||
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, uniqueHelper.get());
|
||||
|
||||
EXPECT_NE(nullptr, pOfflineCompiler);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
@ -396,7 +391,7 @@ TEST_F(OfflineCompilerTests, GoodBuildTestWithOutputDir) {
|
||||
"-out_dir",
|
||||
"offline_compiler_test"};
|
||||
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, uniqueHelper.get());
|
||||
|
||||
EXPECT_NE(nullptr, pOfflineCompiler);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
@ -415,7 +410,7 @@ TEST_F(OfflineCompilerTests, PrintUsage) {
|
||||
"--help"};
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, uniqueHelper.get());
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
EXPECT_STRNE("", output.c_str());
|
||||
@ -433,7 +428,7 @@ TEST_F(OfflineCompilerTests, NaughtyArgTest_File) {
|
||||
gEnvironment->devicePrefix.c_str()};
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, uniqueHelper.get());
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_STRNE(output.c_str(), "");
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
@ -451,7 +446,7 @@ TEST_F(OfflineCompilerTests, NaughtyArgTest_Flag) {
|
||||
gEnvironment->devicePrefix.c_str()};
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, uniqueHelper.get());
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_STRNE(output.c_str(), "");
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
@ -467,7 +462,7 @@ TEST_F(OfflineCompilerTests, NaughtyArgTest_NumArgs) {
|
||||
};
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
pOfflineCompiler = OfflineCompiler::create(argvA.size(), argvA, true, retVal);
|
||||
pOfflineCompiler = OfflineCompiler::create(argvA.size(), argvA, true, retVal, uniqueHelper.get());
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_STRNE(output.c_str(), "");
|
||||
|
||||
@ -482,7 +477,7 @@ TEST_F(OfflineCompilerTests, NaughtyArgTest_NumArgs) {
|
||||
"test_files/ImANaughtyFile.cl",
|
||||
"-device"};
|
||||
testing::internal::CaptureStdout();
|
||||
pOfflineCompiler = OfflineCompiler::create(argvB.size(), argvB, true, retVal);
|
||||
pOfflineCompiler = OfflineCompiler::create(argvB.size(), argvB, true, retVal, uniqueHelper.get());
|
||||
output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_STRNE(output.c_str(), "");
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
@ -500,7 +495,7 @@ TEST_F(OfflineCompilerTests, GivenNonexistantDeviceWhenCompilingThenExitWithErro
|
||||
"foobar"};
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, uniqueHelper.get());
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ(output.c_str(), "Error: Cannot get HW Info for device foobar.\n");
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
@ -515,7 +510,7 @@ TEST_F(OfflineCompilerTests, NaughtyKernelTest) {
|
||||
"-device",
|
||||
gEnvironment->devicePrefix.c_str()};
|
||||
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, uniqueHelper.get());
|
||||
|
||||
EXPECT_NE(nullptr, pOfflineCompiler);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
@ -1052,7 +1047,7 @@ TEST(OfflineCompilerTest, givenNonExistingFilenameWhenUsedToReadOptionsThenReadO
|
||||
ASSERT_FALSE(fileExists(file.c_str()));
|
||||
|
||||
auto helper = std::make_unique<OclocArgHelper>();
|
||||
bool result = OfflineCompiler::readOptionsFromFile(options, file, helper);
|
||||
bool result = OfflineCompiler::readOptionsFromFile(options, file, helper.get());
|
||||
|
||||
EXPECT_FALSE(result);
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <CL/cl.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@ -20,17 +21,20 @@ class OfflineCompilerTests : public ::testing::Test {
|
||||
public:
|
||||
OfflineCompilerTests() : pOfflineCompiler(nullptr),
|
||||
retVal(CL_SUCCESS) {
|
||||
uniqueHelper = std::make_unique<OclocArgHelper>();
|
||||
// ctor
|
||||
}
|
||||
|
||||
OfflineCompiler *pOfflineCompiler;
|
||||
int retVal;
|
||||
std::unique_ptr<OclocArgHelper> uniqueHelper;
|
||||
};
|
||||
|
||||
class MultiCommandTests : public ::testing::Test {
|
||||
public:
|
||||
MultiCommandTests() : pMultiCommand(nullptr),
|
||||
retVal(CL_SUCCESS) {
|
||||
uniqueHelper = std::make_unique<OclocArgHelper>();
|
||||
}
|
||||
void createFileWithArgs(const std::vector<std::string> &, int numOfBuild);
|
||||
void deleteFileWithArgs();
|
||||
@ -39,6 +43,7 @@ class MultiCommandTests : public ::testing::Test {
|
||||
std::string nameOfFileWithArgs;
|
||||
std::string outFileList;
|
||||
int retVal;
|
||||
std::unique_ptr<OclocArgHelper> uniqueHelper;
|
||||
};
|
||||
|
||||
void MultiCommandTests::createFileWithArgs(const std::vector<std::string> &singleArgs, int numOfBuild) {
|
||||
|
@ -32,15 +32,9 @@ using PTMap = std::unordered_map<uint8_t, std::unique_ptr<PatchToken>>;
|
||||
|
||||
class BinaryDecoder {
|
||||
public:
|
||||
BinaryDecoder() : iga(new IgaWrapper) {
|
||||
iga->setMessagePrinter(messagePrinter);
|
||||
if (nullptr == argHelper) {
|
||||
argHelper = std::make_unique<OclocArgHelper>();
|
||||
}
|
||||
}
|
||||
BinaryDecoder(const std::string &file, const std::string &patch, const std::string &dump)
|
||||
: binaryFile(file), pathToPatch(patch), pathToDump(dump){};
|
||||
BinaryDecoder(std::unique_ptr<OclocArgHelper> helper) : argHelper(std::move(helper)), iga(new IgaWrapper) {
|
||||
BinaryDecoder(OclocArgHelper *helper) : argHelper(helper), iga(new IgaWrapper) {
|
||||
iga->setMessagePrinter(messagePrinter);
|
||||
};
|
||||
int decode();
|
||||
@ -48,7 +42,7 @@ class BinaryDecoder {
|
||||
void setMessagePrinter(const MessagePrinter &messagePrinter);
|
||||
|
||||
protected:
|
||||
std::unique_ptr<OclocArgHelper> argHelper = nullptr;
|
||||
OclocArgHelper *argHelper = nullptr;
|
||||
bool ignoreIsaPadding = false;
|
||||
BinaryHeader programHeader, kernelHeader;
|
||||
std::vector<char> binary;
|
||||
|
@ -17,13 +17,9 @@
|
||||
|
||||
class BinaryEncoder {
|
||||
public:
|
||||
BinaryEncoder() : iga(new IgaWrapper) {
|
||||
iga->setMessagePrinter(messagePrinter);
|
||||
argHelper = std::make_unique<OclocArgHelper>();
|
||||
}
|
||||
BinaryEncoder(const std::string &dump, const std::string &elf)
|
||||
: pathToDump(dump), elfName(elf){};
|
||||
BinaryEncoder(std::unique_ptr<OclocArgHelper> helper) : argHelper(std::move(helper)), iga(new IgaWrapper) {
|
||||
BinaryEncoder(OclocArgHelper *helper) : argHelper(helper), iga(new IgaWrapper) {
|
||||
iga->setMessagePrinter(messagePrinter);
|
||||
}
|
||||
int encode();
|
||||
@ -32,7 +28,7 @@ class BinaryEncoder {
|
||||
void setMessagePrinter(const MessagePrinter &messagePrinter);
|
||||
|
||||
protected:
|
||||
std::unique_ptr<OclocArgHelper> argHelper = nullptr;
|
||||
OclocArgHelper *argHelper = nullptr;
|
||||
bool ignoreIsaPadding = false;
|
||||
std::string pathToDump, elfName;
|
||||
MessagePrinter messagePrinter;
|
||||
|
@ -7,15 +7,18 @@
|
||||
|
||||
#include "shared/offline_compiler/source/multi_command.h"
|
||||
|
||||
namespace NEO {
|
||||
int MultiCommand::singleBuild(size_t numArgs, const std::vector<std::string> &allArgs) {
|
||||
int retVal = ErrorCode::SUCCESS;
|
||||
std::string buildLog;
|
||||
OfflineCompiler *pCompiler = OfflineCompiler::create(numArgs, allArgs, true, retVal);
|
||||
if (retVal == ErrorCode::SUCCESS) {
|
||||
retVal = buildWithSafetyGuard(pCompiler);
|
||||
#include "shared/source/utilities/const_stringref.h"
|
||||
|
||||
buildLog = pCompiler->getBuildLog();
|
||||
#include <memory>
|
||||
|
||||
namespace NEO {
|
||||
int MultiCommand::singleBuild(const std::vector<std::string> &allArgs) {
|
||||
int retVal = SUCCESS;
|
||||
std::unique_ptr<OfflineCompiler> pCompiler{OfflineCompiler::create(allArgs.size(), allArgs, true, retVal, argHelper)};
|
||||
if (retVal == SUCCESS) {
|
||||
retVal = buildWithSafetyGuard(pCompiler.get());
|
||||
|
||||
std::string &buildLog = pCompiler->getBuildLog();
|
||||
if (buildLog.empty() == false) {
|
||||
printf("%s\n", buildLog.c_str());
|
||||
}
|
||||
@ -27,45 +30,24 @@ int MultiCommand::singleBuild(size_t numArgs, const std::vector<std::string> &al
|
||||
printf("Build failed with error code: %d\n", retVal);
|
||||
}
|
||||
}
|
||||
if (buildLog.empty() == false) {
|
||||
singleBuilds.push_back(pCompiler);
|
||||
} else {
|
||||
delete pCompiler;
|
||||
}
|
||||
|
||||
if (outputFileList != "") {
|
||||
std::ofstream myfile(outputFileList, std::fstream::app);
|
||||
if (myfile.is_open()) {
|
||||
if (retVal == ErrorCode::SUCCESS)
|
||||
myfile << getCurrentDirectoryOwn(outDirForBuilds) + OutFileName + ".bin";
|
||||
else
|
||||
myfile << "Unsuccesful build";
|
||||
myfile << std::endl;
|
||||
myfile.close();
|
||||
} else
|
||||
printf("Unable to open outputFileList\n");
|
||||
if (retVal == SUCCESS) {
|
||||
outputFile << getCurrentDirectoryOwn(outDirForBuilds) + outFileName + ".bin";
|
||||
} else {
|
||||
outputFile << "Unsuccesful build";
|
||||
}
|
||||
outputFile << '\n';
|
||||
|
||||
return retVal;
|
||||
}
|
||||
MultiCommand::MultiCommand() = default;
|
||||
|
||||
MultiCommand::~MultiCommand() {
|
||||
deleteBuildsWithWarnigs();
|
||||
}
|
||||
|
||||
void MultiCommand::deleteBuildsWithWarnigs() {
|
||||
for (OfflineCompiler *pSingle : singleBuilds)
|
||||
delete pSingle;
|
||||
singleBuilds.clear();
|
||||
}
|
||||
|
||||
MultiCommand *MultiCommand::create(const std::vector<std::string> &argv, int &retVal) {
|
||||
MultiCommand *MultiCommand::create(const std::vector<std::string> &args, int &retVal, OclocArgHelper *helper) {
|
||||
retVal = ErrorCode::SUCCESS;
|
||||
auto pMultiCommand = new MultiCommand();
|
||||
|
||||
if (pMultiCommand) {
|
||||
retVal = pMultiCommand->initialize(argv);
|
||||
pMultiCommand->argHelper = helper;
|
||||
retVal = pMultiCommand->initialize(args);
|
||||
}
|
||||
|
||||
if (retVal != ErrorCode::SUCCESS) {
|
||||
@ -76,103 +58,90 @@ MultiCommand *MultiCommand::create(const std::vector<std::string> &argv, int &re
|
||||
return pMultiCommand;
|
||||
}
|
||||
|
||||
std::string MultiCommand::eraseExtensionFromPath(std::string &filePath) {
|
||||
size_t extPos = filePath.find_last_of(".", filePath.size());
|
||||
if (extPos == std::string::npos) {
|
||||
extPos = filePath.size();
|
||||
}
|
||||
std::string fileName;
|
||||
std::string fileTrunk = filePath.substr(0, extPos);
|
||||
|
||||
return fileTrunk;
|
||||
}
|
||||
|
||||
void MultiCommand::addAdditionalOptionsToSingleCommandLine(std::vector<std::string> &singleLineWithArguments, int buildId) {
|
||||
void MultiCommand::addAdditionalOptionsToSingleCommandLine(std::vector<std::string> &singleLineWithArguments, size_t buildId) {
|
||||
bool hasOutDir = false;
|
||||
bool hasSpecificName = false;
|
||||
for (auto arg : singleLineWithArguments) {
|
||||
if (arg == "-out_dir") {
|
||||
bool hasOutName = false;
|
||||
for (const auto &arg : singleLineWithArguments) {
|
||||
if (ConstStringRef("-out_dir") == arg) {
|
||||
hasOutDir = true;
|
||||
}
|
||||
if (arg == "-output") {
|
||||
hasSpecificName = true;
|
||||
} else if (ConstStringRef("-output") == arg) {
|
||||
hasOutName = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasOutDir) {
|
||||
singleLineWithArguments.push_back("-out_dir");
|
||||
outDirForBuilds = eraseExtensionFromPath(pathToCMD);
|
||||
outDirForBuilds = OfflineCompiler::getFileNameTrunk(pathToCommandFile);
|
||||
singleLineWithArguments.push_back(outDirForBuilds);
|
||||
}
|
||||
if (!hasSpecificName) {
|
||||
if (!hasOutName) {
|
||||
singleLineWithArguments.push_back("-output");
|
||||
OutFileName = "build_no_" + std::to_string(buildId + 1);
|
||||
singleLineWithArguments.push_back(OutFileName);
|
||||
outFileName = "build_no_" + std::to_string(buildId + 1);
|
||||
singleLineWithArguments.push_back(outFileName);
|
||||
}
|
||||
if (quiet)
|
||||
singleLineWithArguments.push_back("-q");
|
||||
}
|
||||
|
||||
int MultiCommand::initialize(const std::vector<std::string> &allArgs) {
|
||||
int retVal = ErrorCode::SUCCESS;
|
||||
size_t numArgs = allArgs.size();
|
||||
int MultiCommand::initialize(const std::vector<std::string> &args) {
|
||||
if (args[args.size() - 1] == "--help") {
|
||||
printHelp();
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (uint32_t argIndex = 1; argIndex < numArgs; argIndex++) {
|
||||
if (allArgs[argIndex] == "-multi") {
|
||||
if (numArgs > argIndex + 1)
|
||||
pathToCMD = allArgs[argIndex + 1];
|
||||
else {
|
||||
printHelp();
|
||||
return INVALID_COMMAND_LINE;
|
||||
}
|
||||
argIndex++;
|
||||
} else if (allArgs[argIndex] == "-q") {
|
||||
for (size_t argIndex = 1; argIndex < args.size(); argIndex++) {
|
||||
const auto &currArg = args[argIndex];
|
||||
const bool hasMoreArgs = (argIndex + 1 < args.size());
|
||||
if (hasMoreArgs && ConstStringRef("-multi") == currArg) {
|
||||
pathToCommandFile = args[++argIndex];
|
||||
} else if (hasMoreArgs && ConstStringRef("-output_file_list") == currArg) {
|
||||
outputFileList = args[++argIndex];
|
||||
} else if (ConstStringRef("-q") == currArg) {
|
||||
quiet = true;
|
||||
} else if (allArgs[argIndex] == "-output_file_list") {
|
||||
if (numArgs > argIndex + 1)
|
||||
outputFileList = allArgs[argIndex + 1];
|
||||
else {
|
||||
printHelp();
|
||||
return INVALID_COMMAND_LINE;
|
||||
}
|
||||
argIndex++;
|
||||
} else if (allArgs[argIndex] == "--help") {
|
||||
printHelp();
|
||||
return PRINT_USAGE;
|
||||
} else {
|
||||
printf("Invalid option (arg %d): %s\n", argIndex, allArgs[argIndex].c_str());
|
||||
printf("Invalid option (arg %zu): %s\n", argIndex, currArg.c_str());
|
||||
printHelp();
|
||||
return INVALID_COMMAND_LINE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//save file with builds arguments to vector of strings, line by line
|
||||
openFileWithBuildsArguments();
|
||||
if (!lines.empty()) {
|
||||
for (unsigned int i = 0; i < lines.size(); i++) {
|
||||
std::vector<std::string> singleLineWithArguments;
|
||||
unsigned int numberOfArg;
|
||||
if (argHelper->fileExists(pathToCommandFile)) {
|
||||
argHelper->readFileToVectorOfStrings(pathToCommandFile, lines);
|
||||
if (lines.empty()) {
|
||||
printf("Command file was empty.\n");
|
||||
return INVALID_FILE;
|
||||
}
|
||||
} else {
|
||||
printf("Could not find/open file with builds argument.s\n");
|
||||
return INVALID_FILE;
|
||||
}
|
||||
|
||||
singleLineWithArguments.push_back(allArgs[0]);
|
||||
retVal = splitLineInSeparateArgs(singleLineWithArguments, lines[i], i);
|
||||
if (retVal != ErrorCode::SUCCESS) {
|
||||
retValues.push_back(retVal);
|
||||
continue;
|
||||
}
|
||||
runBuilds(args[0]);
|
||||
|
||||
addAdditionalOptionsToSingleCommandLine(singleLineWithArguments, i);
|
||||
if (outputFileList != "") {
|
||||
argHelper->saveOutput(outputFileList, outputFile);
|
||||
}
|
||||
return showResults();
|
||||
}
|
||||
|
||||
numberOfArg = static_cast<unsigned int>(singleLineWithArguments.size());
|
||||
void MultiCommand::runBuilds(const std::string &argZero) {
|
||||
for (size_t i = 0; i < lines.size(); ++i) {
|
||||
std::vector<std::string> args = {argZero};
|
||||
|
||||
if (!quiet)
|
||||
printf("\nCommand number %d: ", i + 1);
|
||||
retVal = singleBuild(numberOfArg, singleLineWithArguments);
|
||||
int retVal = splitLineInSeparateArgs(args, lines[i], i);
|
||||
if (retVal != SUCCESS) {
|
||||
retValues.push_back(retVal);
|
||||
continue;
|
||||
}
|
||||
|
||||
return showResults();
|
||||
} else {
|
||||
printHelp();
|
||||
return INVALID_COMMAND_LINE;
|
||||
if (!quiet) {
|
||||
printf("Command numer %zu: \n", i + 1);
|
||||
}
|
||||
|
||||
addAdditionalOptionsToSingleCommandLine(args, i);
|
||||
retVal = singleBuild(args);
|
||||
retValues.push_back(retVal);
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,83 +163,45 @@ Usage: ocloc multi <file_name>
|
||||
)===");
|
||||
}
|
||||
|
||||
int MultiCommand::splitLineInSeparateArgs(std::vector<std::string> &qargs, const std::string &command, int numberOfBuild) {
|
||||
unsigned int len = static_cast<unsigned int>(command.length());
|
||||
|
||||
bool qot = false, sqot = false;
|
||||
int arglen;
|
||||
|
||||
for (unsigned int i = 0; i < len; i++) {
|
||||
int start = i;
|
||||
if (command[i] == '\"') {
|
||||
qot = true;
|
||||
} else if (command[i] == '\'')
|
||||
sqot = true;
|
||||
|
||||
if (qot) {
|
||||
i++;
|
||||
start++;
|
||||
while (i < len && command[i] != '\"')
|
||||
i++;
|
||||
if (i < len)
|
||||
qot = false;
|
||||
arglen = i - start;
|
||||
i++;
|
||||
} else if (sqot) {
|
||||
i++;
|
||||
while (i < len && command[i] != '\'')
|
||||
i++;
|
||||
if (i < len)
|
||||
sqot = false;
|
||||
arglen = i - start;
|
||||
i++;
|
||||
int MultiCommand::splitLineInSeparateArgs(std::vector<std::string> &qargs, const std::string &commandsLine, size_t numberOfBuild) {
|
||||
size_t start, end, argLen;
|
||||
for (size_t i = 0; i < commandsLine.length(); ++i) {
|
||||
const char &currChar = commandsLine[i];
|
||||
if ('\"' == currChar) {
|
||||
start = i + 1;
|
||||
end = commandsLine.find('\"', start);
|
||||
} else if ('\'' == currChar) {
|
||||
start = i + 1;
|
||||
end = commandsLine.find('\'', start);
|
||||
} else if (' ' == currChar) {
|
||||
continue;
|
||||
} else {
|
||||
while (i < len && command[i] != ' ')
|
||||
i++;
|
||||
arglen = i - start;
|
||||
start = i;
|
||||
end = commandsLine.find(" ", start);
|
||||
end = (end == std::string::npos) ? commandsLine.length() : end;
|
||||
}
|
||||
qargs.push_back(command.substr(start, arglen));
|
||||
}
|
||||
if (qot || sqot) {
|
||||
printf("One of the quotes is open in build number %d\n", numberOfBuild + 1);
|
||||
return INVALID_COMMAND_LINE;
|
||||
}
|
||||
return ErrorCode::SUCCESS;
|
||||
}
|
||||
|
||||
void MultiCommand::openFileWithBuildsArguments() {
|
||||
std::fstream multiCmdFile;
|
||||
std::stringstream fileContent;
|
||||
multiCmdFile.open(pathToCMD, std::fstream::in);
|
||||
|
||||
if (multiCmdFile.is_open()) {
|
||||
std::string param;
|
||||
fileContent << multiCmdFile.rdbuf();
|
||||
multiCmdFile.close();
|
||||
while (std::getline(fileContent, param, '\n')) {
|
||||
param.erase(param.find_last_not_of(" \r\t") + 1);
|
||||
param.erase(0, param.find_first_not_of(" \r\t"));
|
||||
if (!param.empty()) {
|
||||
lines.push_back(param);
|
||||
}
|
||||
if (end == std::string::npos) {
|
||||
printf("One of the quotes is open in build number %zu\n", numberOfBuild + 1);
|
||||
return INVALID_FILE;
|
||||
}
|
||||
} else {
|
||||
printf("Can not open file with builds arguments\n");
|
||||
argLen = end - start;
|
||||
i = end;
|
||||
qargs.push_back(commandsLine.substr(start, argLen));
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
int MultiCommand::showResults() {
|
||||
int retValue = ErrorCode::SUCCESS;
|
||||
int retValue = SUCCESS;
|
||||
int indexRetVal = 0;
|
||||
for (int retVal : retValues) {
|
||||
if (retVal != ErrorCode::SUCCESS) {
|
||||
if (retValue == ErrorCode::SUCCESS)
|
||||
retValue = retVal;
|
||||
if (!quiet)
|
||||
retValue |= retVal;
|
||||
if (!quiet) {
|
||||
if (retVal != SUCCESS) {
|
||||
printf("Build %d: failed. Error code: %d\n", indexRetVal, retVal);
|
||||
} else {
|
||||
if (!quiet)
|
||||
} else {
|
||||
printf("Build %d: successful\n", indexRetVal);
|
||||
}
|
||||
}
|
||||
indexRetVal++;
|
||||
}
|
||||
|
@ -14,41 +14,39 @@
|
||||
|
||||
#include <CL/cl.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class MultiCommand {
|
||||
public:
|
||||
static MultiCommand *create(const std::vector<std::string> &argv, int &retVal);
|
||||
void deleteBuildsWithWarnigs();
|
||||
|
||||
std::vector<OfflineCompiler *> singleBuilds;
|
||||
|
||||
MultiCommand &operator=(const MultiCommand &) = delete;
|
||||
MultiCommand(const MultiCommand &) = delete;
|
||||
~MultiCommand();
|
||||
~MultiCommand() = default;
|
||||
|
||||
static MultiCommand *create(const std::vector<std::string> &args, int &retVal, OclocArgHelper *helper);
|
||||
|
||||
std::string outDirForBuilds;
|
||||
std::string outputFileList = "";
|
||||
std::string outputFileList;
|
||||
|
||||
protected:
|
||||
int splitLineInSeparateArgs(std::vector<std::string> &qargs, const std::string &command, int numberOfBuild);
|
||||
void openFileWithBuildsArguments();
|
||||
void addAdditionalOptionsToSingleCommandLine(std::vector<std::string> &, int);
|
||||
void printHelp();
|
||||
int initialize(const std::vector<std::string> &allArgs);
|
||||
MultiCommand() = default;
|
||||
|
||||
int initialize(const std::vector<std::string> &args);
|
||||
int splitLineInSeparateArgs(std::vector<std::string> &qargs, const std::string &command, size_t numberOfBuild);
|
||||
int showResults();
|
||||
int singleBuild(size_t numArgs, const std::vector<std::string> &allArgs);
|
||||
std::string eraseExtensionFromPath(std::string &filePath);
|
||||
std::string OutFileName;
|
||||
int singleBuild(const std::vector<std::string> &args);
|
||||
void addAdditionalOptionsToSingleCommandLine(std::vector<std::string> &, size_t buildId);
|
||||
void printHelp();
|
||||
void runBuilds(const std::string &argZero);
|
||||
|
||||
OclocArgHelper *argHelper = nullptr;
|
||||
std::vector<int> retValues;
|
||||
std::string pathToCMD;
|
||||
std::vector<std::string> lines;
|
||||
std::string outFileName;
|
||||
std::string pathToCommandFile;
|
||||
std::stringstream outputFile;
|
||||
bool quiet = false;
|
||||
|
||||
MultiCommand();
|
||||
};
|
||||
} // namespace NEO
|
||||
|
@ -65,7 +65,7 @@ int oclocInvoke(unsigned int numArgs, const char *argv[],
|
||||
printHelp();
|
||||
return ErrorCode::SUCCESS;
|
||||
} else if (numArgs > 1 && !strcmp(argv[1], "disasm")) {
|
||||
BinaryDecoder disasm(std::move(helper));
|
||||
BinaryDecoder disasm(helper.get());
|
||||
int retVal = disasm.validateInput(allArgs);
|
||||
if (retVal == 0) {
|
||||
return disasm.decode();
|
||||
@ -73,7 +73,7 @@ int oclocInvoke(unsigned int numArgs, const char *argv[],
|
||||
return retVal;
|
||||
}
|
||||
} else if (numArgs > 1 && !strcmp(argv[1], "asm")) {
|
||||
BinaryEncoder assembler(std::move(helper));
|
||||
BinaryEncoder assembler(helper.get());
|
||||
int retVal = assembler.validateInput(allArgs);
|
||||
if (retVal == 0) {
|
||||
return assembler.encode();
|
||||
@ -82,21 +82,16 @@ int oclocInvoke(unsigned int numArgs, const char *argv[],
|
||||
}
|
||||
} else if (numArgs > 1 && (!strcmp(argv[1], "multi") || !strcmp(argv[1], "-multi"))) {
|
||||
int retValue = ErrorCode::SUCCESS;
|
||||
auto pMulti = std::unique_ptr<MultiCommand>(MultiCommand::create(allArgs, retValue));
|
||||
std::unique_ptr<MultiCommand> pMulti{(MultiCommand::create(allArgs, retValue, helper.get()))};
|
||||
return retValue;
|
||||
} else if (requestedFatBinary(numArgs, argv)) {
|
||||
return buildFatbinary(numArgs, argv);
|
||||
return buildFatbinary(numArgs, argv, helper.get());
|
||||
} else {
|
||||
int retVal = ErrorCode::SUCCESS;
|
||||
std::vector<std::string> allArgs;
|
||||
if (numArgs > 1) {
|
||||
allArgs.assign(argv, argv + numArgs);
|
||||
}
|
||||
|
||||
OfflineCompiler *pCompiler = OfflineCompiler::create(numArgs, allArgs, true, retVal, std::move(helper));
|
||||
|
||||
std::unique_ptr<OfflineCompiler> pCompiler{OfflineCompiler::create(numArgs, allArgs, true, retVal, helper.get())};
|
||||
if (retVal == ErrorCode::SUCCESS) {
|
||||
retVal = buildWithSafetyGuard(pCompiler);
|
||||
retVal = buildWithSafetyGuard(pCompiler.get());
|
||||
|
||||
std::string buildLog = pCompiler->getBuildLog();
|
||||
if (buildLog.empty() == false) {
|
||||
@ -110,7 +105,6 @@ int oclocInvoke(unsigned int numArgs, const char *argv[],
|
||||
printf("Build failed with error code: %d\n", retVal);
|
||||
}
|
||||
}
|
||||
delete pCompiler;
|
||||
return retVal;
|
||||
}
|
||||
} catch (const std::exception &e) {
|
||||
|
@ -72,6 +72,4 @@ class OclocArgHelper {
|
||||
inline bool hasHeaders() { return headers.size() > 0; }
|
||||
void saveOutput(const std::string &filename, const void *pData, const size_t &dataSize);
|
||||
void saveOutput(const std::string &filename, std::ostream &stream);
|
||||
|
||||
void addInput(const std::string &filename, std::stringstream &stream);
|
||||
};
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_fatbinary.h"
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
|
||||
#include "shared/offline_compiler/source/offline_compiler.h"
|
||||
#include "shared/offline_compiler/source/utilities/safety_caller.h"
|
||||
#include "shared/source/device_binary_format/ar/ar_encoder.h"
|
||||
@ -202,7 +203,7 @@ std::vector<ConstStringRef> getTargetPlatformsForFatbinary(ConstStringRef device
|
||||
return toProductNames(requestedPlatforms);
|
||||
}
|
||||
|
||||
int buildFatbinary(int argc, const char *argv[]) {
|
||||
int buildFatbinary(int argc, const char *argv[], OclocArgHelper *helper) {
|
||||
std::string pointerSizeInBits = (sizeof(void *) == 4) ? "32" : "64";
|
||||
int deviceArgIndex = -1;
|
||||
std::string inputFileName = "";
|
||||
@ -248,7 +249,7 @@ int buildFatbinary(int argc, const char *argv[]) {
|
||||
for (auto targetPlatform : targetPlatforms) {
|
||||
int retVal = 0;
|
||||
argsCopy[deviceArgIndex] = targetPlatform.str();
|
||||
std::unique_ptr<OfflineCompiler> pCompiler{OfflineCompiler::create(argc, argsCopy, false, retVal)};
|
||||
std::unique_ptr<OfflineCompiler> pCompiler{OfflineCompiler::create(argc, argsCopy, false, retVal, helper)};
|
||||
auto stepping = pCompiler->getHardwareInfo().platform.usRevId;
|
||||
if (retVal == 0) {
|
||||
retVal = buildWithSafetyGuard(pCompiler.get());
|
||||
@ -285,7 +286,7 @@ int buildFatbinary(int argc, const char *argv[]) {
|
||||
if (false == outputDirectory.empty()) {
|
||||
fatbinaryFileName = outputDirectory + "/" + outputFileName;
|
||||
}
|
||||
writeDataToFile(fatbinaryFileName.c_str(), fatbinaryData.data(), fatbinaryData.size());
|
||||
helper->saveOutput(fatbinaryFileName, fatbinaryData.data(), fatbinaryData.size());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -13,11 +13,12 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class OclocArgHelper;
|
||||
namespace NEO {
|
||||
|
||||
bool requestedFatBinary(int argc, const char *argv[]);
|
||||
|
||||
int buildFatbinary(int argc, const char *argv[]);
|
||||
int buildFatbinary(int argc, const char *argv[], OclocArgHelper *helper);
|
||||
|
||||
std::vector<PRODUCT_FAMILY> getAllSupportedTargetPlatforms();
|
||||
std::vector<ConstStringRef> toProductNames(const std::vector<PRODUCT_FAMILY> &productIds);
|
||||
|
@ -73,29 +73,12 @@ OfflineCompiler::~OfflineCompiler() {
|
||||
delete[] genBinary;
|
||||
}
|
||||
|
||||
OfflineCompiler *OfflineCompiler::create(size_t numArgs, const std::vector<std::string> &allArgs, bool dumpFiles, int &retVal) {
|
||||
OfflineCompiler *OfflineCompiler::create(size_t numArgs, const std::vector<std::string> &allArgs, bool dumpFiles, int &retVal, OclocArgHelper *helper) {
|
||||
retVal = SUCCESS;
|
||||
auto pOffCompiler = new OfflineCompiler();
|
||||
|
||||
if (pOffCompiler) {
|
||||
pOffCompiler->argHelper = std::make_unique<OclocArgHelper>();
|
||||
retVal = pOffCompiler->initialize(numArgs, allArgs, dumpFiles);
|
||||
}
|
||||
|
||||
if (retVal != SUCCESS) {
|
||||
delete pOffCompiler;
|
||||
pOffCompiler = nullptr;
|
||||
}
|
||||
|
||||
return pOffCompiler;
|
||||
}
|
||||
|
||||
OfflineCompiler *OfflineCompiler::create(size_t numArgs, const std::vector<std::string> &allArgs, bool dumpFiles, int &retVal, std::unique_ptr<OclocArgHelper> helper) {
|
||||
retVal = SUCCESS;
|
||||
auto pOffCompiler = new OfflineCompiler();
|
||||
|
||||
if (pOffCompiler) {
|
||||
pOffCompiler->argHelper = std::move(helper);
|
||||
pOffCompiler->argHelper = helper;
|
||||
retVal = pOffCompiler->initialize(numArgs, allArgs, dumpFiles);
|
||||
}
|
||||
|
||||
@ -884,7 +867,7 @@ void OfflineCompiler::writeOutAllFiles() {
|
||||
}
|
||||
}
|
||||
|
||||
bool OfflineCompiler::readOptionsFromFile(std::string &options, const std::string &file, std::unique_ptr<OclocArgHelper> &helper) {
|
||||
bool OfflineCompiler::readOptionsFromFile(std::string &options, const std::string &file, OclocArgHelper *helper) {
|
||||
if (!helper->fileExists(file)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -43,8 +43,7 @@ std::string getDevicesTypes();
|
||||
|
||||
class OfflineCompiler {
|
||||
public:
|
||||
static OfflineCompiler *create(size_t numArgs, const std::vector<std::string> &allArgs, bool dumpFiles, int &retVal);
|
||||
static OfflineCompiler *create(size_t numArgs, const std::vector<std::string> &allArgs, bool dumpFiles, int &retVal, std::unique_ptr<OclocArgHelper> helper);
|
||||
static OfflineCompiler *create(size_t numArgs, const std::vector<std::string> &allArgs, bool dumpFiles, int &retVal, OclocArgHelper *helper);
|
||||
int build();
|
||||
std::string &getBuildLog();
|
||||
void printUsage();
|
||||
@ -59,7 +58,7 @@ class OfflineCompiler {
|
||||
|
||||
std::string parseBinAsCharArray(uint8_t *binary, size_t size, std::string &fileName);
|
||||
|
||||
static bool readOptionsFromFile(std::string &optionsOut, const std::string &file, std::unique_ptr<OclocArgHelper> &helper);
|
||||
static bool readOptionsFromFile(std::string &optionsOut, const std::string &file, OclocArgHelper *helper);
|
||||
|
||||
ArrayRef<const uint8_t> getPackedDeviceBinaryOutput() {
|
||||
return this->elfBinary;
|
||||
@ -136,6 +135,6 @@ class OfflineCompiler {
|
||||
CIF::RAII::UPtr_t<IGC::FclOclDeviceCtxTagOCL> fclDeviceCtx = nullptr;
|
||||
IGC::CodeType::CodeType_t preferredIntermediateRepresentation;
|
||||
|
||||
std::unique_ptr<OclocArgHelper> argHelper = nullptr;
|
||||
OclocArgHelper *argHelper = nullptr;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
Reference in New Issue
Block a user