TorchSpec icon indicating copy to clipboard operation
TorchSpec copied to clipboard

Add TensorRT-LLM support for inference backend

Open chungen04 opened this issue 5 months ago • 0 comments

Summary

Integrates TensorRT-LLM (v1.3.0rc18) as an inference backend for hidden-state capture, alongside the existing vLLM and SGLang backends.

Approach

TRT-LLM already ships the EAGLE3 capture machinery natively (SaveHiddenStatesDecodingConfig / SaveHiddenStatesResourceManager), so this integration is thin. It builds on that mode and adds a small patch that redirects captured aux + final hidden states to Mooncake instead of writing .pt files to disk. No reimplementation of the capture path is needed.

Changes

  • patches/trtllm/v1.3.0rc18/trtllm.patch : env-gated (TORCHSPEC_TRTLLM_MOONCAKE) Mooncake redirect in save_hidden_state.py. Also fixes a per-request token-offset bug so batched prefill works (upstream only handled a single request per forward).
  • torchspec/inference/engine/trtllm_engine.py : TrtllmEngine Ray actor wrapping the PyTorch-backend LLM; maps RequestOutput.request_id -> Mooncake key using the same sanitizer as the patch.
  • factory.py / config : "trtllm" dispatch, TrtllmConfig, trtllm_ flatten prefix.
  • docker/trtllm/v1.3.0rc18/Dockerfile + justfile branch + [trtllm] extra : patches the installed package at build time with an assertion guard, and includes the CUDA-13 Mooncake wheel fix.
  • configs/trtllm_qwen3_8b.yaml + README entry.

Notes

  • Single-node tensor parallelism only : nnodes > 1 raises NotImplementedError (TRT-LLM spawns its own MPI workers; multi-node TP needs more orchestration).

chungen04 avatar Jun 16 '26 00:06 chungen04