Skip to content

[mxfp8 moe training] register constant with pytree#3667

Merged
danielvegamyhre merged 1 commit into
mainfrom
pytree
Jan 21, 2026
Merged

[mxfp8 moe training] register constant with pytree#3667
danielvegamyhre merged 1 commit into
mainfrom
pytree

Conversation

@danielvegamyhre

Copy link
Copy Markdown
Contributor

After #3606 @torch._dynamo.nonstrict_trace was added to support autograd functions having different tensor subclasses for forward output and backward input.

The e2e integration tests for compile and eager passed and it was landed, but it turns out if you explicitly specify a scaling recipe instead of defaulting, it breaks with this error:

torch._dynamo.exc.Unsupported: Invalid input type for nonstrict_trace-ed function Explanation: For nonstrict_trace-ed functions, only basic types (e.g., torch.Tensor, int, float) or pytree containers of those are allowed as inputs. The provided argument contains an unsupported type. Hint: Use one of the following to register the type with pytree: * torch.utils._pytree.register_constant * torch.utils._pytree.register_dataclass * torch.utils._pytree.register_pytree_node

Basically we need to register the enum with pytree, which is done in this PR.

Tests

Added unit test cases which fail without this change.

  • pytest test/prototype/moe_training/test_scaled_grouped_mm.py -k dq

@pytorch-bot

pytorch-bot Bot commented Jan 21, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/3667

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures, 4 Unrelated Failures

As of commit 8a86e54 with merge base 3834780 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 21, 2026
@danielvegamyhre danielvegamyhre added mx topic: bug fix Use this tag for PRs that fix bugs moe labels Jan 21, 2026
@danielvegamyhre

Copy link
Copy Markdown
Contributor Author

test failures unrelated, landing

@danielvegamyhre danielvegamyhre merged commit 3350b2f into main Jan 21, 2026
17 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. moe mx topic: bug fix Use this tag for PRs that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants