Import Agentrix codebase with vllm submodule
Copy project code (benchmark suite, Dockerfile, configs) and register the vllm submodule pointing to the gitlink mirror at https://gitlink.org.cn/I1Dsk46hji/vllm.git (branch fork-attn).
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
Agentrix
Agentrix keeps the shared-prefix attention implementation for vLLM and its end-to-end benchmark suite in one repository:
vllm/is a Git submodule pinned to the experimental implementation.benchmark/contains simulation, API, and local vLLM benchmarks.System Requirements
nvccavailable inPATH.ccacheis recommended.Install the basic tools on Ubuntu:
Clone the Repository
Initialize the vLLM submodule when cloning:
For an existing clone:
The
vllm/submodule should be pinned to commitd74abf592on thefork-attnbranch. Before publishing the Agentrix repository, verify that this commit is available from the vLLM remote specified in.gitmodules.Install uv
This project uses
uvfor all Python environment management:Build and Install vLLM
Run these commands from the Agentrix repository root. The editable install must be executed inside the
vllm/submodule, not at the Agentrix root directory.The following commands perform a full C++/CUDA source build. Low build parallelism avoids exhausting system memory.
TORCH_CUDA_ARCH_LIST=12.0targets SM120 / Blackwell GPUs; change it if you build on another GPU architecture.uv pip installcan still buffer some output because it drives the build through Python packaging.-vasksuvto show build output, andVERBOSE=1passesCMAKE_VERBOSE_MAKEFILE=ONinto vLLM’s CMake setup. If you want the clearest per-target Ninja/CMake progress, use the incremental CMake workflow below after the editable install has created the environment.Verify the ForkAttention backend and CUDA Graph dispatch helpers:
After modifying files under
vllm/csrc/, use the incremental build workflow:Install the Benchmark Suite
The benchmark suite uses a separate environment so that it does not alter the vLLM build dependencies:
Run Benchmarks
The scripts start vLLM, wait for its health check, run the benchmark, and then stop the server.
MODEL_PATHmay be a Hugging Face model ID or a local model directory.Run the default ForkAttention benchmark:
Run the FlashAttention baseline with the same workload:
To run both backends and write a comparison summary in one command:
The comparison summary is written to
results/fork_vs_flash_p8192_b16_o64/backend_comparison.md. Per-backend CSV files are written under the correspondingflash_attn/andfork_attn/subdirectories.On a two-GPU machine, run two single-GPU vLLM replicas and compare DP routing policies.
round_robinis the load-balancing baseline.prefix_forestkeeps each branch group on one replica while greedily balancing group weights across replicas:Profile ForkAttention with Nsight Systems:
The Nsight report is written under
results/fork_attention_nsys_p8192_b16_o64/fork_attn/asfork_attention.nsys-repplus the regular benchmark CSV/Markdown outputs.ForkAttention is intended to run with CUDA Graph capture, so the script leaves
ENFORCE_EAGER=0by default. Common overrides includePORT,MAX_MODEL_LEN,MAX_NUM_SEQS,GPU_MEMORY_UTILIZATION,DTYPE,STARTUP_TIMEOUT,KEEP_SERVER, andVLLM_SERVER_EXTRA_ARGS. Results and server logs are written to the selectedOUTPUT_DIR.Use a smaller workload for a quick smoke test:
Docker
The provided image builds both the ForkAttention-enabled vLLM submodule and the benchmark environment on CUDA 13.1:
Run a smoke benchmark with access to the NVIDIA GPU and the host Hugging Face cache:
For another GPU architecture, override
TORCH_CUDA_ARCH_LISTat build time. The default value12.0targets NVIDIA Blackwell consumer GPUs.