Skip to content

Commit

Permalink
rco
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Dec 3, 2024
1 parent 38121ef commit 0962199
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ jobs:
export RISCV_ROOT_PATH=/data/action/osd/riscv
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/riscv64-unknown-linux-gnu.toolchain.cmake -DCMAKE_BUILD_TYPE=relwithdebinfo -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_RVV=ON -DNCNN_ZFH=ON -DNCNN_ZVFH=ON -DNCNN_OPENMP=${{ matrix.openmp }} -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/riscv64-unknown-linux-gnu.toolchain.cmake -DCMAKE_BUILD_TYPE=debug -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_RVV=ON -DNCNN_ZFH=ON -DNCNN_ZVFH=ON -DNCNN_OPENMP=${{ matrix.openmp }} -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
cmake --build . -j 8
- name: test-vlen256
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,9 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(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(FATAL_ERROR "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()
# if(NCNN_COMPILER_IS_XUANTIE_GCC)
# message(FATAL_ERROR "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 Down
8 changes: 7 additions & 1 deletion cmake/ncnn_add_layer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,13 @@ macro(ncnn_add_layer class)
ncnn_add_arch_opt_layer(${class} rvv "-march=rv64gcv")
endif()
if(NCNN_ZFH)
ncnn_add_arch_opt_source(${class} zfh "-march=rv64gc_zfh -D__fp16=_Float16")
if(NOT NCNN_RUNTIME_CPU AND NCNN_ZVFH)
ncnn_add_arch_opt_source(${class} zfh "-march=rv64gcv_zfh_zvfh -D__fp16=_Float16")
elseif(NOT NCNN_RUNTIME_CPU AND NCNN_XTHEADVECTOR)
ncnn_add_arch_opt_source(${class} zfh "-march=rv64gc_zfh_xtheadvector -D__fp16=_Float16")
else()
ncnn_add_arch_opt_source(${class} zfh "-march=rv64gc_zfh -D__fp16=_Float16")
endif()
endif()
if(NCNN_RUNTIME_CPU AND NCNN_XTHEADVECTOR)
# linker complains the conflict of v and xtheadvector, so disable generating any riscv attributes
Expand Down

0 comments on commit 0962199

Please sign in to comment.