From e0f540fe9806978106667b4527586470ca672599 Mon Sep 17 00:00:00 2001 From: tzhouam Date: Tue, 10 Feb 2026 02:17:00 +0000 Subject: [PATCH] Enhance Dockerfile.ci to synchronize flashinfer runtime package versions with installed flashinfer-python, ensuring compatibility across components. Additionally, improve error handling in ring_globals.py for flashinfer import failures, logging warnings for fallback scenarios. Signed-off-by: tzhouam --- docker/Dockerfile.ci | 11 +++++++++++ .../diffusion/attention/backends/ring/ring_globals.py | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile.ci b/docker/Dockerfile.ci index 3c06395fc..d5f8a6827 100644 --- a/docker/Dockerfile.ci +++ b/docker/Dockerfile.ci @@ -20,6 +20,17 @@ RUN apt-get update && \ # causing it to fall back to the older stable release from PyPI. RUN uv pip install --system --upgrade --force-reinstall --prerelease=allow vllm --extra-index-url https://wheels.vllm.ai/f97ca671766c5201404e9fc812e35bf2c4e95a01 +# Keep flashinfer runtime packages in version sync. +# We derive the version from installed flashinfer-python (pulled by vllm) +# and enforce the same version for flashinfer-cubin / flashinfer-jit-cache. +RUN FLASHINFER_VERSION="$(python3 -c 'import importlib.metadata as m; print(m.version(\"flashinfer-python\"))')" && \ + FLASHINFER_CUDA_TAG="$(python3 -c 'import torch; print((torch.version.cuda or \"12.4\").replace(\".\", \"\"))')" && \ + uv pip install --system --upgrade --force-reinstall \ + "flashinfer-cubin==${FLASHINFER_VERSION}" \ + "flashinfer-jit-cache==${FLASHINFER_VERSION}" \ + --extra-index-url "https://flashinfer.ai/whl/cu${FLASHINFER_CUDA_TAG}" && \ + flashinfer show-config + # Install vllm-omni into the same uv-managed Python environment used by the base image. RUN uv pip install --python "$(python3 -c 'import sys; print(sys.executable)')" --no-cache-dir ".[dev]" diff --git a/vllm_omni/diffusion/attention/backends/ring/ring_globals.py b/vllm_omni/diffusion/attention/backends/ring/ring_globals.py index d80d81fb4..4ac7d1456 100644 --- a/vllm_omni/diffusion/attention/backends/ring/ring_globals.py +++ b/vllm_omni/diffusion/attention/backends/ring/ring_globals.py @@ -3,6 +3,8 @@ # Copyright (c) 2024, Jiarui Fang. # Adapted from https://github.com/feifeibear/long-context-attention +import logging + # test if flash_attn (FA2) is available try: import flash_attn # noqa: F401 @@ -45,12 +47,17 @@ HAS_FLASH_ATTN_HOPPER = HAS_FA3 flash_attn_forward_hopper = fa3_fwd_func flash3_attn_func = fa3_attn_func +logger = logging.getLogger(__name__) + try: from flashinfer.prefill import single_prefill_with_kv_cache # noqa: F401 HAS_FLASHINFER = True -except (ImportError, ModuleNotFoundError): +except Exception as e: + # flashinfer may raise RuntimeError at import-time for version/binary mismatches. + # Treat it as unavailable so the runtime can gracefully fall back to other backends. HAS_FLASHINFER = False + logger.warning("FlashInfer is unavailable; falling back to other attention backends. Reason: %s", e) try: import aiter # noqa: F401