-
Notifications
You must be signed in to change notification settings - Fork 332
[TileOp] Implement WGMMA for T.gemm_v2 #813
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
ec26c23
[Feature] Introduce WGMMA support and enhance GEMM layout handling
LeiWang1999 2ff5cbf
[Refactor] Clean up code formatting and enhance layout function reada…
LeiWang1999 0166a90
[Feature] Add descriptor initialization and offset manipulation for W…
LeiWang1999 ce83ace
[Refactor] Improve code formatting and readability in various files
LeiWang1999 72e900d
[Update] Update subproject commit and refactor layout function call
LeiWang1999 22131e7
support more data types
LeiWang1999 6632a70
gemm_rs support
LeiWang1999 eac5433
lint fix
LeiWang1999 51fcf15
wgmma wrapper
LeiWang1999 ce9f545
Remove debug logging for wgmma assembly code and refactor swizzle byt…
LeiWang1999 70699a9
Merge branch 'main' of https://github.com/tile-ai/tilelang into v2_wg…
LeiWang1999 2dbaccc
Refactor GEMM layout functions to replace 'kfactor' with 'k_inner' fo…
LeiWang1999 d2db013
Comprehensively support WGMMA GEMM SS
LeiWang1999 ce9e2b6
remove debug print
LeiWang1999 fef8d2a
lint fix
LeiWang1999 bd9bd37
remove debug print
LeiWang1999 ff3e04d
reduce bwd test shape
LeiWang1999 c6ab014
lint fix
LeiWang1999 cc9e32f
clear cache for pytest
LeiWang1999 5244c19
lint fix
LeiWang1999 3b5c075
Update sparse MLA examples to support SKV adjustment and correctness …
LeiWang1999 caa2e51
test fix
LeiWang1999 3858d81
adjust test case
LeiWang1999 4cdd131
test fix
LeiWang1999 8783aad
skip some test currently
LeiWang1999 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,7 +109,7 @@ GetTCGEN5MMAMeta(int M, int N, int K, DataType ab_dtype, DataType c_dtype) { | |
| * @param vmap Mapping from access pointer vars to Buffer objects used to | ||
| * resolve the Buffer corresponding to each pointer argument. | ||
| * | ||
| * @note If `kPack` is provided it must be 1 or 2; otherwise the constructor | ||
| * @note If `kPack` is provided it must be 1; otherwise the constructor | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| * fails with an ICHECK (runtime assertion). No other validation is | ||
| * performed here. | ||
| */ | ||
|
|
@@ -670,7 +670,7 @@ LayoutMap GemmNode::InferLayout(const LayoutInferArgs &T, | |
| int dim_A = A->shape.size(); | ||
| results.Set(A, makeGemmVoltaABLayout(*as_const_int(A->shape[dim_A - 2]), | ||
| *as_const_int(A->shape[dim_A - 1]), | ||
| true, trans_A ? 1 : 2)); | ||
| true, !trans_A)); | ||
| } else if (A.scope() == "local.fragment") { | ||
| ICHECK(trans_A == false); | ||
| auto fragment = makeGemmVoltaFragmentA(M, N, K, M / warp_m, N / warp_n); | ||
|
|
@@ -683,7 +683,7 @@ LayoutMap GemmNode::InferLayout(const LayoutInferArgs &T, | |
| int dim_B = B->shape.size(); | ||
| results.Set(B, makeGemmVoltaABLayout(*as_const_int(B->shape[dim_B - 2]), | ||
| *as_const_int(B->shape[dim_B - 1]), | ||
| false, trans_B ? 2 : 1)); | ||
| false, trans_B)); | ||
| } else if (TargetIsAmpere(T.target) || TargetIsTuring(T.target) || | ||
| TargetIsSM120(T.target) || | ||
| (TargetIsSm100(T.target) && gemm_inst == GemmInst::kMMA)) { | ||
|
|
@@ -700,7 +700,7 @@ LayoutMap GemmNode::InferLayout(const LayoutInferArgs &T, | |
| const int64_t mat_continuous = *as_const_int(A->shape[dim_A - 1]); | ||
| results.Set(A, | ||
| makeGemmABLayout(mat_stride, mat_continuous, mat_continuous, | ||
| A->dtype.bits(), trans_A ? 1 : 2)); | ||
| A->dtype.bits(), !trans_A)); | ||
| } else if (A.scope() == "local.fragment") { | ||
| auto fragment = makeGemmFragmentA(M, N, K, M / warp_m, N / warp_n, | ||
| A->dtype.bits(), trans_A); | ||
|
|
@@ -714,7 +714,7 @@ LayoutMap GemmNode::InferLayout(const LayoutInferArgs &T, | |
| const int64_t mat_continuous = *as_const_int(B->shape[dim_B - 1]); | ||
| results.Set(B, | ||
| makeGemmABLayout(mat_stride, mat_continuous, mat_continuous, | ||
| B->dtype.bits(), trans_B ? 2 : 1)); | ||
| B->dtype.bits(), trans_B)); | ||
| } else if (B.scope() == "local.fragment") { | ||
| auto fragment = | ||
| makeGemmFragmentB(M, N, K, M / warp_m, N / warp_n, trans_B); | ||
|
|
@@ -741,9 +741,9 @@ LayoutMap GemmNode::InferLayout(const LayoutInferArgs &T, | |
| auto ABLayout = | ||
| gemm_inst == GemmInst::kWGMMA | ||
| ? makeGemmABLayoutHopper(mat_stride, mat_continuous, continuity, | ||
| A->dtype.bits(), trans_A ? 1 : 2) | ||
| A->dtype.bits(), !trans_A) | ||
| : makeGemmABLayout(mat_stride, mat_continuous, mat_continuous, | ||
| A->dtype.bits(), trans_A ? 1 : 2); | ||
| A->dtype.bits(), !trans_A); | ||
| results.Set(A, ABLayout); | ||
| } else { | ||
| auto fragment = makeGemmFragmentA(M, N, K, M / warp_m, N / warp_n, | ||
|
|
@@ -756,12 +756,14 @@ LayoutMap GemmNode::InferLayout(const LayoutInferArgs &T, | |
| const int64_t mat_continuous = *as_const_int(B->shape[dim_B - 1]); | ||
| const int64_t continuity = | ||
| trans_B ? mat_continuous : mat_continuous / warp_n; | ||
|
|
||
| LOG(INFO) << "gemm_inst: " << (int)gemm_inst << ", trans_B: " << trans_B; | ||
| auto ABLayout = | ||
| gemm_inst == GemmInst::kWGMMA | ||
| ? makeGemmABLayoutHopper(mat_stride, mat_continuous, continuity, | ||
| B->dtype.bits(), trans_B ? 2 : 1) | ||
| B->dtype.bits(), trans_B) | ||
| : makeGemmABLayout(mat_stride, mat_continuous, mat_continuous, | ||
| B->dtype.bits(), trans_B ? 2 : 1); | ||
| B->dtype.bits(), trans_B); | ||
| results.Set(B, ABLayout); | ||
| } else { | ||
| auto fragment = | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.