Fused FP8 CUDA kernel for FLUX.1 SingleStreamBlock with spike attention and step caching. Replaces ComfyUI's entire SingleStreamBlock forward pass with a single torch.ops call — modulation, dual GEMMs, QKV, RoPE, attention, gating and residual all fused. 30%+ faster than stock ComfyUI on RTX 4090. Spike attention: block-sparse Triton kernel that scores attention blocks by dot-product similarity and keeps only the top 45% after image structure forms. Step caching replays cached attention output on alternating spike steps for zero attention compute every other step. Works with all 38 ComfyUI samplers at any step count. FP16 ports included for 10-series, 20-series, and 30-series GPUs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
24 lines
655 B
Batchfile
24 lines
655 B
Batchfile
@echo off
|
|
setlocal
|
|
|
|
REM Use VS 2022 (CUDA 12.8 supports MSVC 14.3x from VS 2022, not MSVC 14.5x from VS 2025)
|
|
set "VSVARS=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
|
|
if not exist "%VSVARS%" (
|
|
echo [flux_ext] ERROR: VS 2022 vcvars64.bat not found
|
|
exit /b 1
|
|
)
|
|
|
|
call "%VSVARS%" || exit /b 1
|
|
|
|
set DISTUTILS_USE_SDK=1
|
|
|
|
echo [flux_ext] Building PyTorch C++ extension with VS 2022 + CUDA 12.8...
|
|
py -3.10 setup_ext.py install
|
|
if errorlevel 1 (
|
|
echo [flux_ext] Build FAILED
|
|
exit /b 1
|
|
)
|
|
|
|
echo [flux_ext] Build succeeded! flux_ext is now installed.
|
|
echo [flux_ext] Restart ComfyUI to use the new torch.ops path.
|