Overview of DeepInfer
Table of Contents
1. Layered Architecture of DeepInfer
DeepInfer can be divided into several layers.
- Entrypoint.
entrypoints/llm.pyis the entrance for offline batch inference.
- Engine layer.
engine/llm_engine.pyis the scheduler core, consisting of scheduling, async execution, and state managementengine/arg_utils.pyis for argument parsing
- Worker layer.
worker/model_runner.pyis responsible for model forward, sampling, and graph capturingworker/cache_engine.pyis for KV cache management, like SWA, compression, and indexingworker/cuda_graph_runner.py, dflash_cuda_graph_runner.pycaptures CUDA Graph
- Model and Executor layer, which consists of models and kernels.
models/andv4_modules/modules for models.layers/+tilelangs/Kernels in TileLang, CUDA or Ascendeplb/Expert Parallelism load balanceinput_metadata/
- Support layer.
ve/vision encoder.structure_output/xgrammar for structured output and maskdistributed/is shared memory broadcast
- C/C++ & Hardware layer, which abstracts hardware.
csrc/contains C++ scheduler, sequences, block management, and pybind.deep_cluster/abstracts hardware devices, including Nvidia, Huawei Ascend, CPU, etc.