Describe the bug
On Windows with an RTX 5090, enabling LTX2MemoryEfficientSageAttentionPatch for an LTX2 workflow crashes at the first sampling step with:
AttributeError: module 'sageattention._qattn_sm89' has no attribute 'qk_int8_sv_f8_accum_f32_fuse_v_scale_attn'
The workflow runs when this node is bypassed. Native ComfyUI --use-sage-attention is also present in my launch args and is not the failing path here. The failure only starts when LTX2MemoryEfficientSageAttentionPatch replaces the LTX2 attn1.forward calls.
Why this looks like a KJNodes compatibility issue
In nodes/ltxv_nodes.py, the sm120 branch calls private SageAttention extension module attributes:
_qattn_sm89.qk_int8_sv_f8_accum_f32_fuse_v_scale_attn(...)
On this install, those functions are not exposed as attributes on sageattention._qattn_sm89, but the corresponding kernels are available as registered PyTorch custom ops after importing sageattention.core:
torch.ops.sageattention_qattn_sm89.qk_int8_sv_f8_accum_f32_fuse_v_scale_attn
torch.ops.sageattention_qattn_sm89.qk_int8_sv_f8_accum_f32_fuse_v_scale_attn_inst_buf
torch.ops.sageattention_qattn_sm89.qk_int8_sv_f8_accum_f16_fuse_v_scale_attn_inst_buf
SageAttention itself is not generally broken on this machine. Both local smoke tests below succeed on the RTX 5090:
from sageattention import sageattn
from sageattention.core import sageattn_qk_int8_pv_fp8_cuda
o = sageattn(q, k, v, tensor_layout="NHD", is_causal=False)
o = sageattn_qk_int8_pv_fp8_cuda(
q, k, v,
tensor_layout="NHD",
is_causal=False,
qk_quant_gran="per_warp",
pv_accum_dtype="fp32+fp16",
)
Environment
OS: Windows
Python: 3.13.7
GPU: NVIDIA GeForce RTX 5090
CUDA capability: (12, 0), SageAttention reports sm120
torch: 2.9.1+cu130
torch CUDA: 13.0
sageattention: 2.2.0+cu130torch2.9.0.post3
triton-windows: 3.5.1.post24
comfyui-kjnodes: 1.4.7 from Comfy Registry
ComfyUI: recent master when tested
Reproduction
- Use an LTX2 / LTX2.3 workflow that includes
LTX2MemoryEfficientSageAttentionPatch.
- Enable the node.
- Queue the prompt on an RTX 5090 / sm120 system with the environment above.
- Sampling fails near step 0 with the
_qattn_sm89 missing attribute error.
In my workflow, the node is LTX2MemoryEfficientSageAttentionPatch, with triton_kernels=True. Turning triton_kernels off is unlikely to address this specific error because that widget controls fused RoPE/helper kernels around the LTX2 forward path, not the failing SageAttention attention op call.
Relevant stack trace excerpt
File "<ComfyUI>\custom_nodes\comfyui-kjnodes\nodes\ltxv_nodes.py", line 1863, in ltx2_sageattn_forward
o = _sageattn_int8_fp8_nhd(qkv, dtype)
File "<ComfyUI>\custom_nodes\comfyui-kjnodes\nodes\ltxv_nodes.py", line 1808, in _sageattn_int8_fp8_nhd
_qattn_sm89.qk_int8_sv_f8_accum_f32_fuse_v_scale_attn(...)
AttributeError: module 'sageattention._qattn_sm89' has no attribute 'qk_int8_sv_f8_accum_f32_fuse_v_scale_attn'
Local verification
The direct module attribute is absent:
import sageattention.core as c
hasattr(c._qattn_sm89, "qk_int8_sv_f8_accum_f32_fuse_v_scale_attn")
# False
The registered op is present:
import torch
import sageattention.core
hasattr(torch.ops.sageattention_qattn_sm89, "qk_int8_sv_f8_accum_f32_fuse_v_scale_attn")
# True
The public local SageAttention function path also works:
public_sageattn (1, 128, 8, 64) torch.float16 True
public_fp8_cuda (1, 128, 8, 64) torch.float16 True
Suggested fix
This is intentionally narrower than PR #518. I am not asking to replace the LTX2 low-memory implementation with only SageAttention's high-level local Python function, since that was rejected for losing the memory benefit of this node.
The narrow fix would be to keep the existing _sageattn_int8_fp8_nhd low-memory path, but call the registered local PyTorch custom ops when the direct _qattn_sm89 attributes are absent. For example, resolve the op from either:
_qattn_sm89.qk_int8_sv_f8_accum_f32_fuse_v_scale_attn
or:
torch.ops.sageattention_qattn_sm89.qk_int8_sv_f8_accum_f32_fuse_v_scale_attn
and update sageplus_sm89_available detection to check the same call surface. That should preserve the node's memory-conscious q/k/v lifetime behavior while supporting current Windows SageAttention wheels that register kernels via torch.ops.
Related items I found
Describe the bug
On Windows with an RTX 5090, enabling
LTX2MemoryEfficientSageAttentionPatchfor an LTX2 workflow crashes at the first sampling step with:The workflow runs when this node is bypassed. Native ComfyUI
--use-sage-attentionis also present in my launch args and is not the failing path here. The failure only starts whenLTX2MemoryEfficientSageAttentionPatchreplaces the LTX2attn1.forwardcalls.Why this looks like a KJNodes compatibility issue
In
nodes/ltxv_nodes.py, thesm120branch calls private SageAttention extension module attributes:On this install, those functions are not exposed as attributes on
sageattention._qattn_sm89, but the corresponding kernels are available as registered PyTorch custom ops after importingsageattention.core:SageAttention itself is not generally broken on this machine. Both local smoke tests below succeed on the RTX 5090:
Environment
Reproduction
LTX2MemoryEfficientSageAttentionPatch._qattn_sm89missing attribute error.In my workflow, the node is
LTX2MemoryEfficientSageAttentionPatch, withtriton_kernels=True. Turningtriton_kernelsoff is unlikely to address this specific error because that widget controls fused RoPE/helper kernels around the LTX2 forward path, not the failing SageAttention attention op call.Relevant stack trace excerpt
Local verification
The direct module attribute is absent:
The registered op is present:
The public local SageAttention function path also works:
Suggested fix
This is intentionally narrower than PR #518. I am not asking to replace the LTX2 low-memory implementation with only SageAttention's high-level local Python function, since that was rejected for losing the memory benefit of this node.
The narrow fix would be to keep the existing
_sageattn_int8_fp8_nhdlow-memory path, but call the registered local PyTorch custom ops when the direct_qattn_sm89attributes are absent. For example, resolve the op from either:or:
and update
sageplus_sm89_availabledetection to check the same call surface. That should preserve the node's memory-conscious q/k/v lifetime behavior while supporting current Windows SageAttention wheels that register kernels viatorch.ops.Related items I found
sm120/qk_quant_gran="per_warp"discussion, closed_qattn_sm89AttributeError