[PyTorch] fp8_cs_quantize fake implementation returns a vector inverse scale instead of a scalar
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 82/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- machine-learning, testing
Línea de trabajo
Lee transformer_engine/pytorch/onnx_extensions.py en torno a onnx_cs_quantize_fp8_op y su implementación de register_fake. Cambia la salida de la escala inversa fake para que coincida con la forma escalar de la salida eager y, después, ejecuta la comprobación FakeTensor propuesta con torch.library.opcheck en un entorno TE/CUDA compatible; se considera terminado cuando coincidan los metadatos de las salidas eager y fake.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
At current main 9d4bd38678f29a29dc0989e3a679dc14f3538e6a, onnx_cs_quantize_fp8_op computes amax = tensor.abs().max() without a dimension, then scale_inv = 1 / scale. This produces a zero-dimensional float32 tensor. Its register_fake implementation instead returns torch.ones(1, ...) for that output, describing a one-dimensional tensor.
This violates the custom operator's eager/FakeTensor metadata contract. PyTorch's torch.library.opcheck(..., test_utils=("test_faketensor",)) reports:
found mismatched tensor metadata for output[1]:
Shapes torch.Size([]) and torch.Size([1]) are not equal!
Narrow reproduction and limitation
I isolated the exact upstream current-scaling function and its fake registration on Linux with PyTorch 2.11.0+cu130, CUDA hidden. I replaced only the lower tex::fp8_quantize operation with a CPU uint8 shape producer. The separately computed inverse scale does not depend on that producer's output. Across FP32/FP16/BF16 inputs with shapes (4,), (2, 3), and (2, 3, 4), all nine original metadata checks fail with the mismatch above.
Changing only the fake inverse-scale allocation to torch.ones((), dtype=torch.float32, device=tensor.device) makes all nine isolated metadata checks pass. This is a shape-contract reproduction, not a test of native TE FP8 kernels, numerical quantization, ONNX Runtime, or TensorRT export.
Suggested fix and native follow-up
Return a scalar inverse scale in the fake implementation:
return torch.empty(tensor.shape, dtype=torch.uint8, device=tensor.device), torch.ones(
(), dtype=torch.float32, device=tensor.device
)
On a compatible installed TE/CUDA environment, a focused regression can compare eager and FakeTensor metadata using:
import torch
import transformer_engine.pytorch.onnx_extensions
x = torch.randn(16, 16, device="cuda", dtype=torch.float32)
torch.library.opcheck(torch.ops.tex.fp8_cs_quantize.default, (x,),
test_utils=("test_faketensor",))
The native follow-up command above is proposed, not executed in my isolated reproduction.
- Lenguaje dominante
- Python
- Estrellas
- 3.6k
- Forks
- 844
- Merge medio
- 4 d 55 min
- PR fusionados (30 d)
- 51
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de NVIDIA/TransformerEngine
-
[Bug] Backend selection picks FA3 for training with head_dim_qk=192 / v_head_dim=128, but FA3 backward cannot run itPosiblemente ocupada @yuweih205 la tomó hace 30 días. Abiertoattention
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
NVIDIA/TransformerEngine#3481 · 4 comentarios ·
Los mantenedores suelen responder en 2 días
-
Increase MAX_TENSOR_NUMAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
NVIDIA/TransformerEngine#2189 · 7 comentarios · 5 reacciones ·
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 54/100
NVIDIA/TransformerEngine#3640 · 5 comentarios ·
Los mantenedores suelen responder en 2 días
-
[BUG] Grouped MXFP8 quantization is not concurrency safe with multiple streamsPosiblemente ocupada @kainzhong la tomó hace 1 día. Abiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
NVIDIA/TransformerEngine#3630 ·
Los mantenedores suelen responder en 2 días
-
[bug] NVFP4 + `torch.compile`: errors with 3D inputPosiblemente ocupada @pggPL la tomó hace 2 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
NVIDIA/TransformerEngine#3626 ·
Los mantenedores suelen responder en 2 días
Todos los issues de NVIDIA/TransformerEngine
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
Vector35/community-plugins#376 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
py-econometrics/pyfixest#1883 ·
Los mantenedores suelen responder en 1 día
-
bad links in rfc5890.htmlAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
ietf-tools/rfc2html#81 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
mysql/mysql-operator#60 ·
-
Python: Bug: split_plaintext_paragraph / split_markdown_paragraph can return a chunk larger than max_tokensPosiblemente ocupada @xThreeh la tomó hoy. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
microsoft/semantic-kernel#14566 ·
Los mantenedores suelen responder en 4 días