fix(hip,aiter): bootstrap non-causal varlen .so for single-prefill with logits cap#260
Merged
demandal25 merged 2 commits intoJun 17, 2026
Conversation
…th logits cap The single-prefill AITER path routes through mha_varlen_fwd when logits_soft_cap > 0, and AITER lazy-JIT-builds that .so split by causality (mask vs nmask). The bootstrap helper hardcoded is_causal=True, so a non-causal request hit a dlopen failure for the never-built nmask variant. Thread causal through the bootstrap so it builds the variant matching the request. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes an AITER dlopen failure in ROCm single-prefill when logits_soft_cap > 0 and causal=False by ensuring the bootstrap warmup compiles the correct varlen .so variant (mask vs nmask) instead of always bootstrapping the causal one.
Changes:
- Thread
causalinto_aiter_bootstrap_single_prefill_varlen(..., is_causal=causal)so the lazy-JIT builds the correct logits varlen artifact. - Add
@functools.lru_cacheto the varlen bootstrap helper to avoid repeating warmups. - Update the single-prefill caller to pass
causalinto the varlen bootstrap.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ents Address Copilot review: the logits varlen .so is split by causality (mask vs nmask) and neither is pre-shipped, so both the docstring and the call-site comment now reflect that we bootstrap the requested variant rather than only the (logits, causal) combo. Co-Authored-By: Claude Opus 4.7 <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.
Summary
Fixes a
dlopenfailure in the AITER single-prefill path whenlogits_soft_cap > 0andcausal=False. The bootstrap that triggers AITER's lazy JIT only ever built the causal variant of themha_varlen_fwd.so, so a non-causal request with a logits soft cap failed to load the never-builtnmaskvariant.What changed
flashinfer/prefill_rocm.py—_aiter_bootstrap_single_prefill_varlennow takes acausalargument and threads it intois_causal, so the bootstrap compiles the.sovariant matching the actual request instead of hardcodingis_causal=True. AITER splits the varlen.soby causality (maskvsnmask); the caller insingle_prefill_with_kv_cachenow passescausalthrough. Added@functools.lru_cacheto match the sibling bootstrap helpers and avoid re-running the warmup on every call.Root cause
When
logits_soft_cap > 0, single-prefill routes throughmha_varlen_fwd(themha_fwdtemplate has no_logitsarm). AITER ships non-logits variants prebuilt but lazy-JIT-builds the logits ones, keyed by causality. The bootstrap warmup only exercisedis_causal=True, leaving the non-causal logits.soabsent — sobackend="aiter", causal=False, logits_soft_cap=8.0raisedRuntimeError: AITER .so not found: ...mha_varlen_fwd_fp16_logits_nbias_nmask_....Test plan
pytest tests/rocm_tests/test_single_prefill_kernels_hip.py— previously failingaiternon-causal logits cases now passpre-commit run -a