For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Python class
JitExecutor
JitExecutor
class max.experimental.executor.JitExecutor(*, interpreter, sync_on_interpreter_fallback=True)
Bases: object
Executes via the interpreter while compiling in the background.
The first call for a given graph (keyed by structure) submits the
graph to a background compile process
(ProcessCompilePool) and
caches the resulting future for the life of this executor. The future
resolves to an initialized model: session.init runs as soon as the
compile lands, off the calling thread, so a call that finds a done
future executes immediately. While the compile is pending, calls
execute via the interpreter. When the interpreter refuses a graph,
the call waits for that graph’s compile.
Failed compilations are assumed to not be transient and are cached.
Initializes the executor.
-
Parameters:
-
- interpreter (Executor) – Executor serving graphs whose compile is pending.
- sync_on_interpreter_fallback (bool) – Whether a graph the interpreter
refuses waits for its compile. When False such a graph
raises
UnsupportedGraphErrorinstead.
cache
cache: dict[tuple[str, tuple[tuple[str, str], ...]], Future[Model]]
compile()
compile(graph)
Submits the graph to the compiler on first sight.
execute()
execute(graph, inputs)
Executes graph, compiling in the background on first call.
lock
lock: lock