Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Dec 3, 2024
1 parent 8754523 commit d4785c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
7 changes: 1 addition & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,6 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(riscv)")
set(NCNN_TARGET_ARCH riscv)

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
check_cxx_source_compiles("#if __riscv_v == 7000\nint main() { return 0; }\n#endif\n" NCNN_COMPILER_IS_XUANTIE_GCC)
if(NCNN_COMPILER_IS_XUANTIE_GCC)
message(WARNING "Since XuanTie GCC Toolchain is not yet ready for RVV1.0, the risc-v optimized code of ncnn has been migrated to the RVV1.0 standard. Please use the old version of ncnn, which can be found at https://github.com/Tencent/ncnn/releases/download/20240820/ncnn-20240820-full-source.zip")
endif()

set(CMAKE_REQUIRED_FLAGS "-march=rv64gcv")
check_cxx_source_compiles("#include <riscv_vector.h>\nint main() { vfloat32m8_t _s, _w; float _v; size_t vl; _s = __riscv_vfmacc_vf_f32m8(_s, _v, _w, vl); vfloat32m1_t _x; vfloat32m1x2_t _xx = __riscv_vcreate_v_f32m1x2(_x, _x); return 0; }" NCNN_COMPILER_SUPPORT_RISCV_V)

Expand All @@ -434,7 +429,7 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(riscv)")
check_cxx_source_compiles("#include <riscv_vector.h>\nint main() { vfloat16m8_t _s, _w; __fp16 _v; size_t vl; _s = __riscv_vfmacc_vf_f16m8(_s, _v, _w, vl); return 0; }" NCNN_COMPILER_SUPPORT_RISCV_ZVFH)

set(CMAKE_REQUIRED_FLAGS "-march=rv64gc_zfh_xtheadvector -D__fp16=_Float16")
check_cxx_source_compiles("#include <riscv_vector.h>\nint main() { vfloat16m8_t _s, _w; __fp16 _v; size_t vl; _s = __riscv_vfmacc_vf_f16m8(_s, _v, _w, vl); return 0; }" NCNN_COMPILER_SUPPORT_RISCV_XTHEADVECTOR)
check_cxx_source_compiles("#include <riscv_vector.h>\nint main() { vfloat16m8_t _s, _w; __fp16 _v; size_t vl; _s = __riscv_vfmacc_vf_f16m8(_s, _v, _w, vl); vfloat32m1_t _x; vfloat32m1x2_t _xx = __riscv_vcreate_v_f32m1x2(_x, _x); return 0; }" NCNN_COMPILER_SUPPORT_RISCV_XTHEADVECTOR)

unset(CMAKE_REQUIRED_FLAGS)

Expand Down
12 changes: 4 additions & 8 deletions docs/how-to-build/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -667,23 +667,19 @@ Pick `build-XYZ/install` folder for further usage.

### Build for AllWinner D1

**Important Note**

Since XuanTie GCC Toolchain is not yet ready for RVV1.0, the RISC-V optimized code of ncnn has been migrated to the RVV1.0 standard. The compilation process here uses the old version of ncnn, which can be found at https://github.com/Tencent/ncnn/releases/download/20240820/ncnn-20240820-full-source.zip

Download c906 toolchain package from https://xuantie.t-head.cn/community/download?id=4224193099938729984
Download c906 toolchain package from https://www.xrvm.cn/community/download?id=4382928864901402624

```shell
tar -xf Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1-20220906.tar.gz
export RISCV_ROOT_PATH=/home/nihui/osd/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1
tar -xf Xuantie-900-gcc-linux-6.6.0-glibc-x86_64-V3.0.1-20241120.tar.gz
export RISCV_ROOT_PATH=/home/nihui/osd/Xuantie-900-gcc-linux-6.6.0-glibc-x86_64-V3.0.1
```

Build ncnn with riscv-v vector and simpleocv enabled:
```shell
mkdir -p build-c906
cd build-c906
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/c906-v226.toolchain.cmake \
-DCMAKE_BUILD_TYPE=release -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF -DNCNN_RUNTIME_CPU=OFF -DNCNN_RVV=ON \
-DCMAKE_BUILD_TYPE=release -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF -DNCNN_RUNTIME_CPU=OFF -DNCNN_RVV=OFF -DNCNN_XTHEADVECTOR=ON -DNCNN_ZFH=ON \
-DNCNN_SIMPLEOCV=ON -DNCNN_BUILD_EXAMPLES=ON ..
cmake --build . -j 4
cmake --build . --target install
Expand Down

0 comments on commit d4785c4

Please sign in to comment.