Skip to content

Commit b99adec

Browse files
Correct test kernel dependencies for l0 aub tests
Related-To: NEO-6328 Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent 7392b5f commit b99adec

File tree

6 files changed

+40
-25
lines changed

6 files changed

+40
-25
lines changed

cmake/run_aub_test_target.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ if(NOT SKIP_NEO_UNIT_TESTS)
6868
endif()
6969

7070
if(NOT SKIP_L0_UNIT_TESTS AND BUILD_WITH_L0)
71+
add_dependencies(run_${product}_${revision_id}_aub_tests prepare_l0_test_kernels)
72+
7173
if(WIN32 OR NOT DEFINED NEO__GMM_LIBRARY_PATH)
7274
set(l0_aub_test_cmd_prefix $<TARGET_FILE:ze_intel_gpu_aub_tests>)
7375
else()

level_zero/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,11 +533,13 @@ if(BUILD_WITH_L0)
533533
)
534534
endif()
535535
if(NOT SKIP_L0_UNIT_TESTS)
536+
add_subdirectory_unique(core/test/common)
536537
add_subdirectory_unique(core/test/unit_tests)
537538
add_subdirectory_unique(core/test/aub_tests)
538539
add_subdirectory_unique(tools/test/unit_tests)
539540
add_subdirectory_unique(experimental/test/unit_tests)
540541
else()
542+
hide_subdir(core/test/common)
541543
hide_subdir(core/test/unit_tests)
542544
hide_subdir(core/test/aub_tests)
543545
hide_subdir(tools/test/unit_tests)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#
2+
# Copyright (C) 2021 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
#
6+
7+
include(gen_kernel.cmake)
8+
9+
add_custom_target(prepare_l0_test_kernels)
10+
set_target_properties(prepare_l0_test_kernels PROPERTIES FOLDER ${TARGET_NAME_L0})
11+
12+
set(TEST_MODULES
13+
${CMAKE_CURRENT_SOURCE_DIR}/test_modules/test_kernel.cl
14+
)
15+
16+
set(l0_test_kernels_outputs)
17+
macro(macro_for_each_gen)
18+
foreach(PLATFORM_TYPE ${PLATFORM_TYPES})
19+
if(${GEN_TYPE}_HAS_${PLATFORM_TYPE})
20+
get_family_name_with_type(${GEN_TYPE} ${PLATFORM_TYPE})
21+
string(TOLOWER ${PLATFORM_TYPE} PLATFORM_TYPE_LOWER)
22+
set(PLATFORM_LOWER ${DEFAULT_SUPPORTED_${GEN_TYPE}_${PLATFORM_TYPE}_PLATFORM})
23+
level_zero_gen_kernels(l0_test_kernel_outputs ${PLATFORM_LOWER} ${family_name_with_type} "-g" ${TEST_MODULES})
24+
endif()
25+
endforeach()
26+
endmacro()
27+
apply_macro_for_each_gen("TESTED")
28+
add_custom_target(l0_common_test_kernels DEPENDS ${l0_test_kernel_outputs} copy_compiler_files)
29+
set_target_properties(l0_common_test_kernels PROPERTIES FOLDER ${TARGET_NAME_L0})
30+
add_dependencies(prepare_l0_test_kernels l0_common_test_kernels)
31+

level_zero/core/test/unit_tests/gen_kernel.cmake renamed to level_zero/core/test/common/gen_kernel.cmake

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# SPDX-License-Identifier: MIT
55
#
66

7-
function(level_zero_gen_kernels target platform_name suffix options)
7+
function(level_zero_gen_kernels target_list platform_name suffix options)
88

99
if(NOT DEFINED cloc_cmd_prefix)
1010
if(WIN32)
@@ -20,7 +20,6 @@ function(level_zero_gen_kernels target platform_name suffix options)
2020

2121
set(outputdir "${TargetDir}/level_zero/${suffix}/test_files/${NEO_ARCH}/")
2222

