2017-12-21 07:45:38 +08:00
|
|
|
#
|
2019-12-18 18:40:25 +08:00
|
|
|
# Copyright (C) 2018-2020 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
#
|
2018-09-18 15:11:08 +08:00
|
|
|
# SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
#
|
|
|
|
|
2018-11-19 23:29:16 +08:00
|
|
|
project(ocloc)
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
set(CLOC_SRCS_LIB
|
2020-02-24 04:00:51 +08:00
|
|
|
${NEO_CORE_DIRECTORY}/device_binary_format/ar/ar.h
|
|
|
|
${NEO_CORE_DIRECTORY}/device_binary_format/ar/ar_decoder.h
|
|
|
|
${NEO_CORE_DIRECTORY}/device_binary_format/ar/ar_decoder.cpp
|
|
|
|
${NEO_CORE_DIRECTORY}/device_binary_format/ar/ar_encoder.h
|
|
|
|
${NEO_CORE_DIRECTORY}/device_binary_format/ar/ar_encoder.cpp
|
|
|
|
${NEO_CORE_DIRECTORY}/device_binary_format/elf/elf.h
|
|
|
|
${NEO_CORE_DIRECTORY}/device_binary_format/elf/elf_decoder.h
|
|
|
|
${NEO_CORE_DIRECTORY}/device_binary_format/elf/elf_decoder.cpp
|
|
|
|
${NEO_CORE_DIRECTORY}/device_binary_format/elf/elf_encoder.h
|
|
|
|
${NEO_CORE_DIRECTORY}/device_binary_format/elf/elf_encoder.cpp
|
|
|
|
${NEO_CORE_DIRECTORY}/device_binary_format/elf/ocl_elf.h
|
|
|
|
${NEO_CORE_DIRECTORY}/helpers/abort.cpp
|
|
|
|
${NEO_CORE_DIRECTORY}/helpers/debug_helpers.cpp
|
|
|
|
${NEO_CORE_DIRECTORY}/helpers/file_io.cpp
|
|
|
|
${NEO_CORE_DIRECTORY}/os_interface/os_library.h
|
2019-10-10 23:41:59 +08:00
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/decoder/binary_decoder.cpp
|
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/decoder/binary_decoder.h
|
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/decoder/binary_encoder.cpp
|
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/decoder/binary_encoder.h
|
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/decoder/helper.cpp
|
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/decoder/helper.h
|
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/decoder/iga_wrapper.h
|
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/decoder/translate_platform_base.h
|
2020-02-10 06:59:57 +08:00
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/ocloc_fatbinary.cpp
|
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/ocloc_fatbinary.h
|
2019-12-12 19:09:49 +08:00
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/offline_compiler_helper.cpp
|
2019-10-10 23:41:59 +08:00
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/offline_compiler.cpp
|
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/offline_compiler.h
|
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/multi_command.cpp
|
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/multi_command.h
|
2019-12-12 19:09:49 +08:00
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/offline_compiler_options.cpp
|
2019-10-10 23:41:59 +08:00
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/${BRANCH_DIR_SUFFIX}/extra_settings.cpp
|
2020-02-24 04:00:51 +08:00
|
|
|
${NEO_CORE_DIRECTORY}/compiler_interface/compiler_options/compiler_options_base.cpp
|
|
|
|
${NEO_CORE_DIRECTORY}/compiler_interface/create_main.cpp
|
|
|
|
${NEO_CORE_DIRECTORY}/helpers/hw_info.cpp
|
2020-02-23 05:50:57 +08:00
|
|
|
${NEO_SOURCE_DIR}/opencl/source/platform/extensions.cpp
|
|
|
|
${NEO_SOURCE_DIR}/opencl/source/platform/extensions.h
|
2017-12-21 07:45:38 +08:00
|
|
|
)
|
|
|
|
|
2019-06-27 03:19:34 +08:00
|
|
|
if(${IGA_HEADERS_AVAILABLE})
|
|
|
|
set(CLOC_SRCS_LIB ${CLOC_SRCS_LIB}
|
2019-10-10 23:41:59 +08:00
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/decoder/iga_wrapper.cpp
|
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/decoder${BRANCH_DIR_SUFFIX}/translate_platform.cpp
|
2019-06-27 03:19:34 +08:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
set(CLOC_SRCS_LIB ${CLOC_SRCS_LIB}
|
2019-10-10 23:41:59 +08:00
|
|
|
${NEO_SOURCE_DIR}/offline_compiler/decoder/iga_stubs.cpp
|
2019-06-27 03:19:34 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2018-03-08 18:42:23 +08:00
|
|
|
if(WIN32)
|
|
|
|
list(APPEND CLOC_SRCS_LIB
|
2020-02-24 04:00:51 +08:00
|
|
|
${NEO_CORE_DIRECTORY}/os_interface/windows/os_library_win.cpp
|
|
|
|
${NEO_CORE_DIRECTORY}/os_interface/windows/os_library_win.h
|
2020-02-23 05:50:57 +08:00
|
|
|
${NEO_SOURCE_DIR}/opencl/source/dll/windows/options_windows.cpp
|
2017-12-21 07:45:38 +08:00
|
|
|
)
|
2018-03-08 18:42:23 +08:00
|
|
|
else()
|
|
|
|
list(APPEND CLOC_SRCS_LIB
|
2020-02-24 04:00:51 +08:00
|
|
|
${NEO_CORE_DIRECTORY}/os_interface/linux/os_library_linux.cpp
|
|
|
|
${NEO_CORE_DIRECTORY}/os_interface/linux/os_library_linux.h
|
2020-02-23 05:50:57 +08:00
|
|
|
${NEO_SOURCE_DIR}/opencl/source/dll/linux/options_linux.cpp
|
2017-12-21 07:45:38 +08:00
|
|
|
)
|
2018-03-08 18:42:23 +08:00
|
|
|
endif()
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-02-11 15:33:07 +08:00
|
|
|
string(REPLACE ";" "," ALL_SUPPORTED_PRODUCT_FAMILIES "${ALL_SUPPORTED_PRODUCT_FAMILY}")
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
set(CLOC_LIB_FLAGS_DEFINITIONS
|
|
|
|
-DCIF_HEADERS_ONLY_BUILD
|
2020-02-11 15:33:07 +08:00
|
|
|
-DALL_SUPPORTED_PRODUCT_FAMILIES=${ALL_SUPPORTED_PRODUCT_FAMILIES}
|
2017-12-21 07:45:38 +08:00
|
|
|
)
|
|
|
|
|
2018-05-11 16:54:35 +08:00
|
|
|
set(RUNTIME_GENX_CPP_FILES
|
|
|
|
hw_info
|
2017-12-21 07:45:38 +08:00
|
|
|
)
|
|
|
|
|
2018-03-22 18:35:24 +08:00
|
|
|
macro(macro_for_each_platform)
|
2020-02-23 05:50:57 +08:00
|
|
|
list(APPEND CLOC_SRCS_LIB ${NEO_SOURCE_DIR}/opencl/source/${GEN_TYPE_LOWER}/hw_info_${PLATFORM_IT_LOWER}.inl)
|
2018-03-22 18:35:24 +08:00
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(macro_for_each_gen)
|
2018-05-11 16:54:35 +08:00
|
|
|
foreach(SRC_IT ${RUNTIME_GENX_CPP_FILES})
|
2020-02-23 05:50:57 +08:00
|
|
|
set(SRC_FILE ${NEO_SOURCE_DIR}/opencl/source/${GEN_TYPE_LOWER}/${SRC_IT})
|
2018-05-11 16:54:35 +08:00
|
|
|
if(EXISTS ${SRC_FILE}_${GEN_TYPE_LOWER}.cpp)
|
|
|
|
list(APPEND CLOC_SRCS_LIB ${SRC_FILE}_${GEN_TYPE_LOWER}.cpp)
|
2018-03-22 18:35:24 +08:00
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
apply_macro_for_each_platform()
|
2018-06-04 16:20:09 +08:00
|
|
|
|
2020-02-24 04:00:51 +08:00
|
|
|
list(APPEND CLOC_SRCS_LIB ${NEO_CORE_DIRECTORY}/${GEN_TYPE_LOWER}/enable_${GEN_TYPE_LOWER}.cpp)
|
2018-03-22 18:35:24 +08:00
|
|
|
endmacro()
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-03-22 18:35:24 +08:00
|
|
|
apply_macro_for_each_gen("SUPPORTED")
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
set(CLOC_SRCS
|
|
|
|
${CLOC_SRCS_LIB}
|
2018-03-01 18:59:54 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
2017-12-21 07:45:38 +08:00
|
|
|
)
|
2018-11-19 23:29:16 +08:00
|
|
|
add_executable(ocloc ${CLOC_SRCS})
|
2019-05-16 00:06:16 +08:00
|
|
|
|
|
|
|
if(UNIX)
|
|
|
|
install(FILES $<TARGET_FILE:ocloc>
|
|
|
|
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
|
|
|
COMPONENT ocloc)
|
|
|
|
set_property(GLOBAL APPEND PROPERTY NEO_COMPONENTS_LIST "ocloc")
|
|
|
|
endif()
|
|
|
|
|
2018-06-22 23:38:00 +08:00
|
|
|
add_subdirectories()
|
|
|
|
|
2019-10-09 20:24:46 +08:00
|
|
|
create_project_source_tree(ocloc)
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-02-05 22:07:21 +08:00
|
|
|
set(CLOC_INCLUDES
|
2019-03-27 17:06:29 +08:00
|
|
|
${ENGINE_NODE_DIR}
|
2018-03-08 18:42:23 +08:00
|
|
|
${IGC_OCL_ADAPTOR_DIR}
|
|
|
|
${CIF_BASE_DIR}
|
2020-01-14 21:38:19 +08:00
|
|
|
${NEO__GMM_INCLUDE_DIR}
|
2018-02-05 22:07:21 +08:00
|
|
|
${KHRONOS_HEADERS_DIR}
|
2020-01-14 21:38:19 +08:00
|
|
|
${NEO__IGC_INCLUDE_DIR}
|
2017-12-21 07:45:38 +08:00
|
|
|
)
|
|
|
|
|
2018-11-19 23:29:16 +08:00
|
|
|
target_include_directories(ocloc BEFORE PRIVATE ${CLOC_INCLUDES})
|
2019-06-27 03:19:34 +08:00
|
|
|
target_include_directories(ocloc BEFORE PRIVATE ${IGA_INCLUDE_DIR})
|
2018-02-05 22:07:21 +08:00
|
|
|
|
2019-06-27 03:19:34 +08:00
|
|
|
target_compile_definitions(ocloc PUBLIC ${CLOC_LIB_FLAGS_DEFINITIONS} ${SUPPORTED_GEN_FLAGS_DEFINITONS} DEFAULT_PLATFORM=${DEFAULT_SUPPORTED_PLATFORM}
|
|
|
|
IGA_LIBRARY_NAME=${CMAKE_SHARED_LIBRARY_PREFIX}${IGA_LIBRARY_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
|
2020-01-14 21:38:19 +08:00
|
|
|
target_compile_definitions(ocloc PRIVATE ${NEO__IGC_COMPILE_DEFINITIONS})
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-06-22 23:38:00 +08:00
|
|
|
if(MSVC)
|
2018-11-19 23:29:16 +08:00
|
|
|
target_link_libraries(ocloc dbghelp)
|
2018-06-22 23:38:00 +08:00
|
|
|
endif()
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
if(UNIX)
|
2018-11-19 23:29:16 +08:00
|
|
|
target_link_libraries(ocloc dl pthread)
|
2018-03-08 18:42:23 +08:00
|
|
|
endif()
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-11-19 23:29:16 +08:00
|
|
|
set_target_properties(ocloc PROPERTIES FOLDER "offline_compiler")
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-01-14 21:38:19 +08:00
|
|
|
add_custom_target(copy_compiler_files DEPENDS ${NEO__IGC_TARGETS})
|
2017-12-21 07:45:38 +08:00
|
|
|
set_target_properties(copy_compiler_files PROPERTIES FOLDER "opencl runtime")
|
|
|
|
|
2019-03-07 17:45:33 +08:00
|
|
|
if(WIN32)
|
2020-01-14 21:38:19 +08:00
|
|
|
foreach(TARGET_tmp ${NEO__IGC_TARGETS})
|
2019-03-07 17:45:33 +08:00
|
|
|
add_custom_command(
|
|
|
|
TARGET copy_compiler_files
|
|
|
|
PRE_BUILD
|
2019-07-02 22:56:10 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:ocloc>
|
2019-03-07 17:45:33 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${TARGET_tmp}> $<TARGET_FILE_DIR:ocloc>
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
endif()
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-03-08 18:42:23 +08:00
|
|
|
set(CLOC_SRCS_LIB ${CLOC_SRCS_LIB} PARENT_SCOPE)
|