diff --git a/cmake/common_macros.cmake b/cmake/common_macros.cmake index e991d040f5..1973c0cb3c 100644 --- a/cmake/common_macros.cmake +++ b/cmake/common_macros.cmake @@ -78,6 +78,12 @@ 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 d88b666732..f7066d521a 100644 --- a/level_zero/core/test/common/CMakeLists.txt +++ b/level_zero/core/test/common/CMakeLists.txt @@ -22,19 +22,23 @@ set(TEST_KERNEL_BINDLESS ) set(l0_test_kernels_outputs) -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_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") + 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}) + + #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() + endforeach() 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) diff --git a/level_zero/core/test/common/gen_kernel.cmake b/level_zero/core/test/common/gen_kernel.cmake index 76593b6fba..7fba0d1a46 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 revision_id options) +function(level_zero_generate_kernels target_list platform_name suffix revision_id options) list(APPEND results copy_compiler_files) - set(relativeDir "level_zero/${platform_name}/${revision_id}/test_files/${NEO_ARCH}") + set(relativeDir "level_zero/${suffix}/${revision_id}/test_files/${NEO_ARCH}") set(outputdir "${TargetDir}/${relativeDir}/") @@ -18,7 +18,7 @@ function(level_zero_generate_kernels target_list platform_name revision_id optio get_filename_component(workdir ${filepath} DIRECTORY) get_filename_component(absolute_filepath ${filepath} ABSOLUTE) - set(outputpath_base "${outputdir}${basename}_${platform_name}") + set(outputpath_base "${outputdir}${basename}_${suffix}") 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 revision_id optio list(APPEND ${target_list} ${output_files}) else() foreach(extension "bin" "spv") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${relativeDir}/${basename}_${platform_name}.${extension}") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${relativeDir}/${basename}_${suffix}.${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 revision_id optio set(${target_list} ${${target_list}} PARENT_SCOPE) endfunction() -function(level_zero_generate_kernels_with_internal_options target_list platform_name prefix revision_id options internal_options) +function(level_zero_generate_kernels_with_internal_options target_list platform_name suffix prefix revision_id options internal_options) list(APPEND results copy_compiler_files) - set(relativeDir "level_zero/${platform_name}/${revision_id}/test_files/${NEO_ARCH}") + set(relativeDir "level_zero/${suffix}/${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}_${platform_name}") + set(outputpath_base "${outputdir}${prefix}_${basename}_${suffix}") 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}_${platform_name}.${extension}") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${relativeDir}/${prefix}_${basename}_${suffix}.${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 2f0410aa7a..1087a67c2b 100644 --- a/level_zero/core/test/unit_tests/main.cpp +++ b/level_zero/core/test/unit_tests/main.cpp @@ -320,7 +320,8 @@ int main(int argc, char **argv) { listeners.Append(new NEO::MemoryLeakListener); listeners.Append(new NEO::BaseUltConfigListener); - binaryNameSuffix.append(NEO::hardwarePrefix[hwInfoForTests.platform.eProductFamily]); + binaryNameSuffix.append(NEO::familyName[hwInfoForTests.platform.eRenderCoreFamily]); + binaryNameSuffix.append(hwInfoForTests.capabilityTable.platformType); std::string testBinaryFiles = getRunPath(argv[0]); std::string testBinaryFilesApiSpecific = testBinaryFiles; diff --git a/manifests/manifest.yml b/manifests/manifest.yml index e6d681d4ba..edc46f242c 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-515 + revision: 2007-507 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 adb6badd92..7a76d0d81a 100644 --- a/opencl/source/built_ins/kernels/CMakeLists.txt +++ b/opencl/source/built_ins/kernels/CMakeLists.txt @@ -9,3 +9,123 @@ 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 1eb9ba0650..941c4e81a2 100644 --- a/opencl/source/cl_device/cl_device_caps.cpp +++ b/opencl/source/cl_device/cl_device_caps.cpp @@ -22,6 +22,8 @@ #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 c3694905cb..8e3d42a2e7 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_it_lower revision_id forcePatchtokenFormat) - set(outputdir "${TargetDir}/${platform_it_lower}/${revision_id}/test_files/${NEO_ARCH}/") +function(neo_gen_kernels platform_name_with_type platform_name revision_id suffix forcePatchtokenFormat) + set(outputdir "${TargetDir}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/") if(forcePatchtokenFormat) set(formatArgument "--format" "patchtokens") @@ -141,7 +141,7 @@ function(neo_gen_kernels platform_it_lower revision_id forcePatchtokenFormat) get_filename_component(workdir ${filepath} DIRECTORY) get_filename_component(absolute_filepath ${filepath} ABSOLUTE) - set(outputpath_base "${outputdir}${basename}_${platform_it_lower}") + set(outputpath_base "${outputdir}${basename}_${suffix}") if(NOT NEO_DISABLE_BUILTINS_COMPILATION) set(output_files ${outputpath_base}.spv @@ -150,7 +150,7 @@ function(neo_gen_kernels platform_it_lower revision_id forcePatchtokenFormat) add_custom_command( OUTPUT ${output_files} - COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_it_lower} -${NEO_BITS} -revision_id ${revision_id} -out_dir ${outputdir} ${formatArgument} + COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -${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_it_lower revision_id forcePatchtokenFormat) list(APPEND kernels_to_compile ${output_files}) else() foreach(extension "spv" "bin") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${platform_it_lower}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${platform_it_lower}.${extension}") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${suffix}.${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_it_lower}_${revision_id} ${outputpath_base}.${extension}) + list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${outputpath_base}.${extension}) endforeach() endif() endforeach() - 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) + 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) endfunction() -function(neo_gen_kernels_with_options platform_it_lower revision_id filepath) +function(neo_gen_kernels_with_options platform_name_with_type platform_name revision_id suffix 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_it_lower revision_id filepath) get_filename_component(base_workdir ${filearg} DIRECTORY) get_filename_component(absolute_filepath ${filearg} ABSOLUTE) - set(outputdir "${TargetDir}/${platform_it_lower}/${revision_id}/test_files/${NEO_ARCH}/") + set(outputdir "${TargetDir}/${suffix}/${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}_${platform_it_lower}") + set(outputpath_base "${outputdir}/${base_filename}_${suffix}") if(NOT NEO_DISABLE_BUILTINS_COMPILATION) set(output_files ${outputpath_base}.spv @@ -196,30 +196,30 @@ function(neo_gen_kernels_with_options platform_it_lower revision_id filepath) add_custom_command( OUTPUT ${output_files} - 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} + COMMAND ${ocloc_cmd_prefix} -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(extension "spv" "bin") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${platform_it_lower}/${revision_id}/test_files/${NEO_ARCH}/${base_filename}_${platform_it_lower}.${extension}") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${base_filename}_${suffix}.${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_it_lower}_${revision_id} ${outputpath_base}.${extension}) + list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${outputpath_base}.${extension}) endforeach() endif() endforeach() endforeach() - 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) + 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) endfunction() -function(neo_gen_kernels_with_internal_options platform_it_lower revision_id filepath output_name_prefix) +function(neo_gen_kernels_with_internal_options platform_name_with_type platform_name revision_id suffix filepath output_name_prefix) set(kernels_to_compile) set(filearg ${filepath}) @@ -228,14 +228,14 @@ function(neo_gen_kernels_with_internal_options platform_it_lower revision_id fil get_filename_component(base_workdir ${filearg} DIRECTORY) get_filename_component(absolute_filepath ${filearg} ABSOLUTE) - set(outputdir "${TargetDir}/${platform_it_lower}/${revision_id}/test_files/${NEO_ARCH}/") + set(outputdir "${TargetDir}/${suffix}/${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}_${platform_it_lower}") + set(outputpath_base "${outputdir}/${basename}_${suffix}") if(NOT NEO_DISABLE_BUILTINS_COMPILATION) set(output_files ${outputpath_base}.spv @@ -248,25 +248,25 @@ function(neo_gen_kernels_with_internal_options platform_it_lower revision_id fil add_custom_command( OUTPUT ${output_files} - 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} + COMMAND ${ocloc_cmd_prefix} -file ${absolute_filepath} -device ${platform_name} -revision_id ${revision_id} -${NEO_BITS} -out_dir ${outputdir} ${output_name} -internal_options ${ARGN} WORKING_DIRECTORY ${workdir} DEPENDS ${filearg} ocloc ) - list(APPEND kernels_to_compile_${platform_it_lower}_${revision_id} ${output_files}) + list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${output_files}) else() foreach(extension "spv" "bin") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${platform_it_lower}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${platform_it_lower}.${extension}") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${suffix}.${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_it_lower}_${revision_id} ${outputpath_base}.${extension}) + list(APPEND kernels_to_compile_${platform_name_with_type}_${revision_id} ${outputpath_base}.${extension}) endforeach() endif() - set(kernels_to_compile_${platform_it_lower}_${revision_id} ${kernels_to_compile_${platform_it_lower}_${revision_id}} PARENT_SCOPE) + set(kernels_to_compile_${platform_name_with_type}_${revision_id} ${kernels_to_compile_${platform_name_with_type}_${revision_id}} PARENT_SCOPE) endfunction() set(TEST_KERNEL test_files/CopyBuffer_simd16.cl) @@ -332,91 +332,94 @@ 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_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() - - 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_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_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") + 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}) + + 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() + + 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() + + #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}") + endforeach() + endif() + endforeach() endmacro() apply_macro_for_each_core_type("TESTED") add_subdirectories() diff --git a/opencl/test/unit_test/device/device_caps_tests.cpp b/opencl/test/unit_test/device/device_caps_tests.cpp index b7e1c5cce6..bbaa6f02c8 100644 --- a/opencl/test/unit_test/device/device_caps_tests.cpp +++ b/opencl/test/unit_test/device/device_caps_tests.cpp @@ -34,6 +34,10 @@ #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 4fcd101182..579295d0c5 100644 --- a/opencl/test/unit_test/device/get_device_name_tests.cpp +++ b/opencl/test/unit_test/device/get_device_name_tests.cpp @@ -12,6 +12,10 @@ #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 a7cefdf908..b8d833ed7c 100644 --- a/opencl/test/unit_test/main.cpp +++ b/opencl/test/unit_test/main.cpp @@ -301,7 +301,8 @@ int main(int argc, char **argv) { gtSystemInfo.MaxSubSlicesSupported = std::max(gtSystemInfo.MaxSubSlicesSupported, gtSystemInfo.SubSliceCount); // clang-format on - binaryNameSuffix.append(hardwarePrefix[hwInfoForTests.platform.eProductFamily]); + binaryNameSuffix.append(familyName[hwInfoForTests.platform.eRenderCoreFamily]); + binaryNameSuffix.append(hwInfoForTests.capabilityTable.platformType); 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 28cbdf8d69..905eadfeaa 100644 --- a/opencl/test/unit_test/offline_compiler/CMakeLists.txt +++ b/opencl/test/unit_test/offline_compiler/CMakeLists.txt @@ -163,10 +163,15 @@ endif() macro(macro_for_each_platform) if("${PLATFORM_IT_LOWER}" STREQUAL "${CLOC_LIB_DEFAULT_DEVICE}") - 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}) + 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() 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 257b38f882..4fad08f339 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) - : devicePrefix(devicePrefix), productConfig(productConfig) { + Environment(const std::string &devicePrefix, const std::string productConfig, const std::string &familyNameWithType) + : devicePrefix(devicePrefix), productConfig(productConfig), familyNameWithType(familyNameWithType) { } void SetInputFileName( // NOLINT(readability-identifier-naming) @@ -53,4 +53,5 @@ 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 0b137b0126..fc15682dc5 100644 --- a/opencl/test/unit_test/offline_compiler/main.cpp +++ b/opencl/test/unit_test/offline_compiler/main.cpp @@ -51,6 +51,7 @@ int main(int argc, char **argv) { std::string dumpTestStatsFileName = ""; std::string devicePrefix("skl"); + std::string familyNameWithType("Gen9core"); std::string revId("0"); std::string productConfig(""); @@ -85,6 +86,9 @@ 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]; @@ -123,13 +127,13 @@ int main(int argc, char **argv) { // working directories std::string nTestFiles = getRunPath(); nTestFiles.append("/"); - nTestFiles.append(devicePrefix); + nTestFiles.append(familyNameWithType); nTestFiles.append("/"); nTestFiles.append(revId); nTestFiles.append("/"); nTestFiles.append(testFiles); testFiles = nTestFiles; - binaryNameSuffix.append(devicePrefix); + binaryNameSuffix.append(familyNameWithType); std::string nClFiles = NEO_OPENCL_TEST_FILES_DIR; nClFiles.append("/"); @@ -137,13 +141,13 @@ int main(int argc, char **argv) { #ifdef WIN32 #include - if (_chdir(devicePrefix.c_str())) { - std::cout << "chdir into " << devicePrefix << " directory failed.\nThis might cause test failures." << std::endl; + if (_chdir(familyNameWithType.c_str())) { + std::cout << "chdir into " << familyNameWithType << " directory failed.\nThis might cause test failures." << std::endl; } #elif defined(__linux__) #include - if (chdir(devicePrefix.c_str()) != 0) { - std::cout << "chdir into " << devicePrefix << " directory failed.\nThis might cause test failures." << std::endl; + if (chdir(familyNameWithType.c_str()) != 0) { + std::cout << "chdir into " << familyNameWithType << " directory failed.\nThis might cause test failures." << std::endl; } #endif @@ -157,7 +161,7 @@ int main(int argc, char **argv) { } listeners.Append(new NEO::VirtualFileSystemListener); - gEnvironment = reinterpret_cast(::testing::AddGlobalTestEnvironment(new Environment(devicePrefix, productConfig))); + gEnvironment = reinterpret_cast(::testing::AddGlobalTestEnvironment(new Environment(devicePrefix, productConfig, familyNameWithType))); 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 23326c15d6..b5e534e784 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->devicePrefix); + fName.append(gEnvironment->familyNameWithType); fName.append("."); fName.append(type); return fName; @@ -1955,17 +1955,17 @@ TEST_F(OfflineCompilerTests, WhenParsingBinToCharArrayThenCorrectFileIsGenerated }; // clang-format on - std::string devicePrefix = gEnvironment->devicePrefix; + std::string familyNameWithType = gEnvironment->familyNameWithType; std::string fileName = "scheduler"; std::string retArray = pOfflineCompiler->parseBinAsCharArray(binary, sizeof(binary), fileName); std::string target = "#include \n" "#include \n\n" "size_t SchedulerBinarySize_" + - devicePrefix + " = 37;\n" - "uint32_t SchedulerBinary_" + - devicePrefix + "[10] = {\n" - " 0x40032302, 0x90800756, 0x05340301, 0x66097860, 0x101010ff, 0x40032302, 0x90800756, 0x05340301, \n" - " 0x66097860, 0xff000000};\n"; + familyNameWithType + " = 37;\n" + "uint32_t SchedulerBinary_" + + familyNameWithType + "[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 f3525bbb72..7afa007ec2 100644 --- a/platforms.cmake +++ b/platforms.cmake @@ -200,8 +200,11 @@ 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 1a0bdbcc1f..b09b9a6c9e 100644 --- a/shared/offline_compiler/source/offline_compiler.cpp +++ b/shared/offline_compiler/source/offline_compiler.cpp @@ -425,6 +425,12 @@ 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); @@ -442,7 +448,7 @@ int OfflineCompiler::initHardwareInfoForDeprecatedAcronyms(std::string deviceNam setHwInfoValuesFromConfig(config, hwInfo); hardwareInfoBaseSetup[hwInfo.platform.eProductFamily](&hwInfo, true); - productFamilyName = hardwarePrefix[hwInfo.platform.eProductFamily]; + setFamilyType(); return SUCCESS; } } @@ -468,7 +474,7 @@ int OfflineCompiler::initHardwareInfoForProductConfig(std::string deviceName) { hwInfo.platform.usRevId = revisionId; } deviceConfig = productConfig; - productFamilyName = hardwarePrefix[hwInfo.platform.eProductFamily]; + setFamilyType(); return SUCCESS; } argHelper->printf("Could not determine target based on product config: %s\n", deviceName.c_str()); @@ -825,8 +831,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_" << productFamilyName << " = " << size << ";\n"; - out << "uint32_t " << builtinName << "Binary_" << productFamilyName << "[" << (size + 3) / 4 << "] = {" + out << "size_t " << builtinName << "BinarySize_" << familyNameWithType << " = " << size << ";\n"; + out << "uint32_t " << builtinName << "Binary_" << familyNameWithType << "[" << (size + 3) / 4 << "] = {" << std::endl << " "; @@ -1115,9 +1121,9 @@ void OfflineCompiler::writeOutAllFiles() { } } else { if (outputFile.empty()) { - fileBase = fileTrunk + "_" + productFamilyName; + fileBase = fileTrunk + "_" + familyNameWithType; } else { - fileBase = outputFile + "_" + productFamilyName; + fileBase = outputFile + "_" + familyNameWithType; } } diff --git a/shared/offline_compiler/source/offline_compiler.h b/shared/offline_compiler/source/offline_compiler.h index b40727591d..395dcbe0f1 100644 --- a/shared/offline_compiler/source/offline_compiler.h +++ b/shared/offline_compiler/source/offline_compiler.h @@ -98,6 +98,7 @@ 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); @@ -133,7 +134,7 @@ All supported acronyms: %s. AOT::PRODUCT_CONFIG deviceConfig = {}; std::string deviceName; - std::string productFamilyName; + std::string familyNameWithType; 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 6214c95fbb..431b085133 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 = hardwarePrefix[hwInfo.platform.eProductFamily]; + const auto platformName = getFamilyNameWithType(hwInfo); 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 36a504b7f7..9a84082009 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_it_lower) +function(get_bits_for_stateless core_type platform_type) # Force 32bits compiling on gen9lp for stateless builtins - if((${core_type} STREQUAL "GEN9") AND ((${platform_it_lower} STREQUAL "glk") OR (${platform_it_lower} STREQUAL "bxt"))) + if((${core_type} STREQUAL "GEN9") AND (${platform_type} STREQUAL "LP")) 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_it builtin bits builtin_options mode) - string(TOLOWER ${platform_it} platform_it_lower) +function(compile_builtin core_type platform_type builtin bits builtin_options mode) 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_it builtin bits builtin_options mode get_filename_component(absolute_filepath ${builtin} ABSOLUTE) set(OUTPUT_FILE_SPV - ${OUTPUTDIR}/${mode}_${BASENAME}_${platform_it_lower}.spv + ${OUTPUTDIR}/${mode}_${BASENAME}_${family_name_with_type}.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 ${platform_it_lower} ${builtin_options} -${bits} -output ${mode}_${BASENAME} -out_dir ${OUTPUTDIR} ${INTERNAL_OPTIONS} -options "$" + 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 "$" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${builtin} ocloc copy_compiler_files ) - foreach(REVISION_ID ${${platform_it}_${core_type}_REVISIONS}) + foreach(REVISION_ID ${${platform_type}_${core_type}_REVISIONS}) set(OUTPUT_FILE_CPP - ${OUTPUTDIR}/${mode}_${BASENAME}_${platform_it_lower}_${REVISION_ID}.cpp + ${OUTPUTDIR}/${mode}_${BASENAME}_${family_name_with_type}_${REVISION_ID}.cpp ) - set(BINARY_OUTPUT "${OUTPUTDIR}/${mode}_${BASENAME}_${REVISION_ID}_${platform_it_lower}") + set(BINARY_OUTPUT "${OUTPUTDIR}/${mode}_${BASENAME}_${REVISION_ID}_${family_name_with_type}") 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 ${platform_it_lower} ${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 ${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 "$" 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 ${platform_it_lower} --revision_id ${REVISION_ID} + COMMAND $ --file ${BINARY_OUTPUT}.bin --output ${OUTPUT_FILE_CPP} --array ${mode}_${BASENAME} --platform ${family_name_with_type} --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}_${platform_it_lower}.${_file_name}") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/built_ins/${NEO_ARCH}/${core_type_lower}/${mode}_${BASENAME}_${REVISION_ID}_${family_name_with_type}.${_file_name}") if(EXISTS ${_file_prebuilt}) add_custom_command( OUTPUT ${BINARY_OUTPUT}.${_file_name} @@ -97,7 +97,7 @@ function(compile_builtin core_type platform_it builtin bits builtin_options mode ) endif() endforeach() - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/built_ins/${NEO_ARCH}/${core_type_lower}/${mode}_${BASENAME}_${platform_it_lower}_${REVISION_ID}.cpp") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/built_ins/${NEO_ARCH}/${core_type_lower}/${mode}_${BASENAME}_${family_name_with_type}_${REVISION_ID}.cpp") if(EXISTS ${_file_prebuilt}) add_custom_command( OUTPUT ${OUTPUT_FILE_CPP} @@ -157,83 +157,85 @@ function(generate_cpp_spirv builtin) endif() endfunction() -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) +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) - 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_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}) + 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() - 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}) + 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() - endif() + 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}") + endforeach() 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 57e725adca..f11caab1e5 100644 --- a/shared/source/device_binary_format/device_binary_formats.h +++ b/shared/source/device_binary_format/device_binary_formats.h @@ -193,4 +193,5 @@ 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 512392b293..802fbd1885 100644 --- a/shared/source/device_binary_format/zebin_decoder.cpp +++ b/shared/source/device_binary_format/zebin_decoder.cpp @@ -60,8 +60,10 @@ bool validateTargetDevice(const TargetDevice &targetDevice, Elf::ELF_IDENTIFIER_ return false; } } - if (targetDevice.productFamily != productFamily) { - return false; + if (productFamily != IGFX_UNKNOWN) { + if (false == haveSameCore(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 a81f166b2a..bbe01b397e 100644 --- a/shared/source/gen11/hw_info_ehl.cpp +++ b/shared/source/gen11/hw_info_ehl.cpp @@ -36,6 +36,7 @@ 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 edc132f0c1..a2753f3c23 100644 --- a/shared/source/gen11/hw_info_icllp.cpp +++ b/shared/source/gen11/hw_info_icllp.cpp @@ -36,6 +36,7 @@ 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 b8b1c2e711..88cee67045 100644 --- a/shared/source/gen11/hw_info_lkf.cpp +++ b/shared/source/gen11/hw_info_lkf.cpp @@ -36,6 +36,7 @@ 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 eb0c2898b7..478e8f707e 100644 --- a/shared/source/gen12lp/hw_info_adln.cpp +++ b/shared/source/gen12lp/hw_info_adln.cpp @@ -37,6 +37,7 @@ 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 a81992bdbf..f763fe31bd 100644 --- a/shared/source/gen12lp/hw_info_adlp.cpp +++ b/shared/source/gen12lp/hw_info_adlp.cpp @@ -37,6 +37,7 @@ 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 f47dc10778..9b96accc4e 100644 --- a/shared/source/gen12lp/hw_info_adls.cpp +++ b/shared/source/gen12lp/hw_info_adls.cpp @@ -37,6 +37,7 @@ 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 a17dd63203..aa8cdf8e86 100644 --- a/shared/source/gen12lp/hw_info_dg1.cpp +++ b/shared/source/gen12lp/hw_info_dg1.cpp @@ -37,6 +37,7 @@ 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 e171e2d219..c8d041a596 100644 --- a/shared/source/gen12lp/hw_info_rkl.cpp +++ b/shared/source/gen12lp/hw_info_rkl.cpp @@ -37,6 +37,7 @@ 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 164e8ad765..fda6efc433 100644 --- a/shared/source/gen12lp/hw_info_tgllp.cpp +++ b/shared/source/gen12lp/hw_info_tgllp.cpp @@ -37,6 +37,7 @@ 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 976e803e4c..fc8b477a3f 100644 --- a/shared/source/gen8/hw_info_bdw.cpp +++ b/shared/source/gen8/hw_info_bdw.cpp @@ -36,6 +36,7 @@ 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 1a568d36d2..e763bef8de 100644 --- a/shared/source/gen9/hw_info_bxt.cpp +++ b/shared/source/gen9/hw_info_bxt.cpp @@ -36,6 +36,7 @@ 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 7fdfce6f02..5784cf3d10 100644 --- a/shared/source/gen9/hw_info_cfl.cpp +++ b/shared/source/gen9/hw_info_cfl.cpp @@ -36,6 +36,7 @@ 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 bf4c94e9e3..1704a26e7b 100644 --- a/shared/source/gen9/hw_info_glk.cpp +++ b/shared/source/gen9/hw_info_glk.cpp @@ -36,6 +36,7 @@ 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 70b5d82020..b78efb4f61 100644 --- a/shared/source/gen9/hw_info_kbl.cpp +++ b/shared/source/gen9/hw_info_kbl.cpp @@ -36,6 +36,7 @@ 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 9643287732..5af1db4aef 100644 --- a/shared/source/gen9/hw_info_skl.cpp +++ b/shared/source/gen9/hw_info_skl.cpp @@ -36,6 +36,7 @@ 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 b9b0682b2c..733d1c35bf 100644 --- a/shared/source/helpers/hw_info.cpp +++ b/shared/source/helpers/hw_info.cpp @@ -29,6 +29,10 @@ 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, @@ -120,4 +124,18 @@ 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 d4e89ecc25..e32ea595ee 100644 --- a/shared/source/helpers/hw_info.h +++ b/shared/source/helpers/hw_info.h @@ -24,6 +24,7 @@ struct RuntimeCapabilityTable { uint64_t sharedSystemMemCapabilities; double defaultProfilingTimerResolution; size_t requiredPreemptionSurfaceSize; + const char *platformType; const char *deviceName; PreemptionMode defaultPreemptionMode; aub_stream::EngineType defaultEngineType; @@ -112,6 +113,7 @@ 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); @@ -154,6 +156,7 @@ 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]; @@ -164,6 +167,7 @@ template struct EnableGfxFamilyHw { EnableGfxFamilyHw() { familyEnabled[gfxFamily] = true; + familyName[gfxFamily] = GfxFamilyMapper::name; } }; @@ -171,6 +175,8 @@ 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 0f678be5e5..4503992dec 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,6 +40,7 @@ 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 5d716e1534..e109f0a107 100644 --- a/shared/source/xe_hpc_core/hw_info_pvc.cpp +++ b/shared/source/xe_hpc_core/hw_info_pvc.cpp @@ -50,6 +50,7 @@ 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 bbcc588117..fee95ce04c 100644 --- a/shared/source/xe_hpg_core/hw_info_dg2.cpp +++ b/shared/source/xe_hpg_core/hw_info_dg2.cpp @@ -41,6 +41,7 @@ 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 d3b4adbc42..ea0958c80f 100644 --- a/shared/source/xe_hpg_core/hw_info_mtl.cpp +++ b/shared/source/xe_hpg_core/hw_info_mtl.cpp @@ -38,6 +38,7 @@ 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 df099f442a..6d3ccac3dd 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 revision_id platform_name) +function(compile_kernels_gen platform_name_with_type revision_id platform_name suffix) - set(outputdir "${TargetDir}/${platform_name}/${revision_id}/test_files/${NEO_ARCH}/") + set(outputdir "${TargetDir}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/") set(compiled_kernels) foreach(filepath ${ARGN}) @@ -16,7 +16,7 @@ function(compile_kernels_gen revision_id platform_name) get_filename_component(workdir ${filepath} DIRECTORY) get_filename_component(absolute_filepath ${filepath} ABSOLUTE) - set(outputpath_base "${outputdir}${basename}_${platform_name}") + set(outputpath_base "${outputdir}${basename}_${suffix}") if(NOT NEO_DISABLE_BUILTINS_COMPILATION) set(output_files @@ -31,21 +31,21 @@ function(compile_kernels_gen revision_id platform_name) DEPENDS ${filepath} ocloc copy_compiler_files ) - list(APPEND compiled_kernels_${platform_name}_${revision_id} ${output_files}) + list(APPEND compiled_kernels_${platform_name_with_type}_${revision_id} ${output_files}) else() foreach(_file_name "spv" "bin") - set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${platform_name}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${platform_name}.${_file_name}") + set(_file_prebuilt "${NEO_KERNELS_BIN_DIR}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/${basename}_${suffix}.${_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}_${revision_id} ${outputpath_base}.${_file_name}) + list(APPEND compiled_kernels_${platform_name_with_type}_${revision_id} ${outputpath_base}.${_file_name}) endforeach() endif() endforeach() - set(compiled_kernels_${platform_name}_${revision_id} ${compiled_kernels_${platform_name}_${revision_id}} PARENT_SCOPE) + set(compiled_kernels_${platform_name_with_type}_${revision_id} ${compiled_kernels_${platform_name_with_type}_${revision_id}} PARENT_SCOPE) endfunction() file(GLOB_RECURSE TEST_KERNELS *.cl) @@ -58,27 +58,41 @@ 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) - 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}) + 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() 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 4781f7b957..af79a8ac01 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 = hardwarePrefix[hwInfo.platform.eProductFamily]; + const std::string platformName = getFamilyNameWithType(hwInfo); 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 = hardwarePrefix[hwInfo.platform.eProductFamily]; + const std::string platformName = getFamilyNameWithType(hwInfo); 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 = hardwarePrefix[hwInfo.platform.eProductFamily]; + const std::string platformName = getFamilyNameWithType(hwInfo); 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 = hardwarePrefix[hwInfo.platform.eProductFamily]; + const std::string platformName = getFamilyNameWithType(hwInfo); 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 = hardwarePrefix[hwInfo.platform.eProductFamily]; + const std::string platformName = getFamilyNameWithType(hwInfo); 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 = hardwarePrefix[hwInfo.platform.eProductFamily]; + const std::string platformName = getFamilyNameWithType(hwInfo); 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/main.cpp b/shared/test/unit_test/main.cpp index 6a824140e7..4bc00b82a9 100644 --- a/shared/test/unit_test/main.cpp +++ b/shared/test/unit_test/main.cpp @@ -296,7 +296,8 @@ int main(int argc, char **argv) { gtSystemInfo.MaxSubSlicesSupported = std::max(gtSystemInfo.MaxSubSlicesSupported, gtSystemInfo.SubSliceCount); // clang-format on - binaryNameSuffix.append(hardwarePrefix[hwInfoForTests.platform.eProductFamily]); + binaryNameSuffix.append(familyName[hwInfoForTests.platform.eRenderCoreFamily]); + binaryNameSuffix.append(hwInfoForTests.capabilityTable.platformType); std::string testBinaryFiles = getRunPath(argv[0]); testBinaryFiles.append("/");