Extensions/ComfyUI-RayAttention
ComfyUI Extension

ComfyUI-RayAttention

Spatiotemporal Block-Multipole Tensor-Core Attention (Ray Attention), compressed GGUF DiT loader, and Zero-Merge LoRA V3 custom nodes for ComfyUI.

By Cyrostar·Created a day ago·Updated a day ago· 0
Cyrostar/ComfyUI-RayAttention
Nodes—
On cloudLocal install
Stars0
Updateda day ago
Readme

ComfyUI-RayAttention

ComfyUI V3 custom nodes for Ray Attention (ray_attn) — bringing Spatiotemporal 2-Tier Barnes-Hut Multipole Tensor-Core Attention, compressed GGUF DiT streaming (MXFP8 / FP8), and Zero-Merge BF16 LoRA side-branches to 2D Image and 3D Video Diffusion Transformers across NVIDIA Ampere (SM80), Ada (SM89), Hopper (SM90), and Blackwell (SM100a / SM120a) GPUs.


Included Nodes (Artha/Ray & Artha/Loaders)

| Node | Node ID | Category | Description | | :--- | :--- | :--- | :--- | | 🔱 Artha Ray Attention Override | ArthaRayAttentionOverride | Artha/Ray | Non-destructive optimized_attention_override routing 2D/3D DiT self-attention (D ∈ {64, 96, 128, 256}) through Ray Attention (Quality, Dense, Fast, Off presets + optional qk_fp8, pv_fp4, nvfp4). Works out of the box with all ComfyUI UNet, LoRA, ControlNet, FP8, ConvRot, Audio-Video (LTX-2.5), and GGUF pipelines. | | 🔱 Artha Ray Attention Fused DiT | ArthaRayAttentionFusedDiT | Artha/Ray | Full sub-block fused Ray Attention installer (QKNorm + 2D/3D RoPE + Gate + Stage-C FP8 -> to_out + empirical Jacobian dense_blocks) across FLUX.1 / FLUX.2 [klein], Krea 2, SD 3.5, Z-Image, Qwen-Image / 2.1, MOSS-Image, Wan 2.1 / 2.2, LTX-2.5, HunyuanVideo 1.0 / 1.5, CogVideoX, and MiniMax-H3. | | 🔱 Artha Ray Release Workspace | ArthaRayReleaseWorkspace | Artha/Ray | Pass-through any -> any utility node that frees static Ray Attention C++ CUDA workspace buffers and soft-clears ComfyUI's VRAM cache between stages. | | 🔱 Artha Ray Quantized GGUF Loader | ArthaRayQuantizedGGUFLoader | Artha/Loaders | Streams .gguf DiT checkpoints (models/unet_gguf/*.gguf) directly into compressed VRAM (RayGGUFLinear: Blackwell SM120a MXFP8 / SM89+ FP8 Tensor-Core GEMMs + optional Ray Attention) with zero BF16 load-time expansion and configurable VRAM streaming budget. | | 🔱 Artha Ray LoRA Attach | ArthaRayLoRAAttach | Artha/Loaders | Attaches, stacks, or detaches zero-merge BF16 LoRA side-branches (0 B detach residue, zero weight requantization loss) onto RayGGUFLinear, RayConvRotLinear, RayFP8Linear, and nn.Linear diffusion models. |


Requirements

  • GPU: NVIDIA Ampere (SM80/SM86, A100 / RTX 30-series), Ada Lovelace (SM89, RTX 40-series), Hopper (SM90, H100), or Blackwell (SM100a B200/B300 & SM120a RTX 50-series)
  • Software: ComfyUI with Python >= 3.10 and CUDA-enabled PyTorch

Installation

Method 1: ComfyUI Manager (Recommended)

Search for ComfyUI-RayAttention in ComfyUI Manager and click Install. ComfyUI Manager automatically runs install.py to fetch the matching pre-compiled cp310-abi3 ray-attn CUDA wheel from RayAttention Releases.

Method 2: ComfyUI Windows Portable

Run from your ComfyUI_windows_portable root folder:

git -C ComfyUI\custom_nodes clone https://github.com/Cyrostar/ComfyUI-RayAttention.git
python_embeded\python.exe ComfyUI\custom_nodes\ComfyUI-RayAttention\install.py

Method 3: Manual Clone (Standard / Virtual Environment)

cd ComfyUI/custom_nodes
git clone https://github.com/Cyrostar/ComfyUI-RayAttention.git
python ComfyUI-RayAttention/install.py

Note: install.py inspects your installed torch.__version__, torch.version.cuda, and OS (linux_x86_64 / win_amd64) and installs the matching PEP-384 Stable-ABI (cp310-abi3) wheel with --no-deps so your existing ComfyUI PyTorch CUDA build is never overwritten. If no pre-built wheel matches your custom PyTorch/CUDA combination, it falls back to building from Cyrostar/RayAttention source.


Quick Usage Guide

  1. Drop-In Override (Recommended for Any Workflow): Insert 🔱 Artha Ray Attention Override right after your Load Diffusion Model (UNETLoader), Load Checkpoint, or LoraLoaderModelOnly node and connect its model output to KSampler / SamplerCustomAdvanced:

    • Quality (Default): Dense warmup at high noise (sigma >= 0.94) and low token counts (S <= 4608), switching to 2-Tier Barnes-Hut Multipole Tensor-Core attention on high-resolution / multi-second video latents.
    • Dense: Exact 100% dense Tensor-Core attention through Ray Attention's INT8 / WHT-FP8 / NVFP4 kernels.
    • Fast: Tighter multipole margin (sem_margin = 1.25) for maximum throughput on 4K images and long 720p/1080p video sequences.
    • qk_fp8 / pv_fp4 / nvfp4: Optional SM89+ WHT-FP8 QK and Blackwell SM120a NVFP4 (OMMA.SF.16864) inner-loop acceleration.
  2. Compressed .gguf DiT Loading: Place .gguf diffusion checkpoints in ComfyUI/models/diffusion_models/ (or ComfyUI/models/unet_gguf/) and load them with 🔱 Artha Ray Quantized GGUF Loader. Optionally chain 🔱 Artha Ray LoRA Attach to apply or swap LoRAs without dequantizing or modifying quantized weights.

  3. Example Workflow: Open workflows/RAY LTX 2.5 T2V.json in ComfyUI for a ready-to-run side-by-side LTX-2.5 22B Text-to-Video + Audio A/B benchmark comparing stock ComfyUI attention against 🔱 Artha Ray Attention using shared VRAM weights and bit-identical seeds.


License

MIT License — see LICENSE.