BYOC - init and cleanup with multiple subgraphs

Hello, I am planning on using BYOC and offloading multiple sub-graphs to my device. I need to initialize my device on runtime before the first subgraph execution and perform some cleanup after the last one. How does TVM let me do this?

Thanks.