Skip to content

Commit 1634ac9

Browse files
Revert "Dont generate gen file by default"
This reverts commit 95943de. Signed-off-by: Compute-Runtime-Validation <[email protected]>
1 parent 151aaf7 commit 1634ac9

File tree

9 files changed

+27
-143
lines changed

9 files changed

+27
-143
lines changed

level_zero/core/test/common/gen_kernel.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function(level_zero_generate_kernels target_list platform_name suffix options)
2828
add_custom_command(
2929
COMMAND echo generate ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
3030
OUTPUT ${output_files}
31-
COMMAND ${ocloc_cmd_prefix} -q -gen_file -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
31+
COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
3232
WORKING_DIRECTORY ${workdir}
3333
DEPENDS ${filepath} ocloc
3434
)
@@ -80,7 +80,7 @@ function(level_zero_generate_kernels_with_internal_options target_list platform_
8080
add_custom_command(
8181
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}
8282
OUTPUT ${output_files}
83-
COMMAND ${ocloc_cmd_prefix} -q -gen_file -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} ${output_name} -options ${options} -internal_options ${internal_options}
83+
COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} ${output_name} -options ${options} -internal_options ${internal_options}
8484
WORKING_DIRECTORY ${workdir}
8585
DEPENDS ${filepath} ocloc
8686
)

opencl/source/built_ins/kernels/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function(compile_builtin core_type platform_type builtin bits builtin_options)
6868

6969
add_custom_command(
7070
OUTPUT ${OUTPUT_FILES}
71-
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__}, >"
71+
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__}, >"
7272
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
7373
DEPENDS ${builtin} ocloc copy_compiler_files
7474
)

