Skip to content

[fp8 blockwise] load 2d chunks for groupwise quant to enable coalesced gmem accesses #2827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: danielvegamyhre/stack/45
Choose a base branch
from

Conversation

danielvegamyhre
Copy link
Contributor

@danielvegamyhre danielvegamyhre commented Aug 21, 2025

Stacked PRs:


[fp8 blockwise] load 2d chunks for groupwise quant to enable coalesced gmem accesses

NCU flagged uncoalesced gmem accesses when loading input tensor data. I was loading in skinny tiles of size (1 x blocksize) or (blocksize x 1), which can cause uncoalesced loads and stores depending on the underlying memory layout.

By loading 2d chunks of (num_groups, blocksize) or (blocksize, num_groups) we can enable the uncoalesced loads to be grouped into several coalesced loads.

This results in a 20-33% speedup.

Kernel performance

Individual linear fwd + bwd

bf16: 7690 us
Screenshot 2025-08-20 at 7 05 14 PM

fp8 blockwise: 6302 us (22% speedup)
Screenshot 2025-08-20 at 7 05 19 PM

E2E training performance

Eager llama3 8b with FDSP=4 on H100s

  • bf16: ~6080 TPS
  • fp8 blockwise: ~6170 TPS

Copy link

pytorch-bot bot commented Aug 21, 2025

🔗 Helpful Links

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

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

✅ You can merge normally! (3 Unrelated Failures)

As of commit ba52b69 with merge base 253d65a (image):

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.

@danielvegamyhre danielvegamyhre force-pushed the danielvegamyhre/stack/46 branch from 8e32c2e to e9c558c Compare August 21, 2025 00:24
danielvegamyhre added a commit that referenced this pull request Aug 21, 2025
…d gmem accesses

stack-info: PR: #2827, branch: danielvegamyhre/stack/46
@danielvegamyhre danielvegamyhre force-pushed the danielvegamyhre/stack/45 branch from f2f5e62 to 2f44322 Compare August 21, 2025 00:24
@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 Aug 21, 2025
@danielvegamyhre danielvegamyhre added the topic: not user facing Use this tag if you don't want this PR to show up in release notes label Aug 21, 2025
@danielvegamyhre danielvegamyhre changed the base branch from danielvegamyhre/stack/45 to main August 21, 2025 00:51
danielvegamyhre added a commit that referenced this pull request Aug 21, 2025
…d gmem accesses

stack-info: PR: #2827, branch: danielvegamyhre/stack/46
@danielvegamyhre danielvegamyhre force-pushed the danielvegamyhre/stack/46 branch from e9c558c to c77a12e Compare August 21, 2025 00:51
@danielvegamyhre danielvegamyhre changed the base branch from main to danielvegamyhre/stack/45 August 21, 2025 00:51
@danielvegamyhre danielvegamyhre changed the base branch from danielvegamyhre/stack/45 to main August 21, 2025 01:37
@danielvegamyhre danielvegamyhre changed the base branch from main to danielvegamyhre/stack/45 August 21, 2025 01:37
@danielvegamyhre danielvegamyhre changed the base branch from danielvegamyhre/stack/45 to main August 21, 2025 05:34
@danielvegamyhre danielvegamyhre changed the base branch from main to danielvegamyhre/stack/45 August 21, 2025 05:34
…d gmem accesses

stack-info: PR: #2827, branch: danielvegamyhre/stack/46
@danielvegamyhre danielvegamyhre changed the base branch from danielvegamyhre/stack/45 to main August 22, 2025 21:34
@danielvegamyhre danielvegamyhre force-pushed the danielvegamyhre/stack/46 branch from c77a12e to ba52b69 Compare August 22, 2025 21:34
@danielvegamyhre danielvegamyhre changed the base branch from main to danielvegamyhre/stack/45 August 22, 2025 21:34
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: not user facing Use this tag if you don't want this PR to show up in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant