DeepSpeed
DeepSpeed copied to clipboard
Inference layer_norm / rms_norm kill the process (SIGFPE) on an empty batch
launch_fused_ln, launch_fused_residual_ln, launch_fused_residual_ln_store_pre_ln_res (layer_norm.cu) and launch_rms_norm (rms_norm.cu) set groups_per_block = min(rows, max) and then divide by it. With rows == 0 this is an integer divide by zero on the host, so the Python process dies with "Floating point exception" and never gets an exception it could catch.
import torch
from deepspeed.ops.transformer.inference.op_binding.layer_norm import LayerNormOp
x = torch.empty(0, 128, 1024, dtype=torch.half, device="cuda")
g = torch.ones(1024, dtype=torch.half, device="cuda")
b = torch.zeros(1024, dtype=torch.half, device="cuda")
LayerNormOp()(x, g, b, 1e-5)
Floating point exception (core dumped) # exit code 136
RMSNormOp crashes the same way. Seen on master a77aeb6, RTX 2000 Ada (sm_89), CUDA 13.2, torch 2.13.