opencl/test/unit_test/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function(neo_gen_kernels platform_name_with_type platform_name revision_id suffi
192192

193193
add_custom_command(
194194
OUTPUT ${output_files}
195-
COMMAND ${ocloc_cmd_prefix} -q -gen_file -file ${absolute_filepath} -device ${platform_name} -${NEO_BITS} -revision_id ${revision_id} -out_dir ${outputdir}
195+
COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -${NEO_BITS} -revision_id ${revision_id} -out_dir ${outputdir}
196196
WORKING_DIRECTORY ${workdir}
197197
DEPENDS ${filepath} ocloc
198198
)
@@ -239,7 +239,7 @@ function(neo_gen_kernels_with_options platform_name_with_type platform_name revi
239239

240240
add_custom_command(
241241
OUTPUT ${output_files}
242-
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
242+
COMMAND ${ocloc_cmd_prefix} -file ${absolute_filepath} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id} -options ${arg} -options_name
243243
WORKING_DIRECTORY ${workdir}
244244
DEPENDS ${filearg} ocloc
245245
)
@@ -292,7 +292,7 @@ function(neo_gen_kernels_with_internal_options platform_name_with_type platform_
292292

293293
add_custom_command(
294294
OUTPUT ${output_files}
295-
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}
295+
COMMAND ${ocloc_cmd_prefix} -file ${absolute_filepath} -device ${platform_name} -revision_id ${revision_id} -${NEO_BITS} -out_dir ${outputdir} ${output_name} -internal_options ${ARGN}
296296
WORKING_DIRECTORY ${workdir}
297297
DEPENDS ${filearg} ocloc
298298
)
@@ -340,7 +340,7 @@ function(neo_gen_kernel_with_kernel_debug_options platform_name_with_type platfo
340340

341341
add_custom_command(
342342
OUTPUT ${output_files}
343-
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"
343+
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"
344344
WORKING_DIRECTORY ${workdir}
345345
DEPENDS ${filepath} ocloc
346346
)
@@ -377,7 +377,7 @@ function(neo_gen_kernel_from_ll platform_name_with_type platform_name suffix fil
377377
378378
add_custom_command(
379379
OUTPUT ${output_files}
380-
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
380+
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
381381
WORKING_DIRECTORY ${workdir}
382382
DEPENDS ${filepath} ocloc
383383
)

opencl/test/unit_test/offline_compiler/mock/mock_offline_compiler.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class MockOfflineCompiler : public OfflineCompiler {
1919
using OfflineCompiler::deviceName;
2020
using OfflineCompiler::elfBinary;
2121
using OfflineCompiler::excludeIr;
22-
using OfflineCompiler::familyNameWithType;
2322
using OfflineCompiler::fclDeviceCtx;
2423
using OfflineCompiler::forceStatelessToStatefulOptimization;
2524
using OfflineCompiler::genBinary;

opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp

Lines changed: 14 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#include "offline_compiler_tests.h"
99

10-
#include "shared/offline_compiler/source/ocloc_api.h"
1110
#include "shared/source/compiler_interface/intermediate_representations.h"
1211
#include "shared/source/compiler_interface/oclc_extensions.h"
1312
#include "shared/source/debug_settings/debug_settings_manager.h"
@@ -122,7 +121,6 @@ TEST_F(MultiCommandTests, GivenOutputFileWhenBuildingMultiCommandThenSuccessIsRe
122121
};
123122

124123
std::vector<std::string> singleArgs = {
125-
"-gen_file",
126124
"-file",
127125
"test_files/copybuffer.cl",
128126
"-device",
@@ -156,7 +154,6 @@ TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWhenBuildingMultiCommandThenSuc
156154
};
157155

158156
std::vector<std::string> singleArgs = {
159-
"-gen_file",
160157
"-file",
161158
"test_files/copybuffer.cl",
162159
"-device",
@@ -200,7 +197,6 @@ TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWithProductConfigValueWhenBuild
200197
};
201198

202199
std::vector<std::string> singleArgs = {
203-
"-gen_file",
204200
"-file",
205201
"test_files/copybuffer.cl",
206202
"-device",
@@ -284,7 +280,6 @@ TEST_F(MultiCommandTests, GivenOutputFileListFlagWhenBuildingMultiCommandThenSuc
284280
};
285281

286282
std::vector<std::string> singleArgs = {
287-
"-gen_file",
288283
"-file",
289284
"test_files/copybuffer.cl",
290285
"-device",
@@ -684,8 +679,7 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenBuildingThenBuildSucceeds) {
684679
"-file",
685680
"test_files/copybuffer.cl",
686681
"-device",
687-
gEnvironment->devicePrefix.c_str(),
688-
"-gen_file"};
682+
gEnvironment->devicePrefix.c_str()};
689683

690684
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
691685

@@ -719,30 +713,25 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenBuildingWithDeviceConfigValueThenBuild
719713
"-file",
720714
"test_files/copybuffer.cl",
721715
"-device",
722-
configString,
723-
"-gen_file"};
716+
configString};
724717

725-
MockOfflineCompiler offlineCompiler{};
726-
727-
offlineCompiler.argHelper = oclocArgHelperWithoutInput.get();
728-
retVal = offlineCompiler.initialize(argv.size(), argv);
718+
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
729719

720+
EXPECT_NE(nullptr, pOfflineCompiler);
730721
EXPECT_EQ(CL_SUCCESS, retVal);
731722

732723
testing::internal::CaptureStdout();
733-
retVal = offlineCompiler.build();
724+
retVal = pOfflineCompiler->build();
734725
std::string output = testing::internal::GetCapturedStdout();
735726
EXPECT_EQ(CL_SUCCESS, retVal);
736-
737-
Environment testedEnv{configString, offlineCompiler.familyNameWithType};
738-
VariableBackup<Environment *> backup(&gEnvironment, &testedEnv);
739-
740727
EXPECT_TRUE(compilerOutputExists("copybuffer", "bc") || compilerOutputExists("copybuffer", "spv"));
741728
EXPECT_TRUE(compilerOutputExists("copybuffer", "gen"));
742729
EXPECT_TRUE(compilerOutputExists("copybuffer", "bin"));
743730

744-
std::string buildLog = offlineCompiler.getBuildLog();
731+
std::string buildLog = pOfflineCompiler->getBuildLog();
745732
EXPECT_STREQ(buildLog.c_str(), "");
733+
734+
delete pOfflineCompiler;
746735
}
747736

748737
TEST_F(OfflineCompilerTests, GivenLlvmTextWhenBuildingThenBuildSucceeds) {
@@ -752,8 +741,7 @@ TEST_F(OfflineCompilerTests, GivenLlvmTextWhenBuildingThenBuildSucceeds) {
752741
"test_files/copybuffer.cl",
753742
"-device",
754743
gEnvironment->devicePrefix.c_str(),
755-
"-llvm_text",
756-
"-gen_file"};
744+
"-llvm_text"};
757745

758746
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
759747

@@ -769,97 +757,6 @@ TEST_F(OfflineCompilerTests, GivenLlvmTextWhenBuildingThenBuildSucceeds) {
769757
delete pOfflineCompiler;
770758
}
771759

772-
TEST_F(OfflineCompilerTests, WhenGenFileFlagIsNotProvidedThenGenFileIsNotCreated) {
773-
uint32_t numOutputs = 0u;
774-
uint64_t *lenOutputs = nullptr;
775-
uint8_t **dataOutputs = nullptr;
776-
char **nameOutputs = nullptr;
777-
778-
bool isSpvFile = false;
779-
bool isGenFile = false;
780-
bool isBinFile = false;
781-
782-
const char *argv[] = {
783-
"ocloc",
784-
"-q",
785-
"-file",
786-
"test_files/copybuffer.cl",
787-
"-device",
788-
gEnvironment->devicePrefix.c_str()};
789-
790-
unsigned int argc = sizeof(argv) / sizeof(const char *);
791-
int retVal = oclocInvoke(argc, argv,
792-
0, nullptr, nullptr, nullptr,
793-
0, nullptr, nullptr, nullptr,
794-
&numOutputs, &dataOutputs, &lenOutputs, &nameOutputs);
795-
796-
EXPECT_EQ(retVal, CL_SUCCESS);
797-
EXPECT_EQ(numOutputs, 3u);
798-
799-
for (unsigned int i = 0; i < numOutputs; i++) {
800-
std::string nameOutput(nameOutputs[i]);
801-
if (nameOutput.find(".spv") != std::string::npos) {
802-
isSpvFile = true;
803-
}
804-
if (nameOutput.find(".gen") != std::string::npos) {
805-
isGenFile = true;
806-
}
807-
if (nameOutput.find(".bin") != std::string::npos) {
808-
isBinFile = true;
809-
}
810-
}
811-
812-
EXPECT_TRUE(isSpvFile);
813-
EXPECT_FALSE(isGenFile);
814-
EXPECT_TRUE(isBinFile);
815-
}
816-
817-
TEST_F(OfflineCompilerTests, WhenGenFileFlagIsProvidedThenGenFileIsCreated) {
818-
uint32_t numOutputs = 0u;
819-
uint64_t *lenOutputs = nullptr;
820-
uint8_t **dataOutputs = nullptr;
821-
char **nameOutputs = nullptr;
822-
823-
bool isSpvFile = false;
824-
bool isGenFile = false;
825-
bool isBinFile = false;
826-
827-
const char *argv[] = {
828-
"ocloc",
829-
"-q",
830-
"-gen_file",
831-
"-file",
832-
"test_files/copybuffer.cl",
833-
"-device",
834-
gEnvironment->devicePrefix.c_str()};
835-
836-
unsigned int argc = sizeof(argv) / sizeof(const char *);
837-
int retVal = oclocInvoke(argc, argv,
838-
0, nullptr, nullptr, nullptr,
839-
0, nullptr, nullptr, nullptr,
840-
&numOutputs, &dataOutputs, &lenOutputs, &nameOutputs);
841-
842-
EXPECT_EQ(retVal, CL_SUCCESS);
843-
EXPECT_EQ(numOutputs, 4u);
844-
845-
for (unsigned int i = 0; i < numOutputs; i++) {
846-
std::string nameOutput(nameOutputs[i]);
847-
if (nameOutput.find(".spv") != std::string::npos) {
848-
isSpvFile = true;
849-
}
850-
if (nameOutput.find(".gen") != std::string::npos) {
851-
isGenFile = true;
852-
}
853-
if (nameOutput.find(".bin") != std::string::npos) {
854-
isBinFile = true;
855-
}
856-
}
857-
858-
EXPECT_TRUE(isSpvFile);
859-
EXPECT_TRUE(isGenFile);
860-
EXPECT_TRUE(isBinFile);
861-
}
862-
863760
TEST_F(OfflineCompilerTests, WhenFclNotNeededThenDontLoadIt) {
864761
std::vector<std::string> argv = {
865762
"ocloc",
@@ -927,8 +824,7 @@ TEST_F(OfflineCompilerTests, GivenCppFileWhenBuildingThenBuildSucceeds) {
927824
"test_files/copybuffer.cl",
928825
"-device",
929826
gEnvironment->devicePrefix.c_str(),
930-
"-cpp_file",
931-
"-gen_file"};
827+
"-cpp_file"};
932828

933829
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
934830

@@ -951,7 +847,6 @@ TEST_F(OfflineCompilerTests, GivenOutputDirWhenBuildingThenBuildSucceeds) {
951847
"test_files/copybuffer.cl",
952848
"-device",
953849
gEnvironment->devicePrefix.c_str(),
954-
"-gen_file",
955850
"-out_dir",
956851
"offline_compiler_test"};
957852

@@ -1294,8 +1189,7 @@ TEST(OfflineCompilerTest, givenSpvOnlyOptionPassedWhenCmdLineParsedThenGenerateO
12941189
"myOutputFileName",
12951190
"-spv_only",
12961191
"-device",
1297-
gEnvironment->devicePrefix.c_str(),
1298-
"-gen_file"};
1192+
gEnvironment->devicePrefix.c_str()};
12991193

13001194
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
13011195
ASSERT_NE(nullptr, mockOfflineCompiler);
@@ -1504,8 +1398,7 @@ TEST(OfflineCompilerTest, givenOutputFileOptionWhenSourceIsCompiledThenOutputFil
15041398
"-output",
15051399
"myOutputFileName",
15061400
"-device",
1507-
gEnvironment->devicePrefix.c_str(),
1508-
"-gen_file"};
1401+
gEnvironment->devicePrefix.c_str()};
15091402

