I am adding support for a CUSTOM hardware in tvm using Codegen method for TVM BYOC
Currently hardware requires a call to INIT and DEINIT methods. We need to add the calls in the generated C code using codegen instead of embedding this logic in custom runtime.
AS we can have n modules, one for each subgraph getting offloaded to custom hardware , current implementation insert these init and deinit calls in C code of each and every module, which turns out to be very inefficient.
Hence i needed some help in figuring out if there is a way to declare a bool operator (init_done) which somehow tells the custom codegen to only insert the init call in C code if init_done is false, else ignore the insertion all together.
the C modules look something like this:
module 1{
CUSTOM_init()
some calls
CUSTOM_deinit()
}
..
..
..
module n{
CUSTOM_init()
some calls
CUSTOM_deinit()
}
whereas i want it to be something like this:
module 1{
CUSTOM_init()
some calls
}
..
..
..
module n{
some calls
CUSTOM_deinit()
}