Skip to content

[ROCm] Fix BlockwiseQuantLinear FP8 dtype handling for AMD GPUs#4136

Open
brucechanglongxu wants to merge 1 commit intopytorch:mainfrom
brucechanglongxu:rocm-blockwise-inference-dtype
Open

[ROCm] Fix BlockwiseQuantLinear FP8 dtype handling for AMD GPUs#4136
brucechanglongxu wants to merge 1 commit intopytorch:mainfrom
brucechanglongxu:rocm-blockwise-inference-dtype

Conversation

@brucechanglongxu
Copy link
Contributor

@brucechanglongxu brucechanglongxu commented Mar 22, 2026

BlockwiseQuantLinear doesn't work on MI300 — the dtype whitelist rejects fnuz variants, the default is hardcoded to e4m3fn, and there's a bug where self.dtype reads the class attribute (bfloat16) instead of storing the constructor arg, so the forward pass would always blow up in fp8_blockwise_act_quant.

Fixed by adding fnuz dtypes to the accepted set, defaulting to e4m3_dtype from config (picks the right variant per hardware), and storing the dtype properly as self.fp8_dtype.

Tested on MI300X — all four FP8 dtype variants construct fine, invalid dtypes get rejected, forward pass works.

@pytorch-bot
Copy link

pytorch-bot bot commented Mar 22, 2026

🔗 Helpful Links

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

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

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 Mar 22, 2026
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. topic: rocm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant