Revert "Dont generate gen file by default"

This reverts commit 95943dee0f.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2022-01-21 00:04:45 +01:00
committed by Compute-Runtime-Automation
parent 151aaf7678
commit 1634ac9ec3
9 changed files with 27 additions and 143 deletions

View File

@ -28,7 +28,7 @@ function(level_zero_generate_kernels target_list platform_name suffix options)
add_custom_command(
COMMAND echo generate ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
OUTPUT ${output_files}
COMMAND ${ocloc_cmd_prefix} -q -gen_file -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
WORKING_DIRECTORY ${workdir}
DEPENDS ${filepath} ocloc
)
@ -80,7 +80,7 @@ function(level_zero_generate_kernels_with_internal_options target_list platform_
add_custom_command(
COMMAND echo generate ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} ${output_name} -options ${options} -internal_options ${internal_options} , workdir is ${workdir}
OUTPUT ${output_files}
COMMAND ${ocloc_cmd_prefix} -q -gen_file -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} ${output_name} -options ${options} -internal_options ${internal_options}
COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} ${output_name} -options ${options} -internal_options ${internal_options}
WORKING_DIRECTORY ${workdir}
DEPENDS ${filepath} ocloc
)

View File

@ -68,7 +68,7 @@ function(compile_builtin core_type platform_type builtin bits builtin_options)
add_custom_command(
OUTPUT ${OUTPUT_FILES}
COMMAND ${ocloc_cmd_prefix} -q -gen_file -file ${absolute_filepath} -device ${DEFAULT_SUPPORTED_${core_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -out_dir ${OUTPUTDIR} -options "$<JOIN:${__ocloc__options__}, >"
COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${DEFAULT_SUPPORTED_${core_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -out_dir ${OUTPUTDIR} -options "$<JOIN:${__ocloc__options__}, >"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${builtin} ocloc copy_compiler_files
)

View File

@ -192,7 +192,7 @@ function(neo_gen_kernels platform_name_with_type platform_name revision_id suffi
add_custom_command(
OUTPUT ${output_files}
COMMAND ${ocloc_cmd_prefix} -q -gen_file -file ${absolute_filepath} -device ${platform_name} -${NEO_BITS} -revision_id ${revision_id} -out_dir ${outputdir}
COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -${NEO_BITS} -revision_id ${revision_id} -out_dir ${outputdir}
WORKING_DIRECTORY ${workdir}
DEPENDS ${filepath} ocloc
)
@ -239,7 +239,7 @@ function(neo_gen_kernels_with_options platform_name_with_type platform_name revi
add_custom_command(
OUTPUT ${output_files}
COMMAND ${ocloc_cmd_prefix} -gen_file -file ${absolute_filepath} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id} -options ${arg} -options_name
COMMAND ${ocloc_cmd_prefix} -file ${absolute_filepath} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id} -options ${arg} -options_name
WORKING_DIRECTORY ${workdir}
DEPENDS ${filearg} ocloc
)
@ -292,7 +292,7 @@ function(neo_gen_kernels_with_internal_options platform_name_with_type platform_
add_custom_command(
OUTPUT ${output_files}
COMMAND ${ocloc_cmd_prefix} -gen_file -file ${absolute_filepath} -device ${platform_name} -revision_id ${revision_id} -${NEO_BITS} -out_dir ${outputdir} ${output_name} -internal_options ${ARGN}
COMMAND ${ocloc_cmd_prefix} -file ${absolute_filepath} -device ${platform_name} -revision_id ${revision_id} -${NEO_BITS} -out_dir ${outputdir} ${output_name} -internal_options ${ARGN}
WORKING_DIRECTORY ${workdir}
DEPENDS ${filearg} ocloc
)
@ -340,7 +340,7 @@ function(neo_gen_kernel_with_kernel_debug_options platform_name_with_type platfo
add_custom_command(
OUTPUT ${output_files}
COMMAND ${ocloc_cmd_prefix} -q -gen_file -file ${absolute_filepath} -device ${platform_name} -revision_id ${revision_id} -${NEO_BITS} -out_dir ${outputdir} -output ${argwospaces} -internal_options ${TEST_KERNEL_kernel_debug_enable} -options "-g"
COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -revision_id ${revision_id} -${NEO_BITS} -out_dir ${outputdir} -output ${argwospaces} -internal_options ${TEST_KERNEL_kernel_debug_enable} -options "-g"
WORKING_DIRECTORY ${workdir}
DEPENDS ${filepath} ocloc
)
@ -377,7 +377,7 @@ function(neo_gen_kernel_from_ll platform_name_with_type platform_name suffix fil
add_custom_command(
OUTPUT ${output_files}
COMMAND ${ocloc_cmd_prefix} -q -gen_file -file ${absolute_filepath} -output ${output_name} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -internal_options ${compile_options} -llvm_input
COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -output ${output_name} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -internal_options ${compile_options} -llvm_input
WORKING_DIRECTORY ${workdir}
DEPENDS ${filepath} ocloc
)

View File

@ -19,7 +19,6 @@ class MockOfflineCompiler : public OfflineCompiler {
using OfflineCompiler::deviceName;
using OfflineCompiler::elfBinary;
using OfflineCompiler::excludeIr;
using OfflineCompiler::familyNameWithType;
using OfflineCompiler::fclDeviceCtx;
using OfflineCompiler::forceStatelessToStatefulOptimization;
using OfflineCompiler::genBinary;

View File

@ -7,7 +7,6 @@
#include "offline_compiler_tests.h"
#include "shared/offline_compiler/source/ocloc_api.h"
#include "shared/source/compiler_interface/intermediate_representations.h"
#include "shared/source/compiler_interface/oclc_extensions.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
@ -122,7 +121,6 @@ TEST_F(MultiCommandTests, GivenOutputFileWhenBuildingMultiCommandThenSuccessIsRe
};
std::vector<std::string> singleArgs = {
"-gen_file",
"-file",
"test_files/copybuffer.cl",
"-device",
@ -156,7 +154,6 @@ TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWhenBuildingMultiCommandThenSuc
};
std::vector<std::string> singleArgs = {
"-gen_file",
"-file",
"test_files/copybuffer.cl",
"-device",
@ -200,7 +197,6 @@ TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWithProductConfigValueWhenBuild
};
std::vector<std::string> singleArgs = {
"-gen_file",
"-file",
"test_files/copybuffer.cl",
"-device",
@ -284,7 +280,6 @@ TEST_F(MultiCommandTests, GivenOutputFileListFlagWhenBuildingMultiCommandThenSuc
};
std::vector<std::string> singleArgs = {
"-gen_file",
"-file",
"test_files/copybuffer.cl",
"-device",
@ -684,8 +679,7 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenBuildingThenBuildSucceeds) {
"-file",
"test_files/copybuffer.cl",
"-device",
gEnvironment->devicePrefix.c_str(),
"-gen_file"};
gEnvironment->devicePrefix.c_str()};
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
@ -719,30 +713,25 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenBuildingWithDeviceConfigValueThenBuild
"-file",
"test_files/copybuffer.cl",
"-device",
configString,
"-gen_file"};
configString};
MockOfflineCompiler offlineCompiler{};
offlineCompiler.argHelper = oclocArgHelperWithoutInput.get();
retVal = offlineCompiler.initialize(argv.size(), argv);
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
EXPECT_NE(nullptr, pOfflineCompiler);
EXPECT_EQ(CL_SUCCESS, retVal);
testing::internal::CaptureStdout();
retVal = offlineCompiler.build();
retVal = pOfflineCompiler->build();
std::string output = testing::internal::GetCapturedStdout();
EXPECT_EQ(CL_SUCCESS, retVal);
Environment testedEnv{configString, offlineCompiler.familyNameWithType};
VariableBackup<Environment *> backup(&gEnvironment, &testedEnv);
EXPECT_TRUE(compilerOutputExists("copybuffer", "bc") || compilerOutputExists("copybuffer", "spv"));
EXPECT_TRUE(compilerOutputExists("copybuffer", "gen"));
EXPECT_TRUE(compilerOutputExists("copybuffer", "bin"));
std::string buildLog = offlineCompiler.getBuildLog();
std::string buildLog = pOfflineCompiler->getBuildLog();
EXPECT_STREQ(buildLog.c_str(), "");
delete pOfflineCompiler;
}
TEST_F(OfflineCompilerTests, GivenLlvmTextWhenBuildingThenBuildSucceeds) {
@ -752,8 +741,7 @@ TEST_F(OfflineCompilerTests, GivenLlvmTextWhenBuildingThenBuildSucceeds) {
"test_files/copybuffer.cl",
"-device",
gEnvironment->devicePrefix.c_str(),
"-llvm_text",
"-gen_file"};
"-llvm_text"};
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
@ -769,97 +757,6 @@ TEST_F(OfflineCompilerTests, GivenLlvmTextWhenBuildingThenBuildSucceeds) {
delete pOfflineCompiler;
}
TEST_F(OfflineCompilerTests, WhenGenFileFlagIsNotProvidedThenGenFileIsNotCreated) {
uint32_t numOutputs = 0u;
uint64_t *lenOutputs = nullptr;
uint8_t **dataOutputs = nullptr;
char **nameOutputs = nullptr;
bool isSpvFile = false;
bool isGenFile = false;
bool isBinFile = false;
const char *argv[] = {
"ocloc",
"-q",
"-file",
"test_files/copybuffer.cl",
"-device",
gEnvironment->devicePrefix.c_str()};
unsigned int argc = sizeof(argv) / sizeof(const char *);
int retVal = oclocInvoke(argc, argv,
0, nullptr, nullptr, nullptr,
0, nullptr, nullptr, nullptr,
&numOutputs, &dataOutputs, &lenOutputs, &nameOutputs);
EXPECT_EQ(retVal, CL_SUCCESS);
EXPECT_EQ(numOutputs, 3u);
for (unsigned int i = 0; i < numOutputs; i++) {
std::string nameOutput(nameOutputs[i]);
if (nameOutput.find(".spv") != std::string::npos) {
isSpvFile = true;
}
if (nameOutput.find(".gen") != std::string::npos) {
isGenFile = true;
}
if (nameOutput.find(".bin") != std::string::npos) {
isBinFile = true;
}
}
EXPECT_TRUE(isSpvFile);
EXPECT_FALSE(isGenFile);
EXPECT_TRUE(isBinFile);
}
TEST_F(OfflineCompilerTests, WhenGenFileFlagIsProvidedThenGenFileIsCreated) {
uint32_t numOutputs = 0u;
uint64_t *lenOutputs = nullptr;
uint8_t **dataOutputs = nullptr;
char **nameOutputs = nullptr;
bool isSpvFile = false;
bool isGenFile = false;
bool isBinFile = false;
const char *argv[] = {
"ocloc",
"-q",
"-gen_file",
"-file",
"test_files/copybuffer.cl",
"-device",
gEnvironment->devicePrefix.c_str()};
unsigned int argc = sizeof(argv) / sizeof(const char *);
int retVal = oclocInvoke(argc, argv,
0, nullptr, nullptr, nullptr,
0, nullptr, nullptr, nullptr,
&numOutputs, &dataOutputs, &lenOutputs, &nameOutputs);
EXPECT_EQ(retVal, CL_SUCCESS);
EXPECT_EQ(numOutputs, 4u);
for (unsigned int i = 0; i < numOutputs; i++) {
std::string nameOutput(nameOutputs[i]);
if (nameOutput.find(".spv") != std::string::npos) {
isSpvFile = true;
}
if (nameOutput.find(".gen") != std::string::npos) {
isGenFile = true;
}
if (nameOutput.find(".bin") != std::string::npos) {
isBinFile = true;
}
}
EXPECT_TRUE(isSpvFile);
EXPECT_TRUE(isGenFile);
EXPECT_TRUE(isBinFile);
}
TEST_F(OfflineCompilerTests, WhenFclNotNeededThenDontLoadIt) {
std::vector<std::string> argv = {
"ocloc",
@ -927,8 +824,7 @@ TEST_F(OfflineCompilerTests, GivenCppFileWhenBuildingThenBuildSucceeds) {
"test_files/copybuffer.cl",
"-device",
gEnvironment->devicePrefix.c_str(),
"-cpp_file",
"-gen_file"};
"-cpp_file"};
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
@ -951,7 +847,6 @@ TEST_F(OfflineCompilerTests, GivenOutputDirWhenBuildingThenBuildSucceeds) {
"test_files/copybuffer.cl",
"-device",
gEnvironment->devicePrefix.c_str(),
"-gen_file",
"-out_dir",
"offline_compiler_test"};
@ -1294,8 +1189,7 @@ TEST(OfflineCompilerTest, givenSpvOnlyOptionPassedWhenCmdLineParsedThenGenerateO
"myOutputFileName",
"-spv_only",
"-device",
gEnvironment->devicePrefix.c_str(),
"-gen_file"};
gEnvironment->devicePrefix.c_str()};
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
ASSERT_NE(nullptr, mockOfflineCompiler);
@ -1504,8 +1398,7 @@ TEST(OfflineCompilerTest, givenOutputFileOptionWhenSourceIsCompiledThenOutputFil
"-output",
"myOutputFileName",
"-device",
gEnvironment->devicePrefix.c_str(),
"-gen_file"};
gEnvironment->devicePrefix.c_str()};
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
ASSERT_NE(nullptr, mockOfflineCompiler);
@ -1538,8 +1431,7 @@ TEST(OfflineCompilerTest, givenDebugDataAvailableWhenSourceIsBuiltThenDebugDataF
"-output",
"myOutputFileName",
"-device",
gEnvironment->devicePrefix.c_str(),
"-gen_file"};
gEnvironment->devicePrefix.c_str()};
char debugData[10];
MockCompilerDebugVars igcDebugVars(gEnvironment->igcDebugVars);
@ -2140,8 +2032,7 @@ TEST(OclocCompile, givenSpirvInputThenDontGenerateSpirvFile) {
"offline_compiler_test",
"-device",
gEnvironment->devicePrefix.c_str(),
"-spirv_input",
"-gen_file"};
"-spirv_input"};
int retVal = ocloc.initialize(argv.size(), argv);
ASSERT_EQ(0, retVal);

View File

@ -684,8 +684,6 @@ int OfflineCompiler::parseCommandLine(size_t numArgs, const std::vector<std::str
inputFileSpirV = true;
} else if ("-cpp_file" == currArg) {
useCppFile = true;
} else if ("-gen_file" == currArg) {
useGenFile = true;
} else if (("-options" == currArg) && hasMoreArgs) {
options = argv[argIndex + 1];
argIndex++;
@ -1041,8 +1039,6 @@ Usage: ocloc [compile] -file <filename> -device <device_type> [-output <filename
-cpp_file Will generate c++ file with C-array
containing Intel Compute device binary.
-gen_file Will generate gen file.
-output_no_suffix Prevents ocloc from adding family name suffix.
--help Print this usage message.
@ -1165,10 +1161,9 @@ void OfflineCompiler::writeOutAllFiles() {
}
if (genBinary) {
if (useGenFile) {
std::string genOutputFile = generateFilePath(outputDirectory, fileBase, ".gen") + generateOptsSuffix();
argHelper->saveOutput(genOutputFile, genBinary, genBinarySize);
}
std::string genOutputFile = generateFilePath(outputDirectory, fileBase, ".gen") + generateOptsSuffix();
argHelper->saveOutput(genOutputFile, genBinary, genBinarySize);
if (useCppFile) {
std::string cppOutputFile = generateFilePath(outputDirectory, fileBase, ".cpp");

View File

@ -134,7 +134,6 @@ class OfflineCompiler {
bool useLlvmText = false;
bool useLlvmBc = false;
bool useCppFile = false;
bool useGenFile = false;
bool useOptionsSuffix = false;
bool quiet = false;
bool onlySpirV = false;

View File

@ -88,7 +88,7 @@ function(compile_builtin core_type platform_type builtin bits builtin_options mo
get_filename_component(absolute_filepath_spv ${OUTPUT_FILE_SPV} ABSOLUTE)
add_custom_command(
OUTPUT ${OUTPUT_FILES_BINARIES}
COMMAND ${ocloc_cmd_prefix} -q -gen_file -file ${absolute_filepath_spv} -spirv_input -device ${DEFAULT_SUPPORTED_${core_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -output ${mode}_${BASENAME}_${REVISION_ID} -out_dir ${OUTPUTDIR} -revision_id ${REVISION_ID} ${INTERNAL_OPTIONS} -options "$<JOIN:${__ocloc__options__}, >"
COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath_spv} -spirv_input -device ${DEFAULT_SUPPORTED_${core_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -output ${mode}_${BASENAME}_${REVISION_ID} -out_dir ${OUTPUTDIR} -revision_id ${REVISION_ID} ${INTERNAL_OPTIONS} -options "$<JOIN:${__ocloc__options__}, >"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${OUTPUT_FILE_SPV} ocloc copy_compiler_files
)

View File

@ -27,7 +27,7 @@ function(compile_kernels_gen platform_name_with_type revision_id platform_name s
add_custom_command(
OUTPUT ${output_files}
COMMAND ${ocloc_cmd_prefix} -gen_file -file ${absolute_filepath} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id}
COMMAND ${ocloc_cmd_prefix} -file ${absolute_filepath} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id}
WORKING_DIRECTORY ${workdir}
DEPENDS ${filepath} ocloc copy_compiler_files
)