diff --git a/level_zero/core/test/common/gen_kernel.cmake b/level_zero/core/test/common/gen_kernel.cmake index daa9e5dc23..2fa0b8fdea 100644 --- a/level_zero/core/test/common/gen_kernel.cmake +++ b/level_zero/core/test/common/gen_kernel.cmake @@ -22,7 +22,6 @@ function(level_zero_generate_kernels target_list platform_name suffix revision_i if(NOT NEO_DISABLE_BUILTINS_COMPILATION) set(output_files ${outputpath_base}.bin - ${outputpath_base}.gen ${outputpath_base}.spv ${outputpath_base}.dbg ) @@ -37,15 +36,15 @@ function(level_zero_generate_kernels target_list platform_name suffix revision_i list(APPEND ${target_list} ${output_files}) else() - foreach(_file_name "bin" "gen" "spv" "dbg") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${relativeDir}/${basename}_${suffix}.${_file_name}") + foreach(extension "bin" "spv" "dbg") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${relativeDir}/${basename}_${suffix}.${extension}") add_custom_command( - OUTPUT ${outputpath_base}.${_file_name} + OUTPUT ${outputpath_base}.${extension} COMMAND ${CMAKE_COMMAND} -E make_directory ${outputdir} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_file_prebuilt} ${outputdir} ) - list(APPEND ${target_list} ${outputpath_base}.${_file_name}) + list(APPEND ${target_list} ${outputpath_base}.${extension}) endforeach() endif() endforeach() @@ -72,7 +71,6 @@ function(level_zero_generate_kernels_with_internal_options target_list platform_ if(NOT NEO_DISABLE_BUILTINS_COMPILATION) set(output_files ${outputpath_base}.bin - ${outputpath_base}.gen ${outputpath_base}.spv ${outputpath_base}.dbg ) @@ -89,15 +87,15 @@ function(level_zero_generate_kernels_with_internal_options target_list platform_ list(APPEND ${target_list} ${output_files}) else() - foreach(_file_name "bin" "gen" "spv" "dbg") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${relativeDir}/${prefix}_${basename}_${suffix}.${_file_name}") + foreach(extension "bin" "spv" "dbg") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${relativeDir}/${prefix}_${basename}_${suffix}.${extension}") add_custom_command( - OUTPUT ${outputpath_base}.${_file_name} + OUTPUT ${outputpath_base}.${extension} COMMAND ${CMAKE_COMMAND} -E make_directory ${outputdir} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_file_prebuilt} ${outputdir} ) - list(APPEND ${target_list} ${outputpath_base}.${_file_name}) + list(APPEND ${target_list} ${outputpath_base}.${extension}) endforeach() endif() endforeach() diff --git a/manifests/manifest.yml b/manifests/manifest.yml index 2b0f3b4207..5b3da4891f 100644 --- a/manifests/manifest.yml +++ b/manifests/manifest.yml @@ -38,7 +38,7 @@ components: dest_dir: kernels_bin type: git branch: kernels_bin - revision: 1941-290 + revision: 1941-293 kmdaf: branch: kmdaf dest_dir: kmdaf diff --git a/opencl/test/unit_test/CMakeLists.txt b/opencl/test/unit_test/CMakeLists.txt index fc439b250a..2333f310d2 100644 --- a/opencl/test/unit_test/CMakeLists.txt +++ b/opencl/test/unit_test/CMakeLists.txt @@ -154,15 +154,15 @@ function(neo_gen_kernels platform_name_with_type platform_name revision_id suffi list(APPEND kernels_to_compile ${output_files}) else() - foreach(_file_name "spv" "bin" "gen") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${suffix}.${_file_name}") + foreach(extension "spv" "bin" "gen") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${suffix}.${extension}") add_custom_command( - OUTPUT ${outputpath_base}.${_file_name} + OUTPUT ${outputpath_base}.${extension} COMMAND ${CMAKE_COMMAND} -E make_directory ${outputdir} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_file_prebuilt} ${outputdir} ) - list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${outputpath_base}.${_file_name}) + list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${outputpath_base}.${extension}) endforeach() endif() endforeach() @@ -183,32 +183,32 @@ function(neo_gen_kernels_with_options platform_name_with_type platform_name revi foreach(arg ${ARGN}) string(REPLACE " " "_" argwospaces ${arg}) - - set(outputpath_base "${outputdir}/${basename}_${suffix}") + set(base_filename ${basename}_${argwospaces}) + set(outputpath_base "${outputdir}/${base_filename}_${suffix}") if(NOT NEO_DISABLE_BUILTINS_COMPILATION) set(output_files - ${outputpath_base}.spv${argwospaces} - ${outputpath_base}.bin${argwospaces} - ${outputpath_base}.gen${argwospaces} + ${outputpath_base}.spv + ${outputpath_base}.bin + ${outputpath_base}.gen ) 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} -gen_file -file ${absolute_filepath} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id} -options ${arg} -output ${base_filename} WORKING_DIRECTORY ${workdir} DEPENDS ${filearg} ocloc ) list(APPEND kernels_to_compile ${output_files}) else() - foreach(_file_name "spv" "bin" "gen") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${suffix}.${_file_name}${argwospaces}") + foreach(extension "spv" "bin" "gen") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${base_filename}_${suffix}.${extension}") add_custom_command( - OUTPUT ${outputpath_base}.${_file_name}${argwospaces} + OUTPUT ${outputpath_base}_${suffix}.${extension} COMMAND ${CMAKE_COMMAND} -E make_directory ${outputdir} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_file_prebuilt} ${outputdir} ) - list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${outputpath_base}.${_file_name}${argwospaces}) + list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${outputpath_base}_${suffix}.${extension}) endforeach() endif() endforeach() @@ -253,15 +253,15 @@ function(neo_gen_kernels_with_internal_options platform_name_with_type platform_ ) list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${output_files}) else() - foreach(_file_name "spv" "bin" "gen") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${suffix}.${_file_name}") + foreach(extension "spv" "bin" "gen") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${suffix}.${extension}") add_custom_command( - OUTPUT ${outputpath_base}.${_file_name} + OUTPUT ${outputpath_base}.${extension} COMMAND ${CMAKE_COMMAND} -E make_directory ${outputdir} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_file_prebuilt} ${outputdir} ) - list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${outputpath_base}.${_file_name}) + list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${outputpath_base}.${extension}) endforeach() endif() @@ -301,15 +301,15 @@ function(neo_gen_kernel_with_kernel_debug_options platform_name_with_type platfo ) list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${output_files}) else() - foreach(_file_name "spv" "bin" "gen" "dbg") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${argwospaces}_${suffix}.${_file_name}") + foreach(extension "spv" "bin" "gen" "dbg") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${argwospaces}_${suffix}.${extension}") add_custom_command( - OUTPUT ${outputpath_base}.${_file_name} + OUTPUT ${outputpath_base}.${extension} COMMAND ${CMAKE_COMMAND} -E make_directory ${outputdir} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_file_prebuilt} ${outputdir} ) - list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${outputpath_base}.${_file_name}) + list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${outputpath_base}.${extension}) endforeach() endif() set(kernels_to_compile_${platform_name_with_type}_${revision_id} ${kernels_to_compile_${platform_name_with_type}_${revision_id}} PARENT_SCOPE) diff --git a/shared/test/common/helpers/kernel_binary_helper.cpp b/shared/test/common/helpers/kernel_binary_helper.cpp index a9a5cd33c9..3956b9a8f2 100644 --- a/shared/test/common/helpers/kernel_binary_helper.cpp +++ b/shared/test/common/helpers/kernel_binary_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -22,6 +22,9 @@ KernelBinaryHelper::KernelBinaryHelper(const std::string &name, bool appendOptio retrieveBinaryKernelFilename(fclDebugVars.fileName, name + "_", ".bc"); retrieveBinaryKernelFilename(igcDebugVars.fileName, name + "_", ".gen"); + appendBinaryNameSuffix(fclDebugVars.fileNameSuffix); + appendBinaryNameSuffix(igcDebugVars.fileNameSuffix); + fclDebugVars.appendOptionsToFileName = appendOptionsToFileName; igcDebugVars.appendOptionsToFileName = appendOptionsToFileName; diff --git a/shared/test/common/helpers/test_files.cpp b/shared/test/common/helpers/test_files.cpp index 0090bda7ed..1db45cb2ed 100644 --- a/shared/test/common/helpers/test_files.cpp +++ b/shared/test/common/helpers/test_files.cpp @@ -26,9 +26,12 @@ void retrieveBinaryKernelFilename(std::string &outputFilename, const std::string outputFilename.reserve(2 * testFiles.length()); outputFilename.append(testFiles); outputFilename.append(kernelName); + if (false == options.empty()) { + outputFilename.append(options); + outputFilename.append("_"); + } outputFilename.append(binaryNameSuffix); outputFilename.append(extension); - outputFilename.append(options); if (!fileExists(outputFilename) && (extension == ".bc")) { retrieveBinaryKernelFilename(outputFilename, kernelName, ".spv", options); @@ -50,3 +53,7 @@ void retrieveBinaryKernelFilenameApiSpecific(std::string &outputFilename, const retrieveBinaryKernelFilename(outputFilename, kernelName, ".spv", options); } } + +void appendBinaryNameSuffix(std::string &outputFileNameSuffix) { + outputFileNameSuffix.append(binaryNameSuffix); +} \ No newline at end of file diff --git a/shared/test/common/helpers/test_files.h b/shared/test/common/helpers/test_files.h index bd2f5d1730..d7d33ceefc 100644 --- a/shared/test/common/helpers/test_files.h +++ b/shared/test/common/helpers/test_files.h @@ -17,3 +17,4 @@ extern std::string binaryNameSuffix; void retrieveBinaryKernelFilename(std::string &outputFilename, const std::string &kernelName, const std::string &extension, const std::string &options = ""); void retrieveBinaryKernelFilenameApiSpecific(std::string &outputFilename, const std::string &kernelName, const std::string &extension, const std::string &options = ""); +void appendBinaryNameSuffix(std::string &outputFileNameSuffix); \ No newline at end of file diff --git a/shared/test/common/mocks/mock_compilers.cpp b/shared/test/common/mocks/mock_compilers.cpp index 6cf1a0cca6..65873e3f1c 100644 --- a/shared/test/common/mocks/mock_compilers.cpp +++ b/shared/test/common/mocks/mock_compilers.cpp @@ -420,30 +420,41 @@ void translate(bool usingIgc, CIF::Builtins::BufferSimple *src, CIF::Builtins::B } } - std::string inputFile = ""; - inputFile.append(debugVars.fileName); - - std::string debugFile; - auto pos = inputFile.rfind("."); - debugFile = inputFile.substr(0, pos); - debugFile.append(".dbg"); - - if (debugVars.appendOptionsToFileName && - options->GetSizeRaw()) { - std::string opts(options->GetMemory(), options->GetMemory() + options->GetSize()); - // handle special option "-create-library" - just erase it - size_t pos = opts.find(CompilerOptions::createLibrary.data(), 0); - if (pos != std::string::npos) { - opts.erase(pos, CompilerOptions::createLibrary.length()); + std::string inputFile{}, debugFile{}; + std::string opts(options->GetMemory(), options->GetMemory() + options->GetSize()); + if (false == debugVars.fileName.empty()) { + auto fileBaseName = debugVars.fileName; + auto pos = debugVars.fileName.rfind("."); + auto extension = debugVars.fileName.substr(pos, debugVars.fileName.length()); + if (false == debugVars.fileNameSuffix.empty()) { + pos = debugVars.fileName.rfind(debugVars.fileNameSuffix); } - std::replace(opts.begin(), opts.end(), ' ', '_'); - inputFile.append(opts); + fileBaseName = fileBaseName.substr(0, pos); - if (debugVars.debugDataToReturn == nullptr) { - debugFile.append(opts); + if (debugVars.appendOptionsToFileName && false == opts.empty()) { + // handle special option "-create-library" - just erase it + auto optPos = opts.find(CompilerOptions::createLibrary.data(), 0); + if (optPos != std::string::npos) { + opts.erase(optPos, CompilerOptions::createLibrary.length()); + } + std::replace(opts.begin(), opts.end(), ' ', '_'); } + + inputFile.append(fileBaseName); + debugFile.append(fileBaseName); + + if (debugVars.appendOptionsToFileName && false == opts.empty()) { + auto optString = opts + "_"; + inputFile.append(optString); + debugFile.append(optString); + } + if (false == debugVars.fileNameSuffix.empty()) { + inputFile.append(debugVars.fileNameSuffix); + debugFile.append(debugVars.fileNameSuffix); + } + inputFile.append(extension); + debugFile.append(".dbg"); } - if ((debugVars.binaryToReturn != nullptr) || (debugVars.binaryToReturnSize != 0)) { out->setOutput(debugVars.binaryToReturn, debugVars.binaryToReturnSize); } else { diff --git a/shared/test/common/mocks/mock_compilers.h b/shared/test/common/mocks/mock_compilers.h index 5c99eebfa8..f631e5d765 100644 --- a/shared/test/common/mocks/mock_compilers.h +++ b/shared/test/common/mocks/mock_compilers.h @@ -46,6 +46,7 @@ struct MockCompilerDebugVars { std::string *receivedInput = nullptr; std::string fileName; + std::string fileNameSuffix; std::string translationContextCreationError; };