@@ -511,6 +511,8 @@ int OfflineCompiler::parseCommandLine(size_t numArgs, const std::vector<std::str
511511 argIndex++;
512512 } else if (stringsAreEqual (argv[argIndex], " -q" )) {
513513 quiet = true ;
514+ } else if (stringsAreEqual (argv[argIndex], " -output_no_suffix" )) {
515+ outputNoSuffix = true ;
514516 } else if (stringsAreEqual (argv[argIndex], " --help" )) {
515517 printUsage ();
516518 retVal = PRINT_USAGE;
@@ -661,7 +663,7 @@ void OfflineCompiler::printUsage() {
661663Additionally, outputs intermediate representation (e.g. spirV).
662664Different input and intermediate file formats are available.
663665
664- Usage: ocloc [compile] -file <filename> -device <device_type> [-output <filename>] [-out_dir <output_dir>] [-options <options>] [-32|-64] [-internal_options <options>] [-llvm_text|-llvm_input|-spirv_input] [-options_name] [-q] [-cpp_file] [--help]
666+ Usage: ocloc [compile] -file <filename> -device <device_type> [-output <filename>] [-out_dir <output_dir>] [-options <options>] [-32|-64] [-internal_options <options>] [-llvm_text|-llvm_input|-spirv_input] [-options_name] [-q] [-cpp_file] [-output_no_suffix] [- -help]
665667
666668 -file <filename> The input file to be compiled
667669 (by default input source format is
@@ -732,6 +734,8 @@ Usage: ocloc [compile] -file <filename> -device <device_type> [-output <filename
732734 -cpp_file Will generate c++ file with C-array
733735 containing Intel OpenCL device binary.
734736
737+ -output_no_suffix Prevents ocloc from adding family name suffix.
738+
735739 --help Print this usage message.
736740
737741Examples :
@@ -797,10 +801,18 @@ bool OfflineCompiler::generateElfBinary() {
797801void OfflineCompiler::writeOutAllFiles () {
798802 std::string fileBase;
799803 std::string fileTrunk = getFileNameTrunk (inputFile);
800- if (outputFile.empty ()) {
801- fileBase = fileTrunk + " _" + familyNameWithType;
804+ if (outputNoSuffix) {
805+ if (outputFile.empty ()) {
806+ fileBase = fileTrunk;
807+ } else {
808+ fileBase = outputFile;
809+ }
802810 } else {
803- fileBase = outputFile + " _" + familyNameWithType;
811+ if (outputFile.empty ()) {
812+ fileBase = fileTrunk + " _" + familyNameWithType;
813+ } else {
814+ fileBase = outputFile + " _" + familyNameWithType;
815+ }
804816 }
805817
806818 if (outputDirectory != " " ) {
@@ -845,8 +857,12 @@ void OfflineCompiler::writeOutAllFiles() {
845857 }
846858
847859 if (!elfBinary.empty ()) {
848- std::string elfOutputFile = generateFilePath (outputDirectory, fileBase, " .bin" ) + generateOptsSuffix ();
849-
860+ std::string elfOutputFile;
861+ if (outputNoSuffix) {
862+ elfOutputFile = generateFilePath (outputDirectory, fileBase, " " );
863+ } else {
864+ elfOutputFile = generateFilePath (outputDirectory, fileBase, " .bin" ) + generateOptsSuffix ();
865+ }
850866 writeDataToFile (
851867 elfOutputFile.c_str (),
852868 elfBinary.data (),
0 commit comments