diff --git a/opencl/test/unit_test/offline_compiler/mock/mock_offline_compiler.h b/opencl/test/unit_test/offline_compiler/mock/mock_offline_compiler.h index a6d3aa22f0..f37ff92908 100644 --- a/opencl/test/unit_test/offline_compiler/mock/mock_offline_compiler.h +++ b/opencl/test/unit_test/offline_compiler/mock/mock_offline_compiler.h @@ -65,6 +65,7 @@ class MockOfflineCompiler : public OfflineCompiler { using OfflineCompiler::outputNoSuffix; using OfflineCompiler::parseCommandLine; using OfflineCompiler::parseDebugSettings; + using OfflineCompiler::perDeviceOptions; using OfflineCompiler::revisionId; using OfflineCompiler::setStatelessToStatefulBufferOffsetFlag; using OfflineCompiler::sourceCode; diff --git a/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.cpp b/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.cpp index 78487354c8..89183e26a2 100644 --- a/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.cpp @@ -17,6 +17,7 @@ #include "shared/source/helpers/compiler_product_helper.h" #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/helpers/product_config_helper.h" +#include "shared/test/common/helpers/gtest_helpers.h" #include "environment.h" #include "mock/mock_argument_helper.h" @@ -1074,6 +1075,67 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromReleaseWhenFatBinar } } +TEST_F(OclocFatBinaryProductAcronymsTests, givenDeviceOptionsForNotCompiledDeviceAndListOfProductsWhenFatBinaryBuildIsInvokedThenWarningIsPrinted) { + if (enabledProductsAcronyms.size() < 3) { + GTEST_SKIP(); + } + + std::stringstream products; + products << enabledProductsAcronyms[0].str() << "," << enabledProductsAcronyms[1].str(); + + oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false); + std::stringstream resString; + std::vector argv = { + "ocloc", + "-file", + clFiles + "copybuffer.cl", + "-device", + products.str().c_str(), + "-device-options", + enabledProductsAcronyms[2].str(), + "deviceOptions"}; + + testing::internal::CaptureStdout(); + [[maybe_unused]] int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get()); + auto output = testing::internal::GetCapturedStdout(); + + std::stringstream expectedErrorMessage; + expectedErrorMessage << "Warning! -device-options set for non-compiled device: " + enabledProductsAcronyms[2].str() + "\n"; + EXPECT_TRUE(hasSubstr(output, expectedErrorMessage.str())); +} + +TEST_F(OclocFatBinaryProductAcronymsTests, givenDeviceOptionsForCompiledDeviceAndListOfProductsWhenFatBinaryBuildIsInvokedThenWarningIsNotPrinted) { + if (enabledProductsAcronyms.size() < 2) { + GTEST_SKIP(); + } + + std::stringstream products; + products << enabledProductsAcronyms[0].str() + "," + enabledProductsAcronyms[1].str(); + + oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false); + std::stringstream resString; + std::vector argv = { + "ocloc", + "-file", + clFiles + "copybuffer.cl", + "-device", + products.str().c_str(), + "-device-options", + enabledProductsAcronyms[0].str(), + "deviceOptions"}; + + testing::internal::CaptureStdout(); + [[maybe_unused]] int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get()); + auto output = testing::internal::GetCapturedStdout(); + + std::stringstream errorMessage1, errorMessage2; + errorMessage1 << "Warning! -device-options set for non-compiled device: " << enabledProductsAcronyms[0].str() << "\n"; + errorMessage2 << "Warning! -device-options set for non-compiled device: " << enabledProductsAcronyms[1].str() << "\n"; + + EXPECT_FALSE(hasSubstr(output, errorMessage1.str())); + EXPECT_FALSE(hasSubstr(output, errorMessage2.str())); +} + TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeToReleaseWhenFatBinaryBuildIsInvokedThenSuccessIsReturned) { if (enabledReleasesAcronyms.size() < 3) { GTEST_SKIP(); 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 4a1d59dffe..7b7390f1bd 100644 --- a/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp @@ -3258,6 +3258,188 @@ TEST(OfflineCompilerTest, givenOptionsWhenCmdLineParsedThenOptionsAreAppendedToO EXPECT_TRUE(hasSubstr(options, std::string("options2"))); } +TEST(OfflineCompilerTest, givenDeviceOptionsForCompiledDeviceWhenCmdLineParsedThenDeviceOptionsAreAppendedToOptionsString) { + std::vector argv = { + "ocloc", + "-device", + gEnvironment->devicePrefix.c_str(), + "-options", + "options", + "-device-options", + gEnvironment->devicePrefix.c_str(), + "devOptions"}; + + auto mockOfflineCompiler = std::unique_ptr(new MockOfflineCompiler()); + ASSERT_NE(nullptr, mockOfflineCompiler); + + testing::internal::CaptureStdout(); + mockOfflineCompiler->parseCommandLine(argv.size(), argv); + std::string output = testing::internal::GetCapturedStdout(); + + EXPECT_NE(0u, output.size()); + + auto perDeviceOptions = mockOfflineCompiler->perDeviceOptions; + EXPECT_TRUE(hasSubstr(perDeviceOptions[gEnvironment->devicePrefix.c_str()], std::string("devOptions"))); + + std::string options = mockOfflineCompiler->options; + EXPECT_TRUE(hasSubstr(options, std::string("options"))); + EXPECT_TRUE(hasSubstr(options, std::string("devOptions"))); +} + +TEST(OfflineCompilerTest, givenUnknownDeviceAcronymInDeviceOptionsWhenParsingCommandLineThenErrorLogIsPrintedAndFailureIsReturned) { + std::vector argv = { + "ocloc", + "compile", + "-file", + clFiles + "copybuffer.cl", + "-device", + gEnvironment->devicePrefix.c_str(), + "-options", + "options", + "-device-options", + "unknownDeviceName1", + "devOptions1", + "-device-options", + gEnvironment->devicePrefix.c_str(), + "devOptions2", + "-device-options", + "unknownDeviceName2", + "devOptions2"}; + + auto mockOfflineCompiler = std::unique_ptr(new MockOfflineCompiler()); + ASSERT_NE(nullptr, mockOfflineCompiler); + + testing::internal::CaptureStdout(); + const auto result = mockOfflineCompiler->parseCommandLine(argv.size(), argv); + const std::string output = testing::internal::GetCapturedStdout(); + + EXPECT_EQ(OclocErrorCode::INVALID_COMMAND_LINE, result); + + const std::string expectedErrorMessage1{"Error: Invalid device acronym passed to -device-options: unknownDeviceName1\n"}; + const std::string expectedErrorMessage2{"Error: Invalid device acronym passed to -device-options: unknownDeviceName2\n"}; + EXPECT_TRUE(hasSubstr(output, expectedErrorMessage1)); + EXPECT_TRUE(hasSubstr(output, expectedErrorMessage2)); +} + +TEST(OfflineCompilerTest, givenDeviceOptionsInWrongFormatWhenCmdLineParsedThenDeviceOptionsAreNotAppendedToOptionsString) { + std::vector argv = { + "ocloc", + "-device", + gEnvironment->devicePrefix.c_str(), + "-options", + "options", + "-device-options", + "devOptions"}; + + auto mockOfflineCompiler = std::unique_ptr(new MockOfflineCompiler()); + ASSERT_NE(nullptr, mockOfflineCompiler); + + testing::internal::CaptureStdout(); + mockOfflineCompiler->parseCommandLine(argv.size(), argv); + std::string output = testing::internal::GetCapturedStdout(); + + EXPECT_NE(0u, output.size()); + + auto perDeviceOptions = mockOfflineCompiler->perDeviceOptions; + EXPECT_FALSE(hasSubstr(perDeviceOptions[gEnvironment->devicePrefix.c_str()], std::string("devOptions"))); + + std::string options = mockOfflineCompiler->options; + EXPECT_TRUE(hasSubstr(options, std::string("options"))); + EXPECT_FALSE(hasSubstr(options, std::string("devOptions"))); +} + +TEST(OfflineCompilerTest, givenMultipleDeviceOptionsWhenCmdLineParsedThenDeviceOptionsAreAppendedToOptionsString) { + std::vector argv = { + "ocloc", + "-device", + gEnvironment->devicePrefix.c_str(), + "-options", + "options", + "-device-options", + gEnvironment->devicePrefix.c_str(), + "devOptions1", + "-device-options", + gEnvironment->devicePrefix.c_str(), + "devOptions2"}; + + auto mockOfflineCompiler = std::unique_ptr(new MockOfflineCompiler()); + ASSERT_NE(nullptr, mockOfflineCompiler); + + testing::internal::CaptureStdout(); + mockOfflineCompiler->parseCommandLine(argv.size(), argv); + std::string output = testing::internal::GetCapturedStdout(); + + EXPECT_NE(0u, output.size()); + + auto perDeviceOptions = mockOfflineCompiler->perDeviceOptions; + EXPECT_TRUE(hasSubstr(perDeviceOptions[gEnvironment->devicePrefix.c_str()], std::string("devOptions1"))); + EXPECT_TRUE(hasSubstr(perDeviceOptions[gEnvironment->devicePrefix.c_str()], std::string("devOptions2"))); + + std::string options = mockOfflineCompiler->options; + EXPECT_TRUE(hasSubstr(options, std::string("options"))); + EXPECT_TRUE(hasSubstr(options, std::string("devOptions1"))); + EXPECT_TRUE(hasSubstr(options, std::string("devOptions2"))); +} + +TEST(OfflineCompilerTest, givenMultipleDeviceOptionsForCompiledDeviceAndDeviceOptionsNotForCompiledDeviceWhenCmdLineParsedThenDeviceOptionsOnlyForCompiledDeviceAreAppendedToOptionsString) { + auto mockOfflineCompiler = std::unique_ptr(new MockOfflineCompiler()); + ASSERT_NE(nullptr, mockOfflineCompiler); + + auto allEnabledDeviceAcronyms = mockOfflineCompiler->argHelper->productConfigHelper->getRepresentativeProductAcronyms(); + + if (allEnabledDeviceAcronyms.empty()) { + GTEST_SKIP(); + } + + std::string notCompiledDevice; + for (const auto &deviceAcronym : allEnabledDeviceAcronyms) { + if (deviceAcronym.str() != gEnvironment->devicePrefix.c_str()) { + notCompiledDevice = deviceAcronym.str(); + break; + } + } + + if (notCompiledDevice == "") { + GTEST_SKIP(); + } + + std::vector argv = { + "ocloc", + "-device", + gEnvironment->devicePrefix.c_str(), + "-device-options", + gEnvironment->devicePrefix.c_str(), + "devOptions1", + "-device-options", + notCompiledDevice, + "devOptions2", + "-options", + "options1", + "-device-options", + gEnvironment->devicePrefix.c_str(), + "devOptions3", + "-options", + "options2"}; + + testing::internal::CaptureStdout(); + mockOfflineCompiler->parseCommandLine(argv.size(), argv); + std::string output = testing::internal::GetCapturedStdout(); + + EXPECT_NE(0u, output.size()); + + auto perDeviceOptions = mockOfflineCompiler->perDeviceOptions; + EXPECT_TRUE(hasSubstr(perDeviceOptions[notCompiledDevice], std::string("devOptions2"))); + EXPECT_TRUE(hasSubstr(perDeviceOptions[gEnvironment->devicePrefix.c_str()], std::string("devOptions1"))); + EXPECT_TRUE(hasSubstr(perDeviceOptions[gEnvironment->devicePrefix.c_str()], std::string("devOptions3"))); + + std::string options = mockOfflineCompiler->options; + EXPECT_TRUE(hasSubstr(options, std::string("options1"))); + EXPECT_TRUE(hasSubstr(options, std::string("options2"))); + EXPECT_TRUE(hasSubstr(options, std::string("devOptions1"))); + EXPECT_TRUE(hasSubstr(options, std::string("devOptions3"))); + EXPECT_FALSE(hasSubstr(options, std::string("devOptions2"))); +} + TEST(OfflineCompilerTest, givenDashOOptionWhenCmdLineParsedThenBinaryOutputNameIsSet) { std::vector argv = { "ocloc", diff --git a/shared/offline_compiler/source/ocloc_fatbinary.cpp b/shared/offline_compiler/source/ocloc_fatbinary.cpp index bb6aaf308a..21a208c02e 100644 --- a/shared/offline_compiler/source/ocloc_fatbinary.cpp +++ b/shared/offline_compiler/source/ocloc_fatbinary.cpp @@ -22,9 +22,11 @@ #include "igfxfmid.h" #include "platforms.h" +#include #include #include #include +#include namespace NEO { bool requestedFatBinary(const std::vector &args, OclocArgHelper *helper) { @@ -296,11 +298,13 @@ int buildFatBinary(const std::vector &args, OclocArgHelper *argHelp std::string outputDirectory = ""; bool spirvInput = false; bool excludeIr = false; + std::set deviceAcronymsFromDeviceOptions; std::vector argsCopy(args); for (size_t argIndex = 1; argIndex < args.size(); argIndex++) { const auto &currArg = args[argIndex]; const bool hasMoreArgs = (argIndex + 1 < args.size()); + const bool hasAtLeast2MoreArgs = (argIndex + 2 < args.size()); if ((ConstStringRef("-device") == currArg) && hasMoreArgs) { deviceArgIndex = argIndex + 1; ++argIndex; @@ -321,6 +325,10 @@ int buildFatBinary(const std::vector &args, OclocArgHelper *argHelp excludeIr = true; } else if (ConstStringRef("-spirv_input") == currArg) { spirvInput = true; + } else if (("-device-options" == currArg) && hasAtLeast2MoreArgs) { + const auto &deviceName = args[argIndex + 1]; + deviceAcronymsFromDeviceOptions.insert(deviceName); + argIndex += 2; } } @@ -341,6 +349,13 @@ int buildFatBinary(const std::vector &args, OclocArgHelper *argHelp argHelper->printf("Failed to parse target devices from : %s\n", args[deviceArgIndex].c_str()); return 1; } + + for (const auto &deviceAcronym : deviceAcronymsFromDeviceOptions) { + if (std::find(targetProducts.begin(), targetProducts.end(), deviceAcronym) == targetProducts.end()) { + argHelper->printf("Warning! -device-options set for non-compiled device: %s\n", deviceAcronym.c_str()); + } + } + for (const auto &product : targetProducts) { int retVal = 0; argsCopy[deviceArgIndex] = product.str(); diff --git a/shared/offline_compiler/source/offline_compiler.cpp b/shared/offline_compiler/source/offline_compiler.cpp index 48f2c96f90..9354da45c6 100644 --- a/shared/offline_compiler/source/offline_compiler.cpp +++ b/shared/offline_compiler/source/offline_compiler.cpp @@ -676,6 +676,7 @@ int OfflineCompiler::parseCommandLine(size_t numArgs, const std::vectorprintf("Error: options: -gen_file/-cpp_file/-output_no_suffix/-output cannot be used with -o\n"); retVal = INVALID_COMMAND_LINE; @@ -785,6 +795,15 @@ int OfflineCompiler::parseCommandLine(size_t numArgs, const std::vectorproductConfigHelper->getProductConfigFromAcronym(deviceName); + if (productConfig == AOT::UNKNOWN_ISA) { + argHelper->printf("Error: Invalid device acronym passed to -device-options: %s\n", deviceName.c_str()); + retVal = INVALID_COMMAND_LINE; + } + } + if (inputFile.empty()) { argHelper->printf("Error: Input file name missing.\n"); retVal = INVALID_COMMAND_LINE; @@ -889,156 +908,160 @@ void OfflineCompiler::printUsage() { Additionally, outputs intermediate representation (e.g. spirV). Different input and intermediate file formats are available. -Usage: ocloc [compile] -file -device [-output ] [-out_dir ] [-options ] [-32|-64] [-internal_options ] [-llvm_text|-llvm_input|-spirv_input] [-options_name] [-q] [-cpp_file] [-output_no_suffix] [--help] +Usage: ocloc [compile] -file -device [-output ] [-out_dir ] [-options ] [-device-options ] [-32|-64] [-internal_options ] [-llvm_text|-llvm_input|-spirv_input] [-options_name] [-q] [-cpp_file] [-output_no_suffix] [--help] - -file The input file to be compiled - (by default input source format is - OpenCL C kernel language). + -file The input file to be compiled + (by default input source format is + OpenCL C kernel language). - -device Target device. - can be: %s, ip version or hexadecimal value with 0x prefix - - can be single or multiple target devices. - The ip version can be a representation of the - .. or a decimal value that - can be queried using the L0 ZE_extension_device_ip_version. - The hexadecimal value represents device ID. - If such value is provided, ocloc will try to - match it with corresponding device type. - For example, 0xFF20 device ID will be translated - to tgllp. - If multiple target devices are provided, ocloc - will compile for each of these targets and will - create a fatbinary archive that contains all of - device binaries produced this way. - Supported -device patterns examples: - -device 0x4905 ; will compile 1 target (dg1) - -device 12.10.0 ; will compile 1 target (dg1) - -device 50495488 ; will compile 1 target (dg1) - -device dg1 ; will compile 1 target - -device dg1,acm-g10 ; will compile 2 targets - -device dg1:acm-g10 ; will compile all targets - in range (inclusive) - -device dg1: ; will compile all targets - newer/same as provided - -device :dg1 ; will compile all targets - older/same as provided - -device xe-hpg ; will compile all targets - matching the same release - -device xe ; will compile all targets - matching the same family - -device xe-hpg:xe-hpc ; will compile all targets - in range (inclusive) - -device xe-hpg: ; will compile all targets - newer/same as provided - -device :xe-hpg ; will compile all targets - older/same as provided - known to ocloc + -device Target device. + can be: %s, ip version or hexadecimal value with 0x prefix + - can be single or multiple target devices. + The ip version can be a representation of the + .. or a decimal value that + can be queried using the L0 ZE_extension_device_ip_version. + The hexadecimal value represents device ID. + If such value is provided, ocloc will try to + match it with corresponding device type. + For example, 0xFF20 device ID will be translated + to tgllp. + If multiple target devices are provided, ocloc + will compile for each of these targets and will + create a fatbinary archive that contains all of + device binaries produced this way. + Supported -device patterns examples: + -device 0x4905 ; will compile 1 target (dg1) + -device 12.10.0 ; will compile 1 target (dg1) + -device 50495488 ; will compile 1 target (dg1) + -device dg1 ; will compile 1 target + -device dg1,acm-g10 ; will compile 2 targets + -device dg1:acm-g10 ; will compile all targets + in range (inclusive) + -device dg1: ; will compile all targets + newer/same as provided + -device :dg1 ; will compile all targets + older/same as provided + -device xe-hpg ; will compile all targets + matching the same release + -device xe ; will compile all targets + matching the same family + -device xe-hpg:xe-hpc ; will compile all targets + in range (inclusive) + -device xe-hpg: ; will compile all targets + newer/same as provided + -device :xe-hpg ; will compile all targets + older/same as provided + known to ocloc - Deprecated notation that is still supported: - can be: %s - - can be single target device. + Deprecated notation that is still supported: + can be: %s + - can be single target device. - -o Optional output file name. - Must not be used with: - -gen_file | -cpp_file | -output_no_suffix | -output + -o Optional output file name. + Must not be used with: + -gen_file | -cpp_file | -output_no_suffix | -output - -output Optional output file base name. - Default is input file's base name. - This base name will be used for all output files. - For single target device proper suffixes (describing file formats) - will be added automatically. + -output Optional output file base name. + Default is input file's base name. + This base name will be used for all output files. + For single target device proper suffixes (describing file formats) + will be added automatically. - -out_dir Optional output directory. - Default is current working directory. + -out_dir Optional output directory. + Default is current working directory. - -allow_caching Allows caching binaries from compilation (like spirv, - gen or debug data) and loading them by ocloc - when the same program is compiled again. + -allow_caching Allows caching binaries from compilation (like spirv, + gen or debug data) and loading them by ocloc + when the same program is compiled again. - -cache_dir Optional caching directory. - Default directory is "ocloc_cache". + -cache_dir Optional caching directory. + Default directory is "ocloc_cache". - -options Optional OpenCL C compilation options - as defined by OpenCL specification. - Special options for Vector Compute: - -vc-codegen compile from SPIRV - -cmc compile from CM sources + -options Optional OpenCL C compilation options + as defined by OpenCL specification. + Special options for Vector Compute: + -vc-codegen compile from SPIRV + -cmc compile from CM sources - -32 Forces target architecture to 32-bit pointers. - Default pointer size is inherited from - ocloc's pointer size. - This option is exclusive with -64. + -device-options Optional OpenCL C compilation options + as defined by OpenCL specification - specific to a single target device. + can be product acronym i.e. dg1 - -64 Forces target architecture to 64-bit pointers. - Default pointer size is inherited from - ocloc's pointer size. - This option is exclusive with -32. + -32 Forces target architecture to 32-bit pointers. + Default pointer size is inherited from + ocloc's pointer size. + This option is exclusive with -64. - -internal_options Optional compiler internal options - as defined by compilers used underneath. - Check intel-graphics-compiler (IGC) project - for details on available internal options. - You also may provide explicit --help to inquire - information about option, mentioned in -options + -64 Forces target architecture to 64-bit pointers. + Default pointer size is inherited from + ocloc's pointer size. + This option is exclusive with -32. - -llvm_text Forces intermediate representation (IR) format - to human-readable LLVM IR (.ll). - This option affects only output files - and should not be used in combination with - '-llvm_input' option. - Default IR is spirV. - This option is exclusive with -spirv_input. - This option is exclusive with -llvm_input. + -internal_options Optional compiler internal options + as defined by compilers used underneath. + Check intel-graphics-compiler (IGC) project + for details on available internal options. + You also may provide explicit --help to inquire + information about option, mentioned in -options - -llvm_input Indicates that input file is an llvm binary. - Default is OpenCL C kernel language. - This option is exclusive with -spirv_input. - This option is exclusive with -llvm_text. + -llvm_text Forces intermediate representation (IR) format + to human-readable LLVM IR (.ll). + This option affects only output files + and should not be used in combination with + '-llvm_input' option. + Default IR is spirV. + This option is exclusive with -spirv_input. + This option is exclusive with -llvm_input. - -spirv_input Indicates that input file is a spirV binary. - Default is OpenCL C kernel language format. - This option is exclusive with -llvm_input. - This option is exclusive with -llvm_text. + -llvm_input Indicates that input file is an llvm binary. + Default is OpenCL C kernel language. + This option is exclusive with -spirv_input. + This option is exclusive with -llvm_text. - -options_name Will add suffix to output files. - This suffix will be generated based on input - options (useful when rebuilding with different - set of options so that results won't get - overwritten). - This suffix is added always as the last part - of the filename (even after file's extension). - It does not affect '--output' parameter and can - be used along with it ('--output' parameter - defines the base name - i.e. prefix). + -spirv_input Indicates that input file is a spirV binary. + Default is OpenCL C kernel language format. + This option is exclusive with -llvm_input. + This option is exclusive with -llvm_text. - -force_stos_opt Will forcibly enable stateless to stateful optimization, - i.e. skip "-cl-intel-greater-than-4GB-buffer-required". + -options_name Will add suffix to output files. + This suffix will be generated based on input + options (useful when rebuilding with different + set of options so that results won't get + overwritten). + This suffix is added always as the last part + of the filename (even after file's extension). + It does not affect '--output' parameter and can + be used along with it ('--output' parameter + defines the base name - i.e. prefix). - -q Will silence output messages (except errors). + -force_stos_opt Will forcibly enable stateless to stateful optimization, + i.e. skip "-cl-intel-greater-than-4GB-buffer-required". - -qq Will silence most of output messages. + -q Will silence output messages (except errors). - -spv_only Will generate only spirV file. + -qq Will silence most of output messages. - -cpp_file Will generate c++ file with C-array - containing Intel Compute device binary. + -spv_only Will generate only spirV file. - -gen_file Will generate gen file. + -cpp_file Will generate c++ file with C-array + containing Intel Compute device binary. - -output_no_suffix Prevents ocloc from adding family name suffix. + -gen_file Will generate gen file. - --help Print this usage message. + -output_no_suffix Prevents ocloc from adding family name suffix. - -revision_id Target stepping. Can be decimal or hexadecimal value. + --help Print this usage message. - -exclude_ir Excludes IR from the output binary file. + -revision_id Target stepping. Can be decimal or hexadecimal value. - --format Enforce given binary format. The possible values are: - --format zebin - Enforce generating zebin binary - --format patchtokens - Enforce generating patchtokens (legacy) binary. + -exclude_ir Excludes IR from the output binary file. - -config Target hardware info config for a single device, - e.g 1x4x8. + --format Enforce given binary format. The possible values are: + --format zebin - Enforce generating zebin binary + --format patchtokens - Enforce generating patchtokens (legacy) binary. + + -config Target hardware info config for a single device, + e.g 1x4x8. Examples : Compile file to Intel Compute GPU device binary (out = source_file_Gen9core.bin) diff --git a/shared/offline_compiler/source/offline_compiler.h b/shared/offline_compiler/source/offline_compiler.h index c05f67515a..c0a9ab28a2 100644 --- a/shared/offline_compiler/source/offline_compiler.h +++ b/shared/offline_compiler/source/offline_compiler.h @@ -20,6 +20,7 @@ #include #include #include +#include namespace NEO { @@ -140,6 +141,7 @@ All supported acronyms: %s. std::string binaryOutputFile; std::string outputDirectory; std::string options; + std::unordered_map perDeviceOptions; std::string internalOptions; std::string sourceCode; std::string buildLog;