Skip to content

Add auto-tuning for sparse semi-structured MM operator - #123742

Closed
alexsamardzic wants to merge 27 commits into
gh/alexsamardzic/27/basefrom
gh/alexsamardzic/27/head
Closed

alexsamardzic wants to merge 27 commits into
gh/alexsamardzic/27/basefrom
gh/alexsamardzic/27/head

Conversation

@alexsamardzic

@alexsamardzic alexsamardzic commented Apr 10, 2024 •

Copy link
Copy Markdown
Collaborator

@pytorch-bot

pytorch-bot Bot commented Apr 10, 2024 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

As of commit 7efb13c with merge base 546c53b (image):
💚 Looks good so far! There are no failures yet. 💚

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

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 kadeng muchulee8 aakhundov ColinPeppler amjames desertfire chauhang

[ghstack-poisoned]
alexsamardzic added a commit that referenced this pull request Apr 10, 2024
@cpuhrsch
cpuhrsch requested a review from kadeng April 11, 2024 17:10
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 kadeng muchulee8 aakhundov ColinPeppler amjames desertfire chauhang

[ghstack-poisoned]
@alexsamardzic

Copy link
Copy Markdown
Collaborator Author

Note that the generated kernels will still sometimes fail because of alignment issues, am investigating this.

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 kadeng muchulee8 aakhundov ColinPeppler amjames desertfire chauhang

[ghstack-poisoned]
alexsamardzic added a commit that referenced this pull request Apr 13, 2024
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 kadeng muchulee8 aakhundov ColinPeppler amjames desertfire chauhang

[ghstack-poisoned]
alexsamardzic added a commit that referenced this pull request Apr 16, 2024
@alexsamardzic

Copy link
Copy Markdown
Collaborator Author

This PR is ready for a review now.

[ghstack-poisoned]
[ghstack-poisoned]
alexsamardzic added a commit that referenced this pull request May 27, 2024
[ghstack-poisoned]
alexsamardzic added a commit that referenced this pull request May 30, 2024
[ghstack-poisoned]
alexsamardzic added a commit that referenced this pull request Aug 9, 2024
M = A_size[-2]
N = B_size[-1]
if K != A_size[-1]:
if K != A_size[-1] and K != 2 * A_size[-2]:

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 does K have to equal twice the size of the first dimension of A on this line?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

For sparse semi-structured MM, matrix A here contains only non-zero elements of original matrix, that has two zero elements out of each four successive elements (among rows). So I want to do a quick check here for both regular and sparse MM.

X (IRNode): The X input tensor.
W (IRNode): The W input tensor.
Bias (IRNode): The bias tensor.
Meta (IRNode): The meta tensor.

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.

What is a meta tensor in this context? Is it an optional argument or mandatory even for non-sparse GEMMs?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's again about sparse semi-structured MM: in this case, "meta" tensor encodes which two elements, out of each four successive elements of the original matrix, are actually provided through matrix A.

@kadeng kadeng 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.

lgtm!

@kadeng kadeng added the ciflow/trunk Trigger trunk jobs on your pull request label Aug 13, 2024
@kadeng

kadeng commented Aug 13, 2024

Copy link
Copy Markdown
Contributor

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: trunk / macos-py3-arm64 / test (default, 2, 3, macos-m1-stable)

Details for Dev Infra team Raised by workflow job

@kadeng kadeng removed the topic: not user facing topic category label Aug 13, 2024
@kadeng

kadeng commented Aug 15, 2024

Copy link
Copy Markdown
Contributor

@pytorchbot merge -i

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 3 checks: trunk / macos-py3-arm64 / test (default, 1, 3, macos-m1-stable), trunk / macos-py3-arm64 / test (default, 2, 3, macos-m1-stable), trunk / macos-py3-arm64 / test (default, 3, 3, macos-m1-stable)

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: Command git -C /home/runner/work/pytorch/pytorch cherry-pick -x a10a215d4a6085262765fa3c1c9bfaf10a3833f8 returned non-zero exit code 1

Auto-merging test/inductor/test_cutlass_backend.py
CONFLICT (content): Merge conflict in test/inductor/test_cutlass_backend.py
Auto-merging torch/_inductor/codegen/cuda/gemm_template.py
CONFLICT (content): Merge conflict in torch/_inductor/codegen/cuda/gemm_template.py
Auto-merging torch/_inductor/kernel/mm.py
error: could not apply a10a215d4a... Add auto-tuning for sparse semi-structured MM operator
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Details for Dev Infra team Raised by workflow job

@kadeng

kadeng commented Aug 15, 2024

Copy link
Copy Markdown
Contributor

@alexsamardzic Looks like there's a land-time merge conflict. You might want to rebase. CI will have to run again.-

[ghstack-poisoned]
alexsamardzic added a commit that referenced this pull request Aug 15, 2024
@alexsamardzic

Copy link
Copy Markdown
Collaborator Author

@alexsamardzic Looks like there's a land-time merge conflict. You might want to rebase. CI will have to run again.-

Rebased, CI running now.

@alexsamardzic

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@github-actions
github-actions Bot deleted the gh/alexsamardzic/27/head branch September 28, 2024 02:07
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.

3 participants