Skip to content

add tcgen.ld.red support to sm103a arch#2696

Open
drisspg wants to merge 1 commit into
mainfrom
drisspg/stack/47
Open

add tcgen.ld.red support to sm103a arch#2696
drisspg wants to merge 1 commit into
mainfrom
drisspg/stack/47

Conversation

@drisspg

@drisspg drisspg commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

ad tcgen.ld.red support to sm103a arch

Inspired by; https://github.com/hao-ai-lab/flash-attention-fp4

Perf on dense non casual; makes sense msotly i dont really know why headim32 takes a hit though -> ill just update the expr to not dispatch for this

image

causal is similar

image

drisspg added a commit that referenced this pull request Jul 6, 2026
stack-info: PR: #2696, branch: drisspg/stack/47
@drisspg drisspg force-pushed the drisspg/stack/47 branch from f45c939 to 8eeeabd Compare July 6, 2026 23:17
@drisspg drisspg changed the title ad tcgen.ld.red support to sm103a arch add tcgen.ld.red support to sm103a arch Jul 7, 2026
drisspg added a commit that referenced this pull request Jul 7, 2026
stack-info: PR: #2696, branch: drisspg/stack/47
@drisspg drisspg force-pushed the drisspg/stack/47 branch from 8eeeabd to b242e61 Compare July 7, 2026 19:30
@drisspg drisspg changed the title add tcgen.ld.red support to sm103a arch ad tcgen.ld.red support to sm103a arch Jul 7, 2026
drisspg added a commit that referenced this pull request Jul 7, 2026
stack-info: PR: #2696, branch: drisspg/stack/47
@drisspg drisspg force-pushed the drisspg/stack/47 branch from b242e61 to a8e36d9 Compare July 7, 2026 23:31
@drisspg drisspg requested a review from tridao July 7, 2026 23:48
drisspg added a commit that referenced this pull request Jul 7, 2026
stack-info: PR: #2696, branch: drisspg/stack/47
@drisspg drisspg force-pushed the drisspg/stack/47 branch from a8e36d9 to 9566d8d Compare July 7, 2026 23:48
@drisspg drisspg requested review from jayhshah and thakkarV July 7, 2026 23:49
@drisspg drisspg marked this pull request as ready for review July 7, 2026 23:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9566d8d348

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if const_expr(self.use_ldred_rowmax):
# ld.red returns each x32 tile's max in an extra register.
tSrS_red = cute.make_rmem_tensor(((1, 1), *tSrS_t2r.shape[1:]), self.qk_acc_dtype)
cute.copy(thr_tmem_load, tStS_t2r, (tSrS_t2r, tSrS_red))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Prevent ld.red loads from being optimized across tiles

On SM103 dense kernels with more than one K tile, this ld.red load reads the same tStS_t2r TMEM address on each softmax_step while intervening MMA operations overwrite that slot. CUTLASS has lowered LdRed through side-effect-free inline asm unlike regular Ld32, so repeated reads from the same TMEM address can be CSE'd or hoisted and later tiles can reuse stale scores/max values, corrupting attention results. Please keep the normal TMEM load or use a side-effecting/fenced ld.red wrapper before enabling this path.

Useful? React with 👍 / 👎.

stack-info: PR: #2696, branch: drisspg/stack/47
@drisspg drisspg marked this pull request as draft July 8, 2026 17:14
@drisspg drisspg force-pushed the drisspg/stack/47 branch from 9566d8d to 1a9f9eb Compare July 8, 2026 17:14
@drisspg drisspg marked this pull request as ready for review July 8, 2026 17:14

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1a9f9ebf86

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread flash_attn/cute/block_sparse_utils.py
@drisspg drisspg changed the title ad tcgen.ld.red support to sm103a arch add tcgen.ld.red support to sm103a arch Jul 8, 2026
@drisspg drisspg marked this pull request as draft July 8, 2026 18:26
@drisspg drisspg changed the title add tcgen.ld.red support to sm103a arch ad tcgen.ld.red support to sm103a arch Jul 8, 2026
@drisspg drisspg marked this pull request as ready for review July 8, 2026 18:26
@drisspg drisspg changed the title ad tcgen.ld.red support to sm103a arch add tcgen.ld.red support to sm103a arch Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant