Hello everyone, I was trying to create a custom target (as a part of a thesis)
self.target = tvm.target.Target( “llvm -mcpu=rv32gc --mtriple=riscv32-unknown-elf --system-lib --runtime=c -mfloat-abi=hard”). Using LLVM backend that generated 2 object files that I linked to the tool chain in the CMake and used our micro TVM as a codegen (similar approach while using the C backend by other colleagues) and made some minor changes. Thus, I run into an incompatibility as the 2 files has an architecture of riscv32i20p (inspecting with readelf) using soft floating and the toolchain that uses hard floating.
home/heatdh/Desktop/Ba/ml_on_mcu/deps/install/gcc_riscv/bin/…/lib/gcc/riscv64-unknown-elf/8.3.0/…/…/…/…/riscv64-unknown-elf/bin/ld: …/lib/ml_interface/libml_interface.a(lib1.o): can’t link soft-float modules with double-float modules /home/heatdh/Desktop/Ba/ml_on_mcu/deps/install/gcc_riscv/bin/…/lib/gcc/riscv64-unknown-elf/8.3.0/…/…/…/…/riscv64-unknown-elf/bin/ld: failed to merge target specific data of file …/lib/ml_interface/libml_interface.a(lib1.o) /home/heatdh/Desktop/Ba/ml_on_mcu/deps/install/gcc_riscv/bin/…/lib/gcc/riscv64-unknown-elf/8.3.0/…/…/…/…/riscv64-unknown-elf/bin/ld: …/lib/ml_interface/libml_interface.a(lib1.o): in function
fused_nn_contrib_dense_pack_add_compute_': TVMMod:(.text+0x57c): undefined reference to
__mulsf3’ /home/heatdh/Desktop/Ba/ml_on_mcu/deps/install/gcc_riscv/bin/…/lib/gcc/riscv64-unknown-elf/8.3.0/…/…/…/…/riscv64-unknown-elf/bin/ld: TVMMod:(.text+0x588): undefined reference to__addsf3' /home/heatdh/Desktop/Ba/ml_on_mcu/deps/install/gcc_riscv/bin/../lib/gcc/riscv64-unknown-elf/8.3.0/../../../../riscv64-unknown-elf/bin/ld: TVMMod:(.text+0x5a0): undefined reference to
__mulsf3’ /home/heatdh/Desktop/Ba/ml_on_mcu/deps/install/gcc_riscv/bin/…/lib/gcc/riscv64-unknown-elf/8.3.0/…/…/…/…/riscv64-unknown-elf/bin/ld: TVMMod:(.text+0x5ac): undefined reference to `__addsf3’
(These function doesn’t seem to be implemented in the object files)
I tried playing around in the TVM target implementation changing some attributes and printing within the llvm codegen, but it seems that mfloat-abi is not set properly, and the scope is not being executed. Rebuilding the tool chain as discussed with my supervisor doesn’t seem to be practical for us. Would you have any suggestions
Thank you in advance and would be happy to explain in details if something is unclear