Skip to content

Prototype NVFP4 with FP8 UE5M3 block scales - #3325

Open
timmoon10 wants to merge 27 commits into
NVIDIA:mainfrom
timmoon10:nvfp4-ue5m3-prototype
Open

Prototype NVFP4 with FP8 UE5M3 block scales#3325
timmoon10 wants to merge 27 commits into
NVIDIA:mainfrom
timmoon10:nvfp4-ue5m3-prototype

Conversation

@timmoon10

@timmoon10 timmoon10 commented Aug 7, 2026

Copy link
Copy Markdown
Member

Description

This is a proof-of-concept for NVFP4 with FP8 UE5M3 block scales. Quantization is supported natively and GEMMs go through the cuDNN Frontend kernels (see NVIDIA/cudnn-frontend#545).

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

  • Support NVFP4 tensors with UE5M3 scales
  • Support UE5M3 scales in NVFP4 quantize/dequantize kernels
  • Support UE5M3 scales in NVFP4 quantizers

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Co-authored-by: Teddy Do <tdophung@nvidia.com>
Co-authored-by: Varun Thumbe <vthumbe@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
@timmoon10 timmoon10 added the enhancement New feature or request label Aug 7, 2026
@timmoon10

This comment was marked as outdated.

* [PyTorch] Enable e5m3 fused GEMM kernels from cuDNN

Signed-off-by: Kaining Zhong <kainingz@nvidia.com>

* have to pad to 256 to use cuDNN

Signed-off-by: Kaining Zhong <kainingz@nvidia.com>

* fix: need to pass scale_dtype

Signed-off-by: Kaining Zhong <kainingz@nvidia.com>

* route wgrad to cuDNN's wgrad API

Signed-off-by: Kaining Zhong <kainingz@nvidia.com>

* Support grouped linear with NVFP4-UE5M3

NVFP4-UE5M3 grouped GEMM falls back to dense GEMMs. Generalize usage of wgrad kernel and use when tensors sizes are not 256-aligned. Fix inconsistent m,n,k GEMM notation. Remove ue5m3 hacks in op fuser tests. Add ue5m3 to grouped MLP tests.

Signed-off-by: Tim Moon <tmoon@nvidia.com>

* Fix typos

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>

---------

Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Co-authored-by: Tim Moon <tmoon@nvidia.com>
Co-authored-by: Codex <noreply@openai.com>
Comment thread transformer_engine/pytorch/cpp_extensions/gemm.py Outdated
Comment thread transformer_engine/common/include/transformer_engine/recipe.h
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
@timmoon10
timmoon10 force-pushed the nvfp4-ue5m3-prototype branch from 0987860 to ab3a9b3 Compare August 14, 2026 12:09
Comment thread transformer_engine/pytorch/cpp_extensions/gemm.py Outdated
timmoon10 and others added 5 commits August 14, 2026 12:44
@timmoon10
timmoon10 marked this pull request as ready for review August 17, 2026 21:35
@greptile-apps

greptile-apps Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR prototypes NVFP4 quantization with FP8 UE5M3 block scales across the CUDA core, PyTorch bindings, quantized tensor metadata, GEMM paths, and grouped-MLP integration.

  • Adds UE5M3 scale-type propagation through NVFP4 recipes, quantizers, storage, and kernels.
  • Updates GEMM and grouped-GEMM paths to interpret UE5M3 scale buffers correctly.
  • Extends C++ and PyTorch coverage for quantization, dequantization, GEMM, grouped quantization, and fused operations.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains from the previously reported issues.

No blocking failure remains.

Important Files Changed

Filename Overview
transformer_engine/pytorch/ops/fused/grouped_mlp.py Propagates UE5M3 scale metadata through grouped-MLP kernels and completes the previously reported fallback and single-group NVFP4 reconstruction fixes.
transformer_engine/pytorch/tensor/nvfp4_tensor.py Extends NVFP4 tensor and quantizer metadata to represent the block-scale dtype.
transformer_engine/pytorch/tensor/storage/nvfp4_tensor_storage.py Stores and preserves NVFP4 scale dtype alongside packed data, scales, and amax metadata.
transformer_engine/pytorch/cpp_extensions/gemm.py Routes UE5M3-scaled NVFP4 operands through the corresponding GEMM handling.
transformer_engine/common/cast/nvfp4/core_nvfp4.cuh Generalizes core NVFP4 scale operations to support UE5M3 in addition to E4M3.

Reviews (13): Last reviewed commit: "[pre-commit.ci] auto fixes from pre-comm..." | Re-trigger Greptile

Comment thread transformer_engine/pytorch/ops/fused/grouped_mlp.py
Signed-off-by: Tim Moon <tmoon@nvidia.com>
@timmoon10

This comment was marked as outdated.

Comment thread transformer_engine/common/include/transformer_engine/recipe.h Outdated
@timmoon10

This comment was marked as outdated.

@tdophung
tdophung force-pushed the nvfp4-ue5m3-prototype branch from 0ad7060 to cbae89d Compare August 20, 2026 18:10
Comment thread transformer_engine/pytorch/ops/fused/grouped_mlp.py
@tdophung

This comment was marked as outdated.

1 similar comment
@timmoon10

Copy link
Copy Markdown
Member Author

/te-ci L1

tdophung and others added 12 commits August 21, 2026 02:55
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
@timmoon10
timmoon10 force-pushed the nvfp4-ue5m3-prototype branch from ef16e25 to 26db2ee Compare August 21, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.19 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants