feat(moore): support paged flash attention prefill - #819
Merged
Conversation
flash_attn_varlen_func
voltjia
marked this pull request as ready for review
July 25, 2026 09:21
voltjia
force-pushed
the
feat/moore-flash-attn-varlen
branch
from
July 25, 2026 14:26
a29db4c to
f8e16ae
Compare
19 tasks
flash_attn_varlen_func
voltjia
force-pushed
the
feat/moore-flash-attn-varlen
branch
from
September 1, 2026 14:20
8fd8f5d to
293e84b
Compare
voltjia
force-pushed
the
feat/moore-flash-attn-varlen
branch
from
September 2, 2026 13:34
cd69650 to
70e5008
Compare
voltjia
force-pushed
the
feat/moore-flash-attn-varlen
branch
from
September 3, 2026 07:42
c9f5ac8 to
6d6a409
Compare
voltjia
force-pushed
the
feat/moore-flash-attn-varlen
branch
from
September 3, 2026 10:21
6d6a409 to
cc42fa9
Compare
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.
Summary
master@879d31ccsnapshot.flash_attn_varlen_funcwhen the caller supplies a paged KV-cacheblock_table; dense attention continues to use the shared ATen provider.Caster<kDev>abstraction; this PR adds no__CUDA_ARCH__type-selection branches.DEVICE_LIST.tests/test_flash_attn_varlen_func.pymodule and its existing smoke selector.Current head:
cc42fa99ee4977f80b5cf8af4ff25c47235800ab.Motivation
InfiniLM's paged FlashAttention prefill path calls the public
flash_attn_varlen_funcAPI with a KV-cache block table. The previous Moore provider delegated only dense attention to TorchMusa and rejected this paged form, so Moore inference did not have a complete prefill/decode attention path.Type of Change
feat- new provider capabilitytest- Moore paged-prefill coveragebuild- shared CUDA/MUSA kernel compatibilityPlatforms Affected
Validation
Patch identity after rebase
The feature and test commits are a conflict-free semantic rebase of the hardware-tested prefill commits.
git range-diffmaps both old commits tod4795d03and70e50081one-for-one. Commitabd8d731removes the eight architecture-macro type branches and threads the backend device tag toCaster<kDev>. Commitcc42fa99separates common and backend-specific Torch sources, moves NVIDIA/Moore behavior into backend policy specializations, and consolidates the Moore regression tests into the existing test module.Focused operator tests
All three platforms exercised the relevant FP16/BF16 paths. NVIDIA skips are four linked-provider cases, three Moore-only regressions, and one two-GPU guard on a single-GPU container. Moore skips are eight unsupported local-window cases, four causal unequal-Q/K cases, and three NVIDIA-only stream/device-guard cases.
The standalone Moore paged-prefill provider is not counted above: its existing CTA8 variant requires 36,896 bytes of shared memory while S5000 permits 28,672 bytes. A no-cache compile at the earlier
70e50081head produces the same six errors, so this is not introduced by the caster or source-layout cleanup.InfiniLM integration
The behavior-equivalent pre-layout stack was validated with stacked decode PR #962, InfiniLM #506, InfiniRT
0cdbb169, InfiniCCL's open AllGather/Send/Recv stack, and InfiniCCL #69's Moore architecture fix:host_segments > 0; none used whole-engine eager fallback.The current exact-head focused tests above revalidate all code paths changed by the layout-only follow-up; the full 13-command InfiniLM matrix was not rerun for that follow-up.
Current CI
At exact head
cc42fa99:__halflink area. The base snapshot879d31ccfails at the same stage (base jobs100186334980and100185959499); this PR does not select either NVIDIA or Moore Torch sources in non-target backend builds.Notes for Reviewers
aten_impl.hhas nokNvidia/kMoore,if constexpr,WITH_*,CUDA_ARCH, or__CUDA_ARCH__platform branch.src/torch/nvidia/...; TorchMusa window and causal-length restrictions live insrc/torch/moore/....operator()has the same public signature as its base. It only intercepts calls with a pagedblock_table; dense calls delegate to the shared ATen base. Its implementation lives in the Moore backend directory.Performance Impact
N/A. This PR makes a previously unsupported Moore execution path functional and makes no comparative performance claim.