-
Notifications
You must be signed in to change notification settings - Fork 64
Update to cute dsl 4.6.0.dev0 #94
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
anakinxc
wants to merge
2
commits into
inclusionAI:main
Choose a base branch
from
anakinxc:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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 |
|---|---|---|
|
|
@@ -65,7 +65,7 @@ | |
| import cutlass.utils as utils | ||
| import cutlass.utils.blackwell_helpers as sm100_utils | ||
| import torch | ||
| from cutlass.cute.nvgpu import cpasync, tcgen05 | ||
| from cutlass.cute.nvgpu import OperandMajorMode, cpasync, tcgen05 | ||
| from cutlass.cute.runtime import from_dlpack | ||
| from cutlass.cute.typing import Int32, Int64 | ||
| from fla.modules.l2norm import l2norm_fwd | ||
|
|
@@ -478,20 +478,21 @@ def __call__( | |
| self.k_major_mode = utils.LayoutEnum.from_tensor(k).mma_major_mode() | ||
| self.v_major_mode = utils.LayoutEnum.from_tensor(v).mma_major_mode() | ||
| self.g_major_mode = utils.LayoutEnum.from_tensor(g).mma_major_mode() # NEW for KDA | ||
| self.k_major_mode_kv = tcgen05.OperandMajorMode.MN # For V^T*K, S dimension coalesced | ||
| self.k_major_mode_kv = OperandMajorMode.MN # For V^T*K, S dimension coalesced | ||
| # TMEM register output results as (D, C) | ||
| self.o_layout = utils.LayoutEnum.from_tensor(o) | ||
|
|
||
| if cutlass.const_expr(self.q_major_mode != tcgen05.OperandMajorMode.K): | ||
| if cutlass.const_expr(self.q_major_mode != OperandMajorMode.K): | ||
| raise RuntimeError("The layout of q is not supported") | ||
| if cutlass.const_expr(self.k_major_mode != tcgen05.OperandMajorMode.K): | ||
| if cutlass.const_expr(self.k_major_mode != OperandMajorMode.K): | ||
| raise RuntimeError("The layout of k is not supported") | ||
| if cutlass.const_expr(self.o_layout != utils.LayoutEnum.COL_MAJOR): | ||
| raise RuntimeError("The layout of o is not supported") | ||
| if cutlass.const_expr(self.k_major_mode == self.k_major_mode_kv): | ||
| raise RuntimeError("The layout of k & k^t should be different") | ||
|
|
||
| qk_tiled_mma = sm100_utils.make_trivial_tiled_mma( | ||
| self.q_dtype, | ||
| self.q_dtype, | ||
| self.q_major_mode, | ||
| self.k_major_mode, | ||
|
|
@@ -500,6 +501,7 @@ def __call__( | |
| self.qk_mma_tiler[:2], | ||
| ) | ||
| kk_tiled_mma = sm100_utils.make_trivial_tiled_mma( | ||
| self.k_dtype, | ||
| self.k_dtype, | ||
| # SHOULE BE both K-major | ||
| self.k_major_mode, | ||
|
|
@@ -519,19 +521,21 @@ def __call__( | |
| ) | ||
| # State^T Q^T | ||
| sq_tiled_mma = sm100_utils.make_trivial_tiled_mma( | ||
| self.io_dtype, | ||
| self.io_dtype, | ||
|
Comment on lines
+524
to
525
Contributor
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. |
||
| # State is in TMEM, always K major, TODO | ||
| tcgen05.OperandMajorMode.K, | ||
| OperandMajorMode.K, | ||
| self.q_major_mode, | ||
| self.acc_dtype, | ||
| self.cta_group, | ||
| self.sq_mma_tiler[:2], | ||
| a_source=tcgen05.OperandSource.TMEM, | ||
| ) | ||
| ks_tiled_mma = sm100_utils.make_trivial_tiled_mma( | ||
| self.io_dtype, | ||
| self.io_dtype, | ||
|
Comment on lines
+535
to
536
Contributor
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. |
||
| # State is in TMEM, always K major, TODO | ||
| tcgen05.OperandMajorMode.K, | ||
| OperandMajorMode.K, | ||
| # State is in TMEM, always K major, TODO | ||
| self.k_major_mode, | ||
| self.acc_dtype, | ||
|
|
@@ -540,8 +544,9 @@ def __call__( | |
| a_source=tcgen05.OperandSource.TMEM, | ||
| ) | ||
|
|
||
| m_major_mode = tcgen05.OperandMajorMode.K | ||
| m_major_mode = OperandMajorMode.K | ||
| mv_tiled_mma = sm100_utils.make_trivial_tiled_mma( | ||
| self.v_dtype, | ||
| self.v_dtype, | ||
| self.v_major_mode, | ||
| m_major_mode, | ||
|
|
@@ -550,8 +555,9 @@ def __call__( | |
| self.mv_mma_tiler[:2], | ||
| ) | ||
|
|
||
| p_major_mode = tcgen05.OperandMajorMode.K | ||
| p_major_mode = OperandMajorMode.K | ||
| vp_tiled_mma = sm100_utils.make_trivial_tiled_mma( | ||
| self.v_dtype, | ||
| self.v_dtype, | ||
| self.v_major_mode, | ||
| p_major_mode, | ||
|
|
@@ -1459,6 +1465,7 @@ def kernel( | |
| ############################################ | ||
| kv_mma_tiler2 = (self.kv_mma_tiler[0], self.kv_mma_tiler[1] // 2, self.kv_mma_tiler[2]) | ||
| fake_kv_tiled_mma_acc32 = sm100_utils.make_trivial_tiled_mma( | ||
| self.k_dtype, | ||
| self.k_dtype, | ||
|
Comment on lines
+1468
to
1469
Contributor
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. |
||
| self.v_major_mode, | ||
| self.k_major_mode_kv, | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For
qk_tiled_mma, the operands are Q and K. The first two arguments should beself.q_dtypeandself.k_dtyperespectively, rather than passingself.q_dtypetwice.