Liger-Kernel
Liger-Kernel copied to clipboard
LigerDyT forward fails at launch above 65535 rows
LigerDyT raises Triton Error [CUDA]: invalid argument once the input has more than 65535 rows (batch × sequence length). A batch of 128 sequences of 1024 tokens is 131072 rows.
import torch
from liger_kernel.transformers.dyt import LigerDyT
m = LigerDyT(hidden_size=8).cuda()
print(m(torch.randn(65535, 8).cuda()).shape)
print(m(torch.randn(65536, 8).cuda()).shape)
torch.Size([65535, 8])
RuntimeError: Triton Error [CUDA]: invalid argument
liger_dyt_fwd in src/liger_kernel/ops/dyt.py launches with grid = lambda meta: (triton.cdiv(N, meta["BLOCK_N"]), M), so the row count M is on grid dimension 1. CUDA limits that dimension: on the B200 I ran this on, CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X/Y/Z are 2147483647, 65535 and 65535.
Run on main (e44de705) with an NVIDIA B200, torch 2.15.0a0, Triton 3.8.0 and CUDA 13.4. I have not run it on other GPUs.