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>
25 lines
931 B
Python
25 lines
931 B
Python
"""
|
|
ComfyUI Manager install script.
|
|
Runs build_ext.bat to compile the CUDA extension after clone.
|
|
Requires: CUDA Toolkit 12.x, Visual Studio 2022 (Windows) or gcc/nvcc (Linux).
|
|
"""
|
|
import subprocess
|
|
import sys
|
|
import os
|
|
|
|
node_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
if sys.platform == "win32":
|
|
build_script = os.path.join(node_dir, "build_ext.bat")
|
|
if os.path.exists(build_script):
|
|
print("[FLUXNATION] Building CUDA extension...")
|
|
result = subprocess.run([build_script], cwd=node_dir, shell=True)
|
|
if result.returncode == 0:
|
|
print("[FLUXNATION] Build succeeded.")
|
|
else:
|
|
print("[FLUXNATION] Build failed. Install CUDA Toolkit 12.x and Visual Studio 2022, then run build_ext.bat manually.")
|
|
else:
|
|
print("[FLUXNATION] build_ext.bat not found.")
|
|
else:
|
|
print("[FLUXNATION] Linux build: run 'python setup_ext.py install' from the node directory.")
|