Skip to content

Add Preshuffled FP8 x INT4 Grouped Gemm Kernel #3800

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

Closed
wants to merge 3 commits into from

Conversation

jwfromm
Copy link
Contributor

@jwfromm jwfromm commented Mar 11, 2025

Summary: Working on adding support for stacked mixed dtype grouped gemm with preshuffling.

Differential Revision: D70870933

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70870933

Copy link

netlify bot commented Mar 11, 2025

Deploy Preview for pytorch-fbgemm-docs ready!

Name Link
🔨 Latest commit 46acfbc
🔍 Latest deploy log https://app.netlify.com/sites/pytorch-fbgemm-docs/deploys/67d48d40fe71510008d0e03f
😎 Deploy Preview https://deploy-preview-3800--pytorch-fbgemm-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

jwfromm added a commit to jwfromm/FBGEMM that referenced this pull request Mar 13, 2025
Summary:

Working on adding support for stacked mixed dtype grouped gemm with preshuffling.

Differential Revision: D70870933
jwfromm added a commit to jwfromm/FBGEMM that referenced this pull request Mar 13, 2025
Summary:
Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Differential Revision: D70870933
jwfromm added a commit to jwfromm/FBGEMM that referenced this pull request Mar 13, 2025
Summary:

Working on adding support for stacked mixed dtype grouped gemm with preshuffling.

Differential Revision: D70870933
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70870933

jwfromm added a commit to jwfromm/FBGEMM that referenced this pull request Mar 13, 2025
Summary:
X-link: facebookresearch/FBGEMM#897

Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Differential Revision: D70870933
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70870933

jwfromm added a commit to jwfromm/FBGEMM that referenced this pull request Mar 13, 2025
Summary:
X-link: facebookresearch/FBGEMM#897

Pull Request resolved: pytorch#3800
Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Differential Revision: D70870933
jwfromm added a commit to jwfromm/FBGEMM that referenced this pull request Mar 13, 2025
Summary:
X-link: facebookresearch/FBGEMM#897

Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Differential Revision: D70870933
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70870933

jwfromm added a commit to jwfromm/FBGEMM that referenced this pull request Mar 13, 2025
Summary:
X-link: facebookresearch/FBGEMM#897

Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Differential Revision: D70870933
jwfromm added a commit to jwfromm/FBGEMM that referenced this pull request Mar 13, 2025
Summary:
X-link: facebookresearch/FBGEMM#897

Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Differential Revision: D70870933
jwfromm added a commit to jwfromm/FBGEMM that referenced this pull request Mar 13, 2025
Summary:
X-link: facebookresearch/FBGEMM#897

Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Differential Revision: D70870933
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70870933

jwfromm added a commit to jwfromm/FBGEMM that referenced this pull request Mar 13, 2025
Summary:
X-link: facebookresearch/FBGEMM#897

Pull Request resolved: pytorch#3800
Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Differential Revision: D70870933
jwfromm pushed a commit to jwfromm/FBGEMM that referenced this pull request Mar 13, 2025
Summary:
Pull Request resolved: pytorch#3800

Working on adding support for stacked mixed dtype grouped gemm with preshuffling.

Differential Revision: D70870933
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70870933

jwfromm added a commit to jwfromm/FBGEMM that referenced this pull request Mar 13, 2025
Summary:
X-link: facebookresearch/FBGEMM#897

Pull Request resolved: pytorch#3800
Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Differential Revision: D70870933
Summary:
X-link: facebookresearch/FBGEMM#847

Pull Request resolved: pytorch#3766

One of the new interesting changes in the preshuffled F8I4 kernel is that group scales are downcast to FP8. This has the risk of running into dynamic range issues and impacting accuracy. We can mitigate this risk by adding FP32 columnwise scaling to the output. Fortunately, we can do this using EVT so the performance impact is negligible.

Differential Revision: D70587477
Summary:
X-link: facebookresearch/FBGEMM#855

Pull Request resolved: pytorch#3775

This diff introduces a set of quantization helper functions to fbgemm_gpu/experimental/gen_ai to make it easier to apply the new Int4 packing and preshuffling to weights.

Differential Revision: D70643388

Reviewed By: summerdengfb
jwfromm added a commit to jwfromm/FBGEMM that referenced this pull request Mar 14, 2025
Summary:
X-link: facebookresearch/FBGEMM#897

Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Reviewed By: jiawenliu64

Differential Revision: D70870933
jwfromm added a commit to jwfromm/FBGEMM that referenced this pull request Mar 14, 2025
Summary:
X-link: facebookresearch/FBGEMM#897

Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Reviewed By: jiawenliu64

Differential Revision: D70870933
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70870933

jwfromm added a commit to jwfromm/FBGEMM that referenced this pull request Mar 14, 2025
Summary:
X-link: facebookresearch/FBGEMM#897

Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Reviewed By: jiawenliu64

Differential Revision: D70870933
jwfromm added a commit to jwfromm/FBGEMM that referenced this pull request Mar 14, 2025
Summary:
X-link: facebookresearch/FBGEMM#897

Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Reviewed By: jiawenliu64

Differential Revision: D70870933
Summary:
X-link: facebookresearch/FBGEMM#897

Pull Request resolved: pytorch#3800
Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Reviewed By: jiawenliu64

Differential Revision: D70870933
jwfromm pushed a commit to jwfromm/FBGEMM that referenced this pull request Mar 14, 2025
Summary:
Pull Request resolved: pytorch#3800

Working on adding support for stacked mixed dtype grouped gemm with preshuffling.

Differential Revision: D70870933
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70870933

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in a39d2cc.

liligwu pushed a commit to ROCm/FBGEMM that referenced this pull request Mar 19, 2025
Summary:
X-link: https://github.com/facebookresearch/FBGEMM/pull/897

Pull Request resolved: pytorch#3800
Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Reviewed By: jiawenliu64

Differential Revision: D70870933

fbshipit-source-id: 195fb9feb993ffa7efe27b038173bd70a1db57ed
@robertgshaw2-redhat
Copy link

hey @jwfromm - thanks for the PR

What exactly the intended use of m_offsets?

q10 pushed a commit to q10/FBGEMM that referenced this pull request Apr 10, 2025
Summary:
Pull Request resolved: facebookresearch/FBGEMM#897

X-link: pytorch#3800
Efficient FP8xINT4 grouped gemm with preshuffling and scale packing. This implementation uses the "stacked" API where inputs and outputs are single contiguous tensors and the group boundaries are indicated with an `M_sizes` tensor that contains the number of rows in each group.

Reviewed By: jiawenliu64

Differential Revision: D70870933

fbshipit-source-id: 195fb9feb993ffa7efe27b038173bd70a1db57ed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants