fix: ocloc - remove undesired logs in ocloclib

Signed-off-by: Chodor, Jaroslaw <jaroslaw.chodor@intel.com>
This commit is contained in:
Chodor, Jaroslaw
2023-09-04 18:14:23 +00:00
committed by Compute-Runtime-Automation
parent ff57bec1f0
commit 8a66ac7097
3 changed files with 18 additions and 18 deletions

View File

@@ -28,7 +28,7 @@ int oclocInvoke(unsigned int numArgs, const char *argv[],
try {
if (numArgs <= 1 || NEO::ConstStringRef("-h") == args[1] || NEO::ConstStringRef("--help") == args[1]) {
printHelp(helper.get());
printHelp(*helper);
return NEO::OclocErrorCode::SUCCESS;
}
auto &command = args[1];
@@ -52,8 +52,8 @@ int oclocInvoke(unsigned int numArgs, const char *argv[],
return Commands::compile(helper.get(), args);
}
} catch (const std::exception &e) {
printf("%s\n", e.what());
printOclocCmdLine(args);
helper->printf("%s\n", e.what());
printOclocCmdLine(*helper, args);
return -1;
}
}

View File

@@ -25,25 +25,25 @@
namespace Ocloc {
using namespace NEO;
void printOclocCmdLine(const std::vector<std::string> &args) {
void printOclocCmdLine(OclocArgHelper &wrapper, const std::vector<std::string> &args) {
auto areQuotesRequired = [](const std::string_view &argName) -> bool {
return argName == "-options" || argName == "-internal_options";
};
printf("Command was:");
wrapper.printf("Command was:");
bool useQuotes = false;
for (auto &currArg : args) {
if (useQuotes) {
printf(" \"%s\"", currArg.c_str());
wrapper.printf(" \"%s\"", currArg.c_str());
useQuotes = false;
} else {
printf(" %s", currArg.c_str());
wrapper.printf(" %s", currArg.c_str());
useQuotes = areQuotesRequired(currArg.c_str());
}
}
printf("\n");
wrapper.printf("\n");
}
void printHelp(OclocArgHelper *helper) {
void printHelp(OclocArgHelper &wrapper) {
const char *help = R"===(ocloc is a tool for managing Intel Compute GPU device binary format.
It can be used for generation (as part of 'compile' command) as well as
manipulation (decoding/modifying - as part of 'disasm'/'asm' commands) of such
@@ -99,19 +99,19 @@ Examples:
ocloc concat <fat binary> <fat binary> ... [-out <concatenated fat binary name>]
}
)===";
helper->printf("%s", help);
wrapper.printf("%s", help);
}
void printOclocOptionsReadFromFile(OfflineCompiler *pCompiler) {
void printOclocOptionsReadFromFile(OclocArgHelper &wrapper, OfflineCompiler *pCompiler) {
if (pCompiler) {
std::string options = pCompiler->getOptionsReadFromFile();
if (options != "") {
printf("Compiling options read from file were:\n%s\n", options.c_str());
wrapper.printf("Compiling options read from file were:\n%s\n", options.c_str());
}
std::string internalOptions = pCompiler->getInternalOptionsReadFromFile();
if (internalOptions != "") {
printf("Internal options read from file were:\n%s\n", internalOptions.c_str());
wrapper.printf("Internal options read from file were:\n%s\n", internalOptions.c_str());
}
}
}
@@ -146,8 +146,8 @@ int compile(OclocArgHelper *argHelper, const std::vector<std::string> &args) {
}
if (retVal != OclocErrorCode::SUCCESS) {
printOclocOptionsReadFromFile(pCompiler.get());
printOclocCmdLine(args);
printOclocOptionsReadFromFile(*argHelper, pCompiler.get());
printOclocCmdLine(*argHelper, args);
}
return retVal;
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Intel Corporation
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -13,8 +13,8 @@
class OclocArgHelper;
namespace Ocloc {
void printOclocCmdLine(const std::vector<std::string> &args);
void printHelp(OclocArgHelper *helper);
void printOclocCmdLine(OclocArgHelper &wrapper, const std::vector<std::string> &args);
void printHelp(OclocArgHelper &wrapper);
namespace CommandNames {
inline constexpr NEO::ConstStringRef compile = "compile";