FastVideo icon indicating copy to clipboard operation
FastVideo copied to clipboard

[Bug] fastvideo-kernel build.sh --rocm cannot configure in the rocm/pytorch 7.14.1 image

Open stayinalive181 opened this issue 2 months ago • 1 comments

Describe the bug

fastvideo-kernel/build.sh --rocm cannot configure inside the official rocm/pytorch:rocm7.14.1_ubuntu24.04_py3.12_pytorch_release_2.12.0 image. CMake cannot enable the HIP language: that image installs ROCm as the pip-packaged SDK (_rocm_sdk_core inside the venv), which carries hipcc but no hip-lang CMake package, and there is no /opt/rocm. So on AMD GPUs using the stock image there is currently no supported way to install fastvideo_kernel, even though the sparse attention path only needs its Python and Triton modules.

Reproduction

No model is involved; this is the kernel package build.

cd fastvideo-kernel
./build.sh --rocm
-- The CXX compiler identification is GNU 13.3.0
-- The HIP compiler identification is unknown
-- Configuring incomplete, errors occurred!
CMake Error at .../cmake/data/share/cmake-4.4/Modules/CMakeDetermineHIPCompiler.cmake:257 (message):
  The ROCm root directory:

   /opt/venv/lib/python3.12/site-packages/_rocm_sdk_core

  does not contain the HIP runtime CMake package, expected at one of:

   /opt/venv/lib/python3.12/site-packages/_rocm_sdk_core/lib/cmake/hip-lang/hip-lang-config.cmake
   /opt/venv/lib/python3.12/site-packages/_rocm_sdk_core/lib64/cmake/hip-lang/hip-lang-config.cmake
   /opt/venv/lib/python3.12/site-packages/_rocm_sdk_core/lib/x86_64-linux-gnu/cmake/hip-lang/hip-lang-config.cmake

Call Stack (most recent call first):
  CMakeLists.txt:20 (enable_language)

On that image /opt/rocm does not exist, ROCM_PATH is unset, and _rocm_sdk_core/ contains bin/ (hipcc, hipify-clang, amd-smi), include/, lib/ and share/, but no lib/cmake.

Environment

  • AMD Instinct MI355X (gfx950), Daytona sandbox
  • rocm/pytorch:rocm7.14.1_ubuntu24.04_py3.12_pytorch_release_2.12.0: torch 2.12.0+rocm7.14.1, HIP runtime 7.14.60850, Python 3.12.3, Ubuntu 24.04.4
  • FastVideo 37d06a8; cmake 4.4.3 and scikit-build-core 1.0.3 from PyPI

What does work

The package itself works on ROCm once it is importable. With PYTHONPATH=fastvideo-kernel/python and no build, import fastvideo_kernel (0.3.5), block_sparse_attn_256 and triton_kernels.index all import, and the Triton block-sparse attention runs on the MI355X:

block_sparse_attn first call (Triton autotune+compile) 16.1s -> (1, 4, 2048, 128) torch.bfloat16
vs masked fp32 SDPA: max abs diff 0.0014, mean 0.00011, ref mean abs 0.0519
sparse (10%) H=24 S=262144 D=128: 221.3 ms/call = 382 effective TFLOPS
dense flash SDPA same shape: 702.2 ms/call = 1203 TFLOPS -> sparse speedup 3.17x at 10% density

The same holds with FASTVIDEO_VSA_TRITON=0, i.e. the default dispatch also lands on Triton there. The fused block-mean and top-k kernels, video_sparse_attn as the Wan VSA backend calls it, and the 256-token tile path of block_sparse_attn_256_bshd also match PyTorch references on the same device.

Suggestion

An install mode that skips the compiled extension would let pip install ./fastvideo-kernel ship the Python and Triton modules on ROCm: for example a CMake option that bypasses enable_language(HIP) and the extension targets when GPU_BACKEND=ROCM and the HIP toolchain is not found, or an explicit FASTVIDEO_KERNEL_BUILD_EXTENSION=OFF. Documenting PYTHONPATH=fastvideo-kernel/python as the interim route would also help. Happy to send a PR for whichever you prefer.

Related: #1849 fixes ROCm platform detection in the same image.

stayinalive181 avatar Sep 15 '26 09:09 stayinalive181

Welcome to FastVideo! Thanks for opening your first issue.

To help us investigate, please include:

  • FastVideo version: pip show fastvideo
  • GPU: nvidia-smi output (GPU model, driver, CUDA version)
  • Python version: python --version
  • OS: e.g., Ubuntu 22.04

If this is a bug, a minimal reproduction script helps us fix it faster.

Useful links:

github-actions[bot] avatar Sep 15 '26 09:09 github-actions[bot]