Skip to content

attention_mask is discarded in fmha_interface_wrapper: is a varlen or padding-mask prefill kernel wanted? #191

Open

Description

@Aryan95614

fmha_interface_wrapper in src/tilegym/ops/attn_interface.py accepts attention_mask from the HF attention interface but never passes it on; fmha itself only supports dense causal input. So padded batches at batch_size > 1 attend over padding tokens on the patched path.

Is a varlen-style (cu_seqlens packed, FlashAttention-varlen-like) or padding-mask-aware prefill kernel something you would want as an external contribution to ops/cutile/experimental/, in the style of the SWA prefill from #107? Or is this territory already covered by the roadmap's "Autoregressive Flash Attention (WIP Internal)" or the planned Flex Attention work?

Asking for scope before writing anything; happy to write up a concrete design in this thread if it is wanted.

Activity

  1. hannahli-nv commented on Sep 16, 2026

    @hannahli-nv
    Collaborator

    Hi @Aryan95614, apologies for the slow reply, and thank you for catching this!
    You're right, fmha_interface_wrapper takes attention_mask and never uses it, so padded batches with batch_size > 1 do end up attending over padding tokens. That's a real gap in our code.

    On the kernel side, there's an update: fmha_varlen (cuTile) is now available in TileGym. It takes padded (B, H, S, D) tensors plus per-batch q_lens / kv_lens, and is forward-only for now. The HF attention interface doesn't route to it yet. We'll follow up to fix it shortly.

    Thanks again for the clear and well-scoped report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions