Skip to content

vllm.utils.jit_monitor

Monitor unexpected kernel JIT compilation during inference.

After server warmup completes, any kernel JIT compilation or autotuning event indicates a cache miss or unexpected input shape that causes a latency spike. This module registers hooks in supported runtimes to detect such events so they can be investigated.

Set --jit-monitor-mode=error to fail fast on unexpected runtime compilation. Set --jit-monitor-verbose to log every JIT compile with additional runtime details. Verbose logging is intentionally opt-in because it can emit many logs and add overhead.

Currently monitors: - CuTeDSL cute.compile calls - Triton @triton.autotune cache misses (via knobs.autotuning.print) - Triton @triton.jit first-time compilations (via knobs.runtime.jit_post_compile_hook) - TileLang @tilelang.jit first-time compilations - FlyDSL MlirCompiler.compile calls

Functions:

  • activate –

    Enable JIT compilation monitoring after warmup.

  • is_active –

    Return whether the JIT compilation monitor is currently active.

  • numba_workqueue_threading_layer –

    Force numba's fork-safe workqueue threading layer for this block.

_MonitoredCuteCompile

Logs JIT compilations; a plain function would break cute.compile[opts].

_flydsl_kernel_symbols(module, infer_kernel_names)

Name the gpu.func kernels in a module about to be compiled.

func_name is the Python launcher name, which many kernels share verbatim (launch), so the gpu.func symbols are what identify the kernel and the width that needs warmup.

_setup_cutedsl_jit_hook()

Wrap cutlass.cute.compile to warn on compilation.

_setup_flydsl_jit_hook()

Wrap MlirCompiler.compile to warn on compilation.

_setup_tilelang_jit_hook()

Wrap TileLang JIT entry points to warn on compilation.

_setup_triton_autotuning_print()

Enable TRITON_PRINT_AUTOTUNING unless the user opted out.

_setup_triton_jit_hook()

Register a jit_post_compile_hook that warns on compilation.

activate(*, mode='warn', verbose=False)

Enable JIT compilation monitoring after warmup.

Call once per worker process at the end of compile_or_warm_up_model. After activation every monitored kernel compilation or autotuning benchmark that happens during inference will be logged as a warning or raised as an error, depending on mode.

Safe to call multiple times; subsequent calls are no-ops.

If the user has explicitly set TRITON_PRINT_AUTOTUNING=0 in their environment, autotuning printing is left disabled; the JIT compilation hook is still registered regardless.

is_active()

Return whether the JIT compilation monitor is currently active.

numba_workqueue_threading_layer()

Force numba's fork-safe workqueue threading layer for this block.

GNU OpenMP (numba's default omp threading layer) aborts the process if a forked child re-enters an OpenMP-active runtime. vLLM forks the EngineCore subprocess from a process that may already have launched numba's parallel accelerator, so the first call to any @njit(parallel=True) function must happen under workqueue instead. The threading layer choice is sticky for the life of the process once launched, so restoring the config on exit does not undo the effect.