15101403
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
15111404
ASSERT_NE(nullptr, mockOfflineCompiler);
@@ -1538,8 +1431,7 @@ TEST(OfflineCompilerTest, givenDebugDataAvailableWhenSourceIsBuiltThenDebugDataF
15381431
"-output",
15391432
"myOutputFileName",
15401433
"-device",
1541-
gEnvironment->devicePrefix.c_str(),
1542-
"-gen_file"};
1434+
gEnvironment->devicePrefix.c_str()};
15431435

15441436
char debugData[10];
15451437
MockCompilerDebugVars igcDebugVars(gEnvironment->igcDebugVars);
@@ -2140,8 +2032,7 @@ TEST(OclocCompile, givenSpirvInputThenDontGenerateSpirvFile) {
21402032
"offline_compiler_test",
21412033
"-device",
21422034
gEnvironment->devicePrefix.c_str(),
2143-
"-spirv_input",
2144-
"-gen_file"};
2035+
"-spirv_input"};
21452036

21462037
int retVal = ocloc.initialize(argv.size(), argv);
21472038
ASSERT_EQ(0, retVal);

shared/offline_compiler/source/offline_compiler.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,6 @@ int OfflineCompiler::parseCommandLine(size_t numArgs, const std::vector<std::str
684684
inputFileSpirV = true;
685685
} else if ("-cpp_file" == currArg) {
686686
useCppFile = true;
687-
} else if ("-gen_file" == currArg) {
688-
useGenFile = true;
689687
} else if (("-options" == currArg) && hasMoreArgs) {
690688
options = argv[argIndex + 1];
691689
argIndex++;
@@ -1041,8 +1039,6 @@ Usage: ocloc [compile] -file <filename> -device <device_type> [-output <filename
10411039
-cpp_file Will generate c++ file with C-array
10421040
containing Intel Compute device binary.
10431041
1044-
-gen_file Will generate gen file.
1045-
10461042
-output_no_suffix Prevents ocloc from adding family name suffix.
10471043
10481044
--help Print this usage message.
@@ -1165,10 +1161,9 @@ void OfflineCompiler::writeOutAllFiles() {
11651161
}
11661162

11671163
if (genBinary) {
1168-
if (useGenFile) {
1169-
std::string genOutputFile = generateFilePath(outputDirectory, fileBase, ".gen") + generateOptsSuffix();
1170-
argHelper->saveOutput(genOutputFile, genBinary, genBinarySize);
1171-
}
1164+
std::string genOutputFile = generateFilePath(outputDirectory, fileBase, ".gen") + generateOptsSuffix();
1165+
1166+
argHelper->saveOutput(genOutputFile, genBinary, genBinarySize);
11721167

11731168
if (useCppFile) {
11741169
std::string cppOutputFile = generateFilePath(outputDirectory, fileBase, ".cpp");

shared/offline_compiler/source/offline_compiler.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ class OfflineCompiler {
134134
bool useLlvmText = false;
135135
bool useLlvmBc = false;
136136
bool useCppFile = false;
137-
bool useGenFile = false;
138137
bool useOptionsSuffix = false;
139138
bool quiet = false;
140139
bool onlySpirV = false;

shared/source/built_ins/kernels/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function(compile_builtin core_type platform_type builtin bits builtin_options mo
8888
get_filename_component(absolute_filepath_spv ${OUTPUT_FILE_SPV} ABSOLUTE)
8989
add_custom_command(
9090
OUTPUT ${OUTPUT_FILES_BINARIES}
91-
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__}, >"
91+
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__}, >"
9292
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
9393
DEPENDS ${OUTPUT_FILE_SPV} ocloc copy_compiler_files
9494
)

shared/test/common/test_files/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function(compile_kernels_gen platform_name_with_type revision_id platform_name s
2727

2828
add_custom_command(
2929
OUTPUT ${output_files}
30-
COMMAND ${ocloc_cmd_prefix} -gen_file -file ${absolute_filepath} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id}
30+
COMMAND ${ocloc_cmd_prefix} -file ${absolute_filepath} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id}
3131
WORKING_DIRECTORY ${workdir}
3232
DEPENDS ${filepath} ocloc copy_compiler_files
3333
)

0 commit comments

Comments
 (0)