MCPcopy Index your code
hub / github.com/apache/tvm / Executable

Class Executable

python/tvm/runtime/executable.py:32–175  ·  view source on GitHub ↗

The executable object generated by `tvm.compile`.

Source from the content-addressed store, hash-verified

30
31
32class Executable:
33 """The executable object generated by `tvm.compile`."""
34
35 def __init__(self, mod: Module):
36 """Initialize the Executable object."""
37 self.mod: Module = mod
38 self._jitted_mod: Module | None = None
39
40 def __getitem__(self, name: str) -> Function:
41 """Get the Function from the jitted module."""
42 return self.jit().get_function(name, query_imports=True)
43
44 def __call__(self, *args, **kwargs) -> Any:
45 """Call the executable."""
46 return self.jit().main(*args, **kwargs)
47
48 def jit(
49 self,
50 *,
51 fcompile: Callable[[str, list[str], dict[str, Any]], None] | None = None,
52 addons: list[str] | None = None,
53 force_recompile: bool = False,
54 **kwargs,
55 ) -> Module:
56 """Just-in-time compile and link the modules.
57
58 The Executable returned by tvm.compile may not be directly
59 runnable as they may contain CUDA source files and objects that
60 are yet to be compiled and linked.
61 This function helps to create a runtime.Module for these cases.
62
63 Parameters
64 ----------
65 fcompile : function(target, file_list, kwargs), optional
66 The compilation function to use create the final library object during
67
68 addons : list of str, optional
69 Additional object files to link against.
70
71 force_recompile : bool, optional
72 If True, force a recompile of the module.
73
74 kwargs : dict, optional
75 Additional arguments passed to fcompile
76
77 Returns
78 -------
79 rt_mod: tvm.runtime.Module
80 A runnable runtime module that can be passed to VirtualMachine.
81
82 Examples
83 --------
84 .. code:: python
85
86 ex = tvm.compile(mod, target)
87 rt_mod = ex.jit()
88
89 """

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…