I am running this simple example in order to better understand how the tvm works . I am extracting the opencl code as you can see but in the output file some parts are missing. The part that is missing is the host code that is required for the data transaction and the device setup. Is there a way that i can extract the hole code? What I want is to export a file that i could use to run without the tvm dependencies. Hope it makes sense
PS.: I think that this task is performed somehow with the tvm.graph_runtime.create() but I am not sure.
Host code is directly embeded in LLVM IR. That is why you need ‘llvm’ for target_host.
If you do lib.imported_modules[0].get_source(), you get opencl kernel. if you do lib.get_source(), you get llvm host side code. OpenCL kernel maybe used without TVM, but host side code is strongly tied to TVM so it is not useful without TVM.
@masahi thank you for your reply. The code that is generated is from the codegen functions that are here codegen?Also since we are talking about just raw data shouldnt it be detached from tvm? or am I missing something?
I mean that the host side of the code does the data transmission from the cpu to the gpu and visa versa + the memory and hardware setting (or at least this is what is needed in order to run an openCL kernel in general). This is why I cant understand the tvm bondage
are you asking why we use llvm for host side code, instead of spitting out standalone opencl host code? I think the answer is, by using llvm for host code, we can use the same host code generator for all backend. We don’t want to implement different host code generator for CUDA or OpenCL.
Could you please recommend ways to debug the execution of a DNN model using OpenCL in TVM ? For example, the top-1 result is correct using CUDA, but totally wrong using OpenCL.