Skip to content

[dtype] Map FP8 to torch.float8_e4m3fn on RDNA3 - #4764

Merged
valarLip merged 2 commits into
ROCm:mainfrom
amd-xavierwang:gfx11-fp8-dtype
Aug 15, 2026
Merged

[dtype] Map FP8 to torch.float8_e4m3fn on RDNA3#4764
valarLip merged 2 commits into
ROCm:mainfrom
amd-xavierwang:gfx11-fp8-dtype

Conversation

@skysnow2001

Copy link
Copy Markdown
Contributor

Summary

Add gfx1100, gfx1101, gfx1102, and gfx1151 to AITER's FP8 dtype map with torch.float8_e4m3fn.

Without these entries, AITER falls back to torch.uint8. FP8 tensors produced by vLLM are then interpreted as byte tensors, which can produce invalid mixed FP8/uint8 operands in Triton kernels such as the DeepSeek-V4 paged MQA-logits path.

This follows the same dtype-map change made for gfx1200/gfx1201 in #3332.

Test

Tested on gfx1100 and gfx1151.

Test Command Result
Direct FP8 tgemm check Command below PASS — 3/3 shapes; worst max absolute difference 0.03125 on gfx1100 and 0.25 on gfx1151 with threshold 5.0
Triton contiguous FP8 MQA logits pytest -q op_tests/triton_tests/attention/test_fp8_mqa_logits.py PASS144 passed
Triton fused FP8 quant pytest -q op_tests/triton_tests/quant/test_fused_fp8_quant.py PASS393 passed
Triton fused RMS-gated FP8 group quant pytest -q op_tests/triton_tests/quant/test_fused_rms_gated_fp8_group_quant.py PASS121 passed

It passed these shapes:

4x64x128       max_abs_diff=0
16x4096x4096   max_abs_diff=0
128x1536x4096 max_abs_diff=0.03125
python3 - <<'PY'
import torch
import torch.nn.functional as F

from aiter import dtypes
from aiter.tuned_gemm import tgemm

assert dtypes.fp8 == torch.float8_e4m3fn
torch.manual_seed(0)
one = torch.ones(1, device="cuda", dtype=torch.float32)

for m, n, k in ((4, 64, 128), (16, 4096, 4096), (128, 1536, 4096)):
    x = torch.randn(m, k, device="cuda", dtype=torch.bfloat16).to(dtypes.fp8)
    w = torch.randn(n, k, device="cuda", dtype=torch.bfloat16).to(dtypes.fp8)
    ref = F.linear(x.to(torch.bfloat16), w.to(torch.bfloat16)).float()
    out = tgemm.mm(
        x, w, otype=torch.bfloat16, scale_a=one, scale_b=one
    ).float()
    max_abs_diff = (out - ref).abs().max().item()
    print(f"{m}x{n}x{k}: max_abs_diff={max_abs_diff}")
    assert max_abs_diff <= 5.0
PY

Submission Checklist

Signed-off-by: skysnow2001 <skysnow9285@gmail.com>
@skysnow2001
skysnow2001 requested a review from a team August 14, 2026 16:21
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 4764 --add-label <label>

@valarLip
valarLip merged commit 56bb5b8 into ROCm:main Aug 15, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants