[Bug]: torch.ops.trtllm.flashinfer_silu_and_mul / flashinfer_gelu_tanh_and_mul: wrong values on strided slices

Abierto
#22,992 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@sylvesterkaczmarek ya está trabajando en esto.

Desde el 28/11/2026.

  • #23015 de @sylvesterkaczmarek — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
66/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python, pytorch

Línea de trabajo

Start at the torch.ops.trtllm registrations for flashinfer_silu_and_mul and flashinfer_gelu_tanh_and_mul, then trace how they call the FlashInfer gated activation kernel. Reproduce with the provided strided slice and compare against x.contiguous() on CUDA. Done when both operators either return matching values for strided inputs or reject them explicitly before launch; add regression coverage for both dtypes and operators.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Customized kernels
System Info
  • TensorRT-LLM: 1.3.0 (torch.ops.trtllm, upstream main checked @ 546c48139181)
  • GPU: NVIDIA H100 PCIe (80GB, SM90)
  • PyTorch / CUDA: 2.14.0+cu130 / CUDA 13.0 (driver 580.178.04)
  • OS / Python: Ubuntu 24.04 x86_64, Python 3.12
Reproduction
import torch
import tensorrt_llm  # registers torch.ops.trtllm

torch.manual_seed(0)
for fn in (torch.ops.trtllm.flashinfer_silu_and_mul, torch.ops.trtllm.flashinfer_gelu_tanh_and_mul):
    base = torch.full((4, 160), 77.0, device="cuda", dtype=torch.bfloat16)
    x = base[:, :128]
    x.copy_(torch.randn(4, 128, device="cuda", dtype=torch.bfloat16))
    y_strided = fn(x)
    y_contig = fn(x.contiguous())
    torch.cuda.synchronize()
    print(fn, "max_abs_diff:", (y_strided.float() - y_contig.float()).abs().max().item())
Expected behavior

Either honor x.stride(0) inside the activation wrapper/kernel or reject non-contiguous inputs with an explicit TORCH_CHECK(x.is_contiguous()) before kernel launch so y_strided never silently diverges from y_contig.

actual behavior

Both torch.ops.trtllm.flashinfer_silu_and_mul and torch.ops.trtllm.flashinfer_gelu_tanh_and_mul accept non-contiguous column-strided float16/bfloat16 slices (base[:, :128]) without error, read out-of-slice padding (77.0) into rows >= 1, and silently return wrong values on H100 SM90 (flashinfer_silu_and_mul: max_abs_diff = 154.531 in bfloat16, 203.658 in float16; flashinfer_gelu_tanh_and_mul: max_abs_diff = 149.875 in bfloat16, 172.184 in float16).

additional notes

The underlying FlashInfer gated activation kernel assumes packed row stride 2 * d from x.data_ptr() without checking x.is_contiguous(). Adding x = x.contiguous() or TORCH_CHECK(x.is_contiguous()) at the torch.ops.trtllm registration boundary prevents silent output corruption.

Before submitting a new issue...
  • Make sure you already searched for relevant issues, and checked the documentation and examples for answers to frequently asked questions.

Credit given to UCSB PLSE.

Lenguaje dominante
Python
Estrellas
15.2k
Forks
3k
Merge medio
2 d 21 h
PR fusionados (30 d)
477

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de NVIDIA/TensorRT-LLM

Todos los issues de NVIDIA/TensorRT-LLM

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.