From 482ffd8fd1261b760422bbf40f340e159c209890 Mon Sep 17 00:00:00 2001 From: luyanaa Date: Sun, 22 May 2022 22:13:14 +0800 Subject: [PATCH 1/5] Edit _bias128 in scale_x86.cpp for useless if --- src/layer/x86/scale_x86.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/layer/x86/scale_x86.cpp b/src/layer/x86/scale_x86.cpp index ebf495b808bf..657c36ffd312 100644 --- a/src/layer/x86/scale_x86.cpp +++ b/src/layer/x86/scale_x86.cpp @@ -412,9 +412,7 @@ int Scale_x86::forward_inplace(std::vector& bottom_top_blobs, const Option& } #endif // __AVX__ __m128 _s128 = _mm_set1_ps(s); - __m128 _bias128; - if (bias_term) - _bias128 = _mm_set1_ps(bias_data[i]); + __m128 _bias128 = _mm_set1_ps(bias_data[i]); for (; j < size; j += 4) { __m128 _p = _mm_load_ps(ptr); From c4bcb4b94eabdfbe750bf3fa344a5b9568696f55 Mon Sep 17 00:00:00 2001 From: luyanaa Date: Tue, 5 Jul 2022 16:15:55 +0800 Subject: [PATCH 2/5] Add Loongson 2F toolchain support (refer to AOSC) --- .../loongson2f-linux-gnuabi64.toolchain.cmake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 toolchains/loongson2f-linux-gnuabi64.toolchain.cmake diff --git a/toolchains/loongson2f-linux-gnuabi64.toolchain.cmake b/toolchains/loongson2f-linux-gnuabi64.toolchain.cmake new file mode 100644 index 000000000000..c0acb30dad99 --- /dev/null +++ b/toolchains/loongson2f-linux-gnuabi64.toolchain.cmake @@ -0,0 +1,16 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR mips64el) + +set(CMAKE_C_COMPILER "mips64el-linux-gnuabi64-gcc") +set(CMAKE_CXX_COMPILER "mips64el-linux-gnuabi64-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_C_FLAGS "-mabi=64 -march=mips3 -mtune=loongson2f -mloongson-mmi") +set(CMAKE_CXX_FLAGS "-mabi=64 -march=mips3 -mtune=loongson2f -mloongson-mmi") + +# cache flags +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") From 194de5dfb022e18b7db2ab88d590e6c94f420347 Mon Sep 17 00:00:00 2001 From: luyanaa Date: Wed, 12 Oct 2022 20:05:36 +0800 Subject: [PATCH 3/5] Add TH1520 (4*C910V) toolchain support. --- toolchains/th1520-v240.toolchain.cmake | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 toolchains/th1520-v240.toolchain.cmake diff --git a/toolchains/th1520-v240.toolchain.cmake b/toolchains/th1520-v240.toolchain.cmake new file mode 100644 index 000000000000..b3ee00a509c2 --- /dev/null +++ b/toolchains/th1520-v240.toolchain.cmake @@ -0,0 +1,33 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR riscv64) +set(C906 True) + +if(DEFINED ENV{RISCV_ROOT_PATH}) + file(TO_CMAKE_PATH $ENV{RISCV_ROOT_PATH} RISCV_ROOT_PATH) +else() + message(FATAL_ERROR "RISCV_ROOT_PATH env must be defined") +endif() + +set(RISCV_ROOT_PATH ${RISCV_ROOT_PATH} CACHE STRING "root path to riscv toolchain") + +set(CMAKE_C_COMPILER "${RISCV_ROOT_PATH}/bin/riscv64-unknown-linux-gnu-gcc") +set(CMAKE_CXX_COMPILER "${RISCV_ROOT_PATH}/bin/riscv64-unknown-linux-gnu-g++") + +set(CMAKE_FIND_ROOT_PATH "${RISCV_ROOT_PATH}/riscv64-unknown-linux-gnu") + +set(CMAKE_SYSROOT "${RISCV_ROOT_PATH}/sysroot") + +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_C_FLAGS "-march=rv64gcv0p7_zfh_xtheadc -mabi=lp64d -mtune=c910 -DC906=1 -static") +set(CMAKE_CXX_FLAGS "-march=rv64gcv0p7_zfh_xtheadc -mabi=lp64d -mtune=c910 -DC906=1 -static") + +# cache flags +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") + +# export RISCV_ROOT_PATH=/home/nihui/osd/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.4.0 +# cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/c910-v240.toolchain.cmake -DCMAKE_BUILD_TYPE=release -DNCNN_BUILD_TESTS=ON -DNCNN_OPENMP=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_RVV=OFF -DNCNN_SIMPLEOCV=ON -DNCNN_BUILD_EXAMPLES=ON .. From 06870bcaa851852bb65e62ee25a385d2cdecf6b9 Mon Sep 17 00:00:00 2001 From: luyanaa Date: Thu, 13 Oct 2022 12:12:26 +0800 Subject: [PATCH 4/5] Fix Comment --- toolchains/th1520-v240.toolchain.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/toolchains/th1520-v240.toolchain.cmake b/toolchains/th1520-v240.toolchain.cmake index b3ee00a509c2..fb9787a82632 100644 --- a/toolchains/th1520-v240.toolchain.cmake +++ b/toolchains/th1520-v240.toolchain.cmake @@ -29,5 +29,3 @@ set(CMAKE_CXX_FLAGS "-march=rv64gcv0p7_zfh_xtheadc -mabi=lp64d -mtune=c910 -DC90 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") -# export RISCV_ROOT_PATH=/home/nihui/osd/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.4.0 -# cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/c910-v240.toolchain.cmake -DCMAKE_BUILD_TYPE=release -DNCNN_BUILD_TESTS=ON -DNCNN_OPENMP=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_RVV=OFF -DNCNN_SIMPLEOCV=ON -DNCNN_BUILD_EXAMPLES=ON .. From 92337a15f40f68f5a2f2100d330f06ce1be2db1c Mon Sep 17 00:00:00 2001 From: luyanaa Date: Wed, 12 Oct 2022 20:05:36 +0800 Subject: [PATCH 5/5] Add TH1520 (4*C910V) toolchain support. --- toolchains/th1520-v240.toolchain.cmake | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 toolchains/th1520-v240.toolchain.cmake diff --git a/toolchains/th1520-v240.toolchain.cmake b/toolchains/th1520-v240.toolchain.cmake new file mode 100644 index 000000000000..fb9787a82632 --- /dev/null +++ b/toolchains/th1520-v240.toolchain.cmake @@ -0,0 +1,31 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR riscv64) +set(C906 True) + +if(DEFINED ENV{RISCV_ROOT_PATH}) + file(TO_CMAKE_PATH $ENV{RISCV_ROOT_PATH} RISCV_ROOT_PATH) +else() + message(FATAL_ERROR "RISCV_ROOT_PATH env must be defined") +endif() + +set(RISCV_ROOT_PATH ${RISCV_ROOT_PATH} CACHE STRING "root path to riscv toolchain") + +set(CMAKE_C_COMPILER "${RISCV_ROOT_PATH}/bin/riscv64-unknown-linux-gnu-gcc") +set(CMAKE_CXX_COMPILER "${RISCV_ROOT_PATH}/bin/riscv64-unknown-linux-gnu-g++") + +set(CMAKE_FIND_ROOT_PATH "${RISCV_ROOT_PATH}/riscv64-unknown-linux-gnu") + +set(CMAKE_SYSROOT "${RISCV_ROOT_PATH}/sysroot") + +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_C_FLAGS "-march=rv64gcv0p7_zfh_xtheadc -mabi=lp64d -mtune=c910 -DC906=1 -static") +set(CMAKE_CXX_FLAGS "-march=rv64gcv0p7_zfh_xtheadc -mabi=lp64d -mtune=c910 -DC906=1 -static") + +# cache flags +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") +