Any way to dump the cuda host code?

We can dump cuda device code following:

source_module = lib.get_lib().imported_modules[0]

source_code = source_module.get_source()

I also want to know how to dump the cuda host code, Is possible?

image image Above is the code dumped from the two sentence.

Thanks for your replay. But it’s not work, I can’t see any CUDA runtime APIs like cumemcpy or cumoduleLoad, only kernels exist.

Host library contains invocation of tvm runtime functions. All logic is implemented in appropriate tvm runtime, for cuda it is here: tvm/src/runtime/cuda at main · apache/tvm · GitHub

So if you want to export an executable cuda file (host+device) is it not feasible?

If saying “executable” you mean self-sufficient binary, then probably you need to take a look into uTVM, probably it allows to pack all parts together in one library even for CUDA flow. In other case you need to use lib tvm runtime which is much more lightweight comparing to whole tvm and can be compiled on almost any platform.

2 Likes