From 417746182c18e477fbec854e69574dba6bd6abf0 Mon Sep 17 00:00:00 2001 From: Compute-Runtime-Validation Date: Fri, 9 Sep 2022 05:04:48 +0200 Subject: [PATCH] Revert "Ocloc: Add -s to options string for non-spirv input with -g option pa... This reverts commit 301be3c21b2675e5270e5e6b3d5368842c7216d4. Signed-off-by: Compute-Runtime-Validation --- .../offline_compiler_tests.cpp | 95 ------------------- .../source/offline_compiler.cpp | 6 -- .../compiler_interface/compiler_options.cpp | 5 - .../compiler_interface/compiler_options.h | 3 - 4 files changed, 109 deletions(-) diff --git a/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp b/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp index 1a8d9fddf7..68d46339f4 100644 --- a/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp @@ -1242,101 +1242,6 @@ TEST_F(OfflineCompilerTests, givenDebugOptionThenInternalOptionShouldContainKern EXPECT_TRUE(hasSubstr(internalOptions, "-cl-kernel-debug-enable")); } -TEST_F(OfflineCompilerTests, givenDebugOptionAndNonSpirvInputThenOptionsShouldContainDashSOptionAppendedAutomatically) { - auto mockOfflineCompiler = std::unique_ptr(new MockOfflineCompiler()); - mockOfflineCompiler->uniqueHelper->callBaseFileExists = false; - mockOfflineCompiler->uniqueHelper->callBaseLoadDataFromFile = false; - mockOfflineCompiler->uniqueHelper->filesMap["some_input.cl"] = ""; - - std::vector 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(new MockOfflineCompiler()); - mockOfflineCompiler->uniqueHelper->callBaseFileExists = false; - mockOfflineCompiler->uniqueHelper->callBaseLoadDataFromFile = false; - mockOfflineCompiler->uniqueHelper->filesMap["filename with spaces.cl"] = ""; - - std::vector 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(new MockOfflineCompiler()); - mockOfflineCompiler->uniqueHelper->callBaseFileExists = false; - mockOfflineCompiler->uniqueHelper->callBaseLoadDataFromFile = false; - mockOfflineCompiler->uniqueHelper->filesMap["some_input.spirv"] = ""; - - std::vector 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, givenDebugOptionAndDashSOptionPassedManuallyThenDoNotAppendDashSOptionAutomatically) { - auto mockOfflineCompiler = std::unique_ptr(new MockOfflineCompiler()); - mockOfflineCompiler->uniqueHelper->callBaseFileExists = false; - mockOfflineCompiler->uniqueHelper->callBaseLoadDataFromFile = false; - mockOfflineCompiler->uniqueHelper->filesMap["some_input.cl"] = ""; - std::vector 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 argv = { diff --git a/shared/offline_compiler/source/offline_compiler.cpp b/shared/offline_compiler/source/offline_compiler.cpp index cd6ea6dde7..a5d298a25b 100644 --- a/shared/offline_compiler/source/offline_compiler.cpp +++ b/shared/offline_compiler/source/offline_compiler.cpp @@ -576,12 +576,6 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector & if (hwInfo.platform.eRenderCoreFamily >= IGFX_GEN9_CORE) { internalOptions = CompilerOptions::concatenate(internalOptions, CompilerOptions::debugKernelEnable); } - if (false == inputFileSpirV && false == CompilerOptions::contains(options, CompilerOptions::generateSourcePath)) { - auto sourcePathStringOption = CompilerOptions::generateSourcePath.str(); - sourcePathStringOption.append(" "); - sourcePathStringOption.append(CompilerOptions::wrapInQuotes(inputFile)); - options = CompilerOptions::concatenate(options, sourcePathStringOption); - } } if (deviceName.empty()) { diff --git a/shared/source/compiler_interface/compiler_options.cpp b/shared/source/compiler_interface/compiler_options.cpp index 0c9ba054fe..a183ceab87 100644 --- a/shared/source/compiler_interface/compiler_options.cpp +++ b/shared/source/compiler_interface/compiler_options.cpp @@ -30,11 +30,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(); diff --git a/shared/source/compiler_interface/compiler_options.h b/shared/source/compiler_interface/compiler_options.h index 5821814fb2..c65474d4f1 100644 --- a/shared/source/compiler_interface/compiler_options.h +++ b/shared/source/compiler_interface/compiler_options.h @@ -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"; @@ -177,8 +176,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; TokenizedString tokenize(ConstStringRef src, char sperator = ' '); } // namespace CompilerOptions