[Misc] Rename VLLM_TRITON_ATTN_USE_TD to VLLM_TRITON_USE_TD (#45781)

Signed-off-by: Artur Fierka <artur.fierka@intel.com>
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Artur Fierka
2026-07-14 10:32:57 +00:00
committed by GitHub
co-authored by Claude
parent f04d3f640e
commit 50ac1c7bab
3 changed files with 26 additions and 7 deletions
+22 -3
View File
@@ -87,6 +87,8 @@ if TYPE_CHECKING:
VLLM_MAIN_CUDA_VERSION: str = "13.0"
VLLM_FLOAT32_MATMUL_PRECISION: Literal["highest", "high", "medium"] = "highest"
VLLM_BATCH_INVARIANT: bool = False
VLLM_TRITON_USE_TD: bool | None = None
# Deprecated alias of VLLM_TRITON_USE_TD (removed in v0.25).
VLLM_TRITON_ATTN_USE_TD: bool | None = None
VLLM_GPU_SYNC_CHECK: Literal["warn", "error"] | None = None
MAX_JOBS: str | None = None
@@ -533,6 +535,19 @@ def get_env_or_set_default(
logger = logging.getLogger(__name__)
def _deprecated_triton_attn_use_td() -> None:
"""Warn that VLLM_TRITON_ATTN_USE_TD was renamed to VLLM_TRITON_USE_TD.
The old name is ignored; VLLM_TRITON_USE_TD is the supported variable.
"""
if "VLLM_TRITON_ATTN_USE_TD" in os.environ:
logger.warning(
"VLLM_TRITON_ATTN_USE_TD is deprecated and will be removed in "
"v0.25. Use VLLM_TRITON_USE_TD instead."
)
return None
def _resolve_rust_frontend_path() -> str | None:
"""Resolve the Rust frontend binary path.
@@ -588,13 +603,13 @@ environment_variables: dict[str, Callable[[], Any]] = {
"VLLM_BATCH_INVARIANT": lambda: bool(int(os.getenv("VLLM_BATCH_INVARIANT", "0"))),
# Use tensor descriptors for Q/K/V loads and output stores in the
# Triton unified-attention kernel. Enables HW 2D block reads on
# Intel Xe2/Xe3; the non-TD branch is dead-code-eliminated at Triton
# Intel XPU; the non-TD branch is dead-code-eliminated at Triton
# compile time so other platforms see no overhead. Tri-state override:
# unset (default) lets the `triton_attn` backend auto-select per
# platform (currently auto-enabled on XPU only); ``1`` forces TD on;
# ``0`` forces TD off. Useful for A/B benchmarking the TD path.
"VLLM_TRITON_ATTN_USE_TD": lambda: {"1": True, "0": False}.get(
os.getenv("VLLM_TRITON_ATTN_USE_TD", "").strip()
"VLLM_TRITON_USE_TD": lambda: {"1": True, "0": False}.get(
os.getenv("VLLM_TRITON_USE_TD", "").strip()
),
# If set, enable PyTorch's GPU<->CPU synchronization debug mode around
# the worker's `execute_model` and `sample_tokens` calls. Valid values
@@ -603,6 +618,10 @@ environment_variables: dict[str, Callable[[], Any]] = {
"VLLM_GPU_SYNC_CHECK": env_with_choices(
"VLLM_GPU_SYNC_CHECK", None, ["warn", "error"]
),
# Deprecated: renamed to VLLM_TRITON_USE_TD. Kept registered so it does
# not trip the unknown-env-var check; warns on use and is otherwise
# ignored.
"VLLM_TRITON_ATTN_USE_TD": lambda: _deprecated_triton_attn_use_td(),
# Maximum number of compilation jobs to run in parallel.
# By default this is the number of CPUs
"MAX_JOBS": lambda: os.getenv("MAX_JOBS", None),
+3 -3
View File
@@ -563,15 +563,15 @@ class TritonAttentionImpl(AttentionImpl):
self._is_per_token_head_quant = self._kv_quant_mode.is_per_token_head
# Enable tensor descriptors for Q/K/V load/store on platforms that
# benefit from HW 2D block reads (Intel Xe2/Xe3). The dead branch
# benefit from HW 2D block reads (Intel XPU). The dead branch
# is eliminated at Triton compile time, so other platforms see
# zero cost when TD is off.
#
# ``VLLM_TRITON_ATTN_USE_TD`` is tri-state:
# ``VLLM_TRITON_USE_TD`` is tri-state:
# - unset (None): auto-select (TD on for XPU, off elsewhere),
# - ``1``: force TD on regardless of platform,
# - ``0``: force TD off regardless of platform (useful for A/B).
td_override = envs.VLLM_TRITON_ATTN_USE_TD
td_override = envs.VLLM_TRITON_USE_TD
if td_override is None:
self.use_td = current_platform.is_xpu()
else:
@@ -1026,7 +1026,7 @@ def unified_attention(
assert q.stride(1) == head_size, (
f"USE_TD_QO requires contiguous query heads "
f"(q.stride(1) = {q.stride(1)} != head_size = {head_size}); "
f"set VLLM_TRITON_ATTN_USE_TD=0 or pad the query layout."
f"set VLLM_TRITON_USE_TD=0 or pad the query layout."
)
assert out.stride(1) == head_size, (
f"USE_TD_QO requires contiguous output heads "