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

Fix hexagon_converter and complie merge bugBeluooo #790

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
b344d69
lemon base
Sep 1, 2023
beb2aa5
Fix building hexagon_nn
Sep 1, 2023
d102645
Add MACE_ENABLE_CPU to build scripts
Sep 12, 2023
a46ded1
Merge pull request #1 from BJTU-HXG/libin-dev
linepi Sep 12, 2023
eb06ba6
compile success with qnx
Sep 14, 2023
b0b714f
compile success with qnx
Sep 14, 2023
f1464b0
impl env get_cpu_freq and set_cpu_affinity
Sep 19, 2023
0b5874c
success in compiling qnx dsp
linepi Sep 22, 2023
27daf38
Merge pull request #2 from BJTU-HXG/lemon
linepi Sep 22, 2023
1f5714f
full cmake message
linepi Sep 24, 2023
624f5e9
fix check_tensor error
linepi Sep 26, 2023
8a96d01
Merge pull request #3 from BJTU-HXG/lemon
linepi Sep 26, 2023
d78c8df
support android dsp
Jazzyyyl Oct 9, 2023
c483487
fix two bug: unsignedPD for qnx and protobuf install lib dir is lib64
linepi Oct 12, 2023
8c6424b
success in convertor transformer
linepi Oct 30, 2023
1070667
add debug json dump and add some hexagon_converter op
linepi Nov 7, 2023
35412ac
support dsp log print and graph print
linepi Nov 16, 2023
de6c352
enable transformer running
linepi Nov 17, 2023
40474fa
remove div to max
linepi Dec 2, 2023
fd3e05d
fix android bug
Dec 9, 2023
5cde631
Matmul Reducemean validate passed
Beluooo-H Dec 19, 2023
fd1f839
Transformer validate passed
Beluooo-H Dec 29, 2023
0e70b38
Conformer run on CPU
Beluooo-H Jan 19, 2024
bf4763c
Conformer convert on dsp
Beluooo-H Feb 21, 2024
f336608
Conformer run on dsp
Beluooo-H Mar 1, 2024
36f2e1b
save temporary
linepi Mar 7, 2024
17f92bc
separate batchmatmul and matmul
linepi Mar 23, 2024
c28745f
separate batchmatmul and matmul
linepi Mar 23, 2024
aed362f
Fuse LayerNormi16
Beluooo-H Mar 28, 2024
2c74c35
Merge: Beluooo->develop
Beluooo-H Mar 28, 2024
a0f9f02
Merge: develop->Beluooo
Beluooo-H Mar 28, 2024
9a444ab
Fix merge bug
Beluooo-H Apr 18, 2024
25e9bb8
Merge branch 'XiaoMi:master' into develop
Beluooo-H Apr 18, 2024
5d0d757
Merge branch 'develop' of https://github.com/BJTU-HXG/mace into develop
Beluooo-H Apr 18, 2024
9525a95
modified: mace/tools/mace_run.cc
islive233 May 13, 2024
d9e6ccb
modified: mace/tools/mace_run.cc
islive233 May 13, 2024
123819f
Merge branch 'islive' of https://github.com/BJTU-HXG/mace into islive
islive233 May 13, 2024
ae23482
Optim LN Fuse Rule
Beluooo-H May 14, 2024
2fcd3ff
modified: tools/python/run_model.py
islive233 May 22, 2024
9d70055
modified: tools/python/validate.py
islive233 May 22, 2024
b1023af
Islive (#5)
islive233 May 22, 2024
bfa48e4
modified: tools/python/transform/hexagon_converter.py
islive233 May 31, 2024
520dc72
Merge pull request #6 from BJTU-HXG/islive
islive233 May 31, 2024
a71743a
layernorm cossim not passed
Beluooo-H Jun 13, 2024
23d5d03
modified: tools/python/transform/hexagon_converter.py
islive233 Jun 17, 2024
d69f562
modified: tools/python/transform/hexagon_converter.py
islive233 Dec 13, 2024
44ad156
modified: .gitignore
islive233 Dec 13, 2024
4a4e4ff
modified: tools/python/transform/base_converter.py
islive233 Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
3 changes: 0 additions & 3 deletions .bazelrc

This file was deleted.

15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.gitignore
bazel-*
build/*
cmake-build/
Expand Down Expand Up @@ -39,3 +40,17 @@ __pycache__
*.egg-info
.mace_run
.model
_fa_out
BuildProducts.txt
compileInfo.txt
opt_conformer.txt
opt_transformer.txt
opt_hifigan.txt
output.txt
outputs_fa_out
._qxx
log
log

acc_conformer.txt
conformer_vaild.txt
54 changes: 38 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# new CUDA support requires 3.8 for Linux/Mac, and 3.9 for Windows
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
message("CMAKE_VERSION: ${CMAKE_VERSION}")
project(mace C CXX)

option(MACE_ENABLE_CPU "whether to enable CPU support" OFF)
Expand All @@ -19,8 +18,31 @@ option(MACE_ENABLE_OPT_SIZE "whether to build with optimized binary size" ON)
option(MACE_ENABLE_OBFUSCATE "whether to build with code obfuscation" ON)
option(MACE_ENABLE_CCACHE "whether to build with ccache" ON)
option(MACE_ENABLE_CODE_MODE "whether to use code mode" OFF)
option(MACE_ENABLE_RPCMEM "whether to use rpcmem" OFF)

message("CMAKE_VERSION: ${CMAKE_VERSION}")
message("CROSSTOOL_ROOT: ${CROSSTOOL_ROOT}")
message("CMAKE_TOOLCHAIN_FILE: ${CMAKE_TOOLCHAIN_FILE}")
message("CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
message("MACE_ENABLE_CPU = ${MACE_ENABLE_CPU} ")
message("MACE_ENABLE_NEON = ${MACE_ENABLE_NEON} ")
message("MACE_ENABLE_QUANTIZE = ${MACE_ENABLE_QUANTIZE} ")
message("MACE_ENABLE_OPENCL = ${MACE_ENABLE_OPENCL} ")
message("MACE_ENABLE_CUDA = ${MACE_ENABLE_CUDA} ")
message("MACE_ENABLE_HEXAGON_DSP = ${MACE_ENABLE_HEXAGON_DSP} ")
message("MACE_ENABLE_HEXAGON_HTA = ${MACE_ENABLE_HEXAGON_HTA} ")
message("MACE_ENABLE_MTK_APU = ${MACE_ENABLE_MTK_APU} ")
message("MACE_ENABLE_BFLOAT16 = ${MACE_ENABLE_BFLOAT16} ")
message("MACE_ENABLE_FP16 = ${MACE_ENABLE_FP16} ")
message("MACE_ENABLE_QNN = ${MACE_ENABLE_QNN} ")
message("MACE_ENABLE_TESTS = ${MACE_ENABLE_TESTS} ")
message("MACE_ENABLE_BENCHMARKS = ${MACE_ENABLE_BENCHMARKS} ")
message("MACE_ENABLE_OPT_SIZE = ${MACE_ENABLE_OPT_SIZE} ")
message("MACE_ENABLE_OBFUSCATE = ${MACE_ENABLE_OBFUSCATE} ")
message("MACE_ENABLE_CCACHE = ${MACE_ENABLE_CCACHE} ")
message("MACE_ENABLE_CODE_MODE = ${MACE_ENABLE_CODE_MODE}")
message("MACE_ENABLE_RPCMEM = ${MACE_ENABLE_RPCMEM}")


string(TOLOWER ${CMAKE_SYSTEM_NAME} MACE_OS)
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} MACE_TARGET)
Expand All @@ -40,7 +62,10 @@ if(MACE_ENABLE_OPT_SIZE)
if(APPLE)
set(MACE_LINKER_FLAGS "${MACE_LINKER_FLAGS} -Wl,-dead_strip -Wl,-dead_strip_dylibs")
else(APPLE)
set(MACE_LINKER_FLAGS "${MACE_LINKER_FLAGS} -Wl,--strip-all -Wl,--gc-sections")
set(MACE_LINKER_FLAGS "${MACE_LINKER_FLAGS} -Wl,--gc-sections")
if(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug"))
set(MACE_LINKER_FLAGS "${MACE_LINKER_FLAGS} -Wl,--strip-all")
endif()
set(MACE_CC_FLAGS "${MACE_CC_FLAGS} -ffunction-sections -fdata-sections")
endif(APPLE)
set(MACE_CC_FLAGS "${MACE_CC_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
Expand All @@ -57,7 +82,7 @@ endif(MACE_ENABLE_CODE_MODE)
if(ANDROID)
set(MACE_CODE_CC_FLAGS "${MACE_CODE_CC_FLAGS} -Wall -Werror -Wno-error=unused-command-line-argument -Wno-error=unevaluated-expression -Wno-error=tautological-compare")
else(ANDROID)
set(MACE_CODE_CC_FLAGS "${MACE_CODE_CC_FLAGS} -Wall -Werror")
set(MACE_CODE_CC_FLAGS "${MACE_CODE_CC_FLAGS} -Wall -Werror -Wno-strict-aliasing")
endif(ANDROID)
set(MACE_CODE_CC_FLAGS "${MACE_CODE_CC_FLAGS} -std=c++11 -D_GLIBCXX_USE_C99_MATH_TR1")

Expand Down Expand Up @@ -102,28 +127,25 @@ if(MACE_ENABLE_RPCMEM)
endif(MACE_ENABLE_RPCMEM)

if(MACE_ENABLE_HEXAGON_DSP OR MACE_ENABLE_HEXAGON_HTA)
if(ANDROID_ABI STREQUAL "arm64-v8a")
set(MACE_ENABLE_HEXAGON ON)
if(ANDROID_ABI STREQUAL "arm64-v8a" OR QNX)
# Use gold linker to avoid linking check of libcdsprpc.so
set(MACE_LINKER_FLAGS "${MACE_LINKER_FLAGS} -fuse-ld=gold")
endif(ANDROID_ABI STREQUAL "arm64-v8a")
endif()
endif(MACE_ENABLE_HEXAGON_DSP OR MACE_ENABLE_HEXAGON_HTA)

if(MACE_ENABLE_HEXAGON_DSP)
if(NOT ANDROID)
message(FATAL_ERROR "Hexagon DSP is only supported on Android")
endif(NOT ANDROID)
# TODO => -DMACE_ENABLE_HEXAGON_DSP
if(NOT ANDROID AND NOT QNX)
message(FATAL_ERROR "Hexagon DSP is only supported on Android and Qnx")
endif()
add_definitions(-DMACE_ENABLE_RPCMEM)
add_definitions(-DMACE_ENABLE_HEXAGON)
endif(MACE_ENABLE_HEXAGON_DSP)

if(MACE_ENABLE_RPCMEM)
add_definitions(-DMACE_ENABLE_RPCMEM)
endif(MACE_ENABLE_RPCMEM)

if(MACE_ENABLE_HEXAGON_HTA)
if(NOT ANDROID)
message(FATAL_ERROR "Hexagon HTA is only supported on Android")
endif(NOT ANDROID)
if(NOT ANDROID AND NOT QNX)
message(FATAL_ERROR "Hexagon HTA is only supported on Android and Qnx")
endif()
add_definitions(-DMACE_ENABLE_HEXAGON_HTA)
add_definitions(-DMACE_ENABLE_HTA)
endif(MACE_ENABLE_HEXAGON_HTA)
Expand Down
163 changes: 0 additions & 163 deletions WORKSPACE

This file was deleted.

4 changes: 2 additions & 2 deletions cmake/toolchains/aarch64-linux-gnu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)

set(CMAKE_C_COMPILER "${CROSSTOOL_ROOT}/bin/aarch64-linux-gnu-gcc")
set( "${CROSSTOOL_ROOT}/bin/aarch64-linux-gnu-gcc")
set(CMAKE_CXX_COMPILER "${CROSSTOOL_ROOT}/bin/aarch64-linux-gnu-g++")

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOCMAKE_C_COMPILERT_PATH_MODE_PACKAGE ONLY)

set(CMAKE_CXX_FLAGS "-march=armv8-a ${CMAKE_CXX_FLAGS}")
13 changes: 13 additions & 0 deletions cmake/toolchains/qnx.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
set(CMAKE_SYSTEM_NAME QNX)
set(CMAKE_SYSTEM_PROCESSOR aarch64)

set(CMAKE_C_COMPILER "${CROSSTOOL_ROOT}/qnx700/host/linux/x86_64/usr/bin/ntoaarch64-gcc")
set(CMAKE_CXX_COMPILER "${CROSSTOOL_ROOT}/qnx700/host/linux/x86_64/usr/bin/ntoaarch64-g++")
set(CMAKE_FIND_ROOT_PATH "${CROSSTOOL_ROOT}/qnx700/target/qnx7")

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(CMAKE_CXX_FLAGS "-D_XOPEN_SOURCE=500 -D_QNX_SOURCE ${CMAKE_CXX_FLAGS} -Wno-unused-variable")
set(MACE_CC_FLAGS "-D_XOPEN_SOURCE=500 -D_QNX_SOURCE ${MACE_CC_FLAGS}")
8 changes: 6 additions & 2 deletions include/mace/port/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@
#include <string>
#include <vector>

#ifdef _WIN32
#if defined(_WIN32)
#include <malloc.h>
#endif

#if defined(__QNX__)
void *memalign(size_t __alignment, size_t __size);
#endif

#include <sys/stat.h>

#include "mace/public/mace.h"
Expand Down Expand Up @@ -101,7 +105,7 @@ inline MaceStatus Memalign(void **memptr, size_t alignment, size_t size) {
return MaceStatus::MACE_SUCCESS;
}
#else
#if defined(__ANDROID__) || defined(__hexagon__)
#if defined(__ANDROID__) || defined(__hexagon__) || defined(__QNX__)
*memptr = memalign(alignment, size);
if (*memptr == nullptr) {
return MaceStatus::MACE_OUT_OF_RESOURCES;
Expand Down
Loading