1 Star 0 Fork 141

zhangfan/acl_1

forked from CANN/acl 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CMakeLists.txt 46.72 KB
一键复制 编辑 原始数据 按行查看 历史
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291
cmake_minimum_required(VERSION 3.14)
project (ascend)
set(INSTALL_BASE_DIR "")
set(INSTALL_LIBRARY_DIR lib)
set(INSTALL_RUNTIME_DIR bin)
set(INSTALL_INCLUDE_DIR include)
set(INSTALL_CONFIG_DIR cmake)
include(CMakePackageConfigHelpers)
set(BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
option(ENABLE_OPEN_SRC "Enable acl compile in opensource." FALSE)
if(ENABLE_OPEN_SRC)
if(DEFINED ENV{ASCEND_CUSTOM_PATH})
set(ASCEND_DIR $ENV{ASCEND_CUSTOM_PATH})
set(ASCEND_OPENSDK_DIR ${ASCEND_DIR}/opensdk/opensdk)
set(CMAKE_PREFIX_PATH
${ASCEND_OPENSDK_DIR}/cmake
${ASCEND_OPENSDK_DIR}/c_sec
${ASCEND_OPENSDK_DIR}/json
${ASCEND_OPENSDK_DIR}/openssl
${ASCEND_OPENSDK_DIR}/zlib
${ASCEND_OPENSDK_DIR}/jpeg
${ASCEND_OPENSDK_DIR}/protoc_grpc
${ASCEND_OPENSDK_DIR}/grpc/lib/cmake/grpc
${ASCEND_OPENSDK_DIR}/grpc/lib/cmake/absl
${ASCEND_OPENSDK_DIR}/gtest_shared/lib64/cmake/GTest
)
set(protobuf_static_ROOT ${ASCEND_OPENSDK_DIR}/protobuf_static)
set(protobuf_grpc_ROOT ${ASCEND_OPENSDK_DIR}/grpc)
set(ascend_protobuf_shared_ROOT ${ASCEND_OPENSDK_DIR}/ascend_protobuf)
set(ascend_protobuf_static_ROOT ${ASCEND_OPENSDK_DIR}/ascend_protobuf_static)
set(protoc_ROOT ${ASCEND_OPENSDK_DIR}/protoc)
set(CMAKE_MODULE_PATH ${ASCEND_OPENSDK_DIR}/cmake/modules)
message("Ascend custom path is ${ASCEND_DIR}")
else()
set(ASCEND_DIR /usr/local/Ascend)
endif()
if(DEFINED ENV{D_PKG_SERVER})
set(ACL_PB_PKG $ENV{D_PKG_SERVER})
message("Download packages from DPKG server")
endif()
set(TARGET_SYSTEM_NAME "Linux")
set(HI_PYTHON python3)
include(${BASE_DIR}/cmake/intf_pub_linux.cmake)
include(${BASE_DIR}/cmake/FindModule.cmake)
include(cmake/function.cmake)
# 开源软件包
find_package(Threads REQUIRED)
find_package(json MODULE REQUIRED)
find_package(protoc MODULE REQUIRED)
find_package(protoc_grpc MODULE REQUIRED)
find_package(protobuf_grpc MODULE REQUIRED)
find_package(protobuf_static MODULE REQUIRED)
find_package(ascend_protobuf_static MODULE REQUIRED)
find_package(openssl MODULE REQUIRED)
find_package(zlib MODULE REQUIRED)
find_package(ascend_protobuf_shared MODULE REQUIRED)
find_package(gRPC CONFIG)
find_package(securec MODULE REQUIRED)
include(${BASE_DIR}/cmake/external_libs/gtest.cmake)
if(ENABLE_ACL_COV OR ENABLE_ACL_UT)
add_subdirectory(tests)
include(${BASE_DIR}/cmake/external_libs/jpeg.cmake)
include(${BASE_DIR}/cmake/external_libs/gtest.cmake)
else()
set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/runtime/lib64)
set(ASCEND_COMPILER_DIR ${ASCEND_DIR}/compiler/lib64)
set(ASCEND_DRIVER_DIR ${ASCEND_DIR}/driver/lib64)
find_package(slog CONFIG REQUIRED)
find_package(metadef CONFIG REQUIRED)
find_package(mmpa CONFIG REQUIRED)
find_package(opcompiler CONFIG REQUIRED)
find_package(platform CONFIG REQUIRED)
find_package(ascend_hal CONFIG REQUIRED)
find_package(runtime CONFIG REQUIRED)
find_package(air CONFIG REQUIRED)
find_package(adump CONFIG REQUIRED)
find_package(msprof CONFIG REQUIRED)
find_package(tdt CONFIG REQUIRED)
find_package(acldvpp CONFIG REQUIRED)
if(PLATFORM STREQUAL "train")
if(PRODUCT STREQUAL "flr3")
message(FATAL_ERROR "This platform is not supported in train mode, build terminated")
endif()
endif()
# 开源软件包
find_package(jpeg MODULE)
endif()
if (${PRODUCT} STREQUAL "nano")
if(ENABLE_C_COV OR ENABLE_C_UT)
add_subdirectory(tests/ut/acl/testcase_c)
else()
find_package(c_base CONFIG REQUIRED)
find_package(air_c_exec CONFIG REQUIRED)
add_subdirectory(c)
endif()
endif()
endif()
if(NOT ENABLE_OPEN_SRC)
add_subdirectory(c)
endif()
###################################################################################################
add_library(ascendcl_headers INTERFACE)
target_include_directories(ascendcl_headers INTERFACE
$<BUILD_INTERFACE:${BASE_DIR}/inc>
$<BUILD_INTERFACE:${BASE_DIR}/inc/external>
$<BUILD_INTERFACE:${BASE_DIR}/inc/external/acl>
$<BUILD_INTERFACE:${BASE_DIR}/inc/external/acl/error_codes>
$<BUILD_INTERFACE:${BASE_DIR}/inc/external/acl/ops>
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:include/ascendcl>
$<INSTALL_INTERFACE:include/ascendcl/external>
$<INSTALL_INTERFACE:include/ascendcl/external/acl>
$<INSTALL_INTERFACE:include/ascendcl/external/acl/error_codes>
$<INSTALL_INTERFACE:include/ascendcl/external/acl/ops>
)
if(NOT ENABLE_OPEN_SRC)
set(PROTO_LIST
"${TOP_DIR}/metadef/proto/om.proto"
)
else()
set(PROTO_LIST
"${BASE_DIR}/third_party/proto/metadef/proto/om.proto"
)
endif()
protobuf_generate(acl PROTO_SRCS PROTO_HDRS ${PROTO_LIST})
set(SRC_LIST
runtime/device.cpp
runtime/event.cpp
runtime/stream.cpp
runtime/memory.cpp
runtime/context.cpp
runtime/callback.cpp
runtime/group.cpp
runtime/allocator.cpp
model/model.cpp
model/acl_aipp.cpp
model/aipp_param_check.cpp
model/model_config.cpp
model/acl_resource_manager.cpp
common/acl.cpp
common/log_inner.cpp
common/log.cpp
common/json_parser.cpp
common/error_codes_api.cpp
single_op/compile/op_compiler.cpp
single_op/compile/op_compile_service.cpp
single_op/builtin/cast_op.cpp
single_op/op.cpp
single_op/op_executor.cpp
single_op/op_model_cache.cpp
single_op/op_model_parser.cpp
single_op/ge_tensor_cache.cpp
single_op/shape_range_utils.cpp
types/acl_op.cpp
types/fp16.cpp
types/fp16_impl.cpp
types/op_attr.cpp
types/op_model.cpp
types/tensor_desc_internal.cpp
utils/array_utils.cpp
utils/attr_utils.cpp
utils/file_utils.cpp
utils/string_utils.cpp
utils/math_utils.cpp
utils/hash_utils.cpp
toolchain/dump.cpp
toolchain/profiling.cpp
toolchain/profiling_manager.cpp
toolchain/resource_statistics.cpp
single_op/compile/op_kernel_selector.cpp
single_op/compile/op_kernel_registry.cpp
single_op/executor/op_task.cpp
single_op/executor/resource_manager.cpp
single_op/executor/stream_executor.cpp
)
############ libascendcl.so ############
if(${TARGET_SYSTEM_NAME} STREQUAL "Windows")
add_library(ascendcl SHARED ${SRC_LIST} ${PROTO_SRCS} $<TARGET_OBJECTS:profapi_stub>)
else()
add_library(ascendcl SHARED ${SRC_LIST} ${PROTO_HDRS})
endif()
if(ENABLE_OPEN_SRC)
add_library(msprofiler_object OBJECT IMPORTED GLOBAL)
if (msprofiler_ext_LIBRARY_DIR)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_object)
execute_process(
COMMAND ar x ${msprofiler_ext_LIBRARY_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_object
)
file(GLOB MSPROFILER_OBJECT_LIST ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_object/*.o)
set_property(TARGET msprofiler_object PROPERTY IMPORTED_OBJECTS ${MSPROFILER_OBJECT_LIST})
endif()
endif()
target_include_directories(ascendcl PRIVATE
if(NOT ENABLE_OPEN_SRC)
####yellow zone####
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/metadef/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/graphengine/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/graphengine/inc/framework>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/metadef/inc/external>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/graphengine/inc/external>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/abl/adump/external>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/abl/adump/inc/adump>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/inc/driver>
####blue zone####
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/metadef/inc>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/graphengine/inc>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/graphengine/inc/framework>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/metadef/inc/external>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/graphengine/inc/external>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/toolchain/ide/ide-daemon/external>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/driver>
${BASE_DIR}/inc/external/acl
${BASE_DIR}/inc/external
${BASE_DIR}/inc
${BASE_DIR}
${BASE_DIR}/common
${BASE_DIR}/toolchain
)
target_compile_options(ascendcl PRIVATE
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-fvisibility=hidden -O2 -fno-common>
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:/utf-8 /Od>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
)
target_compile_definitions(ascendcl PRIVATE
$<IF:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,OS_TYPE=WIN,OS_TYPE=0>
LOG_CPP
FUNC_VISIBILITY
google=ascend_private
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX>
$<$<STREQUAL:${ENABLE_OPEN_SRC},True>:ONLY_COMPILE_OPEN_SRC>
)
target_link_options(ascendcl PRIVATE
-rdynamic
-Wl,-Bsymbolic
-Wl,--exclude-libs,ALL
)
target_link_directories(ascendcl PRIVATE
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Android>:${TOP_DIR}/prebuilts/clang/linux-x86/aarch64/android-ndk-r21/sysroot/usr/lib/aarch64-linux-android/29>
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Android>:${TOP_DIR}/build/prebuilts/clang/linux-x86/aarch64/android-ndk-r21/sysroot/usr/lib/aarch64-linux-android/29>
)
set(linklibs ascend_hal_stub)
if (NOT ENABLE_OPEN_SRC)
if (PRODUCT)
if (${PRODUCT} STREQUAL "npuf10")
set(linklibs )
if (${TARGET_SYSTEM_NAME} STREQUAL "Android")
target_link_directories(ascendcl PRIVATE
${TOP_DIR}/vendor/sdk/hi3796/drv_android
)
elseif(${TARGET_LINUX_DISTRIBUTOR_RELEASE} STREQUAL 100)
target_link_directories(ascendcl PRIVATE
${TOP_DIR}/vendor/sdk/hi3796/drv
)
elseif(${TARGET_LINUX_DISTRIBUTOR_RELEASE} STREQUAL 200)
target_link_directories(ascendcl PRIVATE
${TOP_DIR}/vendor/sdk/hi3559dv100/drv
)
endif()
list(APPEND linklibs -ldrvdevdrv -ldrv_dfx)
else ()
list(APPEND linklibs ascend_hal_stub)
endif()
endif()
else ()
if(PRODUCT STREQUAL "flr2")
set(linklibs )
endif()
if(PRODUCT STREQUAL "flr3")
set(linklibs )
if (${TARGET_SYSTEM_NAME} STREQUAL "Android")
list(APPEND linklibs ${ASCEND_DIR}/drv_android)
else()
list(APPEND linklibs ${ASCEND_DIR}/drv)
endif()
list(APPEND linklibs -ldrvdevdrv -ldrv_dfx)
endif()
endif()
if(${TARGET_SYSTEM_NAME} STREQUAL "Windows")
set(linklibs ascend_hal)
endif()
if(${TARGET_SYSTEM_NAME} STREQUAL "Windows")
target_link_libraries(ascendcl
PRIVATE
$<BUILD_INTERFACE:intf_pub>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:runtime_headers>>
-Wl,--whole-archive
ge_executor
-Wl,--no-whole-archive
ge_common_static
graph_static
ascend_protobuf_static
register_static
error_manager_static
adump_base
static_mmpa
gert_static
exe_graph_static
-Wl,--no-as-needed
c_sec
runtime
alog
${linklibs}
-Wl,--as-needed
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
-ldl
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Android>:-llog>
json
PUBLIC
ascendcl_headers
)
else()
target_link_libraries(ascendcl
PRIVATE
$<BUILD_INTERFACE:intf_pub>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:runtime_headers>>
-Wl,--whole-archive
-Wl,--no-whole-archive
adump_base
$<$<BOOL:${ENABLE_OPEN_SRC}>:adcore>
static_mmpa
-Wl,--no-as-needed
msprofiler_fwk_share
profapi_share
ge_common
graph
exe_graph
ascend_protobuf
error_manager
ge_executor_shared
gert
c_sec
runtime
alog
${linklibs}
-Wl,--as-needed
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
-ldl
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Android>:-llog>
json
PUBLIC
ascendcl_headers
)
endif()
if(${TARGET_SYSTEM_NAME} STREQUAL "Windows")
set_target_properties(ascendcl PROPERTIES
LINK_FLAGS "/WHOLEARCHIVE:ge_executor"
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
OUTPUT_NAME libascendcl
)
endif()
if (NOT ENABLE_OPEN_SRC)
############ libascendcl.a ############
add_library(ascendcl_static STATIC ${SRC_LIST} ${PROTO_SRCS})
target_include_directories(ascendcl_static PRIVATE
${TOP_DIR}/inc
${TOP_DIR}/metadef/inc
${TOP_DIR}/graphengine/inc
${TOP_DIR}/graphengine/inc/framework
${BASE_DIR}/inc/external/acl
${BASE_DIR}/inc/external
${TOP_DIR}/metadef/inc/external
${TOP_DIR}/graphengine/inc/external
${TOP_DIR}/toolchain/ide/ide-daemon/external
${TOP_DIR}/abl/msprof/inc
${TOP_DIR}/abl/adump/external
${TOP_DIR}/abl/adump/inc/adump
${TOP_DIR}/inc/driver
${BASE_DIR}/inc
${BASE_DIR}
${BASE_DIR}/common
${BASE_DIR}/toolchain
)
target_compile_options(ascendcl_static PRIVATE
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-fvisibility=hidden -O2 -fno-common>
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:/utf-8 /Od>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
)
target_compile_definitions(ascendcl_static PRIVATE
$<IF:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,OS_TYPE=WIN,OS_TYPE=0>
FUNC_VISIBILITY
LOG_CPP
google=ascend_private
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX>
)
target_link_options(ascendcl_static PRIVATE
-rdynamic
-Wl,-Bsymbolic
-Wl,--exclude-libs,ALL
)
target_link_directories(ascendcl_static PRIVATE
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Android>:${TOP_DIR}/prebuilts/clang/linux-x86/aarch64/android-ndk-r21/sysroot/usr/lib/aarch64-linux-android/29>
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Android>:${TOP_DIR}/build/prebuilts/clang/linux-x86/aarch64/android-ndk-r21/sysroot/usr/lib/aarch64-linux-android/29>
)
target_link_libraries(ascendcl_static PRIVATE
$<BUILD_INTERFACE:intf_pub>
$<BUILD_INTERFACE:mmpa_headers>
$<BUILD_INTERFACE:msprof_headers>
$<BUILD_INTERFACE:slog_headers>
$<BUILD_INTERFACE:runtime_headers>
c_sec
json
ascend_protobuf
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
-ldl
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Android>:-llog>
)
set_target_properties(ascendcl_static PROPERTIES
OUTPUT_NAME $<IF:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,libascendcl,ascendcl>
)
endif()
if(NOT (ENABLE_OPEN_SRC AND ((PRODUCT STREQUAL "flr2") OR (PRODUCT STREQUAL "flr3"))))
############ fwk/libascendcl.so ############
add_library(fwk_ascendcl SHARED
${SRC_LIST}
)
if (ENABLE_OPEN_SRC)
add_library(msprofiler_fwkacl_object OBJECT IMPORTED GLOBAL)
if (msprofiler_fwkacl_ext_LIBRARY_DIR)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_fwkacl_object)
execute_process(
COMMAND ar x ${msprofiler_fwkacl_ext_LIBRARY_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_fwkacl_object
)
file(GLOB MSPROFILER_FWKACL_OBJECT_LIST ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_fwkacl_object/*.o)
set_property(TARGET msprofiler_fwkacl_object PROPERTY IMPORTED_OBJECTS ${MSPROFILER_FWKACL_OBJECT_LIST})
endif()
endif()
target_include_directories(fwk_ascendcl PRIVATE
####yellow zone####
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/inc/tdt>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/metadef/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/graphengine/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/graphengine/inc/framework>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/metadef/inc/external>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/graphengine/inc/external>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/toolchain/ide/ide-daemon/external>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/abl/adump/external>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/abl/adump/inc/adump>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/inc/driver>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/abl/msprof/inc>
####blue zone####
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/tdt>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/metadef/inc>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/graphengine/inc>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/graphengine/inc/framework>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/metadef/inc/external>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/graphengine/inc/external>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/toolchain/ide/ide-daemon/external>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/driver>
${BASE_DIR}/inc/external/acl
${BASE_DIR}/inc/external
${BASE_DIR}/inc
${BASE_DIR}
${BASE_DIR}/common
${BASE_DIR}/toolchain
)
target_compile_options(fwk_ascendcl PRIVATE
-O2
-fvisibility=hidden
-fno-common
)
target_compile_definitions(fwk_ascendcl PRIVATE
OS_TYPE=0
FUNC_VISIBILITY
google=ascend_private
$<$<STREQUAL:${ENABLE_OPEN_SRC}, True>:ONLY_COMPILE_OPEN_SRC>
)
target_link_options(fwk_ascendcl PRIVATE
-rdynamic
-Wl,-Bsymbolic
-Wl,--exclude-libs,ALL
)
target_link_directories(fwk_ascendcl PRIVATE
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Android>:${TOP_DIR}/prebuilts/clang/linux-x86/aarch64/android-ndk-r21/sysroot/usr/lib/aarch64-linux-android/29>
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Android>:${TOP_DIR}/build/prebuilts/clang/linux-x86/aarch64/android-ndk-r21/sysroot/usr/lib/aarch64-linux-android/29>
)
target_link_libraries(fwk_ascendcl PRIVATE
$<BUILD_INTERFACE:intf_pub>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:runtime_headers>>
adump_base
$<$<BOOL:${ENABLE_OPEN_SRC}>:adcore>
static_mmpa
-Wl,--no-as-needed
c_sec
msprofiler_fwk_share
profapi_share
runtime
slog
ge_common
graph
ascend_protobuf
register
error_manager
ge_runner
datatransfer
ascend_hal_stub
-Wl,--as-needed
json
-ldl
-lrt
)
set_target_properties(fwk_ascendcl PROPERTIES
OUTPUT_NAME ascendcl
LIBRARY_OUTPUT_DIRECTORY fwkacl
)
endif()
##################################################################################################################
add_custom_target(
stub_src ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/acl_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/dvpp_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/cblas_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/op_compiler_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/retr_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/tdt_channel_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/tdt_queue_stub.cpp
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/acl_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/dvpp_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/cblas_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/op_compiler_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/retr_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/tdt_channel_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/tdt_queue_stub.cpp
COMMAND echo "Generating stub files:acl_stub.cpp, dvpp_stub.cpp, cblas_stub.cpp, op_compiler_stub.cpp, retr_stub.cpp, tdt_channel_stub.cpp, tdt_queue_stub.cpp."
&& ${HI_PYTHON} ${BASE_DIR}/stub/gen_stubapi.py ${BASE_DIR}/inc/external/acl
${CMAKE_CURRENT_BINARY_DIR}/acl_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/dvpp_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/cblas_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/op_compiler_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/retr_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/tdt_channel_stub.cpp
${CMAKE_CURRENT_BINARY_DIR}/tdt_queue_stub.cpp
&& echo "Generating stub files end."
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS stub/gen_stubapi.py ${BASE_DIR}/inc/external/acl
)
#----------------------------------------------------------------------------------------------------------------#
############ stub/libascendcl.so ############
add_library(stub_ascendcl SHARED
${CMAKE_CURRENT_BINARY_DIR}/acl_stub.cpp
)
set_target_properties(stub_ascendcl
PROPERTIES
OUTPUT_NAME ascendcl
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/stub
)
target_include_directories(stub_ascendcl PRIVATE
${BASE_DIR}/inc/external
${BASE_DIR}/inc
${BASE_DIR}
${BASE_DIR}/common
)
target_link_libraries(stub_ascendcl
PRIVATE
$<BUILD_INTERFACE:intf_pub>
PUBLIC
ascendcl_headers
)
#----------------------------------------------------------------------------------------------------------------#
############ stub/libacl_dvpp.so ############
add_library(stub_acl_dvpp SHARED
${CMAKE_CURRENT_BINARY_DIR}/dvpp_stub.cpp
)
set_target_properties(stub_acl_dvpp
PROPERTIES
OUTPUT_NAME acl_dvpp
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/stub
)
target_include_directories(stub_acl_dvpp PRIVATE
${BASE_DIR}/inc/external
${BASE_DIR}
${BASE_DIR}/common
)
target_compile_definitions(stub_acl_dvpp PRIVATE
ENABLE_DVPP_INTERFACE
)
target_link_libraries(stub_acl_dvpp PRIVATE
$<BUILD_INTERFACE:intf_pub>
)
#----------------------------------------------------------------------------------------------------------------#
############ stub/libacl_cblas.so ############
add_library(stub_acl_cblas SHARED
${CMAKE_CURRENT_BINARY_DIR}/cblas_stub.cpp
)
target_include_directories(stub_acl_cblas PRIVATE
${BASE_DIR}/inc/external
${BASE_DIR}/inc
${BASE_DIR}
${BASE_DIR}/common
)
set_target_properties(stub_acl_cblas
PROPERTIES
OUTPUT_NAME acl_cblas
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/stub
)
target_link_libraries(stub_acl_cblas PRIVATE
$<BUILD_INTERFACE:intf_pub>
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
-ldl
)
#----------------------------------------------------------------------------------------------------------------#
############ stub/libacl_retr.so ############
add_library(stub_acl_retr SHARED
${CMAKE_CURRENT_BINARY_DIR}/retr_stub.cpp
)
target_include_directories(stub_acl_retr PRIVATE
${BASE_DIR}/inc/external
${BASE_DIR}/inc
${BASE_DIR}
${BASE_DIR}/common
)
set_target_properties(stub_acl_retr
PROPERTIES
OUTPUT_NAME acl_retr
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/stub
)
target_link_libraries(stub_acl_retr PRIVATE
$<BUILD_INTERFACE:intf_pub>
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
-ldl
)
#----------------------------------------------------------------------------------------------------------------#
############ stub/libacl_op_compiler.so ############
add_library(stub_acl_op_compiler SHARED
${CMAKE_CURRENT_BINARY_DIR}/op_compiler_stub.cpp
)
target_include_directories(stub_acl_op_compiler PRIVATE
${BASE_DIR}/inc/external
${BASE_DIR}/inc
${BASE_DIR}
${TOP_DIR}/graphengine/inc/framework
${BASE_DIR}/common
)
set_target_properties(stub_acl_op_compiler
PROPERTIES
OUTPUT_NAME acl_op_compiler
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/stub
)
target_link_libraries(stub_acl_op_compiler PRIVATE
$<BUILD_INTERFACE:intf_pub>
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
-ldl
)
##################################################################################################################
############ stub/libacl_tdt_channel.so ############
add_library(stub_acl_tdt_channel SHARED
${CMAKE_CURRENT_BINARY_DIR}/tdt_channel_stub.cpp
)
target_include_directories(stub_acl_tdt_channel PRIVATE
${BASE_DIR}/inc/external
${BASE_DIR}/inc
${BASE_DIR}
)
set_target_properties(stub_acl_tdt_channel
PROPERTIES
OUTPUT_NAME acl_tdt_channel
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/stub
)
target_link_libraries(stub_acl_tdt_channel PRIVATE
$<BUILD_INTERFACE:intf_pub>
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
-ldl
)
##################################################################################################################
############ stub/libacl_tdt_queue.so ############
add_library(stub_acl_tdt_queue SHARED
${CMAKE_CURRENT_BINARY_DIR}/tdt_queue_stub.cpp
)
target_include_directories(stub_acl_tdt_queue PRIVATE
${BASE_DIR}/inc/external
${BASE_DIR}/inc
${BASE_DIR}
)
set_target_properties(stub_acl_tdt_queue
PROPERTIES
OUTPUT_NAME acl_tdt_queue
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/stub
)
target_link_libraries(stub_acl_tdt_queue PRIVATE
$<BUILD_INTERFACE:intf_pub>
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
-ldl
)
##################################################################################################################
############ libacl_dvpp.so ############
add_library(acl_dvpp SHARED
single_op/dvpp/channel.cpp
single_op/dvpp/vpc.cpp
single_op/dvpp/jpeg.cpp
single_op/dvpp/vdec.cpp
single_op/dvpp/venc.cpp
single_op/dvpp/png.cpp
single_op/dvpp/base/image_processor.cpp
single_op/dvpp/base/video_processor.cpp
single_op/dvpp/mgr/dvpp_manager.cpp
single_op/dvpp/v100/image_processor_v100.cpp
single_op/dvpp/v200/image_processor_v200.cpp
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>>:single_op/dvpp/v300/image_processor_v300.cpp>
single_op/dvpp/v100/video_processor_v100.cpp
single_op/dvpp/v200/video_processor_v200.cpp
single_op/dvpp/common/dvpp_util.cpp
types/dvpp.cpp
$<$<STREQUAL:${PRODUCT},npuf10>:stub/libjpeg_lhisi_stub.cpp>
)
if(${TARGET_SYSTEM_NAME} STREQUAL "Windows")
set(JPEG_INCCLUDE_PATH )
else()
set(JPEG_INCCLUDE_PATH ${TOP_DIR}/open_source/libjpeg-turbo/include)
endif()
target_include_directories(acl_dvpp PRIVATE
####yellow zone####
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/inc/mmpa>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/metadef/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/metadef/inc/external>
####blue zone####
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/mmpa>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/metadef/inc>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/metadef/inc/external>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/dvpp/inc/dvpp>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/dvpp/inc/external/dvpp>
${BASE_DIR}/inc/external
${BASE_DIR}/inc
${BASE_DIR}
${BASE_DIR}/common
${BASE_DIR}/toolchain
${JPEG_INCCLUDE_PATH}
)
target_compile_options(acl_dvpp PRIVATE
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-fvisibility=hidden -O2 -fno-common>
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:/utf-8>
)
target_compile_definitions(acl_dvpp PRIVATE
$<IF:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,OS_TYPE=WIN,OS_TYPE=0>
FUNC_VISIBILITY
ENABLE_DVPP_INTERFACE
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX>
)
target_link_options(acl_dvpp PRIVATE
-rdynamic
-Wl,-Bsymbolic
-Wl,--exclude-libs,ALL
-s
)
target_link_libraries(acl_dvpp PRIVATE
$<BUILD_INTERFACE:intf_pub>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:runtime_headers>>
$<$<AND:$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>,$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>>>:$<BUILD_INTERFACE:dvpp_headers>>
$<$<NOT:$<STREQUAL:${PRODUCT},npuf10>>:static_turbojpeg>
static_mmpa
-Wl,--no-as-needed
runtime
alog
c_sec
ascendcl
# windows mpi is not supported
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>>:acl_dvpp_mpi>
-Wl,--as-needed
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
-ldl
)
if(${TARGET_SYSTEM_NAME} STREQUAL "Windows")
set_target_properties(acl_dvpp PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
OUTPUT_NAME libacl_dvpp
)
endif()
############ libacl_cblas.so ############
add_library(acl_cblas SHARED
single_op/blas/gemm_ops.cpp
single_op/blas/gemv_ops.cpp
)
target_include_directories(acl_cblas PRIVATE
${BASE_DIR}
${BASE_DIR}/inc/ops
${BASE_DIR}/common
${BASE_DIR}/type
${BASE_DIR}/inc
${BASE_DIR}/inc/external
####yellow zone####
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/metadef/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/graphengine/inc/framework>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/metadef/inc/external>
####blue zone####
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/metadef/inc>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/graphengine/inc/framework>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/metadef/inc/external>
)
target_compile_options(acl_cblas PRIVATE
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-fvisibility=hidden -O2 -fno-common>
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:/utf-8>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
)
target_compile_definitions(acl_cblas PRIVATE
$<IF:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,OS_TYPE=WIN,OS_TYPE=0>
FUNC_VISIBILITY
)
target_link_options(acl_cblas PRIVATE
-rdynamic
-Wl,-Bsymbolic
-Wl,--exclude-libs,ALL
)
target_link_libraries(acl_cblas PRIVATE
$<BUILD_INTERFACE:intf_pub>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:runtime_headers>>
-Wl,--no-as-needed
c_sec
ascendcl
alog
-Wl,--as-needed
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
-ldl
)
if(${TARGET_SYSTEM_NAME} STREQUAL "Windows")
set_target_properties(acl_cblas PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
OUTPUT_NAME libacl_cblas
)
endif()
############ libacl_retr.so ############
add_library(acl_retr SHARED
single_op/retr/retr_ops.cpp
types/retr.cpp
single_op/retr/retr_internal.cpp
single_op/retr/retr_init.cpp
single_op/retr/retr_release.cpp
single_op/retr/retr_repo.cpp
single_op/retr/retr_accurate.cpp
single_op/retr/retr_search.cpp
)
target_include_directories(acl_retr PRIVATE
${BASE_DIR}
${BASE_DIR}/inc/external
####yellow zone####
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/metadef/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/metadef/inc/external>
####blue zone####
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/metadef/inc>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/metadef/inc/external>
)
target_compile_options(acl_retr PRIVATE
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-fvisibility=hidden -O2 -Werror -fno-common>
-ftrapv
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:/utf-8>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
)
target_compile_definitions(acl_retr PRIVATE
_FORTIFY_SOURCE=2
OS_TYPE=0
FUNC_VISIBILITY
)
target_link_options(acl_retr PRIVATE
-rdynamic
-Wl,-Bsymbolic
-Wl,--exclude-libs,ALL
)
target_link_libraries(acl_retr PRIVATE
$<BUILD_INTERFACE:intf_pub>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:runtime_headers>>
-Wl,--no-as-needed
ascendcl
alog
runtime
c_sec
-Wl,--as-needed
-ldl
)
if(${TARGET_SYSTEM_NAME} STREQUAL "Windows")
set_target_properties(acl_retr PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
OUTPUT_NAME libacl_retr
)
endif()
############ libacl_tdt_queue.so ############
add_library(acl_tdt_queue SHARED
tensor_data_transfer/queue.cpp
tensor_data_transfer/queue_manager.cpp
tensor_data_transfer/queue_process.cpp
tensor_data_transfer/queue_process_host.cpp
tensor_data_transfer/queue_process_mdc.cpp
tensor_data_transfer/queue_process_ccpu.cpp
)
target_include_directories(acl_tdt_queue PRIVATE
####yellow zone####
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/inc/driver>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/ace/npuruntime/inc>
####blue zone####
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/driver>
${BASE_DIR}/inc/external
${BASE_DIR}/inc
${BASE_DIR}
${BASE_DIR}/common
)
target_compile_options(acl_tdt_queue PRIVATE
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-fvisibility=hidden -O2 -Werror -fno-common>
-ftrapv
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:/utf-8>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
)
target_compile_definitions(acl_tdt_queue PRIVATE
_FORTIFY_SOURCE=2
OS_TYPE=0
FUNC_VISIBILITY
)
target_link_options(acl_tdt_queue PRIVATE
-rdynamic
-Wl,-Bsymbolic
-Wl,--exclude-libs,ALL
)
target_link_libraries(acl_tdt_queue PRIVATE
$<BUILD_INTERFACE:intf_pub>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:runtime_headers>>
-Wl,--no-as-needed
ascendcl
static_mmpa
alog
runtime
c_sec
-Wl,--as-needed
-ldl
)
if(${TARGET_SYSTEM_NAME} STREQUAL "Windows")
set_target_properties(acl_tdt_queue PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
OUTPUT_NAME libacl_tdt_queue
)
endif()
if(NOT (ENABLE_OPEN_SRC AND ((PRODUCT STREQUAL "flr2") OR (PRODUCT STREQUAL "flr3"))))
############ libacl_op_compiler.so ############
add_library(acl_op_compiler SHARED
single_op/op_compiler.cpp
single_op/compile/local_compiler.cpp
single_op/compile/op_compile_processor.cpp
)
target_include_directories(acl_op_compiler PRIVATE
${BASE_DIR}
${BASE_DIR}/common
${BASE_DIR}/inc/external
####yellow zone####
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/metadef/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/graphengine/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/graphengine/inc/framework>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/metadef/inc/external>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/graphengine/inc/external>
####blue zone####
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/metadef/inc>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/graphengine/inc>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/graphengine/inc/framework>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/metadef/inc/external>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/graphengine/inc/external>
)
target_compile_options(acl_op_compiler PRIVATE
-ftrapv
-O2
-Werror
-Wno-deprecated-declarations
-fvisibility=hidden
-fno-common
)
target_compile_definitions(acl_op_compiler PRIVATE
_FORTIFY_SOURCE=2
OS_TYPE=0
FUNC_VISIBILITY
google=ascend_private
)
target_link_options(acl_op_compiler PRIVATE
-rdynamic
-Wl,-Bsymbolic
-Wl,--exclude-libs,ALL
)
target_link_libraries(acl_op_compiler PRIVATE
$<BUILD_INTERFACE:intf_pub>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:runtime_headers>>
static_mmpa
-Wl,--no-as-needed
ascendcl
slog
runtime
c_sec
ge_runner
ascend_protobuf
json
-Wl,--as-needed
-ldl
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
)
endif()
if(NOT (ENABLE_OPEN_SRC AND ((PRODUCT STREQUAL "flr2") OR (PRODUCT STREQUAL "flr3"))))
############ libacl_tdt_channel.so ############
add_library(acl_tdt_channel SHARED
tensor_data_transfer/tensor_data_transfer.cpp
)
target_include_directories(acl_tdt_channel PRIVATE
####yellow zone####
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/ace/npuruntime/inc/tdt>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/metadef/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/graphengine/inc>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/graphengine/inc/framework>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/metadef/inc/external>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/graphengine/inc/external>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/abl/adump/external>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${TOP_DIR}/inc/driver>
####blue zone####
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/tdt>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/metadef/inc>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/graphengine/inc>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/graphengine/inc/framework>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/metadef/inc/external>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/graphengine/inc/external>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/toolchain/ide/ide-daemon/external>
$<$<BOOL:${ENABLE_OPEN_SRC}>:${BASE_DIR}/third_party/inc/driver>
${BASE_DIR}/inc/external
${BASE_DIR}/inc
${BASE_DIR}
${BASE_DIR}/common
)
target_compile_options(acl_tdt_channel PRIVATE
-ftrapv
-O2
-Werror
-Wno-deprecated-declarations
-fvisibility=hidden
-fno-common
)
target_compile_definitions(acl_tdt_channel PRIVATE
_FORTIFY_SOURCE=2
OS_TYPE=0
FUNC_VISIBILITY
$<$<STREQUAL:${ENABLE_OPEN_SRC}, True>:ONLY_COMPILE_OPEN_SRC>
)
target_link_options(acl_tdt_channel PRIVATE
-rdynamic
-Wl,-Bsymbolic
-Wl,--exclude-libs,ALL
)
target_link_libraries(acl_tdt_channel PRIVATE
$<BUILD_INTERFACE:intf_pub>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:runtime_headers>>
static_mmpa
-Wl,--no-as-needed
ascendcl
acl_tdt_queue
runtime
c_sec
slog
datatransfer
-Wl,--as-needed
-ldl
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
)
endif()
############ install #############
install(TARGETS ascendcl ascendcl_headers
EXPORT ascendcl-targets
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} OPTIONAL COMPONENT opensdk
ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} OPTIONAL COMPONENT opensdk
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} OPTIONAL COMPONENT opensdk
)
install(TARGETS stub_ascendcl
EXPORT ascendcl-targets
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/stub OPTIONAL COMPONENT opensdk
ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} OPTIONAL COMPONENT opensdk
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} OPTIONAL COMPONENT opensdk
)
install(FILES ${BASE_DIR}/inc/external/acl/acl.h
${BASE_DIR}/inc/external/acl/acl_base.h
${BASE_DIR}/inc/external/acl/acl_mdl.h
${BASE_DIR}/inc/external/acl/acl_op.h
${BASE_DIR}/inc/external/acl/acl_op_compiler.h
${BASE_DIR}/inc/external/acl/acl_rt.h
${BASE_DIR}/inc/external/acl/acl_rt_allocator.h
${BASE_DIR}/inc/external/acl/acl_tdt.h
${BASE_DIR}/inc/external/acl/acl_tdt_queue.h
${TOP_DIR}/abl/msprof/inc/external/acl/acl_prof.h
DESTINATION ${INSTALL_INCLUDE_DIR}/ascendcl/external/acl COMPONENT opensdk EXCLUDE_FROM_ALL
)
install(FILES ${TOP_DIR}/air/inc/external/ge/ge_error_codes.h
${TOP_DIR}/ace/npuruntime/inc/external/runtime/rt_error_codes.h
DESTINATION ${INSTALL_INCLUDE_DIR}/ascendcl/external/acl/error_codes COMPONENT opensdk EXCLUDE_FROM_ALL
)
install(FILES ${BASE_DIR}/inc/external/acl/ops/acl_cblas.h
${BASE_DIR}/inc/external/acl/ops/acl_dvpp.h
${BASE_DIR}/inc/external/acl/ops/acl_fv.h
DESTINATION ${INSTALL_INCLUDE_DIR}/ascendcl/external/acl/ops COMPONENT opensdk EXCLUDE_FROM_ALL
)
if (PACKAGE STREQUAL "opensdk")
install(EXPORT ascendcl-targets DESTINATION ${INSTALL_CONFIG_DIR}
FILE ascendcl-targets.cmake COMPONENT opensdk EXCLUDE_FROM_ALL
)
set(PKG_NAME ascendcl)
configure_package_config_file(${TOP_DIR}/cmake/config/pkg_config_template.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/ascendcl-config.cmake
INSTALL_DESTINATION ${INSTALL_CONFIG_DIR}
PATH_VARS INSTALL_BASE_DIR INSTALL_INCLUDE_DIR INSTALL_LIBRARY_DIR INSTALL_RUNTIME_DIR INSTALL_CONFIG_DIR
INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}
)
unset(PKG_NAME)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ascendcl-config.cmake
DESTINATION ${INSTALL_CONFIG_DIR} COMPONENT opensdk EXCLUDE_FROM_ALL
)
endif()
if(${TARGET_SYSTEM_NAME} STREQUAL "Windows")
install(TARGETS acl_dvpp acl_cblas acl_retr acl_op_compiler acl_tdt_channel acl_tdt_queue ascendcl_static OPTIONAL
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
)
install(FILES $<TARGET_PDB_FILE:ascendcl acl_dvpp acl_cblas acl_retr> DESTINATION ${INSTALL_LIBRARY_DIR} OPTIONAL)
elseif(NOT ENABLE_OPEN_SRC)
install(TARGETS acl_dvpp acl_cblas acl_retr acl_op_compiler acl_tdt_channel acl_tdt_queue ascendcl_static OPTIONAL
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
)
else()
install(TARGETS acl_dvpp acl_cblas acl_retr acl_tdt_queue OPTIONAL
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
)
if(NOT (ENABLE_OPEN_SRC AND ((PRODUCT STREQUAL "flr2") OR (PRODUCT STREQUAL "flr3"))))
install(TARGETS acl_op_compiler acl_tdt_channel OPTIONAL
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
)
endif()
endif()
install(TARGETS stub_acl_dvpp stub_acl_cblas stub_acl_retr stub_acl_op_compiler stub_acl_tdt_channel stub_acl_tdt_queue OPTIONAL
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/stub
)
install(TARGETS stub_acl_dvpp stub_acl_cblas stub_acl_retr stub_acl_tdt_queue stub_ascendcl OPTIONAL
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/${CMAKE_SYSTEM_PROCESSOR}/stub
)
if(NOT (ENABLE_OPEN_SRC AND ((PRODUCT STREQUAL "flr2") OR (PRODUCT STREQUAL "flr3"))))
install(TARGETS fwk_ascendcl OPTIONAL
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/fwkacl
)
endif()
add_dependencies(stub_ascendcl stub_src)
add_dependencies(stub_acl_op_compiler stub_src)
add_dependencies(stub_acl_tdt_channel stub_src)
add_dependencies(stub_acl_tdt_queue stub_src)
add_dependencies(stub_acl_retr stub_src)
add_dependencies(stub_acl_cblas stub_src)
add_dependencies(stub_acl_dvpp stub_src)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/zhangfan_hq/acl_1.git
git@gitee.com:zhangfan_hq/acl_1.git
zhangfan_hq
acl_1
acl_1
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385