Openblas 按照k230_SDK的patch进行改动后,交叉编译报错,求解决方案!!!

Viewed 73

重现步骤

1、下载openblas源码

git clone https://github.com/OpenMathLib/OpenBLAS.git

切换分支到riscv
git checkout riscv
切换代码提交节点
git checkout e9a911fb9
按照k230_sdk的patch进行修改 k230_sdk/src/big/rt-smart/userapps/openblas/e9a911fb
交叉编译命令如下

make BINARY=64 CC=/home/ubuntu20/tjf/k230_canmv/k230_sdk/toolchain/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.0/bin/riscv64-unknown-linux-gnu-gcc FC=/home/ubuntu20/tjf/k230_canmv/k230_sdk/toolchain/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.0/bin/riscv64-unknown-linux-gnu-gfortran  HOSTCC=gcc TARGET=C908V

期待结果和实际结果

编译报错
image.png

软硬件版本信息

在ubuntu 20.04的环境下进行编译的,交叉编译工具链来自于k230_sdk,具体为Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.0

错误日志

../rvv-v0p10-compatible-headers/non-policy.h:11910:28: error: incompatible types when assigning to type 'vuint32m8_t' from type 'int'
11910 | #define vadd_vx_u32m8(...) __riscv_vadd_vx_u32m8(__VA_ARGS__)
      |                            ^~~~~~~~~~~~~~~~~~~~~
../kernel/riscv64/iamin_vector.c:80:21: note: in expansion of macro 'vadd_vx_u32m8'
   80 | #define VADDVX_UINT vadd_vx_u32m8
      |                     ^~~~~~~~~~~~~
../kernel/riscv64/iamin_vector.c:186:47: note: in expansion of macro 'VADDVX_UINT'
  186 |                                 v_min_index = VADDVX_UINT(v_min_index, j, gvl);
      |                                               ^~~~~~~~~~~
../rvv-v0p10-compatible-headers/non-policy.h:20689:32: error: incompatible types when assigning to type 'vbool4_t' from type 'int'
20689 | #define vmfle_vf_f32m8_b4(...) __riscv_vmfle_vf_f32m8_b4(__VA_ARGS__)
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~
../kernel/riscv64/iamin_vector.c:74:23: note: in expansion of macro 'vmfle_vf_f32m8_b4'
   74 | #define VMFLEVF_FLOAT vmfle_vf_f32m8_b4
      |                       ^~~~~~~~~~~~~~~~~
../kernel/riscv64/iamin_vector.c:188:40: note: in expansion of macro 'VMFLEVF_FLOAT'
  188 |                                 mask = VMFLEVF_FLOAT(v_min, cur_minf, gvl);

尝试解决过程

1、target设置为c910V可以正常编译
2、去掉源码中的头文件common_riscv64.h中的"#include "rvv-v0p10-compatible-headers/non-policy.h" "编译缺少一些定义

补充材料

1 Answers

我们会试一下,如果已有的openblas可以满足您的需求,您可以使用已经编译好的库文件。

是不是当前openblas不支持rvv1.0的版本,在玄铁提供的编译器函数和openblas做向量计算的函数定义的输入参数类型不一样