Craete a codegen mycodegen.cc , the operators which can be loaded to my hardware
make .cmake file and adding entry
After taking basic convolution 2d really module,
After annoying the relay partition is there but while executing
with tvm.transform.PassContext(opt_level=2):
@shreya i think you need to register a codegen function as well to produce a SourceModule with TVM_REGISTER_GLOBAL() (if implementing in c++) or @tvm.register_func() (Python). the function should be named relay.ext.shakti. if you think you have implemented this in mycodegen.cc, then likely that file hasn’t gotten linked into the TVM build (try editing the CMakeLists.txt).
The error I am getting is resolved.
But now I am confused after performing all 4 steps mentioned. Now how can I generate C code after relay partitioning?
On calling Graph to annotate on relay it is working. But as I called relay.build(target=c,mod) will I get C code executable?
I am confused about how can I get an executable in C that I can cross-compile to for my machine and run on my machine.
But I am getting error at relay.build itself.
relay.build(mod, target=“c”, params=None)
on this line. I am confused now how tvm knows that it has to use my codegen shakti
When you annotate a subgraph with kCompiler = "shakti", tvm.relay.build searches for a PackedFunc named relay.ext.shakti and invokes it to create the CSourceModule for the subgraph. I’d suggest you look at the BYOC tutorial: Bring Your Own Codegen To TVM — tvm 0.13.dev0 documentation
based on the error it seems like TVM is not finding this PackedFunc, so either it’s not registered or your codegen file isn’t getting linked in to libtvm.so.
it looks like your codegen is being invoked, but the codegen is accessing an array outside its bounds. i’d suggest you add some LOG(INFO) to debug it further–note you can print out IR like: