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 cb3c6ca31a..7e73f869b9 100644 --- a/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp @@ -5839,33 +5839,4 @@ TEST_F(OfflineCompilerTests, GivenDebugFlagWhenBuildingFromSourceThenTemporarySo std::string expectedSOption = "-s \"" + expectedTempFilePath.string() + "\""; EXPECT_TRUE(CompilerOptions::contains(mockOfflineCompiler.options, expectedSOption)); } - -TEST(OclocOutputFileExtensions, GivenKnownFileFormatTheChooseProperExtension) { - using namespace IGC::CodeType; - std::pair expectedExts[] = { - {llvmLl, ".ll"}, - {llvmBc, ".bc"}, - {spirV, ".spv"}, - {oclC, ".cl"}, - {oclCpp, ".cl"}, - {oclGenBin, ".bin"}, - {elf, ".bin"}, - {undefined, ".bin"}, - {invalid, ".bin"}}; - - for (const auto &[codeType, expectedExt] : expectedExts) { - auto ext = NEO::getFileExtension(codeType); - EXPECT_STREQ(expectedExt, ext.c_str()); - } -} - -TEST(OclocOutputFileExtensions, GivenCustomFileFormatThenUseItAsExtension) { - auto customCodeType = IGC::CodeType::CodeTypeCoder::Enc("TXT"); - auto ext = NEO::getFileExtension(customCodeType); - EXPECT_STREQ(".txt", ext.c_str()); - - customCodeType = IGC::CodeType::CodeTypeCoder::Enc("MD"); - ext = NEO::getFileExtension(customCodeType); - EXPECT_STREQ(".md", ext.c_str()); -} } // namespace NEO diff --git a/shared/offline_compiler/source/offline_compiler.cpp b/shared/offline_compiler/source/offline_compiler.cpp index ae30806024..82552ff022 100644 --- a/shared/offline_compiler/source/offline_compiler.cpp +++ b/shared/offline_compiler/source/offline_compiler.cpp @@ -1625,7 +1625,7 @@ void OfflineCompiler::writeOutAllFiles() { return; } - if (irBinary && (this->inputCodeType == IGC::CodeType::oclC)) { + if (irBinary && (this->inputCodeType != IGC::CodeType::spirV)) { std::string irOutputFileName = generateFilePathForIr(fileBase) + generateOptsSuffix(); argHelper->saveOutput(irOutputFileName, irBinary, irBinarySize); diff --git a/shared/offline_compiler/source/offline_compiler.h b/shared/offline_compiler/source/offline_compiler.h index 912f433820..fc299197b5 100644 --- a/shared/offline_compiler/source/offline_compiler.h +++ b/shared/offline_compiler/source/offline_compiler.h @@ -11,7 +11,6 @@ #include "shared/source/compiler_interface/compiler_options.h" #include "shared/source/helpers/hw_info.h" #include "shared/source/helpers/non_copyable_or_moveable.h" -#include "shared/source/helpers/string_helpers.h" #include "shared/source/utilities/arrayref.h" #include "shared/source/utilities/const_stringref.h" @@ -51,14 +50,9 @@ constexpr bool isIntermediateRepresentation(IGC::CodeType::CodeType_t codeType) return false == ((IGC::CodeType::oclC == codeType) || (IGC::CodeType::oclCpp == codeType) || (IGC::CodeType::oclGenBin == codeType)); } -inline std::string getFileExtension(IGC::CodeType::CodeType_t codeType) { +constexpr const char *getFileExtension(IGC::CodeType::CodeType_t codeType) { switch (codeType) { default: - return "." + StringHelpers::toLower(IGC::CodeType::CodeTypeCoder::Dec(codeType)); - case IGC::CodeType::oclGenBin: - case IGC::CodeType::elf: - case IGC::CodeType::undefined: - case IGC::CodeType::invalid: return ".bin"; case IGC::CodeType::llvmBc: return ".bc"; @@ -66,10 +60,6 @@ inline std::string getFileExtension(IGC::CodeType::CodeType_t codeType) { return ".ll"; case IGC::CodeType::spirV: return ".spv"; - case IGC::CodeType::oclC: - return ".cl"; - case IGC::CodeType::oclCpp: - return ".cl"; } } @@ -196,8 +186,8 @@ All supported acronyms: %s. void updateBuildLog(const char *pErrorString, const size_t errorStringSize); MOCKABLE_VIRTUAL bool generateElfBinary(); std::string generateFilePathForIr(const std::string &fileNameBase) { - auto ext = getFileExtension(intermediateRepresentation); - return generateFilePath(outputDirectory, fileNameBase, ext.c_str()); + const char *ext = getFileExtension(intermediateRepresentation); + return generateFilePath(outputDirectory, fileNameBase, ext); } std::string generateOptsSuffix() { diff --git a/shared/source/helpers/string_helpers.h b/shared/source/helpers/string_helpers.h index 454ad650f2..d615d53527 100644 --- a/shared/source/helpers/string_helpers.h +++ b/shared/source/helpers/string_helpers.h @@ -10,7 +10,6 @@ #include "CL/cl.h" -#include #include #include #include @@ -84,14 +83,4 @@ inline std::vector split(const std::string &input, const char *deli inline uint32_t toUint32t(const std::string &input) { return static_cast(std::stoul(input, nullptr, 0)); } - -inline void toLowerInPlace(std::string &src) { - std::transform(src.begin(), src.end(), src.begin(), [](unsigned char c) { return std::tolower(c); }); -} - -inline std::string toLower(const std::string &src) { - std::string ret = src; - toLowerInPlace(ret); - return ret; -} } // namespace StringHelpers diff --git a/shared/test/unit_test/helpers/string_to_hash_tests.cpp b/shared/test/unit_test/helpers/string_to_hash_tests.cpp index 54be473729..8b5f22db7a 100644 --- a/shared/test/unit_test/helpers/string_to_hash_tests.cpp +++ b/shared/test/unit_test/helpers/string_to_hash_tests.cpp @@ -12,11 +12,6 @@ using NEO::Hash; -TEST(ToLower, GiventStringThenChangeItToLowerCase) { - std::string ls = StringHelpers::toLower("SomeTEXT"); - EXPECT_STREQ("sometext", ls.c_str()); -} - TEST(CreateCombinedStrings, GivenSingleStringWhenCreatingCombinedStringThenDstStringMatchesSrcString) { std::string dstString; size_t dstStringSizeInBytes = 0;