This is crashing because the functions that perform the Float16 conversions are not present. They don’t get resolved at runtime in the generated code and so their addresses remain null.
The problem here is in finding out where to get these functions from. They are present in clang’s compiler-rt, and (afaik) in gcc’s libgcc (possibly with different names), but in TVM we don’t have any indication as to where they are on any particular system.
Talking to some coworkers in Linaro that work on the llvm toolchain this is due to the fact that llvm is missing support. They were going to add it to their todo list.
Also if I build tvm natively on arm64 with gcc, libtvm.so will error out with :
OSError: /home/debian/tvm/build/libtvm.so: undefined symbol: __extendhftf2
Adding -static-libgcc in the top level CMakeLists.txt fixes it.
This is actually a good idea. I was thinking about loading the library into the execution engine, but if the symbols are defined in the current process, we don’t need to do that. We need to make sure they don’t get garbage collected by the linker though.
LLVM does support float16. These functions are implemented in libclang_rt.builtins-<arch>.a, e.g. libclang_rt.builtins-x86_64.a on x86. Usually clang uses libgcc by default, but you can also use compiler-rt with -rtlib=compiler-rt flag.