23-
set(results)
2423
if(NOT NEO_DISABLE_BUILTINS_COMPILATION)
2524
foreach(filepath ${ARGN})
2625
get_filename_component(filename ${filepath} NAME)
@@ -41,9 +40,8 @@ function(level_zero_gen_kernels target platform_name suffix options)
4140
DEPENDS ${filepath} ocloc
4241
)
4342

44-
list(APPEND results ${output_files})
43+
list(APPEND ${target_list} ${output_files})
4544
endforeach()
4645
endif()
47-
add_custom_target(${target} DEPENDS ${results} copy_compiler_files)
48-
set_target_properties(${target} PROPERTIES FOLDER ${TARGET_NAME_L0})
46+
set(${target_list} ${${target_list}} PARENT_SCOPE)
4947
endfunction()

level_zero/core/test/unit_tests/CMakeLists.txt

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ link_libraries(${ASAN_LIBS} ${TSAN_LIBS})
88

99
set(TARGET_NAME ${TARGET_NAME_L0}_core_tests)
1010

11-
include(gen_kernel.cmake)
1211
include(${NEO_SOURCE_DIR}/cmake/setup_ult_global_flags.cmake)
1312

1413
function(ADD_SUPPORTED_TEST_PRODUCT_FAMILIES_DEFINITION)
@@ -27,14 +26,14 @@ add_executable(${TARGET_NAME}
2726
)
2827

2928
target_sources(${TARGET_NAME} PRIVATE
30-
${CMAKE_CURRENT_LIST_DIR}/gen_kernel.cmake
3129
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
3230
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
3331
${CMAKE_CURRENT_SOURCE_DIR}/mock.h
3432
${CMAKE_CURRENT_SOURCE_DIR}/test_mode.h
3533
${CMAKE_CURRENT_SOURCE_DIR}/white_box.h
3634
${NEO_SHARED_TEST_DIRECTORY}/unit_test/tests_configuration.h
3735
${NEO_SHARED_TEST_DIRECTORY}/common/test_configuration/unit_tests/ult_configuration.cpp
36+
${NEO_SOURCE_DIR}/level_zero/core/test/common/gen_kernel.cmake
3837
)
3938

4039
target_sources(${TARGET_NAME} PRIVATE
@@ -133,23 +132,6 @@ if(TARGET ${BUILTINS_SPIRV_LIB_NAME})
133132
)
134133
endif()
135134

136-
set(TEST_MODULES
137-
${CMAKE_CURRENT_SOURCE_DIR}/test_modules/test_kernel.cl
138-
)
139-
140-
macro(macro_for_each_gen)
141-
foreach(PLATFORM_TYPE ${PLATFORM_TYPES})
142-
if(${GEN_TYPE}_HAS_${PLATFORM_TYPE})
143-
get_family_name_with_type(${GEN_TYPE} ${PLATFORM_TYPE})
144-
string(TOLOWER ${PLATFORM_TYPE} PLATFORM_TYPE_LOWER)
145-
set(PLATFORM_LOWER ${DEFAULT_SUPPORTED_${GEN_TYPE}_${PLATFORM_TYPE}_PLATFORM})
146-
level_zero_gen_kernels(level_zero_test_kernels_${family_name_with_type} ${PLATFORM_LOWER} ${family_name_with_type} "-g" ${TEST_MODULES})
147-
add_dependencies(${TARGET_NAME} level_zero_test_kernels_${family_name_with_type})
148-
endif()
149-
endforeach()
150-
endmacro()
151-
apply_macro_for_each_gen("TESTED")
152-
153135
option(L0_ULT_VERBOSE "Use the default/verbose test output" OFF)
154136
if(NOT L0_ULT_VERBOSE)
155137
set(L0_TESTS_LISTENER_OPTION "--disable_default_listener")
@@ -171,6 +153,6 @@ if(MSVC)
171153
)
172154
endif()
173155

174-
add_dependencies(unit_tests ${TARGET_NAME})
156+
add_dependencies(unit_tests ${TARGET_NAME} prepare_l0_test_kernels)
175157

176158
create_source_tree(${TARGET_NAME} ${L0_ROOT_DIR}/..)

0 commit comments

Comments
 (0)