From 1c627a3f987620b2711b28daad8a8f5e7a98edb1 Mon Sep 17 00:00:00 2001 From: William Lin Date: Sat, 6 Jun 2026 17:52:45 -0700 Subject: [PATCH] [bugfix]: build fastvideo-kernel on GPU-less Docker runners (#1437) --- docker/Dockerfile.python3.10 | 6 ++++-- docker/Dockerfile.python3.11 | 6 ++++-- docker/Dockerfile.python3.12 | 6 ++++-- docker/Dockerfile.python3.12.cuda12.9.1 | 6 ++++-- fastvideo-kernel/build.sh | 28 +++++++++++++++++-------- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/docker/Dockerfile.python3.10 b/docker/Dockerfile.python3.10 index 66eabc0a2..ba5f1afb4 100644 --- a/docker/Dockerfile.python3.10 +++ b/docker/Dockerfile.python3.10 @@ -55,12 +55,14 @@ RUN source $HOME/.local/bin/env && \ echo 'source /opt/venv/bin/activate' >> /root/.bashrc && \ echo 'if [ -n "$ZSH_VERSION" ] && [ -f ~/.zshrc ]; then . ~/.zshrc; elif [ -f ~/.bashrc ]; then . ~/.bashrc; fi' > /root/.profile -# Install FastVideo Unified Kernel +# Install FastVideo Unified Kernel. +# This build machine has no GPU, so target Hopper (sm_90a) explicitly instead +# of probing a live device for the arch (matches the released kernel wheel). RUN source $HOME/.local/bin/env && \ source /opt/venv/bin/activate && \ cd fastvideo-kernel && \ git submodule update --init --recursive && \ - ./build.sh + TORCH_CUDA_ARCH_LIST=9.0a ./build.sh EXPOSE 22 diff --git a/docker/Dockerfile.python3.11 b/docker/Dockerfile.python3.11 index 8970bd971..6aa541bd8 100644 --- a/docker/Dockerfile.python3.11 +++ b/docker/Dockerfile.python3.11 @@ -55,12 +55,14 @@ RUN source $HOME/.local/bin/env && \ echo 'source /opt/venv/bin/activate' >> /root/.bashrc && \ echo 'if [ -n "$ZSH_VERSION" ] && [ -f ~/.zshrc ]; then . ~/.zshrc; elif [ -f ~/.bashrc ]; then . ~/.bashrc; fi' > /root/.profile -# Install FastVideo Unified Kernel +# Install FastVideo Unified Kernel. +# This build machine has no GPU, so target Hopper (sm_90a) explicitly instead +# of probing a live device for the arch (matches the released kernel wheel). RUN source $HOME/.local/bin/env && \ source /opt/venv/bin/activate && \ cd fastvideo-kernel && \ git submodule update --init --recursive && \ - ./build.sh + TORCH_CUDA_ARCH_LIST=9.0a ./build.sh EXPOSE 22 diff --git a/docker/Dockerfile.python3.12 b/docker/Dockerfile.python3.12 index aa047a9da..5ac93f392 100644 --- a/docker/Dockerfile.python3.12 +++ b/docker/Dockerfile.python3.12 @@ -55,11 +55,13 @@ RUN source $HOME/.local/bin/env && \ echo 'source /opt/venv/bin/activate' >> /root/.bashrc && \ echo 'if [ -n "$ZSH_VERSION" ] && [ -f ~/.zshrc ]; then . ~/.zshrc; elif [ -f ~/.bashrc ]; then . ~/.bashrc; fi' > /root/.profile -# Install FastVideo Unified Kernel +# Install FastVideo Unified Kernel. +# This build machine has no GPU, so target Hopper (sm_90a) explicitly instead +# of probing a live device for the arch (matches the released kernel wheel). RUN source $HOME/.local/bin/env && \ source /opt/venv/bin/activate && \ cd fastvideo-kernel && \ git submodule update --init --recursive && \ - ./build.sh + TORCH_CUDA_ARCH_LIST=9.0a ./build.sh EXPOSE 22 diff --git a/docker/Dockerfile.python3.12.cuda12.9.1 b/docker/Dockerfile.python3.12.cuda12.9.1 index ce8f2b83a..3f1830d72 100644 --- a/docker/Dockerfile.python3.12.cuda12.9.1 +++ b/docker/Dockerfile.python3.12.cuda12.9.1 @@ -55,12 +55,14 @@ RUN source $HOME/.local/bin/env && \ echo 'source /opt/venv/bin/activate' >> /root/.bashrc && \ echo 'if [ -n "$ZSH_VERSION" ] && [ -f ~/.zshrc ]; then . ~/.zshrc; elif [ -f ~/.bashrc ]; then . ~/.bashrc; fi' > /root/.profile -# Install FastVideo Unified Kernel +# Install FastVideo Unified Kernel. +# This build machine has no GPU, so target Hopper (sm_90a) explicitly instead +# of probing a live device for the arch (matches the released kernel wheel). RUN source $HOME/.local/bin/env && \ source /opt/venv/bin/activate && \ cd fastvideo-kernel && \ git submodule update --init --recursive && \ - ./build.sh + TORCH_CUDA_ARCH_LIST=9.0a ./build.sh EXPOSE 22 diff --git a/fastvideo-kernel/build.sh b/fastvideo-kernel/build.sh index 60f00731a..fed1e08b3 100755 --- a/fastvideo-kernel/build.sh +++ b/fastvideo-kernel/build.sh @@ -78,16 +78,26 @@ print(f'{mj}.{mn}')" } if [ "${GPU_BACKEND}" = "CUDA" ]; then - detected_cc="$(detect_with_torch)" || { - echo "ERROR: torch-based CUDA arch detection failed in uv environment." >&2 - echo " Ensure torch is installed and CUDA is available in the uv-selected Python." >&2 - exit 1 - } - - cc_major="${detected_cc%%.*}" - cc_minor="${detected_cc##*.}" + # Compute capability drives the arch/TK defaults below. Prefer an explicit + # TORCH_CUDA_ARCH_LIST (works on GPU-less build machines such as CI/Docker); + # only probe a live GPU via torch when no arch was provided. + if [ -n "${TORCH_CUDA_ARCH_LIST:-}" ]; then + echo "Using TORCH_CUDA_ARCH_LIST=${TORCH_CUDA_ARCH_LIST} (skipping torch GPU probe)" + first_arch="${TORCH_CUDA_ARCH_LIST%%[;, ]*}" # first entry, e.g. 9.0a + first_arch="${first_arch%[af]}" # strip trailing a/f suffix + cc_major="${first_arch%%.*}" + cc_minor="${first_arch##*.}" + else + detected_cc="$(detect_with_torch)" || { + echo "ERROR: torch-based CUDA arch detection failed and TORCH_CUDA_ARCH_LIST is unset." >&2 + echo " Set TORCH_CUDA_ARCH_LIST (e.g. 9.0a) for GPU-less builds, or build where CUDA is available." >&2 + exit 1 + } + cc_major="${detected_cc%%.*}" + cc_minor="${detected_cc##*.}" + echo "Detected compute capability via torch: ${detected_cc}" + fi cmake_arch="${cc_major}${cc_minor}" - echo "Detected compute capability via torch: ${detected_cc} (sm_${cmake_arch})" # Respect explicit overrides. if [ -z "${TORCH_CUDA_ARCH_LIST:-}" ]; then