Hello,
I am new to TVM, I have been trying to run with RISC V target but the output always fails to compile.
I tried following the steps here:
but it is failing. I also tried different risc v target and it is still failing.
Is there a guide to be able to generate risc v target from TVM, if not what is the best way to proceed to be able to generate RISC v compatible binaries? Also how to support vector instruction and custom institutions. can we also run it with spike ?
the link you posted is a bit old, unfortunately that work didn’t get upstreamed.
this is something we partially support, but would love to improve upon. the best way to get an idea of what TVM generates for RISC-V would be to use the Zephyr qemu_riscv32 board. You could follow the microTVM with TFLite tutorial, but replace the board name with qemu_riscv32. I believe you should be able to get something to compile and run this way.
We do want to support RISC-V including some type of vectorized instructions. We don’t currently have SPIKE included in our CI, but would like to add it, and we have a framework that defines a set of API commands (build, flash, connect) which you could leverage to support SPIKE with microTVM.
Right now, TVM doesn’t have any knowledge of such RISC-V vector instructions, so I wouldn’t expect artifacts for RISC-V to be particularly fast. However, it should be possible to define schedules for RISC-V that leverage those instructions. The main challenge we’ve had is identifying which extension we should support.
Feel free to ask here if you run into difficulties! And, it would be fantastic if you wanted to upstream any progress you make. I can help guide you through the process (or perhaps even just do this for you) of adding SPIKE to the CI if you’d like to leverage that.
Traceback (most recent call last):
File “tvm_test.py”, line 36, in
mod, params = relay.frontend.from_tflite( tflite_model, shape_dict={input_tensor: input_shape}, dtype_dict={input_tensor: input_dtype})
File “/home/zarif/tvm/python/tvm/relay/frontend/tflite.py”, line 3753, in from_tflite
op_converter.convert_op_to_relay()
File “/home/zarif/tvm/python/tvm/relay/frontend/tflite.py”, line 235, in convert_op_to_relay
ret = self.convert_mapop_code_str
File “/home/zarif/tvm/python/tvm/relay/frontend/tflite.py”, line 1878, in convert_fully_connected
keep_num_dims = fully_connected_options.KeepNumDims()
AttributeError: ‘FullyConnectedOptions’ object has no attribute ‘KeepNumDims’
I was following the guide so I installed the 2.1.0 version. I tried to update the last version available via pip3 install (2.4.0) but it gave the same error.
I will try to build 2.6.2 and see if this fixes the issue.
I have tried to build TFlite my i am still facing the same error.
I am thinking it might be the way I build TVM from source?
What is the config.cmake needed to get microTVM to work ?
I am setting the follwing in config.cmake :
set(USE_MICRO ON)
set(USE_MICRO_STANDALONE_RUNTIME ON)
set(USE_LLVM llvm-config-12)
these are the only changes I made when compiling the TVM, or did I miss something?
Thank you,
Nizar
are there other stuff to set to get microTVM to work.
@nizarzaza interesting. we do have a very peculiar way we build TFLite. iiuc it’s due to an API problem. as far as i know folks have been successful using TFLite installed from PyPI though, so I’m not sure if this is needed for particular models or what.
I don’t have cycles to investigate this specifically right now, but I am working on [RFC] Python Dependencies in TVM CI Containers at the moment and as part of that I’ll try to use PyPI-installed TFLite in the CI. I can update this thread as I learn more with that.