CMake: correct test kernels naming + minor improvements

- For test kernels compiled with options passed, change their naming to
following convention:
{basename}_{options_passed}_{suffix}.
- Correct CMake variables naming.
- Refactor logic of retrieving test kernels' data (also in compilers
mock)
- In relation to previous changes: do not generate unnecessary
.gen binary for L0 test kernel

Related-To: NEO-7285
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit is contained in:
Kacper Nowak
2022-08-31 19:16:06 +00:00
committed by Compute-Runtime-Automation
parent ceff16084d
commit b41eed8438
8 changed files with 76 additions and 55 deletions

View File

@ -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)