Revert "Ocloc: Add -s to options string for non-spirv input with -g option pa...

This reverts commit 963930925a.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2022-09-30 12:32:45 +02:00
committed by Compute-Runtime-Automation
parent 9d18df63a9
commit ab8579a6c2
4 changed files with 0 additions and 131 deletions

View File

@@ -1244,123 +1244,6 @@ TEST_F(OfflineCompilerTests, givenDebugOptionThenInternalOptionShouldContainKern
EXPECT_TRUE(hasSubstr(internalOptions, "-cl-kernel-debug-enable"));
}
TEST_F(OfflineCompilerTests, givenDebugOptionAndNonSpirvInputThenOptionsShouldContainDashSOptionAppendedAutomatically) {
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
mockOfflineCompiler->uniqueHelper->callBaseFileExists = false;
mockOfflineCompiler->uniqueHelper->callBaseLoadDataFromFile = false;
mockOfflineCompiler->uniqueHelper->filesMap["some_input.cl"] = "";
std::vector<std::string> argv = {
"ocloc",
"-q",
"-options",
"-g",
"-file",
"some_input.cl",
"-device",
gEnvironment->devicePrefix.c_str()};
mockOfflineCompiler->initialize(argv.size(), argv);
const auto &options = mockOfflineCompiler->options;
std::string appendedOption{"-s \"some_input.cl\""};
EXPECT_TRUE(hasSubstr(options, appendedOption));
}
TEST_F(OfflineCompilerTests, givenDebugOptionAndNonSpirvInputWhenFilenameIsSeparatedWithSpacesThenAppendedSourcePathIsSetCorrectly) {
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
mockOfflineCompiler->uniqueHelper->callBaseFileExists = false;
mockOfflineCompiler->uniqueHelper->callBaseLoadDataFromFile = false;
mockOfflineCompiler->uniqueHelper->filesMap["filename with spaces.cl"] = "";
std::vector<std::string> argv = {
"ocloc",
"-q",
"-options",
"-g",
"-file",
"filename with spaces.cl",
"-device",
gEnvironment->devicePrefix.c_str()};
const auto result = mockOfflineCompiler->initialize(argv.size(), argv);
EXPECT_EQ(OclocErrorCode::SUCCESS, result);
const auto &options = mockOfflineCompiler->options;
std::string appendedOption{"-s \"filename with spaces.cl\""};
EXPECT_TRUE(hasSubstr(options, appendedOption));
}
TEST_F(OfflineCompilerTests, givenDebugOptionAndSpirvInputThenDoNotAppendDashSOptionAutomatically) {
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
mockOfflineCompiler->uniqueHelper->callBaseFileExists = false;
mockOfflineCompiler->uniqueHelper->callBaseLoadDataFromFile = false;
mockOfflineCompiler->uniqueHelper->filesMap["some_input.spirv"] = "";
std::vector<std::string> argvSpirvInput = {
"ocloc",
"-q",
"-spirv_input",
"-options",
"-g",
"-file",
"some_input.spirv",
"-device",
gEnvironment->devicePrefix.c_str()};
mockOfflineCompiler->initialize(argvSpirvInput.size(), argvSpirvInput);
const auto &options = mockOfflineCompiler->options;
std::string notAppendedOption{"-s \"some_input.spirv\""};
EXPECT_FALSE(hasSubstr(options, notAppendedOption));
}
TEST_F(OfflineCompilerTests, givenDebugOptionWhenCompilerIsCMCThenDoNotAppendDashSOptionAutomatically) {
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
mockOfflineCompiler->uniqueHelper->callBaseFileExists = false;
mockOfflineCompiler->uniqueHelper->callBaseLoadDataFromFile = false;
mockOfflineCompiler->uniqueHelper->filesMap["some_input.cl"] = "";
std::vector<std::string> argvSpirvInput = {
"ocloc",
"-q",
"-options",
"-g cmc",
"-file",
"some_input.cl",
"-device",
gEnvironment->devicePrefix.c_str()};
mockOfflineCompiler->initialize(argvSpirvInput.size(), argvSpirvInput);
const auto &options = mockOfflineCompiler->options;
std::string notAppendedOption{"-s \"some_input.spirv\""};
EXPECT_FALSE(hasSubstr(options, notAppendedOption));
}
TEST_F(OfflineCompilerTests, givenDebugOptionAndDashSOptionPassedManuallyThenDoNotAppendDashSOptionAutomatically) {
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
mockOfflineCompiler->uniqueHelper->callBaseFileExists = false;
mockOfflineCompiler->uniqueHelper->callBaseLoadDataFromFile = false;
mockOfflineCompiler->uniqueHelper->filesMap["some_input.cl"] = "";
std::vector<std::string> argvDashSPassed = {
"ocloc",
"-q",
"-options",
"-g -s \"mockPath/some_input.cl\"",
"-file",
"some_input.cl",
"-device",
gEnvironment->devicePrefix.c_str()};
mockOfflineCompiler->initialize(argvDashSPassed.size(), argvDashSPassed);
const auto &options = mockOfflineCompiler->options;
std::string appendedOption{"-s"};
auto occurrences = 0u;
size_t pos = 0u;
while ((pos = options.find(appendedOption, pos)) != std::string::npos) {
occurrences++;
pos++;
}
EXPECT_EQ(1u, occurrences);
}
TEST_F(OfflineCompilerTests, givenDashGInBiggerOptionStringWhenInitializingThenInternalOptionsShouldNotContainKernelDebugEnable) {
std::vector<std::string> argv = {

View File

@@ -616,12 +616,6 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
if (hwInfo.platform.eRenderCoreFamily >= IGFX_GEN9_CORE) {
internalOptions = CompilerOptions::concatenate(internalOptions, CompilerOptions::debugKernelEnable);
}
if (false == inputFileSpirV && false == CompilerOptions::contains(options, CompilerOptions::generateSourcePath) && false == CompilerOptions::contains(options, CompilerOptions::usesCMCCompiler)) {
auto sourcePathStringOption = CompilerOptions::generateSourcePath.str();
sourcePathStringOption.append(" ");
sourcePathStringOption.append(CompilerOptions::wrapInQuotes(inputFile));
options = CompilerOptions::concatenate(options, sourcePathStringOption);
}
}
if (deviceName.empty()) {

View File

@@ -32,11 +32,6 @@ bool contains(const std::string &options, ConstStringRef optionToFind) {
return contains(options.c_str(), optionToFind);
}
std::string wrapInQuotes(const std::string &stringToWrap) {
std::string quoteEscape{"\""};
return std::string{quoteEscape + stringToWrap + quoteEscape};
}
TokenizedString tokenize(ConstStringRef src, char sperator) {
TokenizedString ret;
const char *it = src.begin();

View File

@@ -29,7 +29,6 @@ constexpr ConstStringRef fastRelaxedMath = "-cl-fast-relaxed-math";
constexpr ConstStringRef preserveVec3Type = "-fpreserve-vec3-type";
constexpr ConstStringRef createLibrary = "-create-library";
constexpr ConstStringRef generateDebugInfo = "-g";
constexpr ConstStringRef generateSourcePath = "-s";
constexpr ConstStringRef bindlessMode = "-cl-intel-use-bindless-mode -cl-intel-use-bindless-advanced-mode";
constexpr ConstStringRef uniformWorkgroupSize = "-cl-uniform-work-group-size";
constexpr ConstStringRef forceEmuInt32DivRem = "-cl-intel-force-emu-int32divrem";
@@ -43,7 +42,6 @@ constexpr ConstStringRef noRecompiledFromIr = "-Wno-recompiled-from-ir";
constexpr ConstStringRef defaultGrf = "-cl-intel-128-GRF-per-thread";
constexpr ConstStringRef largeGrf = "-cl-intel-256-GRF-per-thread";
constexpr ConstStringRef numThreadsPerEu = "-cl-intel-reqd-eu-thread-count";
constexpr ConstStringRef usesCMCCompiler = "cmc";
constexpr size_t nullterminateSize = 1U;
constexpr size_t spaceSeparatorSize = 1U;
@@ -179,7 +177,6 @@ bool contains(const char *options, ConstStringRef optionToFind);
bool contains(const std::string &options, ConstStringRef optionToFind);
std::string wrapInQuotes(const std::string &stringToWrap);
using TokenizedString = StackVec<ConstStringRef, 32>;
TokenizedString tokenize(ConstStringRef src, char sperator = ' ');