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

求助!MNN编译错误 #2638

Closed
Schrobine opened this issue Oct 30, 2023 · 10 comments
Closed

求助!MNN编译错误 #2638

Schrobine opened this issue Oct 30, 2023 · 10 comments
Labels

Comments

@Schrobine
Copy link

平台(如果交叉编译请再附上交叉编译目标平台):

Platform(Include target platform as well if cross-compiling):

cmake version 3.16.3
libprotoc 3.17.3
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0

执行
cmake -DMNN_BUILD_DEMO=ON -DMNN_BUILD_CONVERTER=true ..
make -j4
后报错

请在这里粘贴cmake参数或使用的cmake脚本路径以及完整输出
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done

-- 3.19.0.0
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS - Success
-- Use Threadpool, forbid openmp
-- >>>>>>>>>>>>>
-- MNN BUILD INFO:
-- System: Linux
-- Processor: armv7l
-- Version: 2.7.2
-- Metal: OFF
-- OpenCL: OFF
-- OpenGL: OFF
-- Vulkan: OFF
-- ARM82: OFF
-- oneDNN: OFF
-- TensorRT: OFF
-- CoreML: OFF
-- NNAPI: OFF
-- CUDA: OFF
-- OpenMP: OFF
-- BF16: OFF
-- ThreadPool: ON
-- Hidden: TRUE
-- Build Path: /home/orangepi/MNN/build
-- CUDA PROFILE: OFF
-- WIN_USE_ASM:
-- Enabling AArch32 Assemblies
-- Onnx:
-- MNN Depends:MNNMNN_Express
-- Configuring done
-- Generating done
-- Build files have been written to: /home/orangepi/MNN/build

编译日志:

In file included from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18:
/home/orangepi/MNN/source/math/Vec.hpp: In static member function ‘static void MNN::Math::Vec<int, 4>::transpose4(MNN::Math::Vec<int, 4>::VecType&, MNN::Math::Vec<int, 4>::VecType&, MNN::Math::Vec<int, 4>::VecType&, MNN::Math::Vec<int, 4>::VecType&)’:
/home/orangepi/MNN/source/math/Vec.hpp:300:66: note: use ‘-flax-vector-conversions’ to permit conversions between vectors with differing element types or numbers of subparts
300 | vec0.value = vsetq_lane_s64(vgetq_lane_s64(m2m3.val[0], 0), vec0.value, 1);
| ^
/home/orangepi/MNN/source/math/Vec.hpp:300:62: error: cannot convert ‘int32x4_t’ {aka ‘__vector(4) int’} to ‘int64x2_t’ {aka ‘__vector(2) long long int’}
300 | vec0.value = vsetq_lane_s64(vgetq_lane_s64(m2m3.val[0], 0), vec0.value, 1);
| ~~~~~~~~~~^
| |
| int32x4_t {aka __vector(4) int}
In file included from /home/orangepi/MNN/source/math/Vec.hpp:16,
from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18:
/usr/lib/gcc/arm-linux-gnueabihf/9/include/arm_neon.h:6307:27: note: initializing argument 1 of ‘int64_t vgetq_lane_s64(int64x2_t, int)’
6307 | vgetq_lane_s64 (int64x2_t __a, const int __b)
| ~~~~~~~~~~^~~
In file included from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18:
/home/orangepi/MNN/source/math/Vec.hpp:301:62: error: cannot convert ‘int32x4_t’ {aka ‘__vector(4) int’} to ‘int64x2_t’ {aka ‘__vector(2) long long int’}
301 | vec1.value = vsetq_lane_s64(vgetq_lane_s64(m2m3.val[1], 0), vec1.value, 1);
| ~~~~~~~~~~^
| |
| int32x4_t {aka __vector(4) int}
In file included from /home/orangepi/MNN/source/math/Vec.hpp:16,
from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18:
/usr/lib/gcc/arm-linux-gnueabihf/9/include/arm_neon.h:6307:27: note: initializing argument 1 of ‘int64_t vgetq_lane_s64(int64x2_t, int)’
6307 | vgetq_lane_s64 (int64x2_t __a, const int __b)
| ~~~~~~~~~~^~~
In file included from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18:
/home/orangepi/MNN/source/math/Vec.hpp:302:62: error: cannot convert ‘int32x4_t’ {aka ‘__vector(4) int’} to ‘int64x2_t’ {aka ‘__vector(2) long long int’}
302 | vec2.value = vsetq_lane_s64(vgetq_lane_s64(m0m1.val[0], 1), vec2.value, 0);
| ~~~~~~~~~~^
| |
| int32x4_t {aka __vector(4) int}
In file included from /home/orangepi/MNN/source/math/Vec.hpp:16,
from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18:
/usr/lib/gcc/arm-linux-gnueabihf/9/include/arm_neon.h:6307:27: note: initializing argument 1 of ‘int64_t vgetq_lane_s64(int64x2_t, int)’
6307 | vgetq_lane_s64 (int64x2_t __a, const int __b)
| ~~~~~~~~~~^~~
In file included from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18:
/home/orangepi/MNN/source/math/Vec.hpp:303:62: error: cannot convert ‘int32x4_t’ {aka ‘__vector(4) int’} to ‘int64x2_t’ {aka ‘__vector(2) long long int’}
303 | vec3.value = vsetq_lane_s64(vgetq_lane_s64(m0m1.val[1], 1), vec3.value, 0);
| ~~~~~~~~~~^
| |
| int32x4_t {aka __vector(4) int}
In file included from /home/orangepi/MNN/source/math/Vec.hpp:16,
from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18:
/usr/lib/gcc/arm-linux-gnueabihf/9/include/arm_neon.h:6307:27: note: initializing argument 1 of ‘int64_t vgetq_lane_s64(int64x2_t, int)’
6307 | vgetq_lane_s64 (int64x2_t __a, const int __b)
| ~~~~~~~~~~^~~
In file included from /home/orangepi/MNN/source/backend/cpu/CPUBinary.cpp:18:
/home/orangepi/MNN/source/math/Vec.hpp: In member function ‘MNN::Math::Vec<float, 4>::VecType MNN::Math::Vec<float, 4>::operator<(const VecType&) const’:
/home/orangepi/MNN/source/math/Vec.hpp:508:51: error: could not convert ‘{vbslq_s32(res, ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::one), ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::zero))}’ from ‘’ to ‘MNN::Math::Vec<float, 4>::VecType’ {aka ‘MNN::Math::Vec<float, 4>’}
508 | VecType dst = { vbslq_s32(res, one, zero) };
| ^
| |
|
/home/orangepi/MNN/source/math/Vec.hpp: In member function ‘MNN::Math::Vec<float, 4>::VecType MNN::Math::Vec<float, 4>::operator>(const VecType&) const’:
/home/orangepi/MNN/source/math/Vec.hpp:513:51: error: could not convert ‘{vbslq_s32(res, ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::one), ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::zero))}’ from ‘’ to ‘MNN::Math::Vec<float, 4>::VecType’ {aka ‘MNN::Math::Vec<float, 4>’}
513 | VecType dst = { vbslq_s32(res, one, zero) };
| ^
| |
|
/home/orangepi/MNN/source/math/Vec.hpp: In member function ‘MNN::Math::Vec<float, 4>::VecType MNN::Math::Vec<float, 4>::operator<=(const VecType&) const’:
/home/orangepi/MNN/source/math/Vec.hpp:518:51: error: could not convert ‘{vbslq_s32(res, ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::one), ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::zero))}’ from ‘’ to ‘MNN::Math::Vec<float, 4>::VecType’ {aka ‘MNN::Math::Vec<float, 4>’}
518 | VecType dst = { vbslq_s32(res, one, zero) };
| ^
| |
|
/home/orangepi/MNN/source/math/Vec.hpp: In member function ‘MNN::Math::Vec<float, 4>::VecType MNN::Math::Vec<float, 4>::operator>=(const VecType&) const’:
/home/orangepi/MNN/source/math/Vec.hpp:523:51: error: could not convert ‘{vbslq_s32(res, ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::one), ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::zero))}’ from ‘’ to ‘MNN::Math::Vec<float, 4>::VecType’ {aka ‘MNN::Math::Vec<float, 4>’}
523 | VecType dst = { vbslq_s32(res, one, zero) };
| ^
| |
|
/home/orangepi/MNN/source/math/Vec.hpp: In member function ‘MNN::Math::Vec<float, 4>::VecType MNN::Math::Vec<float, 4>::operator==(const VecType&) const’:
/home/orangepi/MNN/source/math/Vec.hpp:528:51: error: could not convert ‘{vbslq_s32(res, ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::one), ((int32x4_t)((const MNN::Math::Vec<float, 4>)this)->MNN::Math::Vec<float, 4>::zero))}’ from ‘’ to ‘MNN::Math::Vec<float, 4>::VecType’ {aka ‘MNN::Math::Vec<float, 4>’}
528 | VecType dst = { vbslq_s32(res, one, zero) };
| ^
| |
|
make[2]: *** [CMakeFiles/MNNCPU.dir/build.make:89: CMakeFiles/MNNCPU.dir/source/backend/cpu/CPUBinary.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:535: CMakeFiles/MNNCPU.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

粘贴在这里
Paste log here or pastebin
@wilway
Copy link

wilway commented Nov 2, 2023

我遇到同样的问题,请问如何解决,aarch64

@wilway
Copy link

wilway commented Nov 2, 2023

vec.hpp 506行开始修改为一下内容,编译通过
VecType operator<(const VecType& lr) const {
uint32x4_t res = vcltq_f32(value, lr.value);
VecType dst = {reinterpret_cast<float32x4_t>(vbslq_s32(res, one, zero)) };
return dst;
}
VecType operator>(const VecType& lr) const {
uint32x4_t res = vcgtq_f32(value, lr.value);
VecType dst = {reinterpret_cast<float32x4_t>(vbslq_s32(res, one, zero)) };
return dst;
}
VecType operator<=(const VecType& lr) const {
uint32x4_t res = vcleq_f32(value, lr.value);
VecType dst = {reinterpret_cast<float32x4_t>(vbslq_s32(res, one, zero)) };
return dst;
}
VecType operator>=(const VecType& lr) const {
uint32x4_t res = vcgeq_f32(value, lr.value);
VecType dst = {reinterpret_cast<float32x4_t>(vbslq_s32(res, one, zero)) };
return dst;
}
VecType operator==(const VecType& lr) const {
uint32x4_t res = vceqq_f32(value, lr.value);
VecType dst = {reinterpret_cast<float32x4_t>(vbslq_s32(res, one, zero)) };
return dst;
}

@wilway
Copy link

wilway commented Nov 2, 2023

MNNGelu.S 48行修改为
fmov v30.4s, #5.0
fmov v31.4s, #-5.0

@hfwanguanghui
Copy link

MNNGelu.S 48行修改为 fmov v30.4s, #5.0 fmov v31.4s, #-5.0

image
把这个修改掉吗?

@Schrobine
Copy link
Author

我遇到同样的问题,请问如何解决,aarch64

Thank you for your reply. I tried the method you provided but did not solve the compilation failure issue. I am considering whether the CPU I am using is supported by MNN

@wilway
Copy link

wilway commented Nov 6, 2023 via email

@hfwanguanghui
Copy link

CMakeLists.txt 中加入这一条就行了 。add_compile_options(-flax-vector-conversions)

@qtyandhasee
Copy link

CMakeLists.txt 中加入这一条就行了 。add_compile_options(-flax-vector-conversions)

请问这条是加在哪里呀?我尝试加入了这个,但是并没有起作用,是不是需要加入到全局变量里?

@muyun777
Copy link

在CMakeLists.txt文件末尾中添加以下内容:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flax-vector-conversions")
完美解决!

Copy link

Marking as stale. No activity in 60 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants