mirror of
https://github.com/NVIDIA/TensorRT-LLM.git
synced 2026-01-22 11:42:41 +08:00
955 lines
69 KiB
HTML
955 lines
69 KiB
HTML
|
||
|
||
<!DOCTYPE html>
|
||
|
||
|
||
<html lang="en" data-content_root="../" >
|
||
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
|
||
<title>Sparse Attention — TensorRT LLM</title>
|
||
|
||
|
||
|
||
<script data-cfasync="false">
|
||
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
|
||
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
|
||
</script>
|
||
<!--
|
||
this give us a css class that will be invisible only if js is disabled
|
||
-->
|
||
<noscript>
|
||
<style>
|
||
.pst-js-only { display: none !important; }
|
||
|
||
</style>
|
||
</noscript>
|
||
|
||
<!-- Loaded before other Sphinx assets -->
|
||
<link href="../_static/styles/theme.css?digest=8878045cc6db502f8baf" rel="stylesheet" />
|
||
<link href="../_static/styles/pydata-sphinx-theme.css?digest=8878045cc6db502f8baf" rel="stylesheet" />
|
||
|
||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=8f2a1f02" />
|
||
<link rel="stylesheet" type="text/css" href="../_static/styles/nvidia-sphinx-theme.css?v=933278ad" />
|
||
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
|
||
<link rel="stylesheet" type="text/css" href="../_static/autodoc_pydantic.css" />
|
||
<link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" />
|
||
<link rel="stylesheet" type="text/css" href="../_static/config_selector.css?v=e17d8078" />
|
||
<link rel="stylesheet" type="text/css" href="../_static/custom.css?v=19d20f17" />
|
||
|
||
<!-- So that users can add custom icons -->
|
||
<script src="../_static/scripts/fontawesome.js?digest=8878045cc6db502f8baf"></script>
|
||
<!-- Pre-loaded scripts that we'll load fully later -->
|
||
<link rel="preload" as="script" href="../_static/scripts/bootstrap.js?digest=8878045cc6db502f8baf" />
|
||
<link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=8878045cc6db502f8baf" />
|
||
|
||
|
||
|
||
<script src="../_static/documentation_options.js?v=5929fcd5"></script>
|
||
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
||
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
|
||
<script src="../_static/copybutton.js?v=65e89d2a"></script>
|
||
<script src="../_static/config_selector.js?v=aaf6cd4a"></script>
|
||
<script>let toggleHintShow = 'Click to show';</script>
|
||
<script>let toggleHintHide = 'Click to hide';</script>
|
||
<script>let toggleOpenOnPrint = 'true';</script>
|
||
<script src="../_static/togglebutton.js?v=4a39c7ea"></script>
|
||
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
|
||
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
|
||
<script>DOCUMENTATION_OPTIONS.pagename = 'features/sparse-attention';</script>
|
||
<script>
|
||
DOCUMENTATION_OPTIONS.theme_version = '0.16.1';
|
||
DOCUMENTATION_OPTIONS.theme_switcher_json_url = './_static/switcher.json';
|
||
DOCUMENTATION_OPTIONS.theme_switcher_version_match = '1.2.0rc7';
|
||
DOCUMENTATION_OPTIONS.show_version_warning_banner =
|
||
false;
|
||
</script>
|
||
|
||
<link rel="icon" href="../_static/favicon.png"/>
|
||
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||
<meta name="docsearch:language" content="en"/>
|
||
<meta name="docsearch:version" content="1.2.0rc7" />
|
||
|
||
|
||
</head>
|
||
|
||
|
||
|
||
<body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">
|
||
|
||
|
||
|
||
<div id="pst-skip-link" class="skip-link d-print-none"><a href="#main-content">Skip to main content</a></div>
|
||
|
||
|
||
|
||
<div id="pst-scroll-pixel-helper"></div>
|
||
|
||
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
|
||
<i class="fa-solid fa-arrow-up"></i>Back to top</button>
|
||
|
||
|
||
<dialog id="pst-search-dialog">
|
||
|
||
<form class="bd-search d-flex align-items-center"
|
||
action="../search.html"
|
||
method="get">
|
||
<i class="fa-solid fa-magnifying-glass"></i>
|
||
<input type="search"
|
||
class="form-control"
|
||
name="q"
|
||
placeholder="Search the docs ..."
|
||
aria-label="Search the docs ..."
|
||
autocomplete="off"
|
||
autocorrect="off"
|
||
autocapitalize="off"
|
||
spellcheck="false"/>
|
||
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
|
||
</form>
|
||
</dialog>
|
||
|
||
<div class="pst-async-banner-revealer d-none">
|
||
<aside id="bd-header-version-warning" class="d-none d-print-none" aria-label="Version warning"></aside>
|
||
</div>
|
||
|
||
|
||
<header class="bd-header navbar navbar-expand-lg bd-navbar d-print-none">
|
||
<div class="bd-header__inner bd-page-width">
|
||
<button class="pst-navbar-icon sidebar-toggle primary-toggle" aria-label="Site navigation">
|
||
<span class="fa-solid fa-bars"></span>
|
||
</button>
|
||
|
||
|
||
<div class="col-lg-3 navbar-header-items__start">
|
||
|
||
<div class="navbar-item">
|
||
|
||
|
||
|
||
|
||
|
||
<a class="navbar-brand logo" href="../index.html">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<img src="../_static/nvidia-logo-horiz-rgb-blk-for-screen.svg" class="logo__image only-light" alt="TensorRT LLM - Home"/>
|
||
<img src="../_static/nvidia-logo-horiz-rgb-wht-for-screen.svg" class="logo__image only-dark pst-js-only" alt="TensorRT LLM - Home"/>
|
||
|
||
|
||
<p class="title logo__title">TensorRT LLM</p>
|
||
|
||
</a></div>
|
||
|
||
</div>
|
||
|
||
<div class="col-lg-9 navbar-header-items">
|
||
|
||
<div class="me-auto navbar-header-items__center">
|
||
|
||
<div class="navbar-item">
|
||
|
||
|
||
<div class="version-switcher__container dropdown pst-js-only">
|
||
<button id="pst-version-switcher-button-2"
|
||
type="button"
|
||
class="version-switcher__button btn btn-sm dropdown-toggle"
|
||
data-bs-toggle="dropdown"
|
||
aria-haspopup="listbox"
|
||
aria-controls="pst-version-switcher-list-2"
|
||
aria-label="Version switcher list"
|
||
>
|
||
Choose version <!-- this text may get changed later by javascript -->
|
||
<span class="caret"></span>
|
||
</button>
|
||
<div id="pst-version-switcher-list-2"
|
||
class="version-switcher__menu dropdown-menu list-group-flush py-0"
|
||
role="listbox" aria-labelledby="pst-version-switcher-button-2">
|
||
<!-- dropdown will be populated by javascript on page load -->
|
||
</div>
|
||
</div></div>
|
||
|
||
</div>
|
||
|
||
|
||
<div class="navbar-header-items__end">
|
||
|
||
<div class="navbar-item navbar-persistent--container">
|
||
|
||
|
||
<button class="btn search-button-field search-button__button pst-js-only" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
||
<i class="fa-solid fa-magnifying-glass"></i>
|
||
<span class="search-button__default-text">Search</span>
|
||
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
|
||
</button>
|
||
</div>
|
||
|
||
|
||
<div class="navbar-item">
|
||
|
||
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button pst-js-only" aria-label="Color mode" data-bs-title="Color mode" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
||
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light" title="Light"></i>
|
||
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark" title="Dark"></i>
|
||
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto" title="System Settings"></i>
|
||
</button></div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
<div class="navbar-persistent--mobile">
|
||
|
||
<button class="btn search-button-field search-button__button pst-js-only" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
||
<i class="fa-solid fa-magnifying-glass"></i>
|
||
<span class="search-button__default-text">Search</span>
|
||
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
|
||
</button>
|
||
</div>
|
||
|
||
|
||
|
||
<button class="pst-navbar-icon sidebar-toggle secondary-toggle" aria-label="On this page">
|
||
<span class="fa-solid fa-outdent"></span>
|
||
</button>
|
||
|
||
</div>
|
||
|
||
</header>
|
||
|
||
|
||
<div class="bd-container">
|
||
<div class="bd-container__inner bd-page-width">
|
||
|
||
|
||
|
||
<dialog id="pst-primary-sidebar-modal"></dialog>
|
||
<div id="pst-primary-sidebar" class="bd-sidebar-primary bd-sidebar">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<a class="navbar-brand logo" href="../index.html">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<img src="../_static/nvidia-logo-horiz-rgb-blk-for-screen.svg" class="logo__image only-light" alt="TensorRT LLM - Home"/>
|
||
<img src="../_static/nvidia-logo-horiz-rgb-wht-for-screen.svg" class="logo__image only-dark pst-js-only" alt="TensorRT LLM - Home"/>
|
||
|
||
|
||
<p class="title logo__title">TensorRT LLM</p>
|
||
|
||
</a>
|
||
|
||
|
||
|
||
<div class="sidebar-header-items sidebar-primary__section">
|
||
|
||
|
||
<div class="sidebar-header-items__center">
|
||
|
||
|
||
|
||
<div class="navbar-item">
|
||
|
||
|
||
<div class="version-switcher__container dropdown pst-js-only">
|
||
<button id="pst-version-switcher-button-3"
|
||
type="button"
|
||
class="version-switcher__button btn btn-sm dropdown-toggle"
|
||
data-bs-toggle="dropdown"
|
||
aria-haspopup="listbox"
|
||
aria-controls="pst-version-switcher-list-3"
|
||
aria-label="Version switcher list"
|
||
>
|
||
Choose version <!-- this text may get changed later by javascript -->
|
||
<span class="caret"></span>
|
||
</button>
|
||
<div id="pst-version-switcher-list-3"
|
||
class="version-switcher__menu dropdown-menu list-group-flush py-0"
|
||
role="listbox" aria-labelledby="pst-version-switcher-button-3">
|
||
<!-- dropdown will be populated by javascript on page load -->
|
||
</div>
|
||
</div></div>
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<div class="sidebar-header-items__end">
|
||
|
||
<div class="navbar-item">
|
||
|
||
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button pst-js-only" aria-label="Color mode" data-bs-title="Color mode" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
||
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light" title="Light"></i>
|
||
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark" title="Dark"></i>
|
||
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto" title="System Settings"></i>
|
||
</button></div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sidebar-primary-items__start sidebar-primary__section">
|
||
<div class="sidebar-primary-item">
|
||
|
||
|
||
|
||
<nav class="bd-docs-nav bd-links"
|
||
aria-label="Table of Contents">
|
||
<p class="bd-links__title" role="heading" aria-level="1">Table of Contents</p>
|
||
<div class="bd-toc-item navbar-nav"><p aria-level="2" class="caption" role="heading"><span class="caption-text">Getting Started</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="../overview.html">Overview</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../quick-start-guide.html">Quick Start Guide</a></li>
|
||
<li class="toctree-l1 has-children"><a class="reference internal" href="../installation/index.html">Installation</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="../installation/containers.html">Pre-built release container images on NGC</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../installation/linux.html">Installing on Linux via <code class="docutils literal notranslate"><span class="pre">pip</span></code></a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../installation/build-from-source-linux.html">Building from Source Code on Linux</a></li>
|
||
</ul>
|
||
</details></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Deployment Guide</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1 has-children"><a class="reference internal" href="../examples/llm_api_examples.html">LLM Examples</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_inference.html">Generate text</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_inference_async.html">Generate text asynchronously</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_inference_async_streaming.html">Generate text in streaming</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_inference_distributed.html">Distributed LLM Generation</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_guided_decoding.html">Generate text with guided decoding</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_logits_processor.html">Control generated text using logits processor</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_multilora.html">Generate text with multiple LoRA adapters</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_sparse_attention.html">Sparse Attention</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_speculative_decoding.html">Speculative Decoding</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_kv_cache_connector.html">KV Cache Connector</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_kv_cache_offloading.html">KV Cache Offloading</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_runtime.html">Runtime Configuration Examples</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_sampling.html">Sampling Techniques Showcase</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_mgmn_llm_distributed.html">Run LLM-API with pytorch backend on Slurm</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_mgmn_trtllm_bench.html">Run trtllm-bench with pytorch backend on Slurm</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/llm_mgmn_trtllm_serve.html">Run trtllm-serve with pytorch backend on Slurm</a></li>
|
||
</ul>
|
||
</details></li>
|
||
<li class="toctree-l1 has-children"><a class="reference internal" href="../examples/trtllm_serve_examples.html">Online Serving Examples</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/aiperf_client.html">Aiperf Client</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/aiperf_client_for_multimodal.html">Aiperf Client For Multimodal</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/curl_chat_client.html">Curl Chat Client</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/curl_chat_client_for_multimodal.html">Curl Chat Client For Multimodal</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/curl_completion_client.html">Curl Completion Client</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/curl_responses_client.html">Curl Responses Client</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/deepseek_r1_reasoning_parser.html">Deepseek R1 Reasoning Parser</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/openai_chat_client.html">OpenAI Chat Client</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/openai_chat_client_for_multimodal.html">OpenAI Chat Client for Multimodal</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/openai_completion_client.html">OpenAI Completion Client</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/openai_completion_client_for_lora.html">Openai Completion Client For Lora</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/openai_completion_client_json_schema.html">OpenAI Completion Client with JSON Schema</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../examples/openai_responses_client.html">OpenAI Responses Client</a></li>
|
||
</ul>
|
||
</details></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../examples/dynamo_k8s_example.html">Dynamo K8s Example</a></li>
|
||
<li class="toctree-l1 has-children"><a class="reference internal" href="../deployment-guide/index.html">Model Recipes</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="../deployment-guide/deployment-guide-for-deepseek-r1-on-trtllm.html">Deployment Guide for DeepSeek R1 on TensorRT LLM - Blackwell & Hopper Hardware</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../deployment-guide/deployment-guide-for-llama3.3-70b-on-trtllm.html">Deployment Guide for Llama3.3 70B on TensorRT LLM - Blackwell & Hopper Hardware</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../deployment-guide/deployment-guide-for-llama4-scout-on-trtllm.html">Deployment Guide for Llama4 Scout 17B on TensorRT LLM - Blackwell & Hopper Hardware</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../deployment-guide/deployment-guide-for-gpt-oss-on-trtllm.html">Deployment Guide for GPT-OSS on TensorRT-LLM - Blackwell Hardware</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../deployment-guide/deployment-guide-for-qwen3-on-trtllm.html">Deployment Guide for Qwen3 on TensorRT LLM - Blackwell & Hopper Hardware</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../deployment-guide/deployment-guide-for-qwen3-next-on-trtllm.html">Deployment Guide for Qwen3 Next on TensorRT LLM - Blackwell & Hopper Hardware</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../deployment-guide/deployment-guide-for-kimi-k2-thinking-on-trtllm.html">Deployment Guide for Kimi K2 Thinking on TensorRT LLM - Blackwell</a></li>
|
||
</ul>
|
||
</details></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Models</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="../models/supported-models.html">Supported Models</a></li>
|
||
|
||
<li class="toctree-l1"><a class="reference internal" href="../models/adding-new-model.html">Adding a New Model</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">CLI Reference</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="../commands/trtllm-bench.html">trtllm-bench</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../commands/trtllm-eval.html">trtllm-eval</a></li>
|
||
<li class="toctree-l1 has-children"><a class="reference internal" href="../commands/trtllm-serve/index.html">trtllm-serve</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="../commands/trtllm-serve/trtllm-serve.html">trtllm-serve</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../commands/trtllm-serve/run-benchmark-with-trtllm-serve.html">Run benchmarking with <code class="docutils literal notranslate"><span class="pre">trtllm-serve</span></code></a></li>
|
||
</ul>
|
||
</details></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">API Reference</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="../llm-api/index.html">LLM API Introduction</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../llm-api/reference.html">API Reference</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Features</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="feature-combination-matrix.html">Feature Combination Matrix</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="attention.html">Multi-Head, Multi-Query, and Group-Query Attention</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="disagg-serving.html">Disaggregated Serving</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="kvcache.html">KV Cache System</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="long-sequence.html">Long Sequences</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="lora.html">LoRA (Low-Rank Adaptation)</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="multi-modality.html">Multimodal Support in TensorRT LLM</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="overlap-scheduler.html">Overlap Scheduler</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="paged-attention-ifb-scheduler.html">Paged Attention, IFB, and Request Scheduling</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="parallel-strategy.html">Parallelism in TensorRT LLM</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="quantization.html">Quantization</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="sampling.html">Sampling</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="additional-outputs.html">Additional Outputs</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="guided-decoding.html">Guided Decoding</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="speculative-decoding.html">Speculative Decoding</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="checkpoint-loading.html">Checkpoint Loading</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="auto_deploy/auto-deploy.html">AutoDeploy (Beta)</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="ray-orchestrator.html">Ray Orchestrator (Prototype)</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="torch_compile_and_piecewise_cuda_graph.html">Torch Compile & Piecewise CUDA Graph</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="helix.html">Helix Parallelism</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="kv-cache-connector.html">KV Cache Connector</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Developer Guide</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="../developer-guide/overview.html">Architecture Overview</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../developer-guide/perf-analysis.html">Performance Analysis</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../developer-guide/perf-benchmarking.html">TensorRT LLM Benchmarking</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../developer-guide/ci-overview.html">Continuous Integration Overview</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../developer-guide/dev-containers.html">Using Dev Containers</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../developer-guide/api-change.html">LLM API Change Guide</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../developer-guide/kv-transfer.html">Introduction to KV Cache Transmission</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Blogs</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/tech_blog/blog10_ADP_Balance_Strategy.html">ADP Balance Strategy</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/tech_blog/blog11_GPT_OSS_Eagle3.html">Running GPT-OSS-120B with Eagle3 Speculative Decoding on GB200/B200 (TensorRT LLM)</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/tech_blog/blog12_Combining_Guided_Decoding_and_Speculative_Decoding.html">Combining Guided Decoding and Speculative Decoding: Making CPU and GPU Cooperate Seamlessly</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/tech_blog/blog13_Inference_Time_Compute_Implementation_in_TensorRT-LLM.html">Inference Time Compute Implementation in TensorRT LLM</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/tech_blog/blog14_Scaling_Expert_Parallelism_in_TensorRT-LLM_part3.html">Scaling Expert Parallelism in TensorRT LLM (Part 3: Pushing the Performance Boundary)</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/tech_blog/blog1_Pushing_Latency_Boundaries_Optimizing_DeepSeek-R1_Performance_on_NVIDIA_B200_GPUs.html">Pushing Latency Boundaries: Optimizing DeepSeek-R1 Performance on NVIDIA B200 GPUs</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/tech_blog/blog2_DeepSeek_R1_MTP_Implementation_and_Optimization.html">DeepSeek R1 MTP Implementation and Optimization</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/tech_blog/blog3_Optimizing_DeepSeek_R1_Throughput_on_NVIDIA_Blackwell_GPUs.html">Optimizing DeepSeek R1 Throughput on NVIDIA Blackwell GPUs: A Deep Dive for Developers</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/tech_blog/blog4_Scaling_Expert_Parallelism_in_TensorRT-LLM.html">Scaling Expert Parallelism in TensorRT LLM (Part 1: Design and Implementation of Large-scale EP)</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/tech_blog/blog5_Disaggregated_Serving_in_TensorRT-LLM.html">Disaggregated Serving in TensorRT LLM</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/tech_blog/blog6_Llama4_maverick_eagle_guide.html">How to launch Llama4 Maverick + Eagle3 TensorRT LLM server</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/tech_blog/blog7_NGram_performance_Analysis_And_Auto_Enablement.html">N-Gram Speculative Decoding in TensorRT LLM</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/tech_blog/blog8_Scaling_Expert_Parallelism_in_TensorRT-LLM_part2.html">Scaling Expert Parallelism in TensorRT LLM (Part 2: Performance Status and Optimization)</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/tech_blog/blog9_Deploying_GPT_OSS_on_TRTLLM.html">Running a High Performance GPT-OSS-120B Inference Server with TensorRT LLM</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/Best_perf_practice_on_DeepSeek-R1_in_TensorRT-LLM.html">How to get best performance on DeepSeek-R1 in TensorRT LLM</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/H200launch.html">H200 achieves nearly 12,000 tokens/sec on Llama2-13B with TensorRT LLM</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/XQA-kernel.html">New XQA-kernel provides 2.4x more Llama-70B throughput within the same latency budget</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../blogs/H100vsA100.html">H100 has 4.6x A100 Performance in TensorRT LLM, achieving 10,000 tok/s at 100ms to first token</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Quick Links</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference external" href="https://github.com/NVIDIA/TensorRT-LLM/releases">Releases</a></li>
|
||
<li class="toctree-l1"><a class="reference external" href="https://github.com/NVIDIA/TensorRT-LLM">Github Code</a></li>
|
||
<li class="toctree-l1"><a class="reference external" href="https://github.com/NVIDIA/TensorRT-LLM/issues?q=is%3Aissue%20state%3Aopen%20label%3Aroadmap">Roadmap</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Use TensorRT Engine</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="../legacy/tensorrt_quickstart.html">LLM API with TensorRT Engine</a></li>
|
||
</ul>
|
||
</div>
|
||
</nav></div>
|
||
</div>
|
||
|
||
|
||
<div class="sidebar-primary-items__end sidebar-primary__section">
|
||
</div>
|
||
|
||
|
||
|
||
</div>
|
||
|
||
<main id="main-content" class="bd-main" role="main">
|
||
|
||
|
||
<div class="bd-content">
|
||
<div class="bd-article-container">
|
||
|
||
<div class="bd-header-article d-print-none">
|
||
<div class="header-article-items header-article__inner">
|
||
|
||
<div class="header-article-items__start">
|
||
|
||
<div class="header-article-item">
|
||
|
||
<nav aria-label="Breadcrumb" class="d-print-none">
|
||
<ul class="bd-breadcrumbs">
|
||
|
||
<li class="breadcrumb-item breadcrumb-home">
|
||
<a href="../index.html" class="nav-link" aria-label="Home">
|
||
<i class="fa-solid fa-home"></i>
|
||
</a>
|
||
</li>
|
||
<li class="breadcrumb-item active" aria-current="page"><span class="ellipsis">Sparse Attention</span></li>
|
||
</ul>
|
||
</nav>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<div id="searchbox"></div>
|
||
<article class="bd-article">
|
||
|
||
<section class="tex2jax_ignore mathjax_ignore" id="sparse-attention">
|
||
<h1>Sparse Attention<a class="headerlink" href="#sparse-attention" title="Link to this heading">#</a></h1>
|
||
<ul class="simple">
|
||
<li><p><a class="reference internal" href="#background-and-motivation">Background and Motivation</a></p></li>
|
||
<li><p><a class="reference internal" href="#quick-start">Quick Start</a></p>
|
||
<ul>
|
||
<li><p><a class="reference internal" href="#python-api">Python API</a></p></li>
|
||
<li><p><a class="reference internal" href="#usage-with-trtllm-bench-or-trtllm-serve">Usage with trtllm-bench or trtllm-serve</a></p></li>
|
||
</ul>
|
||
</li>
|
||
<li><p><a class="reference internal" href="#developer-guide">Developer Guide</a></p>
|
||
<ul>
|
||
<li><p><a class="reference internal" href="#architecture-overview">Architecture Overview</a></p></li>
|
||
<li><p><a class="reference internal" href="#framework-implementation">Framework Implementation</a></p></li>
|
||
<li><p><a class="reference internal" href="#implementing-a-new-algorithm">Implementing a New Algorithm</a></p>
|
||
<ul>
|
||
<li><p><a class="reference internal" href="#configuration-class">1. Configuration Class</a></p></li>
|
||
<li><p><a class="reference internal" href="#implement-the-prediction-module-in-attention-backend">2. Implement the prediction module in Attention Backend</a></p></li>
|
||
<li><p><a class="reference internal" href="#manage-auxiliary-memory-pool">3. Manage Auxiliary Memory Pool</a></p></li>
|
||
<li><p><a class="reference internal" href="#registration-and-dispatch">4. Registration and Dispatch</a></p></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li><p><a class="reference internal" href="#summary-and-future-work">Summary and Future Work</a></p>
|
||
<ul>
|
||
<li><p><a class="reference internal" href="#current-status">Current Status</a></p></li>
|
||
<li><p><a class="reference internal" href="#future-work">Future Work</a></p></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<section id="background-and-motivation">
|
||
<h2>Background and Motivation<a class="headerlink" href="#background-and-motivation" title="Link to this heading">#</a></h2>
|
||
<p>As Large Language Models (LLMs) are applied to increasingly complex tasks such as long-document summarization, code generation, and autonomous agents, the demand for processing long contexts and extended generation has surged. In Transformer-based models, the attention mechanism’s computational complexity and memory usage grow quadratically and linearly with sequence length, respectively. This creates significant bottlenecks in both the <strong>Context (Prefill)</strong> and <strong>Generation (Decode)</strong> phases:</p>
|
||
<ul class="simple">
|
||
<li><p><strong>Context Phase</strong>: Processing long prompts requires substantial memory bandwidth and computation, affecting time-to-first-token (TTFT). Since the context phase is typically compute-bound, reducing the computational load here is critical.</p></li>
|
||
<li><p><strong>Generation Phase</strong>: The Key-Value (KV) cache grows with every generated token, consuming vast amounts of GPU memory and bandwidth. Since the generation phase is usually memory-bound, reducing the memory footprint directly alleviates memory pressure, improves token-to-token latency (TPOT), and allows for larger batch sizes.</p></li>
|
||
</ul>
|
||
<p>Fortunately, key observations indicate that attention scores naturally exhibit sparsity, meaning not all K/V tokens are necessary for attention computation. To enhance the efficiency of long-sequence LLMs, numerous methods have been proposed to optimize performance by leveraging approximate sparse attention. Among those methods, sparsity can be applied to different dimensions of the attention: head dimension, hidden dimension, and sequence dimension. When applying sparsity to the sequence dimension, those methods selectively compute only the most important query-key pairs. This approach can be referred to as token sparsity. Token sparsity has been widely explored in lots of recent academic works, and it is also a kind of structured sparse method that is friendly for GPU. Currently, TensorRT LLM focuses on the sparse attention methods that leverages token sparsity.</p>
|
||
<p>Token sparsity can be applied to two distinct aspects of LLM inference:</p>
|
||
<ul class="simple">
|
||
<li><p><strong>Sparse Computation</strong>: If a query token does not require the entire history, just skip the computation for irrelevant tokens, thereby reducing attention computational costs.</p></li>
|
||
<li><p><strong>Sparse KV cache</strong>: Evicts KV tokens from the cache that are not required for future generation steps. This reduces GPU memory usage and lowers computation overhead for subsequent steps.</p></li>
|
||
</ul>
|
||
<p>Both methods can be enabled simultaneously to achieve better performance.</p>
|
||
<p>To support these emerging techniques, TensorRT LLM has designed a general, extensible and flexible <strong>sparse attention framework</strong> (which is continuously being optimized) to compatibly integrate advanced sparse algorithms. Currently we can support <a class="reference external" href="https://arxiv.org/pdf/2502.14051">RocketKV</a> and <a class="reference external" href="https://github.com/deepseek-ai/DeepSeek-V3.2-Exp/blob/main/DeepSeek_V3_2.pdf">DSA</a>.</p>
|
||
</section>
|
||
<section id="quick-start">
|
||
<h2>Quick Start<a class="headerlink" href="#quick-start" title="Link to this heading">#</a></h2>
|
||
<p>This section provides a brief guide on enabling sparse attention in TensorRT LLM, using RocketKV as an example. For more details, please refer to <a class="reference internal" href="#../../examples/sparse_attention/RocketKV.md"><span class="xref myst">RocketKV sparse attention</span></a>.</p>
|
||
<section id="python-api">
|
||
<h3>Python API<a class="headerlink" href="#python-api" title="Link to this heading">#</a></h3>
|
||
<p>To use sparse attention, you need to configure a specific <code class="docutils literal notranslate"><span class="pre">SparseAttentionConfig</span></code> (for example, <code class="docutils literal notranslate"><span class="pre">RocketSparseAttentionConfig</span></code>) and pass it to the <code class="docutils literal notranslate"><span class="pre">LLM</span></code> constructor.</p>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">tensorrt_llm</span><span class="w"> </span><span class="kn">import</span> <span class="n">LLM</span><span class="p">,</span> <span class="n">SamplingParams</span>
|
||
<span class="kn">from</span><span class="w"> </span><span class="nn">tensorrt_llm.llmapi</span><span class="w"> </span><span class="kn">import</span> <span class="n">RocketSparseAttentionConfig</span><span class="p">,</span> <span class="n">KvCacheConfig</span>
|
||
|
||
<span class="c1"># 1. Configure Sparse Attention</span>
|
||
<span class="c1"># Example: RocketKV configuration</span>
|
||
<span class="n">rocket_config</span> <span class="o">=</span> <span class="n">RocketSparseAttentionConfig</span><span class="p">(</span>
|
||
<span class="n">prompt_budget</span><span class="o">=</span><span class="mi">2048</span><span class="p">,</span>
|
||
<span class="n">kt_cache_dtype</span><span class="o">=</span><span class="s1">'float8_e5m2'</span>
|
||
<span class="p">)</span>
|
||
|
||
<span class="c1"># 2. Configure KV Cache</span>
|
||
<span class="c1"># Note: Some sparse algorithms (like RocketKV) may require disabling block reuse</span>
|
||
<span class="n">kv_config</span> <span class="o">=</span> <span class="n">KvCacheConfig</span><span class="p">(</span><span class="n">enable_block_reuse</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
|
||
|
||
<span class="c1"># 3. Initialize LLM</span>
|
||
<span class="n">llm</span> <span class="o">=</span> <span class="n">LLM</span><span class="p">(</span>
|
||
<span class="n">model</span><span class="o">=</span><span class="s2">"<path_to_model>"</span><span class="p">,</span>
|
||
<span class="n">backend</span><span class="o">=</span><span class="s1">'pytorch'</span><span class="p">,</span> <span class="c1"># Currently requires the PyTorch backend</span>
|
||
<span class="n">sparse_attention_config</span><span class="o">=</span><span class="n">rocket_config</span><span class="p">,</span>
|
||
<span class="n">kv_cache_config</span><span class="o">=</span><span class="n">kv_config</span><span class="p">,</span>
|
||
<span class="p">)</span>
|
||
|
||
<span class="c1"># 4. Generate</span>
|
||
<span class="n">prompts</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"To be or not to be..."</span><span class="p">]</span>
|
||
<span class="n">outputs</span> <span class="o">=</span> <span class="n">llm</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">prompts</span><span class="p">,</span> <span class="n">SamplingParams</span><span class="p">(</span><span class="n">max_tokens</span><span class="o">=</span><span class="mi">128</span><span class="p">))</span>
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
<section id="usage-with-trtllm-bench-or-trtllm-serve">
|
||
<h3>Usage with <code class="docutils literal notranslate"><span class="pre">trtllm-bench</span></code> or <code class="docutils literal notranslate"><span class="pre">trtllm-serve</span></code><a class="headerlink" href="#usage-with-trtllm-bench-or-trtllm-serve" title="Link to this heading">#</a></h3>
|
||
<p>You can enable sparse attention in benchmarking and serving tools by providing a <code class="docutils literal notranslate"><span class="pre">sparse_attention_config</span></code> in an <code class="docutils literal notranslate"><span class="pre">extra_config.yaml</span></code> file.</p>
|
||
<p><strong>extra_config.yaml:</strong></p>
|
||
<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="nt">backend</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">pytorch</span>
|
||
<span class="nt">attn_backend</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">TRTLLM</span>
|
||
<span class="nt">sparse_attention_config</span><span class="p">:</span><span class="w"> </span><span class="c1"># RocketKV as an example</span>
|
||
<span class="w"> </span><span class="nt">algorithm</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">rocket</span>
|
||
<span class="w"> </span><span class="nt">kt_cache_dtype</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">float8_e5m2</span>
|
||
<span class="w"> </span><span class="nt">prompt_budget</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">2048</span>
|
||
<span class="nt">kv_cache_config</span><span class="p">:</span>
|
||
<span class="w"> </span><span class="nt">enable_block_reuse</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">false</span>
|
||
<span class="nt">enable_chunked_prefill</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">false</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Run the command with the config file:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>trtllm-bench/trtllm-serve<span class="w"> </span>--model<span class="w"> </span><model_path><span class="w"> </span>--extra_llm_api_options<span class="w"> </span>extra_config.yaml<span class="w"> </span>...
|
||
</pre></div>
|
||
</div>
|
||
<p>For example, users can evaluate a model with trtllm-eval on LongBenchV2 task like this:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>trtllm-eval<span class="w"> </span>--model<span class="w"> </span><path_to_model><span class="w"> </span>--extra_llm_api_options<span class="w"> </span>extra_config.yaml<span class="w"> </span>longbench_v2<span class="w"> </span>--max_output_length<span class="w"> </span><span class="m">1024</span><span class="w"> </span>...
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
</section>
|
||
<section id="developer-guide">
|
||
<h2>Developer Guide<a class="headerlink" href="#developer-guide" title="Link to this heading">#</a></h2>
|
||
<p>This section describes the sparse attention framework architecture and guides developers on how to implement new sparse attention algorithms in TensorRT LLM. Unless otherwise specified, this framework primarily targets <strong>MQA/GQA/MLA-based</strong> attention mechanisms.</p>
|
||
<section id="architecture-overview">
|
||
<h3>Architecture Overview<a class="headerlink" href="#architecture-overview" title="Link to this heading">#</a></h3>
|
||
<div align="center">
|
||
<figure>
|
||
<img src="https://github.com/NVIDIA/TensorRT-LLM/raw/main/docs/source/media/sparse_attention_framework.png" width="800">
|
||
</figure>
|
||
</div>
|
||
<p align="center"><sub><em>Figure 1: The sparse attention framework in TensorRT LLM.</em></sub></p>
|
||
<p>Our goal is to design a general, extensible, and flexible sparse attention framework. In this framework, the attention operator provides the unified APIs to support both <strong>sparse computation</strong> and <strong>sparse KV cache</strong> that leverage token sparsity, while the users/developers can only focus on the algorithm of sparse attentions, i.e. how to accurately identify important query-key pairs.</p>
|
||
<p>For the generality, TensorRT LLM abstracts sparse attention into a prediction-based workflow: <em>a prediction module first identifies the sparse indices (tokens/blocks to keep or attend to), which are then used by the subsequent attention operator</em>. Currently, for standard attention (MQA/GQA), TensorRT LLM supports <strong>sparse KV cache</strong> in the context phase and <strong>sparse computation</strong> in the generation phase. Different KV heads are allowed to use different sparse indices, while Q heads that map to the same KV head share the same sparse pattern. It does <strong>not</strong> yet support sparse computation in the context phase or sparse KV cache in the generation phase.</p>
|
||
<p>For the scalability, figure 1 illustrates the overall design. The architecture is built by inheriting from the existing <code class="docutils literal notranslate"><span class="pre">AttentionBackend</span></code> to define algorithm-specific sparse attention backends. Within these backends, <code class="docutils literal notranslate"><span class="pre">prediction</span></code> methods are implemented to generate the corresponding sparse indices. These indices are then passed as arguments to the <code class="docutils literal notranslate"><span class="pre">AttentionOp</span></code> to perform the sparse attention computation. This approach balances system flexibility with extensibility, allowing new algorithms to be integrated by simply defining their prediction logic <strong>without</strong> modifying the core attention kernels.</p>
|
||
<p>TensorRT LLM currently supports the following features:</p>
|
||
<ol class="arabic simple">
|
||
<li><p><strong>Context Phase</strong>:</p>
|
||
<ul class="simple">
|
||
<li><p><strong>sparse computation</strong>: MLA</p></li>
|
||
<li><p><strong>sparse KV cache</strong>: MQA/GQA</p></li>
|
||
</ul>
|
||
</li>
|
||
<li><p><strong>Generation Phase</strong>:</p>
|
||
<ul class="simple">
|
||
<li><p><strong>sparse computation</strong>: MLA/MQA/GQA</p></li>
|
||
<li><p><strong>sparse KV cache</strong>: no support yet</p></li>
|
||
</ul>
|
||
</li>
|
||
</ol>
|
||
</section>
|
||
<section id="framework-implementation">
|
||
<h3>Framework Implementation<a class="headerlink" href="#framework-implementation" title="Link to this heading">#</a></h3>
|
||
<p>To hide the complexity of sparse algorithms, the main prediction logic is encapsulated within the <code class="docutils literal notranslate"><span class="pre">tensorrt_llm._torch.attention_backend</span></code> module.</p>
|
||
<p>We have extended the existing <code class="docutils literal notranslate"><span class="pre">AttentionBackend</span></code> to include a prediction step that retrieves sparse indices before the attention operation. These indices are generated using two prediction methods:</p>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># Predict indices for sparse KV Cache</span>
|
||
<span class="n">sparse_kv_indices</span><span class="p">,</span> <span class="n">sparse_kv_offsets</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sparse_kv_predict</span><span class="p">(</span>
|
||
<span class="n">q</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">metadata</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
|
||
|
||
<span class="c1"># Predict indices for sparse computation</span>
|
||
<span class="n">sparse_attn_indices</span><span class="p">,</span> <span class="n">sparse_attn_offsets</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sparse_attn_predict</span><span class="p">(</span>
|
||
<span class="n">q</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">metadata</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>The specific prediction logic is hidden in the subclasses, where developers implement <code class="docutils literal notranslate"><span class="pre">sparse_kv_predict</span></code> and <code class="docutils literal notranslate"><span class="pre">sparse_attn_predict</span></code>.</p>
|
||
<p>The key files located in <code class="docutils literal notranslate"><span class="pre">tensorrt_llm/_torch/attention_backend/sparse/</span></code> are:</p>
|
||
<ul class="simple">
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">rocket.py</span></code>, <code class="docutils literal notranslate"><span class="pre">dsa.py</span></code>: Implementations of specific algorithms (e.g., RocketKV, DSA).</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">kernel.py</span></code>: Custom Triton kernels for importance scoring or selection.</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">utils.py</span></code>: Dispatch related logic.</p></li>
|
||
</ul>
|
||
<div align="center">
|
||
<figure>
|
||
<img src="https://github.com/NVIDIA/TensorRT-LLM/raw/main/docs/source/media/sparse_attention_op.png" width="800">
|
||
</figure>
|
||
</div>
|
||
<p align="center"><sub><em>Figure 2: Sparse attention operator workflow in TensorRT LLM.</em></sub></p>
|
||
<p>In <code class="docutils literal notranslate"><span class="pre">AttentionOp</span></code>, currently, the MQA/GQA sparse attention only supports sparse computation at block granularity in the generation phase, where the block size equals to the page size of the KV cache. It means that we can skip the attention computation of those unimportant pages. In addition, we provide a sparse MLA kernel that supports token-level sparse computation in both the context and generation phases.</p>
|
||
<p>To support those features, as illustrated in figure 2, we have implemented two kernels for the MQA/GQA path, <code class="docutils literal notranslate"><span class="pre">updateSparseKvCacheAfterFmha</span></code> and <code class="docutils literal notranslate"><span class="pre">gatherKvPageOffsetsKernel</span></code>, applied in the context and generation phases respectively:</p>
|
||
<ul class="simple">
|
||
<li><p><strong><code class="docutils literal notranslate"><span class="pre">updateSparseKvCacheAfterFmha</span></code></strong>: Invoked in the post-processing stage after the context attention computation. It selects the important KV tokens and write those K/V vectors to the KV cache to reduce the KV cache size.</p></li>
|
||
<li><p><strong><code class="docutils literal notranslate"><span class="pre">gatherKvPageOffsetsKernel</span></code></strong>: Executed before the attention computation in the generation phase. It converts the input sparse indices (which can be of arbitrary granularity) into page-aligned indices. This means that if a single token is selected, the entire page it is included in the attention computation. After this conversion, we will get a new <code class="docutils literal notranslate"><span class="pre">kv_page_offsets</span></code> and also an updated <code class="docutils literal notranslate"><span class="pre">kv_len</span></code> that is the number of those selected KV tokens. Then these new metadata are fed into the subsequent attention kernel for computation.</p></li>
|
||
</ul>
|
||
<p>For sparse MLA, the kernel supports token sparsity directly, eliminating the need for <code class="docutils literal notranslate"><span class="pre">gatherKvPageOffsetsKernel</span></code>. However, please note that sparse KV cache support is not yet available.</p>
|
||
<p>Many sparse attention algorithms also require additional auxiliary memory. In the current system, there are two paths to support this feature:</p>
|
||
<ul class="simple">
|
||
<li><p>Implement a simple, custom CacheManager at the Python level, inheriting from <code class="docutils literal notranslate"><span class="pre">KVCacheManager</span></code>.</p></li>
|
||
<li><p>Use <code class="docutils literal notranslate"><span class="pre">KVCacheManagerCpp</span></code> to simultaneously manage both the KV Cache and auxiliary memory.</p></li>
|
||
</ul>
|
||
<p>Each option has its own advantages and disadvantages, please refer to the <a class="reference internal" href="#manage-auxiliary-memory-pool">Manage Auxiliary Memory Pool</a> for more details.</p>
|
||
</section>
|
||
<section id="implementing-a-new-algorithm">
|
||
<h3>Implementing a New Algorithm<a class="headerlink" href="#implementing-a-new-algorithm" title="Link to this heading">#</a></h3>
|
||
<section id="configuration-class">
|
||
<h4>1. Configuration Class<a class="headerlink" href="#configuration-class" title="Link to this heading">#</a></h4>
|
||
<p>Define a configuration class in <code class="docutils literal notranslate"><span class="pre">tensorrt_llm/llmapi/llm_args.py</span></code> inheriting from <code class="docutils literal notranslate"><span class="pre">BaseSparseAttentionConfig</span></code>. This class should hold user-tunable parameters for your algorithm.</p>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="nd">@dataclass</span>
|
||
<span class="k">class</span><span class="w"> </span><span class="nc">MySparseAttentionConfig</span><span class="p">(</span><span class="n">BaseSparseAttentionConfig</span><span class="p">):</span>
|
||
<span class="n">topk</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">64</span>
|
||
<span class="c1"># ... other parameters</span>
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
<section id="implement-the-prediction-module-in-attention-backend">
|
||
<h4>2. Implement the prediction module in Attention Backend<a class="headerlink" href="#implement-the-prediction-module-in-attention-backend" title="Link to this heading">#</a></h4>
|
||
<p>Create a new class inheriting from <code class="docutils literal notranslate"><span class="pre">TrtllmAttention</span></code> (in <code class="docutils literal notranslate"><span class="pre">tensorrt_llm/_torch/attention_backend/trtllm.py</span></code>). You typically need to override two main prediction methods:</p>
|
||
<p><strong><code class="docutils literal notranslate"><span class="pre">sparse_kv_predict(self,</span> <span class="pre">q,</span> <span class="pre">k,</span> <span class="pre">metadata,</span> <span class="pre">**kwargs)</span></code></strong></p>
|
||
<ul class="simple">
|
||
<li><p><strong>Behavior</strong>: This function performs prediction to return the indices of tokens to be preserved in the KV cache.</p></li>
|
||
<li><p><strong>Output</strong>:</p>
|
||
<ul>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">sparse_kv_indices</span></code>: The token indices of the important tokens on sequence dimension, shape <code class="docutils literal notranslate"><span class="pre">(nHeads,</span> <span class="pre">nTokens)</span></code>, where <code class="docutils literal notranslate"><span class="pre">nHeads</span></code> is the number of KV heads and <code class="docutils literal notranslate"><span class="pre">nTokens</span></code> is the total number of selected tokens across all samples in the batch.</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">sparse_kv_offsets</span></code>: The offset for the <code class="docutils literal notranslate"><span class="pre">sparse_kv_indices</span></code>, shape <code class="docutils literal notranslate"><span class="pre">(nBatch</span> <span class="pre">+</span> <span class="pre">1)</span></code>, where <code class="docutils literal notranslate"><span class="pre">nBatch</span></code> is the number of the batch size. The index for head <code class="docutils literal notranslate"><span class="pre">h</span></code> and sample <code class="docutils literal notranslate"><span class="pre">n</span></code> can be obtained via <code class="docutils literal notranslate"><span class="pre">sparse_kv_indices[h,</span> <span class="pre">sparse_kv_offsets[n]]</span></code>.</p></li>
|
||
</ul>
|
||
</li>
|
||
<li><p><strong>Constraint</strong>: Returned indices must be <strong>sorted</strong> to ensure safe in-place gathering in memory. Note that this post-processing “gather” step introduces some overhead, but significantly improves flexibility, allowing compatibility with features in context like chunked prefill.</p></li>
|
||
</ul>
|
||
<p><strong><code class="docutils literal notranslate"><span class="pre">sparse_attn_predict(self,</span> <span class="pre">q,</span> <span class="pre">k,</span> <span class="pre">metadata,</span> <span class="pre">**kwargs)</span></code></strong></p>
|
||
<ul class="simple">
|
||
<li><p><strong>Behavior</strong>: For the current query tokens, predict and return the sparse indices for sparse computation.</p></li>
|
||
<li><p><strong>Output</strong>:</p>
|
||
<ul>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">sparse_attn_indices</span></code>: The block indices of the block sparse attention on the KV sequence dimension, shape <code class="docutils literal notranslate"><span class="pre">(nHeads,</span> <span class="pre">nBlocks)</span></code>, where <code class="docutils literal notranslate"><span class="pre">nHeads</span></code> is the number of KV heads and <code class="docutils literal notranslate"><span class="pre">nBlocks</span></code> is the total number of selected blocks across all samples in the batch. For block sparse attention, the block size is defined by <code class="docutils literal notranslate"><span class="pre">sparse_attn_indices_block_size</span></code>, which supports arbitrary values.</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">sparse_attn_offsets</span></code>: The offset for the <code class="docutils literal notranslate"><span class="pre">sparse_attn_indices</span></code>, shape <code class="docutils literal notranslate"><span class="pre">(nBatch</span> <span class="pre">+</span> <span class="pre">1)</span></code>, where <code class="docutils literal notranslate"><span class="pre">nBatch</span></code> is the number of the batch size. The index for head <code class="docutils literal notranslate"><span class="pre">h</span></code> and sample <code class="docutils literal notranslate"><span class="pre">n</span></code> can be obtained via <code class="docutils literal notranslate"><span class="pre">sparse_attn_indices[h,</span> <span class="pre">sparse_attn_offsets[n]]</span></code>.</p></li>
|
||
</ul>
|
||
</li>
|
||
<li><p><strong>Constraint</strong>: The generation phase sparse computation is supported for NVIDIA Blackwell GPUs and newer (SM 100+) using TRTLLM-GEN kernels. However, it is flexible enough to extend to different architectures. Currently, only KV cache’s <strong>page-level</strong> granularity is supported for sparse computation.</p></li>
|
||
</ul>
|
||
<p><strong>Note</strong>: The prediction process can be time-consuming, especially in low-latency scenarios where it might account for a significant portion of the attention time. It is highly recommended to optimize this step using custom kernels.</p>
|
||
</section>
|
||
<section id="manage-auxiliary-memory-pool">
|
||
<h4>3. Manage Auxiliary Memory Pool<a class="headerlink" href="#manage-auxiliary-memory-pool" title="Link to this heading">#</a></h4>
|
||
<p>Many sparse algorithms (like RocketKV or DSA) require auxiliary structures (e.g., a “KT cache” in RocketKV) to select relevant tokens. There are two primary ways to manage this memory in TensorRT LLM:</p>
|
||
<p><strong>Option A: Python-level Custom Manager</strong></p>
|
||
<p>You can implement a custom manager in Python.</p>
|
||
<ul class="simple">
|
||
<li><p><strong>Use Case</strong>: Algorithms like RocketKV use this approach to store the KT cache (e.g., <code class="docutils literal notranslate"><span class="pre">RocketKVCacheManager</span></code> in <code class="docutils literal notranslate"><span class="pre">rocket.py</span></code>).</p></li>
|
||
<li><p><strong>Implementation</strong>: Create a Python level cache manager that handles the allocation and lifecycle of the auxiliary tensors. It is recommended to use the existing <code class="docutils literal notranslate"><span class="pre">BlockManager</span></code> to manage the auxiliary pools if possible. This allows the auxiliary pool to share block manager logics, reducing implementation overhead.</p></li>
|
||
<li><p><strong>Key Methods to Override</strong>:</p>
|
||
<ul>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">get_cache_size_per_token</span></code> / <code class="docutils literal notranslate"><span class="pre">get_cache_bytes_per_token</span></code>: Update <code class="docutils literal notranslate"><span class="pre">kv_factor</span></code> correctly to include the size of the auxiliary structures so TensorRT LLM allocates sufficient GPU memory.</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">add_dummy_requests</span></code> / <code class="docutils literal notranslate"><span class="pre">prepare_resources</span></code>: Ensure the auxiliary pool allocates correct resources/tokens for new requests.</p></li>
|
||
</ul>
|
||
</li>
|
||
<li><p><strong>Pros</strong>: The custom cache manager is more flexible and easier to implement because it can share the same blocks managed by the <code class="docutils literal notranslate"><span class="pre">KVCacheManager</span></code>.</p></li>
|
||
<li><p><strong>Cons</strong>: This approach operates at the Python level, making it difficult to share features of the KV cache managed at the C++ level (e.g., advanced transmission or kvcache reuse features tied to the C++ manager).</p></li>
|
||
</ul>
|
||
<p><strong>Option B: C++ Integrated Manager</strong></p>
|
||
<p>For tighter integration, you can manage the auxiliary memory within the C++ <code class="docutils literal notranslate"><span class="pre">KVCacheManager</span></code>.</p>
|
||
<ul class="simple">
|
||
<li><p><strong>Use Case</strong>: Algorithms like DSA use this approach to store the indexer Kcache.</p></li>
|
||
<li><p><strong>Pros</strong>: Enables compatibility with advanced features such as KV cache reuse and disagg-serving. For example, DSA’s low-rank indexer Kcache can be reused or transmitted between context and generation engines.</p></li>
|
||
<li><p><strong>Cons</strong>: Higher implementation complexity. The current C++ <code class="docutils literal notranslate"><span class="pre">KVCacheManager</span></code> is optimized for the standard KV cache pool. Adding custom pools often requires significant modifications or manual implementation of the pool management logic within the C++ level.</p></li>
|
||
</ul>
|
||
<p><strong>Note</strong>: If your algorithm involves sparse KV cache, standard KV cache block reuse is generally incompatible because eviction modifies the block content uniquely for each request. However, algorithms like DSA that use low-rank approximation without eviction can support block reuse.</p>
|
||
</section>
|
||
<section id="registration-and-dispatch">
|
||
<h4>4. Registration and Dispatch<a class="headerlink" href="#registration-and-dispatch" title="Link to this heading">#</a></h4>
|
||
<ul class="simple">
|
||
<li><p>Register your config and backend in <code class="docutils literal notranslate"><span class="pre">tensorrt_llm/_torch/attention_backend/sparse/utils.py</span></code> and <code class="docutils literal notranslate"><span class="pre">tensorrt_llm/_torch/pyexecutor/_util.py</span></code> to ensure the system routes the request to your new backend when the config is present.</p></li>
|
||
<li><p>Add initialization logic in <code class="docutils literal notranslate"><span class="pre">cpp/tensorrt_llm/thop/attentionOp.cpp</span></code> and <code class="docutils literal notranslate"><span class="pre">cpp/tensorrt_llm/kernels/sparseAttentionKernels.h</span></code> if new C++ level parameters are required.</p></li>
|
||
</ul>
|
||
</section>
|
||
</section>
|
||
</section>
|
||
<section id="summary-and-future-work">
|
||
<h2>Summary and Future Work<a class="headerlink" href="#summary-and-future-work" title="Link to this heading">#</a></h2>
|
||
<section id="current-status">
|
||
<h3>Current Status<a class="headerlink" href="#current-status" title="Link to this heading">#</a></h3>
|
||
<p>Currently, the status of the sparse attention framework is as follows:</p>
|
||
<ol class="arabic simple">
|
||
<li><p><strong>Supported Operations</strong>: The <code class="docutils literal notranslate"><span class="pre">AttentionOp</span></code> currently supports <strong>sparse KV cache</strong> in the context phase and <strong>sparse computation</strong> in the generation phase. Other combinations (for example, sparse computation in the context phase) are not yet supported for MQA/GQA. For MLA, sparse computation is supported in both the context and generation phases.</p></li>
|
||
<li><p><strong>Algorithm Support</strong>: RocketKV is supported in both the vanilla (PyTorch) backend and the TRTLLM backend, while DSA is supported in the TRTLLM backend. These implementations validate the generality and scalability of the framework.</p></li>
|
||
</ol>
|
||
</section>
|
||
<section id="future-work">
|
||
<h3>Future Work<a class="headerlink" href="#future-work" title="Link to this heading">#</a></h3>
|
||
<ul class="simple">
|
||
<li><p><strong>Sparse Computation in Context Phase</strong>: We plan to introduce sparse computation support for the context phase for MQA/GQA, allowing the TensorRT LLM sparse attention framework to cover more scenarios.</p></li>
|
||
<li><p><strong>Dynamic Eviction in Generation Phase</strong>: Dynamically evicting KV cache blocks during the generation phase poses significant challenges to KV cache flexibility. While difficult to implement in the current framework, block-level eviction appears to be a promising compromise and is under further exploration.</p></li>
|
||
<li><p><strong>Unified Auxiliary Memory Management</strong>: We are exploring a unified mechanism to manage auxiliary memory pools. This would allow users to define custom auxiliary spaces more flexibly while automatically inheriting advanced features from the KV cache, such as reuse and offloading.</p></li>
|
||
<li><p><strong>Code Refactoring</strong>: As more sparse attention algorithms are integrated, the framework will undergo refactoring to unify code and improve maintainability.</p></li>
|
||
<li><p><strong>Optimizations</strong>: We are discussing further optimizations, such as improving DSA performance.</p></li>
|
||
</ul>
|
||
</section>
|
||
</section>
|
||
</section>
|
||
|
||
|
||
</article>
|
||
|
||
|
||
|
||
|
||
|
||
<footer class="prev-next-footer d-print-none">
|
||
|
||
<div class="prev-next-area">
|
||
</div>
|
||
</footer>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
<dialog id="pst-secondary-sidebar-modal"></dialog>
|
||
<div id="pst-secondary-sidebar" class="bd-sidebar-secondary bd-toc"><div class="sidebar-secondary-items sidebar-secondary__inner">
|
||
|
||
|
||
<div class="sidebar-secondary-item">
|
||
<div
|
||
id="pst-page-navigation-heading-2"
|
||
class="page-toc tocsection onthispage">
|
||
<i class="fa-solid fa-list"></i> On this page
|
||
</div>
|
||
<nav class="bd-toc-nav page-toc" aria-labelledby="pst-page-navigation-heading-2">
|
||
<ul class="visible nav section-nav flex-column">
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#background-and-motivation">Background and Motivation</a></li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#quick-start">Quick Start</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#python-api">Python API</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#usage-with-trtllm-bench-or-trtllm-serve">Usage with <code class="docutils literal notranslate"><span class="pre">trtllm-bench</span></code> or <code class="docutils literal notranslate"><span class="pre">trtllm-serve</span></code></a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#developer-guide">Developer Guide</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#architecture-overview">Architecture Overview</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#framework-implementation">Framework Implementation</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#implementing-a-new-algorithm">Implementing a New Algorithm</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#configuration-class">1. Configuration Class</a></li>
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#implement-the-prediction-module-in-attention-backend">2. Implement the prediction module in Attention Backend</a></li>
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#manage-auxiliary-memory-pool">3. Manage Auxiliary Memory Pool</a></li>
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#registration-and-dispatch">4. Registration and Dispatch</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#summary-and-future-work">Summary and Future Work</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#current-status">Current Status</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#future-work">Future Work</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</nav></div>
|
||
|
||
</div></div>
|
||
|
||
|
||
|
||
</div>
|
||
<footer class="bd-footer-content">
|
||
|
||
</footer>
|
||
|
||
</main>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<!-- Scripts loaded after <body> so the DOM is not blocked -->
|
||
<script defer src="../_static/scripts/bootstrap.js?digest=8878045cc6db502f8baf"></script>
|
||
<script defer src="../_static/scripts/pydata-sphinx-theme.js?digest=8878045cc6db502f8baf"></script>
|
||
|
||
|
||
<footer class="bd-footer">
|
||
<div class="bd-footer__inner bd-page-width">
|
||
|
||
<div class="footer-items__start">
|
||
|
||
<div class="footer-item">
|
||
<a class="footer-brand logo" href="https://www.nvidia.com">
|
||
<img src="../_static/nvidia-logo-horiz-rgb-1c-blk-for-screen.svg" class="logo__image only-light" alt="NVIDIA"/>
|
||
<img src="../_static/nvidia-logo-horiz-rgb-1c-wht-for-screen.svg" class="logo__image only-dark" alt="NVIDIA"/>
|
||
</a></div>
|
||
|
||
<div class="footer-item">
|
||
|
||
<div class="footer-links">
|
||
|
||
|
||
<a class="external" href="https://www.nvidia.com/en-us/about-nvidia/privacy-policy/">Privacy Policy</a>
|
||
|
|
||
|
||
|
||
|
||
<a class="external" href="https://www.nvidia.com/en-us/about-nvidia/privacy-center/">Your Privacy Choices</a>
|
||
|
|
||
|
||
|
||
|
||
<a class="external" href="https://www.nvidia.com/en-us/about-nvidia/terms-of-service/">Terms of Service</a>
|
||
|
|
||
|
||
|
||
|
||
<a class="external" href="https://www.nvidia.com/en-us/about-nvidia/accessibility/">Accessibility</a>
|
||
|
|
||
|
||
|
||
|
||
<a class="external" href="https://www.nvidia.com/en-us/about-nvidia/company-policies/">Corporate Policies</a>
|
||
|
|
||
|
||
|
||
|
||
<a class="external" href="https://www.nvidia.com/en-us/product-security/">Product Security</a>
|
||
|
|
||
|
||
|
||
|
||
<a class="external" href="https://www.nvidia.com/en-us/contact/">Contact</a>
|
||
|
||
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div class="footer-item">
|
||
|
||
|
||
|
||
|
||
<p class="copyright">
|
||
|
||
Copyright © 2025, NVidia.
|
||
<br/>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
<div class="footer-item">
|
||
<div class="extra_footer">
|
||
|
||
<p>Last updated on January 04, 2026.</p>
|
||
|
||
<p>This page is generated by TensorRT-LLM commit <a href="https://github.com/NVIDIA/TensorRT-LLM/tree/a65b0d4">a65b0d4</a>.</p>
|
||
|
||
</div></div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
</div>
|
||
|
||
</footer>
|
||
</body>
|
||
</html> |