I am trying to compile tvm javascript model for web applications.
First of all, I am able to run the example addOne
listed here: https://github.com/dmlc/tvm/tree/master/web
However, when a real model is used to create js emscripten.create_js
, for example resnet18_v1
, emcc
will complain that assertion error: VT->getBitWidth() <= 128
Seems like even though native bit width is limited to 128(https://github.com/dmlc/tvm/blob/d6dcd6c56febfbb12efe67884c188f045f435893/src/codegen/llvm/codegen_llvm.cc#L93), tvm doesn’t have a constraint on the vector size which is 512 in this case and violates emscripten assertion. The related issue is https://github.com/emscripten-core/emscripten/issues/4789.
I have checked the tvm is using fp32 with primitive size in bits: 32 and num_elements: 16, resulting bit width 512 total.
Since emcc don’t lower larger than 128 vector size, is there some ways to constrain the number of lanes in the case of llvm -target=asmjs-unknown-emscripten
?
I am not familiar with the codegen in llvm so any help is appreciated.