Skip to content

[Quantization] Consolidate MXFP8 Linear and GroupedExperts converters - #3473

Merged
yichuan-w merged 1 commit into
pytorch:mainfrom
yichuan-w:yichuan/consolidate-mxfp8-converters
Jun 1, 2026
Merged

yichuan-w merged 1 commit into
pytorch:mainfrom
yichuan-w:yichuan/consolidate-mxfp8-converters

Conversation

@yichuan-w

Copy link
Copy Markdown
Member

Migrate MXFP8Linear to use torchao's native MXFP8Linear (pytorch/ao#4374) instead of Linear + quantize_(), following the same pattern as Float8Linear.

Merge MXFP8LinearConverter and MXFP8GroupedExpertsConverter into a single MXFP8Converter that handles both Linear and GroupedExperts in one pass. For dense models (no GroupedExperts), the MoE traversal is a no-op.

Fixes #3219

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 1, 2026
@yichuan-w
yichuan-w marked this pull request as draft June 1, 2026 04:05
@yichuan-w
yichuan-w force-pushed the yichuan/consolidate-mxfp8-converters branch from 0d5509a to fb4e87c Compare June 1, 2026 04:18
@yichuan-w
yichuan-w marked this pull request as ready for review June 1, 2026 04:34
@yichuan-w
yichuan-w force-pushed the yichuan/consolidate-mxfp8-converters branch from fb4e87c to dbf0ef9 Compare June 1, 2026 04:42

class MXFP8GroupedExpertsConverter(QuantizationConverter):
"""Apply MXFP8 quantization to MoE expert grouped GEMMs."""
class MXFP8Converter(QuantizationConverter):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why converting both in one converter class? This will couple linear and grouped experts, both converted or both not converted.

For now I think we can follow https://github.com/pytorch/torchtitan/blob/main/torchtitan/components/quantization/float8.py

@tianyu-l
tianyu-l requested a review from danielvegamyhre June 1, 2026 05:34
@yichuan-w
yichuan-w force-pushed the yichuan/consolidate-mxfp8-converters branch from dbf0ef9 to 6db1807 Compare June 1, 2026 05:56

@tianyu-l tianyu-l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to fix linting

self.config = config

if find_spec("torchao") is None:
if MXFP8Linear is None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert?

field compatibility.
"""

_recipe_name: str = "mxfp8_rceil"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielvegamyhre
Does it look OK that recipe is removed from config with MXFP8Linear?

@yichuan-w
yichuan-w force-pushed the yichuan/consolidate-mxfp8-converters branch from 6db1807 to 203ccf2 Compare June 1, 2026 07:33
Migrate MXFP8Linear to use torchao's native MXFP8Linear (pytorch/ao#4374)
instead of Linear + quantize_(), following the same pattern as Float8Linear.

Also fix has_quantization() to handle MXFP8Linear being None when torchao
is not installed, and change assert to ValueError for SM100 capability check.

Fixes pytorch/torchtitan#3219
@yichuan-w
yichuan-w force-pushed the yichuan/consolidate-mxfp8-converters branch from 203ccf2 to 6363521 Compare June 1, 2026 07:35
@yichuan-w
yichuan-w merged commit 3c4d470 into pytorch:main Jun 1, 2026
15 of 18 checks passed
saforem2 added a commit to saforem2/torchtitan that referenced this pull request Jun 2, 2026
…orch#3436 thread

Merged 7 upstream commits (b72d986..04a3098). Headline is PR
pytorch#3450 — the upstream-canonical fix for the histc->scatter swap
that our PR pytorch#3436 was tracking. Approach: build boolean
routing_map_BLE via scatter_ in router, compute
num_tokens_per_expert via routing_map.sum, thread the map through
to dispatcher. Same scatter direction we recommended, done better
(computed once, reused).

API change at the boundary: router returns 4-tuple; dispatch()
takes new num_local_tokens_per_expert_E positional arg. ezpz
doesn't override these methods or unpack router output directly,
inherits cleanly. set_moe_sharding_config call into upstream's
helper picks up the new shard declaration automatically. No
ezpz replay needed.

Other 6 commits: HybridEP compile (pytorch#3360), MXFP8 consolidation
(pytorch#3473), graph_trainer DTensor fix (pytorch#3480), graph_trainer test
skips (pytorch#3432), two CI migrations (pytorch#3464, pytorch#3479). None touch ezpz.

Live 2N smoke deferred to Aurora: the project .venv/bin/python
symlinks at an Aurora-only Spack hash (python-3.12.12-5zo3wzv)
that Sunspot doesn't have (Sunspot equivalent is the nvje3vk
hash). Smoke per the journal's "always smoke after GroupedExperts
touches" lesson should run on Aurora.

Also: updated ~/.ezpz/utils.sh from bit.ly canonical (now exposes
unified ezpz_setup; backup at utils.sh-20260602-065437).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/8gpu CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Quantization] Re-consolidate MXFP8 and FP8 linear converters

2 participants