Skip to content

Segmentation fault and Assembler messages while compiling OpenCV with Branch rvv-intrinsic #701

@joy2myself

Description

@joy2myself

I used some rvv intrinsics while developing in OpenCV. And I tried to use the branch rvv-intrinsics to compile OpenCV. Two errors have been encountered so far.

First:

In file included from /home/git/opencv/modules/core/src/mathfuncs_core.dispatch.cpp:7:
/home/git/opencv/modules/core/src/mathfuncs_core.simd.hpp:76:8: internal compiler error: Segmentation fault
   76 | struct v_atan_f32
      |        ^~~~~~~~~~
0xfb1dbf crash_signal
	../.././riscv-gcc/gcc/toplev.c:328
0x127ec43 selt
	../.././riscv-gcc/gcc/wide-int.cc:404
0x127ec43 wi::lts_p_large(long const*, unsigned int, unsigned int, long const*, unsigned int)
	../.././riscv-gcc/gcc/wide-int.cc:480
0x98a486 bool wi::lts_p<generic_wide_int<wi::extended_tree<192> >, generic_wide_int<wi::extended_tree<192> > >(generic_wide_int<wi::extended_tree<192> > const&, generic_wide_int<wi::extended_tree<192> > const&)
	../.././riscv-gcc/gcc/wide-int.h:1925
0x98a486 wi::binary_traits<generic_wide_int<wi::extended_tree<192> >, generic_wide_int<wi::extended_tree<192> >, wi::int_traits<generic_wide_int<wi::extended_tree<192> > >::precision_type, wi::int_traits<generic_wide_int<wi::extended_tree<192> > >::precision_type>::signed_predicate_result operator< <generic_wide_int<wi::extended_tree<192> >, generic_wide_int<wi::extended_tree<192> > >(generic_wide_int<wi::extended_tree<192> > const&, generic_wide_int<wi::extended_tree<192> > const&)
	../.././riscv-gcc/gcc/wide-int.h:3248
0x98a486 tree_int_cst_lt(tree_node const*, tree_node const*)
	../.././riscv-gcc/gcc/tree.h:6099
0x98a486 walk_subobject_offsets
	../.././riscv-gcc/gcc/cp/class.c:3946
0x994d36 layout_class_type
	../.././riscv-gcc/gcc/cp/class.c:6535
0x994d36 finish_struct_1(tree_node*)
	../.././riscv-gcc/gcc/cp/class.c:7241
0x996db4 finish_struct(tree_node*, tree_node*)
	../.././riscv-gcc/gcc/cp/class.c:7520
0xa523c1 cp_parser_class_specifier_1
	../.././riscv-gcc/gcc/cp/parser.c:23881
0xa54039 cp_parser_class_specifier
	../.././riscv-gcc/gcc/cp/parser.c:24180
0xa54039 cp_parser_type_specifier
	../.././riscv-gcc/gcc/cp/parser.c:17711
0xa54bd1 cp_parser_decl_specifier_seq
	../.././riscv-gcc/gcc/cp/parser.c:14359
0xa556e4 cp_parser_simple_declaration
	../.././riscv-gcc/gcc/cp/parser.c:13613
0xa799b9 cp_parser_declaration
	../.././riscv-gcc/gcc/cp/parser.c:13433
0xa7a59c cp_parser_declaration_seq_opt
	../.././riscv-gcc/gcc/cp/parser.c:13309
0xa7a59c cp_parser_namespace_body
	../.././riscv-gcc/gcc/cp/parser.c:19717
0xa7a59c cp_parser_namespace_definition
	../.././riscv-gcc/gcc/cp/parser.c:19695
0xa79a8f cp_parser_declaration
	../.././riscv-gcc/gcc/cp/parser.c:13413
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
modules/core/CMakeFiles/opencv_core.dir/build.make:577: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/src/mathfuncs_core.dispatch.cpp.o' failed

Second:

/tmp/ccyu6Srz.s: Assembler messages:
/tmp/ccyu6Srz.s:32785: Error: unrecognized opcode `vqmaccu.vv v4,v2,v1'
/tmp/ccyu6Srz.s:33036: Error: unrecognized opcode `vqmacc.vv v4,v2,v1'
/tmp/ccyu6Srz.s:33285: Error: unrecognized opcode `vqmaccu.vv v4,v2,v1'
/tmp/ccyu6Srz.s:33523: Error: unrecognized opcode `vqmacc.vv v4,v2,v1'
modules/core/CMakeFiles/opencv_core.dir/build.make:590: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/src/matmul.dispatch.cpp.o' failed

This seems to be problems with the toolchain itself, right?

Steps to compile OpenCV:

git clone git@github.com:joy2myself/opencv.git
cd opencv
git checkout rvv
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../platforms/linux/riscv64-gcc.toolchain.cmake ../
make -k

Suppose the toolchain with branch rvv-intrinsic is installed in /opt/RISCV. If not, you may need edit opencv/platforms/linux/riscv64-gcc.toolchain.cmake.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions