[repro] flash_attn_generic: concise causal-mask loop trips dynamic-if…#763
Draft
xudoyuan wants to merge 1 commit into
Draft
[repro] flash_attn_generic: concise causal-mask loop trips dynamic-if…#763xudoyuan wants to merge 1 commit into
xudoyuan wants to merge 1 commit into
Conversation
… list-carry
Collapses the 112-line hand-unrolled causal mask (s_raw_lo_0..15 /
s_raw_hi_0..15) into a range_constexpr(16) loop. This is the intended
concise form but it currently FAILS at compile time:
TypeError: state variable 's_raw_lo' is list, not an MLIR Value;
stateful dynamic if requires MLIR-backed values.
Suspected FlyDSL compile-time defect: `tile_needs_mask` is a runtime
value, so `if tile_needs_mask:` lowers to a dynamic scf.if. The
if-rewriter can carry a reassigned *named scalar* MLIR value out of the
branch, but not a reassigned *list* local. The original 112-line unroll
existed solely to work around this (carry 16+16 named scalars).
Committed intentionally as a minimal repro so the rewriter can be fixed
to carry list-typed locals (flatten to per-element scf.if yields). Once
fixed, this is the desired form. Does NOT build as-is.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
… list-carry
Collapses the 112-line hand-unrolled causal mask (s_raw_lo_0..15 / s_raw_hi_0..15) into a range_constexpr(16) loop. This is the intended concise form but it currently FAILS at compile time:
TypeError: state variable 's_raw_lo' is list, not an MLIR Value;
stateful dynamic if requires MLIR-backed values.
Suspected FlyDSL compile-time defect:
tile_needs_maskis a runtime value, soif tile_needs_mask:lowers to a dynamic scf.if. The if-rewriter can carry a reassigned named scalar MLIR value out of the branch, but not a reassigned list local. The original 112-line unroll existed solely to work around this (carry 16+16 named scalars).Committed intentionally as a minimal repro so the rewriter can be fixed to carry list-typed locals (flatten to per-element scf.if yields). Once fixed, this is the desired form. Does NOT build as-is.
Motivation
Technical Details
Test Plan
Test Result
Submission Checklist