From 4647180c763ae2cd30e3d16f861eb07074b99921 Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Tue, 3 Jan 2023 11:46:57 +0000 Subject: [PATCH] refactor: remove platform type string this property is no longer needed as we compile kernels per product family Signed-off-by: Mateusz Jablonski --- cmake/common_macros.cmake | 6 - level_zero/core/test/common/CMakeLists.txt | 26 +-- level_zero/core/test/common/gen_kernel.cmake | 16 +- level_zero/core/test/unit_tests/main.cpp | 3 +- manifests/manifest.yml | 2 +- .../source/built_ins/kernels/CMakeLists.txt | 120 ---------- opencl/source/cl_device/cl_device_caps.cpp | 2 - opencl/test/unit_test/CMakeLists.txt | 207 +++++++++--------- .../unit_test/device/device_caps_tests.cpp | 4 - .../device/get_device_name_tests.cpp | 4 - opencl/test/unit_test/main.cpp | 3 +- .../unit_test/offline_compiler/CMakeLists.txt | 13 +- .../unit_test/offline_compiler/environment.h | 5 +- .../test/unit_test/offline_compiler/main.cpp | 18 +- .../offline_compiler_tests.cpp | 14 +- platforms.cmake | 3 - .../source/offline_compiler.cpp | 18 +- .../source/offline_compiler.h | 3 +- shared/source/built_ins/built_ins_storage.cpp | 2 +- .../source/built_ins/kernels/CMakeLists.txt | 168 +++++++------- .../device_binary_formats.h | 1 - .../device_binary_format/zebin_decoder.cpp | 17 +- shared/source/gen11/hw_info_ehl.cpp | 1 - shared/source/gen11/hw_info_icllp.cpp | 1 - shared/source/gen11/hw_info_lkf.cpp | 1 - shared/source/gen12lp/hw_info_adln.cpp | 1 - shared/source/gen12lp/hw_info_adlp.cpp | 1 - shared/source/gen12lp/hw_info_adls.cpp | 1 - shared/source/gen12lp/hw_info_dg1.cpp | 1 - shared/source/gen12lp/hw_info_rkl.cpp | 1 - shared/source/gen12lp/hw_info_tgllp.cpp | 1 - shared/source/gen8/hw_info_bdw.cpp | 1 - shared/source/gen9/hw_info_bxt.cpp | 1 - shared/source/gen9/hw_info_cfl.cpp | 1 - shared/source/gen9/hw_info_glk.cpp | 1 - shared/source/gen9/hw_info_kbl.cpp | 1 - shared/source/gen9/hw_info_skl.cpp | 1 - shared/source/helpers/hw_info.cpp | 18 -- shared/source/helpers/hw_info.h | 6 - .../source/xe_hp_core/hw_info_xe_hp_sdv.cpp | 1 - shared/source/xe_hpc_core/hw_info_pvc.cpp | 1 - shared/source/xe_hpg_core/hw_info_dg2.cpp | 1 - shared/source/xe_hpg_core/hw_info_mtl.cpp | 1 - shared/test/common/test_files/CMakeLists.txt | 56 ++--- .../unit_test/built_ins/builtin_tests.cpp | 12 +- .../zebin_decoder_tests.cpp | 28 ++- shared/test/unit_test/main.cpp | 3 +- 47 files changed, 298 insertions(+), 499 deletions(-) diff --git a/cmake/common_macros.cmake b/cmake/common_macros.cmake index 1973c0cb3c..e991d040f5 100644 --- a/cmake/common_macros.cmake +++ b/cmake/common_macros.cmake @@ -78,12 +78,6 @@ macro(apply_macro_for_each_platform) endforeach() endmacro() -macro(get_family_name_with_type core_type platform_type) - string(REPLACE "GEN" "Gen" core_type_capitalized ${core_type}) - string(TOLOWER ${platform_type} platform_type_lower) - set(family_name_with_type ${core_type_capitalized}${platform_type_lower}) -endmacro() - macro(append_sources_from_properties list_name) foreach(name ${ARGN}) get_property(${name} GLOBAL PROPERTY ${name}) diff --git a/level_zero/core/test/common/CMakeLists.txt b/level_zero/core/test/common/CMakeLists.txt index f7066d521a..d88b666732 100644 --- a/level_zero/core/test/common/CMakeLists.txt +++ b/level_zero/core/test/common/CMakeLists.txt @@ -22,24 +22,20 @@ set(TEST_KERNEL_BINDLESS ) set(l0_test_kernels_outputs) -macro(macro_for_each_core_type) - foreach(PLATFORM_TYPE ${PLATFORM_TYPES}) - foreach(REVISION_ID ${${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS}) - if(${CORE_TYPE}_HAS_${PLATFORM_TYPE}) - get_family_name_with_type(${CORE_TYPE} ${PLATFORM_TYPE}) - string(TOLOWER ${PLATFORM_TYPE} PLATFORM_TYPE_LOWER) - set(PLATFORM_LOWER ${DEFAULT_SUPPORTED_${CORE_TYPE}_${PLATFORM_TYPE}_PLATFORM}) - string(TOLOWER ${CORE_TYPE} CORE_TYPE_LOWER) - level_zero_generate_kernels(l0_test_kernel_outputs ${PLATFORM_LOWER} ${family_name_with_type} ${REVISION_ID} "-g" ${TEST_MODULES}) +macro(macro_for_each_platform) + foreach(REVISION_ID ${${PLATFORM_IT}_${CORE_TYPE}_REVISIONS}) + level_zero_generate_kernels(l0_test_kernel_outputs ${PLATFORM_IT_LOWER} ${REVISION_ID} "-g" ${TEST_MODULES}) - #skip Gen8 bindless kernel generation - if(NOT ("${CORE_TYPE_LOWER}" STREQUAL "gen8")) - level_zero_generate_kernels_with_internal_options(l0_bindless_test_kernel_outputs ${PLATFORM_LOWER} ${family_name_with_type} "bindless" ${REVISION_ID} "-g" ${TEST_KERNEL_BINDLESS_internal_options} ${TEST_KERNEL_BINDLESS}) - endif() - endif() - endforeach() + #skip Gen8 bindless kernel generation + if(NOT ("${CORE_TYPE_LOWER}" STREQUAL "gen8")) + level_zero_generate_kernels_with_internal_options(l0_bindless_test_kernel_outputs ${PLATFORM_IT_LOWER} "bindless" ${REVISION_ID} "-g" ${TEST_KERNEL_BINDLESS_internal_options} ${TEST_KERNEL_BINDLESS}) + endif() endforeach() endmacro() + +macro(macro_for_each_core_type) + apply_macro_for_each_platform("TESTED") +endmacro() apply_macro_for_each_core_type("TESTED") add_custom_target(l0_common_test_kernels DEPENDS ${l0_test_kernel_outputs} ${l0_bindless_test_kernel_outputs} copy_compiler_files) set_target_properties(l0_common_test_kernels PROPERTIES FOLDER ${TARGET_NAME_L0}) diff --git a/level_zero/core/test/common/gen_kernel.cmake b/level_zero/core/test/common/gen_kernel.cmake index 7fba0d1a46..76593b6fba 100644 --- a/level_zero/core/test/common/gen_kernel.cmake +++ b/level_zero/core/test/common/gen_kernel.cmake @@ -4,11 +4,11 @@ # SPDX-License-Identifier: MIT # -function(level_zero_generate_kernels target_list platform_name suffix revision_id options) +function(level_zero_generate_kernels target_list platform_name revision_id options) list(APPEND results copy_compiler_files) - set(relativeDir "level_zero/${suffix}/${revision_id}/test_files/${NEO_ARCH}") + set(relativeDir "level_zero/${platform_name}/${revision_id}/test_files/${NEO_ARCH}") set(outputdir "${TargetDir}/${relativeDir}/") @@ -18,7 +18,7 @@ function(level_zero_generate_kernels target_list platform_name suffix revision_i get_filename_component(workdir ${filepath} DIRECTORY) get_filename_component(absolute_filepath ${filepath} ABSOLUTE) - set(outputpath_base "${outputdir}${basename}_${suffix}") + set(outputpath_base "${outputdir}${basename}_${platform_name}") if(NOT NEO_DISABLE_BUILTINS_COMPILATION) set(output_files ${outputpath_base}.bin @@ -36,7 +36,7 @@ function(level_zero_generate_kernels target_list platform_name suffix revision_i list(APPEND ${target_list} ${output_files}) else() foreach(extension "bin" "spv") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${relativeDir}/${basename}_${suffix}.${extension}") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${relativeDir}/${basename}_${platform_name}.${extension}") add_custom_command( OUTPUT ${outputpath_base}.${extension} COMMAND ${CMAKE_COMMAND} -E make_directory ${outputdir} @@ -51,11 +51,11 @@ function(level_zero_generate_kernels target_list platform_name suffix revision_i set(${target_list} ${${target_list}} PARENT_SCOPE) endfunction() -function(level_zero_generate_kernels_with_internal_options target_list platform_name suffix prefix revision_id options internal_options) +function(level_zero_generate_kernels_with_internal_options target_list platform_name prefix revision_id options internal_options) list(APPEND results copy_compiler_files) - set(relativeDir "level_zero/${suffix}/${revision_id}/test_files/${NEO_ARCH}") + set(relativeDir "level_zero/${platform_name}/${revision_id}/test_files/${NEO_ARCH}") set(outputdir "${TargetDir}/${relativeDir}/") @@ -65,7 +65,7 @@ function(level_zero_generate_kernels_with_internal_options target_list platform_ get_filename_component(workdir ${filepath} DIRECTORY) get_filename_component(absolute_filepath ${filepath} ABSOLUTE) - set(outputpath_base "${outputdir}${prefix}_${basename}_${suffix}") + set(outputpath_base "${outputdir}${prefix}_${basename}_${platform_name}") if(NOT NEO_DISABLE_BUILTINS_COMPILATION) set(output_files @@ -86,7 +86,7 @@ function(level_zero_generate_kernels_with_internal_options target_list platform_ list(APPEND ${target_list} ${output_files}) else() foreach(extension "bin" "spv") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${relativeDir}/${prefix}_${basename}_${suffix}.${extension}") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${relativeDir}/${prefix}_${basename}_${platform_name}.${extension}") add_custom_command( OUTPUT ${outputpath_base}.${extension} COMMAND ${CMAKE_COMMAND} -E make_directory ${outputdir} diff --git a/level_zero/core/test/unit_tests/main.cpp b/level_zero/core/test/unit_tests/main.cpp index 1087a67c2b..2f0410aa7a 100644 --- a/level_zero/core/test/unit_tests/main.cpp +++ b/level_zero/core/test/unit_tests/main.cpp @@ -320,8 +320,7 @@ int main(int argc, char **argv) { listeners.Append(new NEO::MemoryLeakListener); listeners.Append(new NEO::BaseUltConfigListener); - binaryNameSuffix.append(NEO::familyName[hwInfoForTests.platform.eRenderCoreFamily]); - binaryNameSuffix.append(hwInfoForTests.capabilityTable.platformType); + binaryNameSuffix.append(NEO::hardwarePrefix[hwInfoForTests.platform.eProductFamily]); std::string testBinaryFiles = getRunPath(argv[0]); std::string testBinaryFilesApiSpecific = testBinaryFiles; diff --git a/manifests/manifest.yml b/manifests/manifest.yml index bbf07f602f..fb652f3907 100644 --- a/manifests/manifest.yml +++ b/manifests/manifest.yml @@ -38,7 +38,7 @@ components: dest_dir: kernels_bin type: git branch: kernels_bin - revision: 2007-507 + revision: 2007-515 kmdaf: branch: kmdaf dest_dir: kmdaf diff --git a/opencl/source/built_ins/kernels/CMakeLists.txt b/opencl/source/built_ins/kernels/CMakeLists.txt index 7a76d0d81a..adb6badd92 100644 --- a/opencl/source/built_ins/kernels/CMakeLists.txt +++ b/opencl/source/built_ins/kernels/CMakeLists.txt @@ -9,123 +9,3 @@ set_target_properties(builtins_vme_sources PROPERTIES FOLDER "${OPENCL_RUNTIME_P set(BUILTINS_OUTDIR_WITH_ARCH "${TargetDir}/built_ins/${NEO_ARCH}") add_dependencies(${BUILTINS_BINARIES_BINDFUL_LIB_NAME} builtins_vme_sources) add_subdirectories() -set(GENERATED_BUILTINS ${GENERATED_BUILTINS} PARENT_SCOPE) -set(GENERATED_BUILTINS_STATELESS ${GENERATED_BUILTINS_STATELESS} PARENT_SCOPE) - -set(BUILTIN_OPTIONS_STATELESS - "-cl-intel-greater-than-4GB-buffer-required" -) - -if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") - list(APPEND __ocloc__options__ "-D DEBUG") -endif() - -set(BUILTINS_INCLUDE_DIR ${TargetDir} PARENT_SCOPE) -set(BUILTIN_CPP "") - -function(get_bits_for_stateless core_type platform_type) - # Force 32bits compiling on gen9lp for stateless builtins - if((${CORE_TYPE} STREQUAL "GEN9") AND ((${PLATFORM_TYPE} STREQUAL "BXT") OR (${PLATFORM_TYPE} STREQUAL "GLK"))) - set(BITS "32" PARENT_SCOPE) - else() - set(BITS ${NEO_BITS} PARENT_SCOPE) - endif() -endfunction() - -function(get_builtin_options core_type neo_arch) - if("${neo_arch}" STREQUAL "x32") - set(BUILTIN_OPTIONS "-cl-intel-greater-than-4GB-buffer-required" PARENT_SCOPE) - elseif("${core_type}" STREQUAL "XE_HPC_CORE") - set(BUILTIN_OPTIONS "" PARENT_SCOPE) - else() - set(BUILTIN_OPTIONS "-force_stos_opt" PARENT_SCOPE) - endif() -endfunction() - -# Define function for compiling built-ins (with ocloc) -function(compile_builtin core_type platform_type builtin bits builtin_options) - string(TOLOWER ${core_type} core_type_lower) - get_family_name_with_type(${core_type} ${platform_type}) - set(OUTPUTDIR "${BUILTINS_OUTDIR_WITH_ARCH}/${core_type_lower}") - # get filename - set(FILENAME ${builtin}) - # get name of the file w/o extension - get_filename_component(BASENAME ${builtin} NAME_WE) - get_filename_component(absolute_filepath ${builtin} ABSOLUTE) - - set(OUTPUTPATH_BASE "${OUTPUTDIR}/${BASENAME}_${family_name_with_type}") - - # function returns builtin cpp filename - unset(BUILTIN_CPP) - list(APPEND __ocloc__options__ "-cl-kernel-arg-info") - if(NOT NEO_DISABLE_BUILTINS_COMPILATION) - set(OUTPUT_FILES - ${OUTPUTPATH_BASE}.spv - ${OUTPUTPATH_BASE}.bin - ${OUTPUTPATH_BASE}.cpp - ${OUTPUTPATH_BASE}.gen - ) - - add_custom_command( - OUTPUT ${OUTPUT_FILES} - COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${DEFAULT_SUPPORTED_${core_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -out_dir ${OUTPUTDIR} -options "$" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${builtin} ocloc copy_compiler_files - ) - # set variable outside function - set(BUILTIN_CPP built_ins/${NEO_ARCH}/${core_type_lower}/${BASENAME}_${family_name_with_type}.cpp PARENT_SCOPE) - else() - foreach(_file_name "spv" "bin" "gen") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/built_ins/${NEO_ARCH}/${core_type_lower}/${BASENAME}_${family_name_with_type}.${_file_name}") - if(EXISTS ${_file_prebuilt}) - add_custom_command( - OUTPUT ${OUTPUTPATH_BASE}.${_file_name} - COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTPUTDIR} - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_file_prebuilt} ${OUTPUTDIR} - ) - endif() - endforeach() - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/built_ins/${NEO_ARCH}/${core_type_lower}/${BASENAME}_${family_name_with_type}.cpp") - if(EXISTS ${_file_prebuilt}) - add_custom_command( - OUTPUT ${OUTPUTPATH_BASE}.cpp - COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTPUTDIR} - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_file_prebuilt} ${OUTPUTDIR} - ) - # set variable outside function - set(BUILTIN_CPP built_ins/${NEO_ARCH}/${core_type_lower}/${BASENAME}_${family_name_with_type}.cpp PARENT_SCOPE) - endif() - endif() -endfunction() - -macro(macro_for_each_core_type) - foreach(PLATFORM_TYPE ${PLATFORM_TYPES}) - if(${CORE_TYPE}_HAS_${PLATFORM_TYPE}) - get_family_name_with_type(${CORE_TYPE} ${PLATFORM_TYPE}) - string(TOLOWER ${PLATFORM_TYPE} PLATFORM_TYPE_LOWER) - unset(BUILTINS_COMMANDS) - foreach(GENERATED_BUILTIN ${GENERATED_BUILTINS}) - compile_builtin(${CORE_TYPE} ${PLATFORM_TYPE} ${GENERATED_BUILTIN}.builtin_kernel ${NEO_BITS} "${BUILTIN_OPTIONS}") - if(NOT ${BUILTIN_CPP} STREQUAL "") - list(APPEND BUILTINS_COMMANDS ${TargetDir}/${BUILTIN_CPP}) - endif() - endforeach() - get_bits_for_stateless(${CORE_TYPE} ${PLATFORM_TYPE}) - get_builtin_options(${CORE_TYPE} ${NEO_ARCH}) - foreach(GENERATED_BUILTIN_STATELESS ${GENERATED_BUILTINS_STATELESS}) - compile_builtin(${CORE_TYPE} ${PLATFORM_TYPE} ${GENERATED_BUILTIN_STATELESS}.builtin_kernel ${BITS} "${BUILTIN_OPTIONS_STATELESS}") - if(NOT ${BUILTIN_CPP} STREQUAL "") - list(APPEND BUILTINS_COMMANDS ${TargetDir}/${BUILTIN_CPP}) - endif() - endforeach() - if(NOT "${BUILTINS_COMMANDS}" STREQUAL "") - set(target_name builtins_${family_name_with_type}_vme) - add_custom_target(${target_name} DEPENDS ${BUILTINS_COMMANDS}) - add_dependencies(builtins ${target_name}) - set_target_properties(${target_name} PROPERTIES FOLDER "${OPENCL_RUNTIME_PROJECTS_FOLDER}/built_ins/${family_name_with_type}") - endif() - endif() - endforeach() -endmacro() - -apply_macro_for_each_core_type("SUPPORTED") diff --git a/opencl/source/cl_device/cl_device_caps.cpp b/opencl/source/cl_device/cl_device_caps.cpp index 941c4e81a2..1eb9ba0650 100644 --- a/opencl/source/cl_device/cl_device_caps.cpp +++ b/opencl/source/cl_device/cl_device_caps.cpp @@ -22,8 +22,6 @@ #include namespace NEO { -extern const char *familyName[]; - static std::string vendor = "Intel(R) Corporation"; static std::string profile = "FULL_PROFILE"; static std::string spirVersions = "1.2 "; diff --git a/opencl/test/unit_test/CMakeLists.txt b/opencl/test/unit_test/CMakeLists.txt index 8e3d42a2e7..c3694905cb 100644 --- a/opencl/test/unit_test/CMakeLists.txt +++ b/opencl/test/unit_test/CMakeLists.txt @@ -127,8 +127,8 @@ target_include_directories(igdrcl_tests BEFORE PRIVATE ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/includes${BRANCH_DIR_SUFFIX} ) -function(neo_gen_kernels platform_name_with_type platform_name revision_id suffix forcePatchtokenFormat) - set(outputdir "${TargetDir}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/") +function(neo_gen_kernels platform_it_lower revision_id forcePatchtokenFormat) + set(outputdir "${TargetDir}/${platform_it_lower}/${revision_id}/test_files/${NEO_ARCH}/") if(forcePatchtokenFormat) set(formatArgument "--format" "patchtokens") @@ -141,7 +141,7 @@ function(neo_gen_kernels platform_name_with_type platform_name revision_id suffi get_filename_component(workdir ${filepath} DIRECTORY) get_filename_component(absolute_filepath ${filepath} ABSOLUTE) - set(outputpath_base "${outputdir}${basename}_${suffix}") + set(outputpath_base "${outputdir}${basename}_${platform_it_lower}") if(NOT NEO_DISABLE_BUILTINS_COMPILATION) set(output_files ${outputpath_base}.spv @@ -150,7 +150,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 -file ${absolute_filepath} -device ${platform_name} -${NEO_BITS} -revision_id ${revision_id} -out_dir ${outputdir} ${formatArgument} + COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_it_lower} -${NEO_BITS} -revision_id ${revision_id} -out_dir ${outputdir} ${formatArgument} WORKING_DIRECTORY ${workdir} DEPENDS ${filepath} ocloc ) @@ -158,22 +158,22 @@ function(neo_gen_kernels platform_name_with_type platform_name revision_id suffi list(APPEND kernels_to_compile ${output_files}) else() foreach(extension "spv" "bin") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${suffix}.${extension}") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${platform_it_lower}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${platform_it_lower}.${extension}") add_custom_command( 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}.${extension}) + list(APPEND kernels_to_compile_${platform_it_lower}_${revision_id} ${outputpath_base}.${extension}) endforeach() endif() endforeach() - list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${kernels_to_compile}) - set(kernels_to_compile_${platform_name_with_type}_${revision_id} ${kernels_to_compile_${platform_name_with_type}_${revision_id}} PARENT_SCOPE) + list(APPEND kernels_to_compile_${platform_it_lower}_${revision_id} ${kernels_to_compile}) + set(kernels_to_compile_${platform_it_lower}_${revision_id} ${kernels_to_compile_${platform_it_lower}_${revision_id}} PARENT_SCOPE) endfunction() -function(neo_gen_kernels_with_options platform_name_with_type platform_name revision_id suffix filepath) +function(neo_gen_kernels_with_options platform_it_lower revision_id filepath) set(kernels_to_compile) foreach(filearg ${filepath}) get_filename_component(filename ${filearg} NAME) @@ -181,13 +181,13 @@ function(neo_gen_kernels_with_options platform_name_with_type platform_name revi get_filename_component(base_workdir ${filearg} DIRECTORY) get_filename_component(absolute_filepath ${filearg} ABSOLUTE) - set(outputdir "${TargetDir}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/") + set(outputdir "${TargetDir}/${platform_it_lower}/${revision_id}/test_files/${NEO_ARCH}/") set(workdir "${CMAKE_CURRENT_SOURCE_DIR}/${base_workdir}/") foreach(arg ${ARGN}) string(REPLACE " " "_" argwospaces ${arg}) set(base_filename ${basename}_${argwospaces}) - set(outputpath_base "${outputdir}/${base_filename}_${suffix}") + set(outputpath_base "${outputdir}/${base_filename}_${platform_it_lower}") if(NOT NEO_DISABLE_BUILTINS_COMPILATION) set(output_files ${outputpath_base}.spv @@ -196,30 +196,30 @@ function(neo_gen_kernels_with_options platform_name_with_type platform_name revi add_custom_command( OUTPUT ${output_files} - COMMAND ${ocloc_cmd_prefix} -file ${absolute_filepath} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id} -options ${arg} -output ${base_filename} + COMMAND ${ocloc_cmd_prefix} -file ${absolute_filepath} -device ${platform_it_lower} -${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(extension "spv" "bin") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${base_filename}_${suffix}.${extension}") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${platform_it_lower}/${revision_id}/test_files/${NEO_ARCH}/${base_filename}_${platform_it_lower}.${extension}") add_custom_command( 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}.${extension}) + list(APPEND kernels_to_compile_${platform_it_lower}_${revision_id} ${outputpath_base}.${extension}) endforeach() endif() endforeach() endforeach() - list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${kernels_to_compile}) - set(kernels_to_compile_${platform_name_with_type}_${revision_id} ${kernels_to_compile_${platform_name_with_type}_${revision_id}} PARENT_SCOPE) + list(APPEND kernels_to_compile_${platform_it_lower}_${revision_id} ${kernels_to_compile}) + set(kernels_to_compile_${platform_it_lower}_${revision_id} ${kernels_to_compile_${platform_it_lower}_${revision_id}} PARENT_SCOPE) endfunction() -function(neo_gen_kernels_with_internal_options platform_name_with_type platform_name revision_id suffix filepath output_name_prefix) +function(neo_gen_kernels_with_internal_options platform_it_lower revision_id filepath output_name_prefix) set(kernels_to_compile) set(filearg ${filepath}) @@ -228,14 +228,14 @@ function(neo_gen_kernels_with_internal_options platform_name_with_type platform_ get_filename_component(base_workdir ${filearg} DIRECTORY) get_filename_component(absolute_filepath ${filearg} ABSOLUTE) - set(outputdir "${TargetDir}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/") + set(outputdir "${TargetDir}/${platform_it_lower}/${revision_id}/test_files/${NEO_ARCH}/") set(workdir "${CMAKE_CURRENT_SOURCE_DIR}/${base_workdir}/") if(NOT "${output_name_prefix}" STREQUAL "") set(basename ${output_name_prefix}_${basename}) endif() - set(outputpath_base "${outputdir}/${basename}_${suffix}") + set(outputpath_base "${outputdir}/${basename}_${platform_it_lower}") if(NOT NEO_DISABLE_BUILTINS_COMPILATION) set(output_files ${outputpath_base}.spv @@ -248,25 +248,25 @@ function(neo_gen_kernels_with_internal_options platform_name_with_type platform_ add_custom_command( OUTPUT ${output_files} - COMMAND ${ocloc_cmd_prefix} -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_it_lower} -revision_id ${revision_id} -${NEO_BITS} -out_dir ${outputdir} ${output_name} -internal_options ${ARGN} WORKING_DIRECTORY ${workdir} DEPENDS ${filearg} ocloc ) - list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${output_files}) + list(APPEND kernels_to_compile_${platform_it_lower}_${revision_id} ${output_files}) else() foreach(extension "spv" "bin") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${suffix}.${extension}") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${platform_it_lower}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${platform_it_lower}.${extension}") add_custom_command( 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}.${extension}) + list(APPEND kernels_to_compile_${platform_it_lower}_${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) + set(kernels_to_compile_${platform_it_lower}_${revision_id} ${kernels_to_compile_${platform_it_lower}_${revision_id}} PARENT_SCOPE) endfunction() set(TEST_KERNEL test_files/CopyBuffer_simd16.cl) @@ -332,95 +332,92 @@ list(REMOVE_ITEM TEST_KERNELS "${CMAKE_CURRENT_SOURCE_DIR}/test_files/stateless_ list(REMOVE_ITEM TEST_KERNELS ${TEST_KERNEL_VME}) list(REMOVE_ITEM TEST_KERNELS "${CMAKE_CURRENT_SOURCE_DIR}/${TEST_KERNEL_PRINTF}") -macro(macro_for_each_core_type) - foreach(PLATFORM_TYPE ${PLATFORM_TYPES}) - if(${CORE_TYPE}_HAS_${PLATFORM_TYPE}) - get_family_name_with_type(${CORE_TYPE} ${PLATFORM_TYPE}) - string(TOLOWER ${PLATFORM_TYPE} PLATFORM_TYPE_LOWER) - set(PLATFORM_LOWER ${DEFAULT_SUPPORTED_${CORE_TYPE}_${PLATFORM_TYPE}_PLATFORM}) - set(PLATFORM_2_0_LOWER ${DEFAULT_SUPPORTED_2_0_${CORE_TYPE}_${PLATFORM_TYPE}_PLATFORM}) - set(PLATFORM_VME_LOWER ${DEFAULT_SUPPORTED_VME_${CORE_TYPE}_${PLATFORM_TYPE}_PLATFORM}) +macro(macro_for_each_platform) + set(PLATFORM_2_0_LOWER ${DEFAULT_SUPPORTED_2_0_${CORE_TYPE}_${PLATFORM_IT}_PLATFORM}) + set(PLATFORM_VME_LOWER ${DEFAULT_SUPPORTED_VME_${CORE_TYPE}_${PLATFORM_IT}_PLATFORM}) - set(PLATFORM_TEST_KERNELS ${TEST_KERNELS}) - set(IMAGE_SUPPORT FALSE) - CORE_CONTAINS_PLATFORMS("SUPPORTED_IMAGES" ${CORE_TYPE} IMAGE_SUPPORT) - if(NOT IMAGE_SUPPORT) - list(REMOVE_ITEM PLATFORM_TEST_KERNELS "${CMAKE_CURRENT_SOURCE_DIR}/test_files/copy_buffer_to_image.cl") - endif() + set(PLATFORM_TEST_KERNELS ${TEST_KERNELS}) + set(IMAGE_SUPPORT FALSE) + CORE_CONTAINS_PLATFORMS("SUPPORTED_IMAGES" ${CORE_TYPE} IMAGE_SUPPORT) + if(NOT IMAGE_SUPPORT) + list(REMOVE_ITEM PLATFORM_TEST_KERNELS "${CMAKE_CURRENT_SOURCE_DIR}/test_files/copy_buffer_to_image.cl") + endif() - foreach(KERNEL_TO_REMOVE ${${CORE_TYPE}_TEST_KERNELS_BLOCKLIST}) - set(KERNEL_TO_REMOVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/test_files/${KERNEL_TO_REMOVE}") - list(REMOVE_ITEM PLATFORM_TEST_KERNELS ${KERNEL_TO_REMOVE_PATH}) - endforeach() + foreach(KERNEL_TO_REMOVE ${${CORE_TYPE}_TEST_KERNELS_BLOCKLIST}) + set(KERNEL_TO_REMOVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/test_files/${KERNEL_TO_REMOVE}") + list(REMOVE_ITEM PLATFORM_TEST_KERNELS ${KERNEL_TO_REMOVE_PATH}) + endforeach() - if(MSVC OR CMAKE_SIZEOF_VOID_P EQUAL 8) - foreach(REVISION_ID ${${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS}) - neo_gen_kernels(${family_name_with_type} ${PLATFORM_LOWER} ${REVISION_ID} ${family_name_with_type} FALSE ${PLATFORM_TEST_KERNELS}) - neo_gen_kernels_with_options(${family_name_with_type} ${PLATFORM_LOWER} ${REVISION_ID} ${family_name_with_type} ${TEST_KERNEL} ${TEST_KERNEL_options}) - endforeach() + if(MSVC OR CMAKE_SIZEOF_VOID_P EQUAL 8) + foreach(REVISION_ID ${${PLATFORM_IT}_${CORE_TYPE}_REVISIONS}) + neo_gen_kernels(${PLATFORM_IT_LOWER} ${REVISION_ID} FALSE ${PLATFORM_TEST_KERNELS}) + neo_gen_kernels_with_options(${PLATFORM_IT_LOWER} ${REVISION_ID} ${TEST_KERNEL} ${TEST_KERNEL_options}) + endforeach() - #compile gen specific kernels if any were found - file(GLOB_RECURSE ${CORE_TYPE_LOWER}_TEST_KERNELS test_files/*.${CORE_TYPE_LOWER}) - if(NOT "${${CORE_TYPE_LOWER}_TEST_KERNELS}" STREQUAL "") - foreach(REVISION_ID ${${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS}) - neo_gen_kernels(${family_name_with_type} ${PLATFORM_LOWER} ${REVISION_ID} ${family_name_with_type} FALSE ${${CORE_TYPE_LOWER}_TEST_KERNELS}) - endforeach() - endif() - - # Compile platform specific kernels if any were found - file(GLOB_RECURSE ${PLATFORM_LOWER}_TEST_KERNELS test_files/*.${PLATFORM_LOWER}) - if(NOT "${${PLATFORM_LOWER}_TEST_KERNELS}" STREQUAL "") - foreach(REVISION_ID ${${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS}) - neo_gen_kernels(${family_name_with_type} ${PLATFORM_LOWER} ${REVISION_ID} ${family_name_with_type} FALSE ${${PLATFORM_LOWER}_TEST_KERNELS}) - endforeach() - endif() - - # Gen9lp needs extra -m32 flag - if(("${CORE_TYPE_LOWER}" STREQUAL "gen9") AND (("${PLATFORM_TYPE_LOWER}" STREQUAL "bxt") OR ("${PLATFORM_TYPE_LOWER}" STREQUAL "glk"))) - foreach(REVISION_ID ${${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS}) - neo_gen_kernels_with_internal_options(${family_name_with_type} ${PLATFORM_LOWER} ${REVISION_ID} ${family_name_with_type} ${TEST_KERNEL_PRINTF} "" ${TEST_KERNEL_PRINTF_internal_options_gen9lp}) - neo_gen_kernels_with_internal_options(${family_name_with_type} ${PLATFORM_LOWER} ${REVISION_ID} ${family_name_with_type} ${TEST_KERNEL_STATELESS} "" ${TEST_KERNEL_STATELESS_internal_options_gen9lp}) - endforeach() - else() - foreach(REVISION_ID ${${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS}) - neo_gen_kernels_with_internal_options(${family_name_with_type} ${PLATFORM_LOWER} ${REVISION_ID} ${family_name_with_type} ${TEST_KERNEL_PRINTF} "" " ") - neo_gen_kernels_with_internal_options(${family_name_with_type} ${PLATFORM_LOWER} ${REVISION_ID} ${family_name_with_type} ${TEST_KERNEL_STATELESS} "" ${TEST_KERNEL_STATELESS_internal_options}) - endforeach() - endif() - - set(BINDLESS_KERNELS_IMAGES "") - if(IMAGE_SUPPORT) - set(BINDLESS_KERNELS_IMAGES ${TEST_KERNEL_BINDLESS_IMAGES}) - endif() - - foreach(file ${TEST_KERNEL_BINDLESS} ${BINDLESS_KERNELS_IMAGES}) - foreach(REVISION_ID ${${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS}) - if(NOT ("${CORE_TYPE_LOWER}" STREQUAL "gen8")) - neo_gen_kernels_with_internal_options(${family_name_with_type} ${PLATFORM_LOWER} ${REVISION_ID} ${family_name_with_type} ${file} "bindless" ${TEST_KERNEL_BINDLESS_internal_options}) - endif() - endforeach() - endforeach() - - if(PLATFORM_2_0_LOWER) - foreach(REVISION_ID ${${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS}) - neo_gen_kernels_with_options(${family_name_with_type} ${PLATFORM_2_0_LOWER} ${REVISION_ID} ${family_name_with_type} "${TEST_KERNEL_2_0}" ${TEST_KERNEL_2_0_options}) - endforeach() - endif() - if(PLATFORM_VME_LOWER) - foreach(REVISION_ID ${${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS}) - neo_gen_kernels(${family_name_with_type} ${PLATFORM_VME_LOWER} ${REVISION_ID} ${family_name_with_type} TRUE ${TEST_KERNEL_VME}) - endforeach() - endif() - endif() - - foreach(REVISION_ID ${${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS}) - add_custom_target(prepare_test_kernels_${family_name_with_type}_${REVISION_ID} DEPENDS ${kernels_to_compile_${family_name_with_type}_${REVISION_ID}} copy_compiler_files) - add_dependencies(prepare_test_kernels_for_ocl prepare_test_kernels_${family_name_with_type}_${REVISION_ID}) - set_target_properties(prepare_test_kernels_${family_name_with_type}_${REVISION_ID} PROPERTIES FOLDER "${PLATFORM_SPECIFIC_TEST_TARGETS_FOLDER}/${family_name_with_type}/${REVISION_ID}") + #compile gen specific kernels if any were found + file(GLOB_RECURSE ${CORE_TYPE_LOWER}_TEST_KERNELS test_files/*.${CORE_TYPE_LOWER}) + if(NOT "${${CORE_TYPE_LOWER}_TEST_KERNELS}" STREQUAL "") + foreach(REVISION_ID ${${PLATFORM_IT}_${CORE_TYPE}_REVISIONS}) + neo_gen_kernels(${PLATFORM_IT_LOWER} ${REVISION_ID} FALSE ${${CORE_TYPE_LOWER}_TEST_KERNELS}) endforeach() endif() + + # Compile platform specific kernels if any were found + file(GLOB_RECURSE ${PLATFORM_IT_LOWER}_TEST_KERNELS test_files/*.${PLATFORM_IT_LOWER}) + if(NOT "${${PLATFORM_IT_LOWER}_TEST_KERNELS}" STREQUAL "") + foreach(REVISION_ID ${${PLATFORM_IT}_${CORE_TYPE}_REVISIONS}) + neo_gen_kernels(${PLATFORM_IT_LOWER} ${REVISION_ID} FALSE ${${PLATFORM_IT_LOWER}_TEST_KERNELS}) + endforeach() + endif() + + # Gen9lp needs extra -m32 flag + if(("${CORE_TYPE_LOWER}" STREQUAL "gen9") AND (("${PLATFORM_IT_LOWER}" STREQUAL "bxt") OR ("${PLATFORM_IT_LOWER}" STREQUAL "glk"))) + foreach(REVISION_ID ${${PLATFORM_IT}_${CORE_TYPE}_REVISIONS}) + neo_gen_kernels_with_internal_options(${PLATFORM_IT_LOWER} ${REVISION_ID} ${TEST_KERNEL_PRINTF} "" ${TEST_KERNEL_PRINTF_internal_options_gen9lp}) + neo_gen_kernels_with_internal_options(${PLATFORM_IT_LOWER} ${REVISION_ID} ${TEST_KERNEL_STATELESS} "" ${TEST_KERNEL_STATELESS_internal_options_gen9lp}) + endforeach() + else() + foreach(REVISION_ID ${${PLATFORM_IT}_${CORE_TYPE}_REVISIONS}) + neo_gen_kernels_with_internal_options(${PLATFORM_IT_LOWER} ${REVISION_ID} ${TEST_KERNEL_PRINTF} "" " ") + neo_gen_kernels_with_internal_options(${PLATFORM_IT_LOWER} ${REVISION_ID} ${TEST_KERNEL_STATELESS} "" ${TEST_KERNEL_STATELESS_internal_options}) + endforeach() + endif() + + set(BINDLESS_KERNELS_IMAGES "") + if(IMAGE_SUPPORT) + set(BINDLESS_KERNELS_IMAGES ${TEST_KERNEL_BINDLESS_IMAGES}) + endif() + + foreach(file ${TEST_KERNEL_BINDLESS} ${BINDLESS_KERNELS_IMAGES}) + foreach(REVISION_ID ${${PLATFORM_IT}_${CORE_TYPE}_REVISIONS}) + if(NOT ("${CORE_TYPE_LOWER}" STREQUAL "gen8")) + neo_gen_kernels_with_internal_options(${PLATFORM_IT_LOWER} ${REVISION_ID} ${file} "bindless" ${TEST_KERNEL_BINDLESS_internal_options}) + endif() + endforeach() + endforeach() + + if(PLATFORM_2_0_LOWER) + foreach(REVISION_ID ${${PLATFORM_IT}_${CORE_TYPE}_REVISIONS}) + neo_gen_kernels_with_options(${PLATFORM_IT_LOWER} ${REVISION_ID} "${TEST_KERNEL_2_0}" ${TEST_KERNEL_2_0_options}) + endforeach() + endif() + if(PLATFORM_VME_LOWER) + foreach(REVISION_ID ${${PLATFORM_IT}_${CORE_TYPE}_REVISIONS}) + neo_gen_kernels(${PLATFORM_IT_LOWER} ${REVISION_ID} TRUE ${TEST_KERNEL_VME}) + endforeach() + endif() + endif() + + foreach(REVISION_ID ${${PLATFORM_IT}_${CORE_TYPE}_REVISIONS}) + add_custom_target(prepare_test_kernels_${PLATFORM_IT_LOWER}_${REVISION_ID} DEPENDS ${kernels_to_compile_${PLATFORM_IT_LOWER}_${REVISION_ID}} copy_compiler_files) + add_dependencies(prepare_test_kernels_for_ocl prepare_test_kernels_${PLATFORM_IT_LOWER}_${REVISION_ID}) + set_target_properties(prepare_test_kernels_${PLATFORM_IT_LOWER}_${REVISION_ID} PROPERTIES FOLDER "${PLATFORM_SPECIFIC_TEST_TARGETS_FOLDER}/${PLATFORM_IT_LOWER}/${REVISION_ID}") endforeach() endmacro() + +macro(macro_for_each_core_type) + apply_macro_for_each_platform("TESTED") +endmacro() apply_macro_for_each_core_type("TESTED") add_subdirectories() create_project_source_tree(igdrcl_tests) diff --git a/opencl/test/unit_test/device/device_caps_tests.cpp b/opencl/test/unit_test/device/device_caps_tests.cpp index bbaa6f02c8..b7e1c5cce6 100644 --- a/opencl/test/unit_test/device/device_caps_tests.cpp +++ b/opencl/test/unit_test/device/device_caps_tests.cpp @@ -34,10 +34,6 @@ #include -namespace NEO { -extern const char *familyName[]; -} // namespace NEO - using namespace NEO; struct DeviceGetCapsTest : public ::testing::Test { diff --git a/opencl/test/unit_test/device/get_device_name_tests.cpp b/opencl/test/unit_test/device/get_device_name_tests.cpp index 579295d0c5..4fcd101182 100644 --- a/opencl/test/unit_test/device/get_device_name_tests.cpp +++ b/opencl/test/unit_test/device/get_device_name_tests.cpp @@ -12,10 +12,6 @@ #include "gtest/gtest.h" -namespace NEO { -extern const char *familyName[]; -} // namespace NEO - using namespace NEO; using DeviceNameTest = ::testing::Test; diff --git a/opencl/test/unit_test/main.cpp b/opencl/test/unit_test/main.cpp index b8d833ed7c..a7cefdf908 100644 --- a/opencl/test/unit_test/main.cpp +++ b/opencl/test/unit_test/main.cpp @@ -301,8 +301,7 @@ int main(int argc, char **argv) { gtSystemInfo.MaxSubSlicesSupported = std::max(gtSystemInfo.MaxSubSlicesSupported, gtSystemInfo.SubSliceCount); // clang-format on - binaryNameSuffix.append(familyName[hwInfoForTests.platform.eRenderCoreFamily]); - binaryNameSuffix.append(hwInfoForTests.capabilityTable.platformType); + binaryNameSuffix.append(hardwarePrefix[hwInfoForTests.platform.eProductFamily]); std::string nBinaryKernelFiles = getRunPath(argv[0]); nBinaryKernelFiles.append("/"); diff --git a/opencl/test/unit_test/offline_compiler/CMakeLists.txt b/opencl/test/unit_test/offline_compiler/CMakeLists.txt index 905eadfeaa..28cbdf8d69 100644 --- a/opencl/test/unit_test/offline_compiler/CMakeLists.txt +++ b/opencl/test/unit_test/offline_compiler/CMakeLists.txt @@ -163,15 +163,10 @@ endif() macro(macro_for_each_platform) if("${PLATFORM_IT_LOWER}" STREQUAL "${CLOC_LIB_DEFAULT_DEVICE}") - foreach(PLATFORM_TYPE ${PLATFORM_TYPES}) - if(${PLATFORM_IT}_IS_${PLATFORM_TYPE}) - list(GET ${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS 0 REVISION_ID) - get_family_name_with_type(${CORE_TYPE} ${PLATFORM_TYPE}) - add_dependencies(run_ocloc_tests prepare_test_kernels_${family_name_with_type}_${REVISION_ID}) - add_dependencies(unit_tests prepare_test_kernels_${family_name_with_type}_${REVISION_ID}) - set(run_tests_cmd ocloc_tests --device ${CLOC_LIB_DEFAULT_DEVICE} --family_type ${family_name_with_type} --rev_id ${REVISION_ID}) - endif() - endforeach() + list(GET ${PLATFORM_IT}_${CORE_TYPE}_REVISIONS 0 REVISION_ID) + add_dependencies(run_ocloc_tests prepare_test_kernels_${PLATFORM_IT_LOWER}_${REVISION_ID}) + add_dependencies(unit_tests prepare_test_kernels_${PLATFORM_IT_LOWER}_${REVISION_ID}) + set(run_tests_cmd ocloc_tests --device ${PLATFORM_IT_LOWER} --rev_id ${REVISION_ID}) endif() endmacro() macro(macro_for_each_core_type) diff --git a/opencl/test/unit_test/offline_compiler/environment.h b/opencl/test/unit_test/offline_compiler/environment.h index 4fad08f339..257b38f882 100644 --- a/opencl/test/unit_test/offline_compiler/environment.h +++ b/opencl/test/unit_test/offline_compiler/environment.h @@ -17,8 +17,8 @@ class Environment : public ::testing::Environment { public: - Environment(const std::string &devicePrefix, const std::string productConfig, const std::string &familyNameWithType) - : devicePrefix(devicePrefix), productConfig(productConfig), familyNameWithType(familyNameWithType) { + Environment(const std::string &devicePrefix, const std::string productConfig) + : devicePrefix(devicePrefix), productConfig(productConfig) { } void SetInputFileName( // NOLINT(readability-identifier-naming) @@ -53,5 +53,4 @@ class Environment : public ::testing::Environment { const std::string devicePrefix; const std::string productConfig; - const std::string familyNameWithType; }; diff --git a/opencl/test/unit_test/offline_compiler/main.cpp b/opencl/test/unit_test/offline_compiler/main.cpp index fc15682dc5..0b137b0126 100644 --- a/opencl/test/unit_test/offline_compiler/main.cpp +++ b/opencl/test/unit_test/offline_compiler/main.cpp @@ -51,7 +51,6 @@ int main(int argc, char **argv) { std::string dumpTestStatsFileName = ""; std::string devicePrefix("skl"); - std::string familyNameWithType("Gen9core"); std::string revId("0"); std::string productConfig(""); @@ -86,9 +85,6 @@ int main(int argc, char **argv) { } else if (strcmp("--device", argv[i]) == 0) { ++i; devicePrefix = argv[i]; - } else if (strcmp("--family_type", argv[i]) == 0) { - ++i; - familyNameWithType = argv[i]; } else if (strcmp("--rev_id", argv[i]) == 0) { ++i; revId = argv[i]; @@ -127,13 +123,13 @@ int main(int argc, char **argv) { // working directories std::string nTestFiles = getRunPath(); nTestFiles.append("/"); - nTestFiles.append(familyNameWithType); + nTestFiles.append(devicePrefix); nTestFiles.append("/"); nTestFiles.append(revId); nTestFiles.append("/"); nTestFiles.append(testFiles); testFiles = nTestFiles; - binaryNameSuffix.append(familyNameWithType); + binaryNameSuffix.append(devicePrefix); std::string nClFiles = NEO_OPENCL_TEST_FILES_DIR; nClFiles.append("/"); @@ -141,13 +137,13 @@ int main(int argc, char **argv) { #ifdef WIN32 #include - if (_chdir(familyNameWithType.c_str())) { - std::cout << "chdir into " << familyNameWithType << " directory failed.\nThis might cause test failures." << std::endl; + if (_chdir(devicePrefix.c_str())) { + std::cout << "chdir into " << devicePrefix << " directory failed.\nThis might cause test failures." << std::endl; } #elif defined(__linux__) #include - if (chdir(familyNameWithType.c_str()) != 0) { - std::cout << "chdir into " << familyNameWithType << " directory failed.\nThis might cause test failures." << std::endl; + if (chdir(devicePrefix.c_str()) != 0) { + std::cout << "chdir into " << devicePrefix << " directory failed.\nThis might cause test failures." << std::endl; } #endif @@ -161,7 +157,7 @@ int main(int argc, char **argv) { } listeners.Append(new NEO::VirtualFileSystemListener); - gEnvironment = reinterpret_cast(::testing::AddGlobalTestEnvironment(new Environment(devicePrefix, productConfig, familyNameWithType))); + gEnvironment = reinterpret_cast(::testing::AddGlobalTestEnvironment(new Environment(devicePrefix, productConfig))); int sigOut = setAlarm(enableAlarm); if (sigOut != 0) { 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 b5e534e784..23326c15d6 100644 --- a/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp @@ -69,7 +69,7 @@ void MultiCommandTests::deleteOutFileList() { std::string getCompilerOutputFileName(const std::string &fileName, const std::string &type) { std::string fName(fileName); fName.append("_"); - fName.append(gEnvironment->familyNameWithType); + fName.append(gEnvironment->devicePrefix); fName.append("."); fName.append(type); return fName; @@ -1955,17 +1955,17 @@ TEST_F(OfflineCompilerTests, WhenParsingBinToCharArrayThenCorrectFileIsGenerated }; // clang-format on - std::string familyNameWithType = gEnvironment->familyNameWithType; + std::string devicePrefix = gEnvironment->devicePrefix; std::string fileName = "scheduler"; std::string retArray = pOfflineCompiler->parseBinAsCharArray(binary, sizeof(binary), fileName); std::string target = "#include \n" "#include \n\n" "size_t SchedulerBinarySize_" + - familyNameWithType + " = 37;\n" - "uint32_t SchedulerBinary_" + - familyNameWithType + "[10] = {\n" - " 0x40032302, 0x90800756, 0x05340301, 0x66097860, 0x101010ff, 0x40032302, 0x90800756, 0x05340301, \n" - " 0x66097860, 0xff000000};\n"; + devicePrefix + " = 37;\n" + "uint32_t SchedulerBinary_" + + devicePrefix + "[10] = {\n" + " 0x40032302, 0x90800756, 0x05340301, 0x66097860, 0x101010ff, 0x40032302, 0x90800756, 0x05340301, \n" + " 0x66097860, 0xff000000};\n"; EXPECT_EQ(retArray, target); delete pOfflineCompiler; diff --git a/platforms.cmake b/platforms.cmake index 7afa007ec2..f3525bbb72 100644 --- a/platforms.cmake +++ b/platforms.cmake @@ -200,11 +200,8 @@ macro(DISABLE_FLAGS_FOR CORE_TYPE) endmacro() macro(ADD_PLATFORM_FOR_CORE_TYPE LIST_TYPE CORE_TYPE PLATFORM_NAME) - list(APPEND PLATFORM_TYPES ${PLATFORM_NAME}) - list(REMOVE_DUPLICATES PLATFORM_TYPES) ADD_ITEM_FOR_CORE_TYPE("PLATFORMS" ${LIST_TYPE} ${CORE_TYPE} ${PLATFORM_NAME}) set(${CORE_TYPE}_HAS_${PLATFORM_NAME} TRUE) - set(${PLATFORM_NAME}_IS_${PLATFORM_NAME} TRUE) if(NOT DEFAULT_${LIST_TYPE}_${CORE_TYPE}_${PLATFORM_NAME}_PLATFORM) string(TOLOWER ${PLATFORM_NAME} DEFAULT_${LIST_TYPE}_${CORE_TYPE}_${PLATFORM_NAME}_PLATFORM) endif() diff --git a/shared/offline_compiler/source/offline_compiler.cpp b/shared/offline_compiler/source/offline_compiler.cpp index b09b9a6c9e..1a0bdbcc1f 100644 --- a/shared/offline_compiler/source/offline_compiler.cpp +++ b/shared/offline_compiler/source/offline_compiler.cpp @@ -425,12 +425,6 @@ std::string &OfflineCompiler::getBuildLog() { return buildLog; } -void OfflineCompiler::setFamilyType() { - familyNameWithType.clear(); - familyNameWithType.append(familyName[hwInfo.platform.eRenderCoreFamily]); - familyNameWithType.append(hwInfo.capabilityTable.platformType); -} - int OfflineCompiler::initHardwareInfoForDeprecatedAcronyms(std::string deviceName, int deviceId) { std::vector allSupportedProduct{ALL_SUPPORTED_PRODUCT_FAMILIES}; std::transform(deviceName.begin(), deviceName.end(), deviceName.begin(), ::tolower); @@ -448,7 +442,7 @@ int OfflineCompiler::initHardwareInfoForDeprecatedAcronyms(std::string deviceNam setHwInfoValuesFromConfig(config, hwInfo); hardwareInfoBaseSetup[hwInfo.platform.eProductFamily](&hwInfo, true); - setFamilyType(); + productFamilyName = hardwarePrefix[hwInfo.platform.eProductFamily]; return SUCCESS; } } @@ -474,7 +468,7 @@ int OfflineCompiler::initHardwareInfoForProductConfig(std::string deviceName) { hwInfo.platform.usRevId = revisionId; } deviceConfig = productConfig; - setFamilyType(); + productFamilyName = hardwarePrefix[hwInfo.platform.eProductFamily]; return SUCCESS; } argHelper->printf("Could not determine target based on product config: %s\n", deviceName.c_str()); @@ -831,8 +825,8 @@ std::string OfflineCompiler::parseBinAsCharArray(uint8_t *binary, size_t size, s // Convert binary to cpp out << "#include \n"; out << "#include \n\n"; - out << "size_t " << builtinName << "BinarySize_" << familyNameWithType << " = " << size << ";\n"; - out << "uint32_t " << builtinName << "Binary_" << familyNameWithType << "[" << (size + 3) / 4 << "] = {" + out << "size_t " << builtinName << "BinarySize_" << productFamilyName << " = " << size << ";\n"; + out << "uint32_t " << builtinName << "Binary_" << productFamilyName << "[" << (size + 3) / 4 << "] = {" << std::endl << " "; @@ -1121,9 +1115,9 @@ void OfflineCompiler::writeOutAllFiles() { } } else { if (outputFile.empty()) { - fileBase = fileTrunk + "_" + familyNameWithType; + fileBase = fileTrunk + "_" + productFamilyName; } else { - fileBase = outputFile + "_" + familyNameWithType; + fileBase = outputFile + "_" + productFamilyName; } } diff --git a/shared/offline_compiler/source/offline_compiler.h b/shared/offline_compiler/source/offline_compiler.h index 395dcbe0f1..b40727591d 100644 --- a/shared/offline_compiler/source/offline_compiler.h +++ b/shared/offline_compiler/source/offline_compiler.h @@ -98,7 +98,6 @@ All supported acronyms: %s. protected: OfflineCompiler(); - void setFamilyType(); int initHardwareInfo(std::string deviceName); int initHardwareInfoForProductConfig(std::string deviceName); int initHardwareInfoForDeprecatedAcronyms(std::string deviceName, int deviceId); @@ -134,7 +133,7 @@ All supported acronyms: %s. AOT::PRODUCT_CONFIG deviceConfig = {}; std::string deviceName; - std::string familyNameWithType; + std::string productFamilyName; std::string inputFile; std::string outputFile; std::string outputDirectory; diff --git a/shared/source/built_ins/built_ins_storage.cpp b/shared/source/built_ins/built_ins_storage.cpp index 431b085133..6214c95fbb 100644 --- a/shared/source/built_ins/built_ins_storage.cpp +++ b/shared/source/built_ins/built_ins_storage.cpp @@ -84,7 +84,7 @@ StackVec getBuiltinResourceNames(EBuiltInOps::Type builtin, Buil auto &gfxCoreHelper = device.getGfxCoreHelper(); auto &productHelper = device.getRootDeviceEnvironment().getHelper(); - const auto platformName = getFamilyNameWithType(hwInfo); + const auto platformName = hardwarePrefix[hwInfo.platform.eProductFamily]; const auto revisionId = std::to_string(hwInfo.platform.usRevId); const auto builtinName = getBuiltinAsString(builtin); const auto extension = BuiltinCode::getExtension(type); diff --git a/shared/source/built_ins/kernels/CMakeLists.txt b/shared/source/built_ins/kernels/CMakeLists.txt index 9a84082009..36a504b7f7 100644 --- a/shared/source/built_ins/kernels/CMakeLists.txt +++ b/shared/source/built_ins/kernels/CMakeLists.txt @@ -24,9 +24,9 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") list(APPEND __ocloc__options__ "-D DEBUG") endif() -function(get_bits_for_stateless core_type platform_type) +function(get_bits_for_stateless core_type platform_it_lower) # Force 32bits compiling on gen9lp for stateless builtins - if((${core_type} STREQUAL "GEN9") AND (${platform_type} STREQUAL "LP")) + if((${core_type} STREQUAL "GEN9") AND ((${platform_it_lower} STREQUAL "glk") OR (${platform_it_lower} STREQUAL "bxt"))) set(BITS "32" PARENT_SCOPE) else() set(BITS ${NEO_BITS} PARENT_SCOPE) @@ -44,9 +44,9 @@ function(get_builtin_options core_type neo_arch) endfunction() # Define function for compiling built-ins (with ocloc) -function(compile_builtin core_type platform_type builtin bits builtin_options mode) +function(compile_builtin core_type platform_it builtin bits builtin_options mode) + string(TOLOWER ${platform_it} platform_it_lower) string(TOLOWER ${core_type} core_type_lower) - get_family_name_with_type(${core_type} ${platform_type}) set(OUTPUTDIR "${BUILTINS_OUTDIR_WITH_ARCH}/${core_type_lower}") # get filename set(FILENAME ${builtin}) @@ -55,40 +55,40 @@ function(compile_builtin core_type platform_type builtin bits builtin_options mo get_filename_component(absolute_filepath ${builtin} ABSOLUTE) set(OUTPUT_FILE_SPV - ${OUTPUTDIR}/${mode}_${BASENAME}_${family_name_with_type}.spv + ${OUTPUTDIR}/${mode}_${BASENAME}_${platform_it_lower}.spv ) list(APPEND __ocloc__options__ "-cl-kernel-arg-info") set(INTERNAL_OPTIONS "${${mode}_OPTIONS}") add_custom_command( OUTPUT ${OUTPUT_FILE_SPV} - COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -spv_only -device ${DEFAULT_SUPPORTED_${core_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -output ${mode}_${BASENAME} -out_dir ${OUTPUTDIR} ${INTERNAL_OPTIONS} -options "$" + COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -spv_only -device ${platform_it_lower} ${builtin_options} -${bits} -output ${mode}_${BASENAME} -out_dir ${OUTPUTDIR} ${INTERNAL_OPTIONS} -options "$" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${builtin} ocloc copy_compiler_files ) - foreach(REVISION_ID ${${platform_type}_${core_type}_REVISIONS}) + foreach(REVISION_ID ${${platform_it}_${core_type}_REVISIONS}) set(OUTPUT_FILE_CPP - ${OUTPUTDIR}/${mode}_${BASENAME}_${family_name_with_type}_${REVISION_ID}.cpp + ${OUTPUTDIR}/${mode}_${BASENAME}_${platform_it_lower}_${REVISION_ID}.cpp ) - set(BINARY_OUTPUT "${OUTPUTDIR}/${mode}_${BASENAME}_${REVISION_ID}_${family_name_with_type}") + set(BINARY_OUTPUT "${OUTPUTDIR}/${mode}_${BASENAME}_${REVISION_ID}_${platform_it_lower}") if(NOT NEO_DISABLE_BUILTINS_COMPILATION) set(OUTPUT_FILES_BINARIES ${BINARY_OUTPUT}.bin) get_filename_component(absolute_filepath_spv ${OUTPUT_FILE_SPV} ABSOLUTE) add_custom_command( OUTPUT ${OUTPUT_FILES_BINARIES} - 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 "$" + COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath_spv} -spirv_input -device ${platform_it_lower} ${builtin_options} -${bits} -output ${mode}_${BASENAME}_${REVISION_ID} -out_dir ${OUTPUTDIR} -revision_id ${REVISION_ID} ${INTERNAL_OPTIONS} -options "$" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${OUTPUT_FILE_SPV} ocloc copy_compiler_files ) add_custom_command( OUTPUT ${OUTPUT_FILE_CPP} - COMMAND $ --file ${BINARY_OUTPUT}.bin --output ${OUTPUT_FILE_CPP} --array ${mode}_${BASENAME} --platform ${family_name_with_type} --revision_id ${REVISION_ID} + COMMAND $ --file ${BINARY_OUTPUT}.bin --output ${OUTPUT_FILE_CPP} --array ${mode}_${BASENAME} --platform ${platform_it_lower} --revision_id ${REVISION_ID} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${OUTPUT_FILES_BINARIES} $ ) list(APPEND BUILTINS_COMMANDS "${OUTPUT_FILE_CPP}") else() foreach(_file_name "bin") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/built_ins/${NEO_ARCH}/${core_type_lower}/${mode}_${BASENAME}_${REVISION_ID}_${family_name_with_type}.${_file_name}") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/built_ins/${NEO_ARCH}/${core_type_lower}/${mode}_${BASENAME}_${REVISION_ID}_${platform_it_lower}.${_file_name}") if(EXISTS ${_file_prebuilt}) add_custom_command( OUTPUT ${BINARY_OUTPUT}.${_file_name} @@ -97,7 +97,7 @@ function(compile_builtin core_type platform_type builtin bits builtin_options mo ) endif() endforeach() - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/built_ins/${NEO_ARCH}/${core_type_lower}/${mode}_${BASENAME}_${family_name_with_type}_${REVISION_ID}.cpp") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/built_ins/${NEO_ARCH}/${core_type_lower}/${mode}_${BASENAME}_${platform_it_lower}_${REVISION_ID}.cpp") if(EXISTS ${_file_prebuilt}) add_custom_command( OUTPUT ${OUTPUT_FILE_CPP} @@ -157,85 +157,83 @@ function(generate_cpp_spirv builtin) endif() endfunction() -macro(macro_for_each_core_type) - foreach(PLATFORM_TYPE ${PLATFORM_TYPES}) - if(${CORE_TYPE}_HAS_${PLATFORM_TYPE}) - unset(IMAGE_SUPPORT) - unset(AUX_TRANSLATION_SUPPORT) - CORE_CONTAINS_PLATFORMS("SUPPORTED_IMAGES" ${CORE_TYPE} IMAGE_SUPPORT) - CORE_CONTAINS_PLATFORMS("SUPPORTED_AUX_TRANSLATION" ${CORE_TYPE} AUX_TRANSLATION_SUPPORT) - get_family_name_with_type(${CORE_TYPE} ${PLATFORM_TYPE}) - string(TOLOWER ${PLATFORM_TYPE} PLATFORM_TYPE_LOWER) - get_bits_for_stateless(${CORE_TYPE} ${PLATFORM_TYPE}) - get_builtin_options(${CORE_TYPE} ${NEO_ARCH}) - set(target_name builtins_${family_name_with_type}) - add_custom_target(${target_name}) - add_dependencies(builtins ${target_name}) - set_target_properties(${target_name} PROPERTIES FOLDER "${SHARED_SOURCE_PROJECTS_FOLDER}/${SHARED_BUILTINS_PROJECTS_FOLDER}/${family_name_with_type}") - foreach(MODE ${ADDRESSING_MODES}) - unset(BUILTINS_COMMANDS) +macro(macro_for_each_platform) + unset(IMAGE_SUPPORT) + unset(AUX_TRANSLATION_SUPPORT) + CORE_CONTAINS_PLATFORMS("SUPPORTED_IMAGES" ${CORE_TYPE} IMAGE_SUPPORT) + CORE_CONTAINS_PLATFORMS("SUPPORTED_AUX_TRANSLATION" ${CORE_TYPE} AUX_TRANSLATION_SUPPORT) + get_bits_for_stateless(${CORE_TYPE} ${PLATFORM_IT}) + get_builtin_options(${CORE_TYPE} ${NEO_ARCH}) + set(target_name builtins_${PLATFORM_IT_LOWER}) + add_custom_target(${target_name}) + add_dependencies(builtins ${target_name}) + set_target_properties(${target_name} PROPERTIES FOLDER "${SHARED_SOURCE_PROJECTS_FOLDER}/${SHARED_BUILTINS_PROJECTS_FOLDER}/${PLATFORM_IT_LOWER}") + foreach(MODE ${ADDRESSING_MODES}) + unset(BUILTINS_COMMANDS) - if((${MODE} STREQUAL "bindless") AND (NOT BUILD_WITH_L0 OR("${CORE_TYPE}" STREQUAL "GEN8"))) - continue() - endif() + if((${MODE} STREQUAL "bindless") AND (NOT BUILD_WITH_L0 OR("${CORE_TYPE}" STREQUAL "GEN8"))) + continue() + endif() - if(${AUX_TRANSLATION_SUPPORT}) - foreach(GENERATED_BUILTIN_AUX_TRANSLATION ${GENERATED_BUILTINS_AUX_TRANSLATION}) - compile_builtin(${CORE_TYPE} ${PLATFORM_TYPE} ${GENERATED_BUILTIN_AUX_TRANSLATION}.builtin_kernel ${NEO_BITS} "${BUILTIN_OPTIONS}" ${MODE}) - endforeach() - endif() - - if(${MODE} STREQUAL "stateless") - foreach(GENERATED_BUILTIN_STATELESS ${GENERATED_BUILTINS_STATELESS}) - compile_builtin(${CORE_TYPE} ${PLATFORM_TYPE} ${GENERATED_BUILTIN_STATELESS}.builtin_kernel ${BITS} "${BUILTIN_OPTIONS_STATELESS}" ${MODE}) - endforeach() - - if(${IMAGE_SUPPORT}) - foreach(GENERATED_BUILTIN_IMAGES_STATELESS ${GENERATED_BUILTINS_IMAGES_STATELESS}) - compile_builtin(${CORE_TYPE} ${PLATFORM_TYPE} ${GENERATED_BUILTIN_IMAGES_STATELESS}.builtin_kernel ${BITS} "${BUILTIN_OPTIONS_STATELESS}" ${MODE}) - endforeach() - endif() - - if("${CORE_TYPE}" STREQUAL "XE_HPC_CORE") - # Compile stateful versions as stateless - foreach(GENERATED_BUILTIN ${GENERATED_BUILTINS}) - compile_builtin(${CORE_TYPE} ${PLATFORM_TYPE} ${GENERATED_BUILTIN}.builtin_kernel ${NEO_BITS} "${BUILTIN_OPTIONS}" ${MODE}) - endforeach() - - if(${IMAGE_SUPPORT}) - foreach(GENERATED_BUILTINS_IMAGES ${GENERATED_BUILTINS_IMAGES}) - compile_builtin(${CORE_TYPE} ${PLATFORM_TYPE} ${GENERATED_BUILTINS_IMAGES}.builtin_kernel ${NEO_BITS} "${BUILTIN_OPTIONS}" ${MODE}) - endforeach() - endif() - endif() - else() - if("${CORE_TYPE}" STREQUAL "XE_HPC_CORE") - continue() - endif() - foreach(GENERATED_BUILTIN ${GENERATED_BUILTINS}) - compile_builtin(${CORE_TYPE} ${PLATFORM_TYPE} ${GENERATED_BUILTIN}.builtin_kernel ${NEO_BITS} "${BUILTIN_OPTIONS}" ${MODE}) - endforeach() - - if(${IMAGE_SUPPORT}) - foreach(GENERATED_BUILTINS_IMAGES ${GENERATED_BUILTINS_IMAGES}) - compile_builtin(${CORE_TYPE} ${PLATFORM_TYPE} ${GENERATED_BUILTINS_IMAGES}.builtin_kernel ${NEO_BITS} "${BUILTIN_OPTIONS}" ${MODE}) - endforeach() - endif() - endif() - - get_property(GENERATED_BUILTINS_CPPS_${MODE} GLOBAL PROPERTY GENERATED_BUILTINS_CPPS_${MODE}) - foreach(BUILTIN ${BUILTINS_COMMANDS}) - list(APPEND GENERATED_BUILTINS_CPPS_${MODE} ${BUILTIN}) - endforeach() - set_property(GLOBAL PROPERTY GENERATED_BUILTINS_CPPS_${MODE} ${GENERATED_BUILTINS_CPPS_${MODE}}) - add_custom_target(${target_name}_${MODE} DEPENDS ${BUILTINS_COMMANDS}) - add_dependencies(${target_name} ${target_name}_${MODE}) - set_target_properties(${target_name}_${MODE} PROPERTIES FOLDER "${SHARED_SOURCE_PROJECTS_FOLDER}/${SHARED_BUILTINS_PROJECTS_FOLDER}/${family_name_with_type}") + if(${AUX_TRANSLATION_SUPPORT}) + foreach(GENERATED_BUILTIN_AUX_TRANSLATION ${GENERATED_BUILTINS_AUX_TRANSLATION}) + compile_builtin(${CORE_TYPE} ${PLATFORM_IT} ${GENERATED_BUILTIN_AUX_TRANSLATION}.builtin_kernel ${NEO_BITS} "${BUILTIN_OPTIONS}" ${MODE}) endforeach() endif() + + if(${MODE} STREQUAL "stateless") + foreach(GENERATED_BUILTIN_STATELESS ${GENERATED_BUILTINS_STATELESS}) + compile_builtin(${CORE_TYPE} ${PLATFORM_IT} ${GENERATED_BUILTIN_STATELESS}.builtin_kernel ${BITS} "${BUILTIN_OPTIONS_STATELESS}" ${MODE}) + endforeach() + + if(${IMAGE_SUPPORT}) + foreach(GENERATED_BUILTIN_IMAGES_STATELESS ${GENERATED_BUILTINS_IMAGES_STATELESS}) + compile_builtin(${CORE_TYPE} ${PLATFORM_IT} ${GENERATED_BUILTIN_IMAGES_STATELESS}.builtin_kernel ${BITS} "${BUILTIN_OPTIONS_STATELESS}" ${MODE}) + endforeach() + endif() + + if("${CORE_TYPE}" STREQUAL "XE_HPC_CORE") + # Compile stateful versions as stateless + foreach(GENERATED_BUILTIN ${GENERATED_BUILTINS}) + compile_builtin(${CORE_TYPE} ${PLATFORM_IT} ${GENERATED_BUILTIN}.builtin_kernel ${NEO_BITS} "${BUILTIN_OPTIONS}" ${MODE}) + endforeach() + + if(${IMAGE_SUPPORT}) + foreach(GENERATED_BUILTINS_IMAGES ${GENERATED_BUILTINS_IMAGES}) + compile_builtin(${CORE_TYPE} ${PLATFORM_IT} ${GENERATED_BUILTINS_IMAGES}.builtin_kernel ${NEO_BITS} "${BUILTIN_OPTIONS}" ${MODE}) + endforeach() + endif() + endif() + else() + if("${CORE_TYPE}" STREQUAL "XE_HPC_CORE") + continue() + endif() + foreach(GENERATED_BUILTIN ${GENERATED_BUILTINS}) + compile_builtin(${CORE_TYPE} ${PLATFORM_IT} ${GENERATED_BUILTIN}.builtin_kernel ${NEO_BITS} "${BUILTIN_OPTIONS}" ${MODE}) + endforeach() + + if(${IMAGE_SUPPORT}) + foreach(GENERATED_BUILTINS_IMAGES ${GENERATED_BUILTINS_IMAGES}) + compile_builtin(${CORE_TYPE} ${PLATFORM_IT} ${GENERATED_BUILTINS_IMAGES}.builtin_kernel ${NEO_BITS} "${BUILTIN_OPTIONS}" ${MODE}) + endforeach() + endif() + endif() + + get_property(GENERATED_BUILTINS_CPPS_${MODE} GLOBAL PROPERTY GENERATED_BUILTINS_CPPS_${MODE}) + foreach(BUILTIN ${BUILTINS_COMMANDS}) + list(APPEND GENERATED_BUILTINS_CPPS_${MODE} ${BUILTIN}) + endforeach() + set_property(GLOBAL PROPERTY GENERATED_BUILTINS_CPPS_${MODE} ${GENERATED_BUILTINS_CPPS_${MODE}}) + add_custom_target(${target_name}_${MODE} DEPENDS ${BUILTINS_COMMANDS}) + add_dependencies(${target_name} ${target_name}_${MODE}) + set_target_properties(${target_name}_${MODE} PROPERTIES FOLDER "${SHARED_SOURCE_PROJECTS_FOLDER}/${SHARED_BUILTINS_PROJECTS_FOLDER}/${PLATFORM_IT_LOWER}") endforeach() endmacro() +macro(macro_for_each_core_type) + apply_macro_for_each_platform("SUPPORTED") +endmacro() + file(MAKE_DIRECTORY "${BUILTINS_OUTDIR_WITH_ARCH}/spirv") foreach(builtin ${GENERATED_BUILTINS}) generate_cpp_spirv(${builtin}) diff --git a/shared/source/device_binary_format/device_binary_formats.h b/shared/source/device_binary_format/device_binary_formats.h index f11caab1e5..57e725adca 100644 --- a/shared/source/device_binary_format/device_binary_formats.h +++ b/shared/source/device_binary_format/device_binary_formats.h @@ -193,5 +193,4 @@ inline std::pair decodeSingleDeviceBinary(Progr return ret; } -bool haveSameCore(PRODUCT_FAMILY productFamilyLeft, PRODUCT_FAMILY productFamilyRight); } // namespace NEO diff --git a/shared/source/device_binary_format/zebin_decoder.cpp b/shared/source/device_binary_format/zebin_decoder.cpp index 802fbd1885..80fa69fbb2 100644 --- a/shared/source/device_binary_format/zebin_decoder.cpp +++ b/shared/source/device_binary_format/zebin_decoder.cpp @@ -54,16 +54,15 @@ bool validateTargetDevice(const TargetDevice &targetDevice, Elf::ELF_IDENTIFIER_ if (targetDevice.aotConfig.value != productConfig) { return false; } - } else { - if (gfxCore != IGFX_UNKNOWN_CORE) { - if (targetDevice.coreFamily != gfxCore) { - return false; - } + } + if (gfxCore != IGFX_UNKNOWN_CORE) { + if (targetDevice.coreFamily != gfxCore) { + return false; } - if (productFamily != IGFX_UNKNOWN) { - if (false == haveSameCore(targetDevice.productFamily, productFamily)) { - return false; - } + } + if (productFamily != IGFX_UNKNOWN) { + if (targetDevice.productFamily != productFamily) { + return false; } } if (targetMetadata.validateRevisionId) { diff --git a/shared/source/gen11/hw_info_ehl.cpp b/shared/source/gen11/hw_info_ehl.cpp index bbe01b397e..a81f166b2a 100644 --- a/shared/source/gen11/hw_info_ehl.cpp +++ b/shared/source/gen11/hw_info_ehl.cpp @@ -36,7 +36,6 @@ const RuntimeCapabilityTable EHL::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "ehl", // platformType "", // deviceName PreemptionMode::MidThread, // defaultPreemptionMode aub_stream::ENGINE_RCS, // defaultEngineType diff --git a/shared/source/gen11/hw_info_icllp.cpp b/shared/source/gen11/hw_info_icllp.cpp index a2753f3c23..edc132f0c1 100644 --- a/shared/source/gen11/hw_info_icllp.cpp +++ b/shared/source/gen11/hw_info_icllp.cpp @@ -36,7 +36,6 @@ const RuntimeCapabilityTable ICLLP::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "icllp", // platformType "", // deviceName PreemptionMode::MidThread, // defaultPreemptionMode aub_stream::ENGINE_RCS, // defaultEngineType diff --git a/shared/source/gen11/hw_info_lkf.cpp b/shared/source/gen11/hw_info_lkf.cpp index 88cee67045..b8b1c2e711 100644 --- a/shared/source/gen11/hw_info_lkf.cpp +++ b/shared/source/gen11/hw_info_lkf.cpp @@ -36,7 +36,6 @@ const RuntimeCapabilityTable LKF::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "lkf", // platformType "", // deviceName PreemptionMode::MidThread, // defaultPreemptionMode aub_stream::ENGINE_RCS, // defaultEngineType diff --git a/shared/source/gen12lp/hw_info_adln.cpp b/shared/source/gen12lp/hw_info_adln.cpp index 478e8f707e..eb0c2898b7 100644 --- a/shared/source/gen12lp/hw_info_adln.cpp +++ b/shared/source/gen12lp/hw_info_adln.cpp @@ -37,7 +37,6 @@ const RuntimeCapabilityTable ADLN::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "adln", // platformType "", // deviceName PreemptionMode::MidThread, // defaultPreemptionMode aub_stream::ENGINE_RCS, // defaultEngineType diff --git a/shared/source/gen12lp/hw_info_adlp.cpp b/shared/source/gen12lp/hw_info_adlp.cpp index f763fe31bd..a81992bdbf 100644 --- a/shared/source/gen12lp/hw_info_adlp.cpp +++ b/shared/source/gen12lp/hw_info_adlp.cpp @@ -37,7 +37,6 @@ const RuntimeCapabilityTable ADLP::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "adlp", // platformType "", // deviceName PreemptionMode::MidThread, // defaultPreemptionMode aub_stream::ENGINE_RCS, // defaultEngineType diff --git a/shared/source/gen12lp/hw_info_adls.cpp b/shared/source/gen12lp/hw_info_adls.cpp index 9b96accc4e..f47dc10778 100644 --- a/shared/source/gen12lp/hw_info_adls.cpp +++ b/shared/source/gen12lp/hw_info_adls.cpp @@ -37,7 +37,6 @@ const RuntimeCapabilityTable ADLS::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "adls", // platformType "", // deviceName PreemptionMode::MidThread, // defaultPreemptionMode aub_stream::ENGINE_RCS, // defaultEngineType diff --git a/shared/source/gen12lp/hw_info_dg1.cpp b/shared/source/gen12lp/hw_info_dg1.cpp index aa8cdf8e86..a17dd63203 100644 --- a/shared/source/gen12lp/hw_info_dg1.cpp +++ b/shared/source/gen12lp/hw_info_dg1.cpp @@ -37,7 +37,6 @@ const RuntimeCapabilityTable DG1::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "dg1", // platformType "", // deviceName PreemptionMode::MidThread, // defaultPreemptionMode aub_stream::ENGINE_RCS, // defaultEngineType diff --git a/shared/source/gen12lp/hw_info_rkl.cpp b/shared/source/gen12lp/hw_info_rkl.cpp index c8d041a596..e171e2d219 100644 --- a/shared/source/gen12lp/hw_info_rkl.cpp +++ b/shared/source/gen12lp/hw_info_rkl.cpp @@ -37,7 +37,6 @@ const RuntimeCapabilityTable RKL::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "rkl", // platformType "", // deviceName PreemptionMode::MidThread, // defaultPreemptionMode aub_stream::ENGINE_RCS, // defaultEngineType diff --git a/shared/source/gen12lp/hw_info_tgllp.cpp b/shared/source/gen12lp/hw_info_tgllp.cpp index fda6efc433..164e8ad765 100644 --- a/shared/source/gen12lp/hw_info_tgllp.cpp +++ b/shared/source/gen12lp/hw_info_tgllp.cpp @@ -37,7 +37,6 @@ const RuntimeCapabilityTable TGLLP::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "tgllp", // platformType "", // deviceName PreemptionMode::MidThread, // defaultPreemptionMode aub_stream::ENGINE_RCS, // defaultEngineType diff --git a/shared/source/gen8/hw_info_bdw.cpp b/shared/source/gen8/hw_info_bdw.cpp index fc8b477a3f..976e803e4c 100644 --- a/shared/source/gen8/hw_info_bdw.cpp +++ b/shared/source/gen8/hw_info_bdw.cpp @@ -36,7 +36,6 @@ const RuntimeCapabilityTable BDW::capabilityTable{ 0, // sharedSystemMemCapabilities 80, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "bdw", // platformType "", // deviceName PreemptionMode::Disabled, // defaultPreemptionMode aub_stream::ENGINE_RCS, // defaultEngineType diff --git a/shared/source/gen9/hw_info_bxt.cpp b/shared/source/gen9/hw_info_bxt.cpp index e763bef8de..1a568d36d2 100644 --- a/shared/source/gen9/hw_info_bxt.cpp +++ b/shared/source/gen9/hw_info_bxt.cpp @@ -36,7 +36,6 @@ const RuntimeCapabilityTable BXT::capabilityTable{ 0, // sharedSystemMemCapabilities 52.083, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "bxt", // platformType "", // deviceName PreemptionMode::MidThread, // defaultPreemptionMode aub_stream::ENGINE_RCS, // defaultEngineType diff --git a/shared/source/gen9/hw_info_cfl.cpp b/shared/source/gen9/hw_info_cfl.cpp index 5784cf3d10..7fdfce6f02 100644 --- a/shared/source/gen9/hw_info_cfl.cpp +++ b/shared/source/gen9/hw_info_cfl.cpp @@ -36,7 +36,6 @@ const RuntimeCapabilityTable CFL::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "cfl", // platformType "", // deviceName PreemptionMode::MidThread, // defaultPreemptionMode aub_stream::ENGINE_RCS, // defaultEngineType diff --git a/shared/source/gen9/hw_info_glk.cpp b/shared/source/gen9/hw_info_glk.cpp index 1704a26e7b..bf4c94e9e3 100644 --- a/shared/source/gen9/hw_info_glk.cpp +++ b/shared/source/gen9/hw_info_glk.cpp @@ -36,7 +36,6 @@ const RuntimeCapabilityTable GLK::capabilityTable{ 0, // sharedSystemMemCapabilities 52.083, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "glk", // platformType "", // deviceName PreemptionMode::MidThread, // defaultPreemptionMode aub_stream::ENGINE_RCS, // defaultEngineType diff --git a/shared/source/gen9/hw_info_kbl.cpp b/shared/source/gen9/hw_info_kbl.cpp index b78efb4f61..70b5d82020 100644 --- a/shared/source/gen9/hw_info_kbl.cpp +++ b/shared/source/gen9/hw_info_kbl.cpp @@ -36,7 +36,6 @@ const RuntimeCapabilityTable KBL::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "kbl", // platformType "", // deviceName PreemptionMode::MidThread, // defaultPreemptionMode aub_stream::ENGINE_RCS, // defaultEngineType diff --git a/shared/source/gen9/hw_info_skl.cpp b/shared/source/gen9/hw_info_skl.cpp index 5af1db4aef..9643287732 100644 --- a/shared/source/gen9/hw_info_skl.cpp +++ b/shared/source/gen9/hw_info_skl.cpp @@ -36,7 +36,6 @@ const RuntimeCapabilityTable SKL::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "skl", // platformType "", // deviceName PreemptionMode::MidThread, // defaultPreemptionMode aub_stream::ENGINE_RCS, // defaultEngineType diff --git a/shared/source/helpers/hw_info.cpp b/shared/source/helpers/hw_info.cpp index 733d1c35bf..b9b0682b2c 100644 --- a/shared/source/helpers/hw_info.cpp +++ b/shared/source/helpers/hw_info.cpp @@ -29,10 +29,6 @@ uint64_t defaultHardwareInfoConfigTable[IGFX_MAX_PRODUCT] = { 0x0, }; -// Global table of family names -const char *familyName[IGFX_MAX_CORE] = { - nullptr, -}; // Global table of family names bool familyEnabled[IGFX_MAX_CORE] = { false, @@ -124,18 +120,4 @@ aub_stream::EngineType getChosenEngineType(const HardwareInfo &hwInfo) { ? hwInfo.capabilityTable.defaultEngineType : static_cast(DebugManager.flags.NodeOrdinal.get()); } - -const std::string getFamilyNameWithType(const HardwareInfo &hwInfo) { - std::string platformName = familyName[hwInfo.platform.eRenderCoreFamily]; - platformName.append(hwInfo.capabilityTable.platformType); - return platformName; -} - -bool haveSameCore(PRODUCT_FAMILY productFamilyLeft, PRODUCT_FAMILY productFamilyRight) { - UNRECOVERABLE_IF(productFamilyLeft >= IGFX_MAX_PRODUCT || productFamilyRight >= IGFX_MAX_PRODUCT); - auto hwInfoLeft = NEO::hardwareInfoTable[productFamilyLeft]; - auto hwInfoRight = NEO::hardwareInfoTable[productFamilyRight]; - UNRECOVERABLE_IF(hwInfoLeft == nullptr || hwInfoRight == nullptr); - return hwInfoLeft->platform.eRenderCoreFamily == hwInfoRight->platform.eRenderCoreFamily; -} } // namespace NEO diff --git a/shared/source/helpers/hw_info.h b/shared/source/helpers/hw_info.h index e32ea595ee..d4e89ecc25 100644 --- a/shared/source/helpers/hw_info.h +++ b/shared/source/helpers/hw_info.h @@ -24,7 +24,6 @@ struct RuntimeCapabilityTable { uint64_t sharedSystemMemCapabilities; double defaultProfilingTimerResolution; size_t requiredPreemptionSurfaceSize; - const char *platformType; const char *deviceName; PreemptionMode defaultPreemptionMode; aub_stream::EngineType defaultEngineType; @@ -113,7 +112,6 @@ inline bool operator==(const RuntimeCapabilityTable &lhs, const RuntimeCapabilit result &= (lhs.ftrRenderCompressedImages == rhs.ftrRenderCompressedImages); result &= (lhs.ftr64KBpages == rhs.ftr64KBpages); result &= (lhs.instrumentationEnabled == rhs.instrumentationEnabled); - result &= (lhs.platformType == rhs.platformType); result &= (lhs.deviceName == rhs.deviceName); result &= (lhs.debuggerSupported == rhs.debuggerSupported); result &= (lhs.supportsVme == rhs.supportsVme); @@ -156,7 +154,6 @@ struct GfxFamilyMapper {}; // Global table of hardware prefixes extern bool familyEnabled[IGFX_MAX_CORE]; -extern const char *familyName[IGFX_MAX_CORE]; extern const char *hardwarePrefix[IGFX_MAX_PRODUCT]; extern uint64_t defaultHardwareInfoConfigTable[IGFX_MAX_PRODUCT]; extern const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT]; @@ -167,7 +164,6 @@ template struct EnableGfxFamilyHw { EnableGfxFamilyHw() { familyEnabled[gfxFamily] = true; - familyName[gfxFamily] = GfxFamilyMapper::name; } }; @@ -175,8 +171,6 @@ bool getHwInfoForPlatformString(std::string &platform, const HardwareInfo *&hwIn void setHwInfoValuesFromConfig(const uint64_t hwInfoConfig, HardwareInfo &hwInfoIn); bool parseHwInfoConfigString(const std::string &hwInfoConfigStr, uint64_t &hwInfoConfig); aub_stream::EngineType getChosenEngineType(const HardwareInfo &hwInfo); -const std::string getFamilyNameWithType(const HardwareInfo &hwInfo); -bool haveSameCore(PRODUCT_FAMILY productFamilyLeft, PRODUCT_FAMILY productFamilyRight); // Utility conversion template diff --git a/shared/source/xe_hp_core/hw_info_xe_hp_sdv.cpp b/shared/source/xe_hp_core/hw_info_xe_hp_sdv.cpp index 4503992dec..0f678be5e5 100644 --- a/shared/source/xe_hp_core/hw_info_xe_hp_sdv.cpp +++ b/shared/source/xe_hp_core/hw_info_xe_hp_sdv.cpp @@ -40,7 +40,6 @@ const RuntimeCapabilityTable XE_HP_SDV::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "core", // platformType "", // deviceName PreemptionMode::ThreadGroup, // defaultPreemptionMode aub_stream::ENGINE_CCS, // defaultEngineType diff --git a/shared/source/xe_hpc_core/hw_info_pvc.cpp b/shared/source/xe_hpc_core/hw_info_pvc.cpp index e109f0a107..5d716e1534 100644 --- a/shared/source/xe_hpc_core/hw_info_pvc.cpp +++ b/shared/source/xe_hpc_core/hw_info_pvc.cpp @@ -50,7 +50,6 @@ const RuntimeCapabilityTable PVC::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "pvc", // platformType "", // deviceName PreemptionMode::ThreadGroup, // defaultPreemptionMode aub_stream::ENGINE_CCS, // defaultEngineType diff --git a/shared/source/xe_hpg_core/hw_info_dg2.cpp b/shared/source/xe_hpg_core/hw_info_dg2.cpp index fee95ce04c..bbcc588117 100644 --- a/shared/source/xe_hpg_core/hw_info_dg2.cpp +++ b/shared/source/xe_hpg_core/hw_info_dg2.cpp @@ -41,7 +41,6 @@ const RuntimeCapabilityTable DG2::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "dg2", // platformType "", // deviceName PreemptionMode::ThreadGroup, // defaultPreemptionMode aub_stream::ENGINE_CCS, // defaultEngineType diff --git a/shared/source/xe_hpg_core/hw_info_mtl.cpp b/shared/source/xe_hpg_core/hw_info_mtl.cpp index ea0958c80f..d3b4adbc42 100644 --- a/shared/source/xe_hpg_core/hw_info_mtl.cpp +++ b/shared/source/xe_hpg_core/hw_info_mtl.cpp @@ -38,7 +38,6 @@ const RuntimeCapabilityTable MTL::capabilityTable{ 0, // sharedSystemMemCapabilities 83.333, // defaultProfilingTimerResolution MemoryConstants::pageSize, // requiredPreemptionSurfaceSize - "mtl", // platformType "", // deviceName PreemptionMode::ThreadGroup, // defaultPreemptionMode aub_stream::ENGINE_CCS, // defaultEngineType diff --git a/shared/test/common/test_files/CMakeLists.txt b/shared/test/common/test_files/CMakeLists.txt index 6d3ccac3dd..df099f442a 100644 --- a/shared/test/common/test_files/CMakeLists.txt +++ b/shared/test/common/test_files/CMakeLists.txt @@ -5,9 +5,9 @@ # set(SHARED_TEST_PROJECTS_SUB_FOLDER "prepare test files") -function(compile_kernels_gen platform_name_with_type revision_id platform_name suffix) +function(compile_kernels_gen revision_id platform_name) - set(outputdir "${TargetDir}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/") + set(outputdir "${TargetDir}/${platform_name}/${revision_id}/test_files/${NEO_ARCH}/") set(compiled_kernels) foreach(filepath ${ARGN}) @@ -16,7 +16,7 @@ function(compile_kernels_gen platform_name_with_type revision_id platform_name s get_filename_component(workdir ${filepath} DIRECTORY) get_filename_component(absolute_filepath ${filepath} ABSOLUTE) - set(outputpath_base "${outputdir}${basename}_${suffix}") + set(outputpath_base "${outputdir}${basename}_${platform_name}") if(NOT NEO_DISABLE_BUILTINS_COMPILATION) set(output_files @@ -31,21 +31,21 @@ function(compile_kernels_gen platform_name_with_type revision_id platform_name s DEPENDS ${filepath} ocloc copy_compiler_files ) - list(APPEND compiled_kernels_${platform_name_with_type}_${revision_id} ${output_files}) + list(APPEND compiled_kernels_${platform_name}_${revision_id} ${output_files}) else() foreach(_file_name "spv" "bin") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${suffix}.${_file_name}") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${platform_name}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${platform_name}.${_file_name}") add_custom_command( OUTPUT ${outputpath_base}.${_file_name} COMMAND ${CMAKE_COMMAND} -E make_directory ${outputdir} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_file_prebuilt} ${outputdir} ) - list(APPEND compiled_kernels_${platform_name_with_type}_${revision_id} ${outputpath_base}.${_file_name}) + list(APPEND compiled_kernels_${platform_name}_${revision_id} ${outputpath_base}.${_file_name}) endforeach() endif() endforeach() - set(compiled_kernels_${platform_name_with_type}_${revision_id} ${compiled_kernels_${platform_name_with_type}_${revision_id}} PARENT_SCOPE) + set(compiled_kernels_${platform_name}_${revision_id} ${compiled_kernels_${platform_name}_${revision_id}} PARENT_SCOPE) endfunction() file(GLOB_RECURSE TEST_KERNELS *.cl) @@ -58,41 +58,27 @@ if(TARGET ${BUILTINS_SPIRV_LIB_NAME}) add_dependencies(prepare_test_kernels_for_shared ${BUILTINS_SPIRV_LIB_NAME}) endif() set_target_properties(prepare_test_kernels_for_shared PROPERTIES FOLDER "${SHARED_TEST_PROJECTS_FOLDER}/${SHARED_TEST_PROJECTS_SUB_FOLDER}") +add_dependencies(prepare_test_kernels_for_shared copy_compiler_files) macro(macro_for_each_platform) - foreach(PLATFORM_TYPE ${PLATFORM_TYPES}) - foreach(REVISION_ID ${${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS}) - if(${PLATFORM_IT}_IS_${PLATFORM_TYPE}) - add_dependencies(prepare_test_kernels_for_shared copy_compiler_files) - endif() - endforeach() + set(KERNELS_TO_COMPILE ${TEST_KERNELS}) + set(IMAGE_SUPPORT FALSE) + CORE_CONTAINS_PLATFORMS("SUPPORTED_IMAGES" ${CORE_TYPE} IMAGE_SUPPORT) + if(NOT IMAGE_SUPPORT) + list(REMOVE_ITEM KERNELS_TO_COMPILE ${TEST_KERNELS_IMAGES}) + endif() + + foreach(REVISION_ID ${${PLATFORM_IT}_${CORE_TYPE}_REVISIONS}) + compile_kernels_gen(${REVISION_ID} ${PLATFORM_IT_LOWER} ${KERNELS_TO_COMPILE}) + + add_custom_target(prepare_test_kernels_for_shared_${PLATFORM_IT_LOWER}_${REVISION_ID} DEPENDS ${compiled_kernels_${PLATFORM_IT_LOWER}_${REVISION_ID}}) + set_target_properties(prepare_test_kernels_for_shared_${PLATFORM_IT_LOWER}_${REVISION_ID} PROPERTIES FOLDER "${SHARED_TEST_PROJECTS_FOLDER}/${SHARED_TEST_PROJECTS_SUB_FOLDER}/${PLATFORM_SPECIFIC_TEST_TARGETS_FOLDER}/${PLATFORM_IT_LOWER}/${REVISION_ID}") + add_dependencies(prepare_test_kernels_for_shared prepare_test_kernels_for_shared_${PLATFORM_IT_LOWER}_${REVISION_ID}) endforeach() endmacro() macro(macro_for_each_core_type) apply_macro_for_each_platform("TESTED") - foreach(PLATFORM_TYPE ${PLATFORM_TYPES}) - - if(${CORE_TYPE}_HAS_${PLATFORM_TYPE}) - - set(KERNELS_TO_COMPILE ${TEST_KERNELS}) - set(IMAGE_SUPPORT FALSE) - CORE_CONTAINS_PLATFORMS("SUPPORTED_IMAGES" ${CORE_TYPE} IMAGE_SUPPORT) - if(NOT IMAGE_SUPPORT) - list(REMOVE_ITEM KERNELS_TO_COMPILE ${TEST_KERNELS_IMAGES}) - endif() - - get_family_name_with_type(${CORE_TYPE} ${PLATFORM_TYPE}) - set(PLATFORM_LOWER ${DEFAULT_SUPPORTED_${CORE_TYPE}_${PLATFORM_TYPE}_PLATFORM}) - foreach(REVISION_ID ${${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS}) - compile_kernels_gen(${family_name_with_type} ${REVISION_ID} ${PLATFORM_LOWER} ${family_name_with_type} ${KERNELS_TO_COMPILE}) - - add_custom_target(prepare_test_kernels_for_shared_${family_name_with_type}_${REVISION_ID} DEPENDS ${compiled_kernels_${family_name_with_type}_${REVISION_ID}}) - set_target_properties(prepare_test_kernels_for_shared_${family_name_with_type}_${REVISION_ID} PROPERTIES FOLDER "${SHARED_TEST_PROJECTS_FOLDER}/${SHARED_TEST_PROJECTS_SUB_FOLDER}/${PLATFORM_SPECIFIC_TEST_TARGETS_FOLDER}/${family_name_with_type}/${REVISION_ID}") - add_dependencies(prepare_test_kernels_for_shared prepare_test_kernels_for_shared_${family_name_with_type}_${REVISION_ID}) - endforeach() - endif() - endforeach() endmacro() apply_macro_for_each_core_type("TESTED") diff --git a/shared/test/unit_test/built_ins/builtin_tests.cpp b/shared/test/unit_test/built_ins/builtin_tests.cpp index af79a8ac01..4781f7b957 100644 --- a/shared/test/unit_test/built_ins/builtin_tests.cpp +++ b/shared/test/unit_test/built_ins/builtin_tests.cpp @@ -24,7 +24,7 @@ HWTEST2_F(BuiltInSharedTest, givenUseBindlessBuiltinDisabledWhenBinExtensionPass DebugManager.flags.UseBindlessMode.set(0); auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); auto &productHelper = pDevice->getRootDeviceEnvironment().getHelper(); - const std::string platformName = getFamilyNameWithType(hwInfo); + const std::string platformName = hardwarePrefix[hwInfo.platform.eProductFamily]; const std::string revId = std::to_string(hwInfo.platform.usRevId); const std::string defaultRevId = std::to_string(productHelper.getDefaultRevisionId()); @@ -44,7 +44,7 @@ HWTEST2_F(BuiltInSharedTest, givenUseBindlessBuiltinEnabledWhenBinExtensionPasse DebugManager.flags.UseBindlessMode.set(1); auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); auto &productHelper = pDevice->getRootDeviceEnvironment().getHelper(); - const std::string platformName = getFamilyNameWithType(hwInfo); + const std::string platformName = hardwarePrefix[hwInfo.platform.eProductFamily]; const std::string revId = std::to_string(hwInfo.platform.usRevId); const std::string defaultRevId = std::to_string(productHelper.getDefaultRevisionId()); @@ -88,7 +88,7 @@ HWTEST2_F(BuiltInSharedTest, GivenBuiltinTypeBinaryWhenGettingBuiltinResourceFor HWTEST2_F(BuiltInSharedTest, GivenStatelessBuiltinWhenGettingResourceNameThenAddressingIsStateless, HasStatefulSupport) { auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); auto &productHelper = pDevice->getRootDeviceEnvironment().getHelper(); - const std::string platformName = getFamilyNameWithType(hwInfo); + const std::string platformName = hardwarePrefix[hwInfo.platform.eProductFamily]; const std::string revId = std::to_string(hwInfo.platform.usRevId); const std::string defaultRevId = std::to_string(productHelper.getDefaultRevisionId()); @@ -105,7 +105,7 @@ HWTEST2_F(BuiltInSharedTest, GivenStatelessBuiltinWhenGettingResourceNameThenAdd HWTEST2_F(BuiltInSharedTest, GivenPlatformWithoutStatefulAddresingSupportWhenGettingResourceNamesThenStatelessResourceNameIsReturned, HasNoStatefulSupport) { auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); - const std::string platformName = getFamilyNameWithType(hwInfo); + const std::string platformName = hardwarePrefix[hwInfo.platform.eProductFamily]; const std::string revId = std::to_string(hwInfo.platform.usRevId); { @@ -126,7 +126,7 @@ HWTEST_F(BuiltInSharedTest, GivenRequestedTypeIntermediateWhenGettingResourceNam DebugManager.flags.UseBindlessMode.set(0); auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); auto &productHelper = pDevice->getRootDeviceEnvironment().getHelper(); - const std::string platformName = getFamilyNameWithType(hwInfo); + const std::string platformName = hardwarePrefix[hwInfo.platform.eProductFamily]; const std::string revId = std::to_string(hwInfo.platform.usRevId); const std::string defaultRevId = std::to_string(productHelper.getDefaultRevisionId()); @@ -152,7 +152,7 @@ HWTEST_F(BuiltInSharedTest, GivenValidBuiltinTypeAndAnyTypeWhenGettingBuiltinCod auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); auto &productHelper = pDevice->getRootDeviceEnvironment().getHelper(); - const std::string platformName = getFamilyNameWithType(hwInfo); + const std::string platformName = hardwarePrefix[hwInfo.platform.eProductFamily]; const std::string revId = std::to_string(hwInfo.platform.usRevId); const std::string defaultRevId = std::to_string(productHelper.getDefaultRevisionId()); diff --git a/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp b/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp index 949656cb08..65bdfcb1d5 100644 --- a/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp +++ b/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp @@ -6689,6 +6689,32 @@ TEST(ValidateTargetDeviceTests, givenMismatchedProductFamilyWhenValidatingTarget EXPECT_FALSE(res); } +TEST(ValidateTargetDeviceTests, givenMissingProductFamilyWhenValidatingTargetDeviceThenReturnTrue) { + TargetDevice targetDevice{}; + targetDevice.maxPointerSizeInBytes = 8u; + ASSERT_EQ(AOT::UNKNOWN_ISA, targetDevice.aotConfig.value); + targetDevice.coreFamily = renderCoreFamily; + targetDevice.productFamily = productFamily; + + Elf::ZebinTargetFlags targetMetadata{}; + + auto res = validateTargetDevice(targetDevice, Elf::EI_CLASS_64, IGFX_UNKNOWN, targetDevice.coreFamily, AOT::UNKNOWN_ISA, targetMetadata); + EXPECT_TRUE(res); +} + +TEST(ValidateTargetDeviceTests, givenMissingGfxCoreFamilyWhenValidatingTargetDeviceThenReturnTrue) { + TargetDevice targetDevice{}; + targetDevice.maxPointerSizeInBytes = 8u; + ASSERT_EQ(AOT::UNKNOWN_ISA, targetDevice.aotConfig.value); + targetDevice.coreFamily = renderCoreFamily; + targetDevice.productFamily = productFamily; + + Elf::ZebinTargetFlags targetMetadata{}; + + auto res = validateTargetDevice(targetDevice, Elf::EI_CLASS_64, targetDevice.productFamily, IGFX_UNKNOWN_CORE, AOT::UNKNOWN_ISA, targetMetadata); + EXPECT_TRUE(res); +} + TEST(ValidateTargetDeviceTests, givenMismatchedGfxCoreWhenValidatingTargetDeviceThenReturnFalse) { TargetDevice targetDevice; targetDevice.maxPointerSizeInBytes = 8u; @@ -7224,4 +7250,4 @@ TEST(ZeInfoMetadataExtractionFromElf, givenValidElfNotContainingZeInfoSectionWhe auto zeInfoStr64B = extractZeInfoMetadataStringFromZebin(ArrayRef::fromAny(encoded64BElf.data(), encoded64BElf.size()), outErrors, outWarnings); EXPECT_EQ(nullptr, zeInfoStr32B.data()); EXPECT_EQ(nullptr, zeInfoStr64B.data()); -} \ No newline at end of file +} diff --git a/shared/test/unit_test/main.cpp b/shared/test/unit_test/main.cpp index 4bc00b82a9..6a824140e7 100644 --- a/shared/test/unit_test/main.cpp +++ b/shared/test/unit_test/main.cpp @@ -296,8 +296,7 @@ int main(int argc, char **argv) { gtSystemInfo.MaxSubSlicesSupported = std::max(gtSystemInfo.MaxSubSlicesSupported, gtSystemInfo.SubSliceCount); // clang-format on - binaryNameSuffix.append(familyName[hwInfoForTests.platform.eRenderCoreFamily]); - binaryNameSuffix.append(hwInfoForTests.capabilityTable.platformType); + binaryNameSuffix.append(hardwarePrefix[hwInfoForTests.platform.eProductFamily]); std::string testBinaryFiles = getRunPath(argv[0]); testBinaryFiles.append("/");