[PyTorch] fp8_cs_quantize fake implementation returns a vector inverse scale instead of a scalar
Maintainer thường phản hồi trong vòng 2 ngày
@sanjana658 đang làm issue này rồi.
Từ ngày 8/10/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- machine-learning, testing
Hướng nghiên cứu
Đọc transformer_engine/pytorch/onnx_extensions.py ở phần onnx_cs_quantize_fp8_op và phần triển khai register_fake của nó. Thay đổi đầu ra inverse-scale fake để khớp với hình dạng vô hướng của đầu ra eager, sau đó chạy kiểm tra FakeTensor được đề xuất bằng torch.library.opcheck trong môi trường TE/CUDA tương thích; hoàn tất khi siêu dữ liệu đầu ra eager và fake khớp nhau.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 3.6k
- Fork
- 862
- Merge trung bình
- 4 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 57
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NVIDIA/TransformerEngine
-
[Bug] Backend selection picks FA3 for training with head_dim_qk=192 / v_head_dim=128, but FA3 backward cannot run itCó thể làm lại được @modelpath-dev đã nhận 45 ngày trước và không có pull request nào đang mở. Đang mởattention
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
NVIDIA/TransformerEngine#3481 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Increase MAX_TENSOR_NUMĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
NVIDIA/TransformerEngine#2189 · 7 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 69/100
NVIDIA/TransformerEngine#3711 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[BUG] Grouped MXFP8 activation kernels return all-zero output when tensor widths differ (CUDA 12.x builds)Có thể đã có người làm @ravimajeti đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
NVIDIA/TransformerEngine#3703 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
MXFP8 quantize_ writes out of bounds of compact unswizzled scale buffers when rows are not a multiple of 64Có thể đã có người làm @XFDG đã nhận hôm nay. Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
NVIDIA/TransformerEngine#3689 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của NVIDIA/TransformerEngine
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
eclipse-score/inc_someip_gateway#356 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[BUG]: `GitHubRestAdapter.check_user_permission` and `has_write_access` raise `TypeError` (missing `params`), silently disabling the inactivity lifecycleCó thể đã có người làm @tarunagnihotri534 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
AOSSIE-Org/Gitcord-GithubDiscordBot#167 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
mihai-vlc/sublime-jsfmt#56 ·
-
comp/cli comp/plugins P2 type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
NousResearch/hermes-agent#141917 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
riscv/riscv-opcodes#441 ·