Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev 0.4.2 #1926

Open
wants to merge 98 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
43e0b7e
[UPD] merge API header files
doxutx Apr 12, 2023
33a47de
[UPD] merge global CMakeLists.txt
doxutx Apr 12, 2023
407e24e
[UPD] merge test files in ./test/ folder
doxutx Apr 12, 2023
dc69915
[UPD] merge docs folder
doxutx Apr 12, 2023
554e923
[UPD] merge linux & windows platform CMakeLists.txt
doxutx Apr 12, 2023
9b94418
[UPD] merge scripts & .gitignore
doxutx Apr 12, 2023
07b2520
[UPD] merge & move pybind11 to third_party folder
doxutx Apr 12, 2023
628436d
[UPD] Merge with master
doxutx Apr 24, 2023
9a99598
[UPD] merge modifications in tools directory
doxutx Apr 24, 2023
01babd8
[UPD] merge source/tnn/core modifications
doxutx Apr 24, 2023
96e1dc0
[UPD] merge source/tnn/device/arm modifications
doxutx Apr 25, 2023
134ca42
[UPD] merge source/tnn/device/cpu modification
doxutx Apr 25, 2023
eb91d92
[UPD] merge source/tnn/device/cuda modifications
doxutx Apr 25, 2023
0e676ad
[UPD] merge source/tnn/device/huawei_npu modifications
doxutx Apr 25, 2023
3b490a0
[UPD] merge source/tnn/device/metal modifications
doxutx Apr 25, 2023
a56a38b
[UPD] merge source/tnn/device/opencl modifications
doxutx Apr 25, 2023
f940efb
[UPD] merge source/tnn/device/metal/blob_cvter.mm modifications
doxutx Apr 25, 2023
4f6e68c
[UPD] merge source/tnn/device/rknpu modifications
doxutx Apr 25, 2023
1e1d1be
[UPD] merge source/tnn/device/x86 modifications
doxutx Apr 25, 2023
27444c6
[UPD] merge source/tnn/extern_wrapper modifications
doxutx Apr 25, 2023
8555e6e
[UPD] merge source/tnn/interpreter modifications
doxutx Apr 25, 2023
b4c7012
[UPD] merge source/tnn/interpreter/ncnn modifications
doxutx Apr 25, 2023
ec27444
[UPD] merge source/tnn/interpreter/tnn modifications
doxutx Apr 25, 2023
0c26dd2
[UPD] merge source/tnn/layer modifications
doxutx Apr 25, 2023
7197b08
[UPD] merge source/tnn/memory_manager modifications
doxutx Apr 26, 2023
be19267
[UPD] merge source/tnn/network/coreml modifications
doxutx Apr 26, 2023
2d2dba7
[UPD] merge source/tnn/network/openvino modifications
doxutx Apr 26, 2023
dd3ac97
[UPD] merge source/tnn/network/tensorrt modifications
doxutx Apr 26, 2023
81e8577
[UPD] merge source/tnn/optimizer modifications
doxutx Apr 26, 2023
c122c6f
[UPD] merge source/tnn/utils modifications
doxutx Apr 26, 2023
7c0048b
[UPD] merge NeedDoScaleBias, floorf, CMakeLists.txt modifications
doxutx Apr 26, 2023
30e7d75
[UPD] rename 'RESERVED_XXX' Mat formats
doxutx Apr 26, 2023
528014b
[UPD] merge TNN coreml API changes
doxutx May 4, 2023
c171661
[UPD] add arm BlobCVTer NeedDoScaleBias() func
doxutx May 4, 2023
ea13c1b
[UPD] adjust arm BlobCVTer NeedDoScaleBias() func
doxutx May 4, 2023
6a7c8ff
[UPD] futher adjust arm BlobCVTer NeedDoScaleBias() func
doxutx May 4, 2023
9f46ad9
[UPD] merge stable diffusion opt updates
doxutx May 4, 2023
0a93e0c
[UPD] merge optimizer const, comment fused layer ptrs
doxutx May 4, 2023
f53945e
[UPD] remove optimizer_const.cc in ios project file
doxutx May 4, 2023
aa969c6
[UPD] Add back RESERVED_XXX Mat Format
doxutx May 11, 2023
9480536
[UPD] fix typo in arm_blob_converter.cc
doxutx May 11, 2023
7b827c5
[UPD] update TNNTest documents
doxutx May 11, 2023
0fbb0a3
[UPD] fix TNNTest doc indentation
doxutx May 11, 2023
f1633d7
[TOOLS][ARM] Add Arm Cumsum CVTer, Cumsum Onnx2tnn CVTer
doxutx May 24, 2023
9a5d027
[ARM][UPD] Add arm Roll OP implmentation
doxutx May 24, 2023
3bf1f47
[UPD] Add Or, Xor Onnx Converter
doxutx May 24, 2023
5f04e7c
[UPD][NPU] change huawei npu #include from <> to ''
doxutx May 24, 2023
3297015
[UPD][NPU] fix huawei npu new version compile errors
doxutx May 24, 2023
2d44ad2
[UPD][NPU] Add DataType Map to HUAWEI NPU Network
doxutx May 24, 2023
bdc1737
[UPD] Add pytnn
doxutx May 25, 2023
8c685d8
[UPD] Add compatible MatTypes to model_checker
doxutx May 26, 2023
72d9b2d
[UPD] Add TRT Version restriction to layernorm & non-zero
doxutx May 29, 2023
dd3fac2
[UPD][OPTIMIZER] replace Optimizer namespace with TNN_NS
doxutx May 29, 2023
0e24f7d
[UPD] add TRT Network GPU sm version check
doxutx May 30, 2023
4230dba
[UPD][NPU] Update huawei HiAi NPU codes to support HiAi DDK 100.520.X…
doxutx Jun 1, 2023
cddfcbd
[UPD][SNPE] Add TNN for Qualcomm SNPE
doxutx Jun 6, 2023
3276266
[BUG] Comment unused 'i' in third_party/flatbuffers to fix mac compil…
doxutx Jun 8, 2023
7930ebd
[BUG] Fix TNN SplitV layer interpret default value bug
doxutx Jun 8, 2023
47dc361
[UPD] Update linux-x86-cpu-gcc.yml
doxutx Jun 12, 2023
0ad3759
[UPD] Update github actions, update to new versions to avoid WARNINGs
doxutx Jun 12, 2023
a1a30d7
[UPD] fix model_checker bug, upate github action version
doxutx Jun 12, 2023
813a5c6
[UPD][OPENVINO] Major Update, upgrade openvino to version 2023.0
doxutx Jun 13, 2023
a9208e3
Merge branch 'master' of github.com:Tencent/TNN into dev-0.4.2
doxutx Jun 13, 2023
f5ccd97
update for atlas (#1939)
calvinphxu Jun 19, 2023
c9a6093
[UPD] Update scripts/build_macos.sh OPENVINO to new version
doxutx Jun 19, 2023
bb2d60c
[OPENVINO] Update openvino macos lib address
doxutx Jun 19, 2023
c95d539
[OPENVINO] fix build_macos.sh typo
doxutx Jun 20, 2023
4d0c0f6
[OPENVINO] Adjust openvino Mac Link
doxutx Jun 20, 2023
e544e94
[OPENVINO] remove tbb link on macos
doxutx Jun 20, 2023
07082e4
[SNPE] Update SNPE version to 2.11
doxutx Jul 4, 2023
93c77d0
[DEMO] Update Android Demo Settings to 2023 new version
doxutx Jul 4, 2023
e59c908
[DEMO] Update android demo to support Qualcomm SNPE
doxutx Jul 7, 2023
8aea575
[DEMO] Update Android SNPE demo
doxutx Jul 11, 2023
20a68a8
[TOOLS] Lower Cyclomatic Complexity: onnx2tnn part
doxutx Jul 19, 2023
ec8a953
[OPTIMIZER] remove unused MulitHeadAttention v1 Optimizer
doxutx Jul 20, 2023
bb953bf
[UPD] Lower Cyclomatic Complexity: layer part
doxutx Jul 20, 2023
20276bf
[ATLAS] Update doc & examples & codes for HUAWEI Atlas (#1946)
calvinphxu Jul 21, 2023
af491b1
[IOS][COREML] Fix ios CoreML build errors
doxutx Aug 16, 2023
4350595
[CUDA][ARM] Add arm64+CUDA compile script
doxutx Sep 6, 2023
a66300e
close fuse ffn optimizer
doxutx Sep 19, 2023
88bfb0b
[ATLAS] fix atlas code bugs
doxutx Sep 22, 2023
96e9ec5
Merge remote-tracking branch 'origin/master' into dev-0.4.2
doxutx Dec 4, 2023
a7605b8
[CUDA] Add TensorRT Swish Impl
doxutx Dec 4, 2023
8934bc7
[OP] Update Range OP TNN interepreter to support OLD TNN Proto
doxutx Jan 18, 2024
70836d0
[TRT] Add fallback to hand-written ROIAlign for TRT prev to 8.4
doxutx Feb 27, 2024
97e7c1b
[ATLAS] Update ATLAS, support new APIs like get input shape map
doxutx Feb 29, 2024
6be1b0d
[ATLAS] Update CMakeLists.txt for Atlas Platform
doxutx Feb 29, 2024
4d3dc00
[TRT] Disable TRT MatMul Plugin Cases, plugin can only be called via …
doxutx Mar 20, 2024
1e2b6a6
[OP] Update BiasAdd OP settings
doxutx Mar 23, 2024
f453576
[BUG][CUDA] Revert CUDA LayerNorm Grid.x Grid.y to fix >65535 bug on …
doxutx Mar 26, 2024
7cea315
[TRT][OP] Fix Upsample TRT LayerBuilder BUG for dim upsample under dy…
doxutx Mar 28, 2024
3bf8a7b
[ATLAS] Refact TNN ATLAS for Multiple Model
doxutx Apr 12, 2024
b9136bb
[TRT] Fix Upsample TRT LayerBuilder Plugin & 3D BUGs
doxutx Apr 20, 2024
49ed37c
[ATLAS] Fix Atlas func return BUG, remove destroy old desc code
doxutx May 11, 2024
5713190
fix layernorm and graph ir logic
seanxcwang May 15, 2024
dc16e53
[ATLAS] Set Atlas Default cxx11 abi to OFF
doxutx May 20, 2024
baff1f6
[ATLAS] Fix TNN Atlas Bugs
doxutx May 21, 2024
debcb38
[TRT] Add TRT Layer delete when layer creation return non-zero
doxutx Jun 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions .github/workflows/android-arm-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ jobs:
outputs:
CONDITION: ${{ steps.preflight.outputs.CONDITION }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Preflight
id: preflight
run: |
echo ::set-output name=CONDITION::0
./scripts/.ci/preflight.sh android || ret=$? && echo $ret && echo ::set-output name=CONDITION::$ret
echo "CONDITION=0" >> $GITHUB_OUTPUT
./scripts/.ci/preflight.sh android || ret=$? && echo $ret && echo "CONDITION=$ret" >> $GITHUB_OUTPUT

android:
needs: [setup]
if: ${{ needs.setup.outputs.CONDITION != '11' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: configure
run: sudo apt-get install attr
- name: build
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ios-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ jobs:
outputs:
CONDITION: ${{ steps.preflight.outputs.CONDITION }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Preflight
id: preflight
run: |
echo ::set-output name=CONDITION::0
./scripts/.ci/preflight.sh ios || ret=$? && echo $ret && echo ::set-output name=CONDITION::$ret
echo "CONDITION=0" >> $GITHUB_OUTPUT
./scripts/.ci/preflight.sh ios || ret=$? && echo $ret && echo "CONDITION=$ret" >> $GITHUB_OUTPUT

ios-iphone-os:
needs: [setup]
if: ${{ needs.setup.outputs.CONDITION != '11' }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: build
run: ./scripts/build_framework_ios.sh
12 changes: 6 additions & 6 deletions .github/workflows/linux-x86-cpu-gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ on:

jobs:
setup:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
outputs:
CONDITION: ${{ steps.preflight.outputs.CONDITION }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Preflight
id: preflight
run: |
echo ::set-output name=CONDITION::0
./scripts/.ci/preflight.sh x86 || ret=$? && echo $ret && echo ::set-output name=CONDITION::$ret
echo "CONDITION=0" >> $GITHUB_OUTPUT
./scripts/.ci/preflight.sh x86 || ret=$? && echo $ret && echo "CONDITION=$ret" >> $GITHUB_OUTPUT

linux-gcc:
needs: [setup]
if: ${{ needs.setup.outputs.CONDITION != '11' }}
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: build
run: ./scripts/build_x86_linux.sh
8 changes: 4 additions & 4 deletions .github/workflows/macos-x64-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ jobs:
outputs:
CONDITION: ${{ steps.preflight.outputs.CONDITION }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Preflight
id: preflight
run: |
echo ::set-output name=CONDITION::0
./scripts/.ci/preflight.sh x86 || ret=$? && echo $ret && echo ::set-output name=CONDITION::$ret
echo "CONDITION=0" >> $GITHUB_OUTPUT
./scripts/.ci/preflight.sh x86 || ret=$? && echo $ret && echo "CONDITION=$ret" >> $GITHUB_OUTPUT

macos-clang:
needs: [setup]
if: ${{ needs.setup.outputs.CONDITION != '11' }}
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: protobuf
run: brew install protobuf opencv3
- name: build
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,10 @@ model/
# opencl generated code
opencl_program.cc

# cache
*.cache
*.cache~

# opencl generated code
opencl_program.cc
platforms/mac/tnn.xcodeproj/project.xcworkspace/xcuserdata/darrenyao.xcuserdatad/UserInterfaceState.xcuserstate
Expand Down
102 changes: 94 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.1)

#set(CMAKE_CXX_STANDARD 14)
#set(CMAKE_CXX_STANDARD_REQUIRED ON)
# https://cmake.org/cmake/help/latest/policy/CMP0068.html
if(POLICY CMP0068)
cmake_policy(SET CMP0068 NEW)
Expand All @@ -15,8 +16,8 @@ project(TNN)
ENABLE_LANGUAGE(ASM)

set(TNN_MAJOR_VERSION 0)
set(TNN_MINOR_VERSION 3)
set(TNN_PATCH_VERSION 0)
set(TNN_MINOR_VERSION 4)
set(TNN_PATCH_VERSION 2)
set(TNN_BUILD_VERSION 0)
set(TNN_VERSION "${TNN_MAJOR_VERSION}.${TNN_MINOR_VERSION}.${TNN_PATCH_VERSION}.${TNN_BUILD_VERSION}")

Expand All @@ -27,14 +28,16 @@ option(TNN_ARM82_ENABLE "Enable Arm82" OFF)
option(TNN_METAL_ENABLE "Enable Metal" OFF)
option(TNN_OPENCL_ENABLE "Enable OpenCL" OFF)
option(TNN_CUDA_ENABLE "Enable CUDA" OFF)
option(TNN_DSP_ENABLE "Enable DSP" OFF)
option(TNN_SNPE_ENABLE "Enable Qualcomm SNPE DSP" OFF)
option(TNN_ATLAS_ENABLE "Enable Atlas" OFF)
option(TNN_TENSORRT_ENABLE "Enable TensorRT" OFF)
option(TNN_OPENVINO_ENABLE "Enable OPENVINO" OFF)
option(TNN_APPLE_NPU_ENABLE "Enable NPU" OFF)
option(TNN_HUAWEI_NPU_ENABLE "Enable NPU" OFF)
option(TNN_RK_NPU_ENABLE "Enable RKNPU" OFF)
option(TNN_JETSON_NANO_ENABLE "Enable Jetson Nano" OFF)
option(TNN_TNNTORCH_ENABLE "Enable TNNTorch" OFF)
option(TNN_ZIXIAO_ENABLE "Enable TNNTorch" OFF)
option(TNN_TORCHVISION_ENABLE "Enable TorchVision" OFF)
option(TNN_SYMBOL_HIDE "Enable Hide Symbol Visibility" ON)
option(TNN_OPENMP_ENABLE "Enable OpenMP" OFF)
option(TNN_BUILD_SHARED "Build Shared Library" ON)
Expand All @@ -52,12 +55,17 @@ option(TNN_ONNX2TNN_ENABLE "Enable ONNX2TNN Converter" OFF)
option(TNN_TNN2MEM_ENABLE "Enable tnn2mem" OFF)
option(TNN_BUILD_BENCHMARK_TEST_LIB_ENABLE "Enable Build Benchmark Test Lib" OFF)
option(TNN_GLIBCXX_USE_CXX11_ABI_ENABLE "Enable Use CXX11 ABI" ON)
option(TNN_PYBIND_ENABLE "Enable Pybind" OFF)
option(TNN_METAL_FLOAT32 "Enable Metal Float32" OFF)
option(TNN_COREML_FLOAT32 "Enable Float32 CoreML Model" ON)
option(TNN_DYNAMIC_RANGE_QUANTIZATION_ENABLE "Enable Dynamic Range Quantization" OFF)
option(TNN_PACK_TORCH_LIB "Enable Torch Lib Pack in release" ON)

set(TNN_USE_GFLAGS OFF)

set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_SKIP_BUILD_RPATH FALSE)

message(${CMAKE_SOURCE_DIR})
message(${CMAKE_CURRENT_SOURCE_DIR})

Expand All @@ -76,6 +84,10 @@ if(TNN_PROFILER_ENABLE)
set(TNN_SYMBOL_HIDE OFF)
endif()

if(TNN_TORCHVISION_ENABLE)
add_definitions(-DTNN_TORCHVISION)
endif()

if(TNN_BENCHMARK_MODE)
add_definitions(-DGENERATE_RESOURCE)
endif()
Expand Down Expand Up @@ -131,12 +143,17 @@ if(TNN_UNIT_TEST_ENABLE)
add_definitions(-DGENERATE_RESOURCE)
endif()

if(TNN_MATCHER_TEST_ENABLE)
set(TNN_SYMBOL_HIDE OFF)
endif()

if(TNN_CONVERTER_ENABLE)
set(TNN_ONNX2TNN_ENABLE ON)
endif()

if(TNN_CONVERTER_ENABLE OR TNN_ONNX2TNN_ENABLE)
set(TNN_SYMBOL_HIDE OFF)
set(TNN_PYBIND_ENABLE ON)
add_definitions(-DTNN_CONVERTER_RUNTIME)
endif()

Expand Down Expand Up @@ -256,14 +273,16 @@ message(STATUS "\tArm82:\t${TNN_ARM82_ENABLE}")
message(STATUS "\tMetal:\t${TNN_METAL_ENABLE}")
message(STATUS "\tOpenCL:\t${TNN_OPENCL_ENABLE}")
message(STATUS "\tCUDA:\t${TNN_CUDA_ENABLE}")
message(STATUS "\tDSP:\t${TNN_DSP_ENABLE}")
message(STATUS "\tSNPE:\t${TNN_SNPE_ENABLE}")
message(STATUS "\tAtlas:\t${TNN_ATLAS_ENABLE}")
message(STATUS "\tTensorRT:\t${TNN_TENSORRT_ENABLE}")
message(STATUS "\tAppleNPU:\t${TNN_APPLE_NPU_ENABLE}")
message(STATUS "\tHuaweiNPU:\t${TNN_HUAWEI_NPU_ENABLE}")
message(STATUS "\tRKNPU:\t${TNN_RK_NPU_ENABLE}")
message(STATUS "\tJetson Nano:\t${TNN_JETSON_NANO_ENABLE}")
message(STATUS "\tOpenVINO:\t${TNN_OPENVINO_ENABLE}")
message(STATUS "\tTNNTorch:\t${TNN_TNNTORCH_ENABLE}")
message(STATUS "\tZIXIAO:\t${TNN_ZIXIAO_ENABLE}")
message(STATUS "\tOpenMP:\t${TNN_OPENMP_ENABLE}")
message(STATUS "\tTEST:\t${TNN_TEST_ENABLE}")
message(STATUS "\t--Unit Test:\t${TNN_UNIT_TEST_ENABLE}")
Expand Down Expand Up @@ -385,19 +404,58 @@ if(TNN_CUDA_ENABLE)
set(TARGET_OBJECTS ${TARGET_OBJECTS} "$<TARGET_OBJECTS:TNNCuda>")
endif()

if(TNN_SNPE_ENABLE)
if(ANDROID_ABI STREQUAL "armeabi-v7a")
# SNPE 2.11+ no longer support ARMv7
message(STATUS "TNN SNPE not available on Android ARMv7")
else()
link_directories(third_party/snpe/lib/aarch64-android/)
add_subdirectory(source/tnn/device/snpe)
set(TARGET_OBJECTS ${TARGET_OBJECTS} "$<TARGET_OBJECTS:TNNSNPE>")
endif()
endif()

if(TNN_HUAWEI_NPU_ENABLE)
if(ANDROID_ABI STREQUAL "armeabi-v7a")
link_directories(
third_party/huawei_npu/hiai_ddk_latest/armeabi-v7a/
third_party/huawei_npu/hiai_ddk_latest/ddk/ai_ddk_lib/lib/
)
else()
link_directories(
third_party/huawei_npu/hiai_ddk_latest/arm64-v8a/
third_party/huawei_npu/hiai_ddk_latest/ddk/ai_ddk_lib/lib64/
)
endif()
add_subdirectory(source/tnn/device/huawei_npu)
set(TARGET_OBJECTS ${TARGET_OBJECTS} "$<TARGET_OBJECTS:TNNNPU>")
endif()
if(TNN_ATLAS_ENABLE)
add_definitions(-DGET_NETWORK_ENABLE)
add_subdirectory(source/tnn/device/atlas)
set(TARGET_OBJECTS ${TARGET_OBJECTS} "$<TARGET_OBJECTS:TNNAtlas>")
include_directories(${CMAKE_SOURCE_DIR}/source/tnn/device/atlas)
set(ASCEND_PATH $ENV{DDK_PATH})
if (NOT DEFINED ENV{DDK_PATH})
set(ASCEND_PATH "/usr/local/Ascend/ascend-toolkit/latest")
message(STATUS "set default ASCEND_PATH: ${ASCEND_PATH}")
else ()
message(STATUS "env ASCEND_PATH: ${ASCEND_PATH}")
endif()
set(ACL_LIB_PATH $ENV{NPU_HOST_LIB})
if (NOT DEFINED ENV{NPU_HOST_LIB})
set(ACL_LIB_PATH "/usr/local/Ascend/ascend-toolkit/latest/lib64")
message(STATUS "set default ACL_LIB_PATH: ${ACL_LIB_PATH}")
else ()
message(STATUS "env ACL_LIB_PATH: ${ACL_LIB_PATH}")
endif()
# Header path
include_directories(
${ASCEND_PATH}/acllib/include/
)
# add host lib path
link_directories(
${ACL_LIB_PATH}
)
endif()

if(TNN_RK_NPU_ENABLE)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
Expand All @@ -413,9 +471,23 @@ if(TNN_RK_NPU_ENABLE)
set(TARGET_OBJECTS ${TARGET_OBJECTS} "$<TARGET_OBJECTS:TNNRKNPU>")
endif()

if(TNN_TNNTORCH_ENABLE)
add_subdirectory(source/tnn/network/torch)
set(TARGET_OBJECTS ${TARGET_OBJECTS} "$<TARGET_OBJECTS:TNNTorch>")
endif()

if(TNN_ZIXIAO_ENABLE)
add_subdirectory(source/tnn/device/zixiao)
set(TARGET_OBJECTS ${TARGET_OBJECTS} "$<TARGET_OBJECTS:TNNZIXIAO>")
endif()

if(TNN_BUILD_SHARED)
add_library(TNN SHARED ${SRC} ${TARGET_OBJECTS})
set_target_properties(TNN PROPERTIES VERSION ${TNN_VERSION} SOVERSION ${TNN_MAJOR_VERSION})
set_target_properties(TNN PROPERTIES LINK_FLAGS "-Wl,-rpath,$ORIGIN")
if (NOT TNN_PACK_TORCH_LIB)
set_target_properties(TNN PROPERTIES LINK_FLAGS "-Wl,-rpath,$ORIGIN -Wl,-rpath,$ORIGIN/../torch/lib")
endif()
if(SHARING_MEM_WITH_OPENGL)
if(SYSTEM.Windows)
target_link_libraries(TNN opengl32)
Expand Down Expand Up @@ -456,6 +528,19 @@ elseif(SYSTEM.Windows)
include(platforms/windows/CMakeLists.txt)
endif()

if(TNN_PYBIND_ENABLE)
set(CMAKE_CXX_STANDARD 14)
include_directories(third_party/pybind11/include)
add_subdirectory(third_party/pybind11)
file(GLOB_RECURSE TORCH_SRC "source/pytnn/*.cc")
add_library(_pytnn SHARED ${TORCH_SRC})
target_link_libraries(_pytnn pybind11::module)
set_target_properties(_pytnn PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}")
set_target_properties(_pytnn PROPERTIES LINK_FLAGS "-Wl,-rpath,\$ORIGIN")
target_link_libraries(_pytnn TNN)
endif()

if (TNN_TEST_ENABLE OR TNN_CONVERTER_ENABLE OR TNN_MODEL_CHECK_ENABLE OR TNN_DYNAMIC_RANGE_QUANTIZATION_ENABLE)
set(TNN_USE_GFLAGS ON)
endif ()
Expand Down Expand Up @@ -499,6 +584,7 @@ endif()
if(TNN_DYNAMIC_RANGE_QUANTIZATION_ENABLE)
add_subdirectory(tools/dynamic_range_quantization)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPYBIND11_COMPILER_TYPE=\\\"_gcc\\\" -DPYBIND11_STDLIB=\\\"_libstdcpp\\\" -DPYBIND11_BUILD_ABI=\\\"_cxxabi1011\\\"")

if (MSVC)
target_compile_options(TNN PUBLIC "/Zc:__cplusplus")
Expand Down
Loading
Loading