Skip to content

fix(hip,aiter): bootstrap non-causal varlen .so for single-prefill with logits cap#260

Merged
demandal25 merged 2 commits into
ROCm:amd-integrationfrom
demandal25:fix-aiter-single-prefill-noncausal-logits-bootstrap
Jun 17, 2026
Merged

fix(hip,aiter): bootstrap non-causal varlen .so for single-prefill with logits cap#260
demandal25 merged 2 commits into
ROCm:amd-integrationfrom
demandal25:fix-aiter-single-prefill-noncausal-logits-bootstrap

Conversation

@demandal25

Copy link
Copy Markdown
Collaborator

Summary

Fixes a dlopen failure in the AITER single-prefill path when logits_soft_cap > 0 and causal=False. The bootstrap that triggers AITER's lazy JIT only ever built the causal variant of the mha_varlen_fwd .so, so a non-causal request with a logits soft cap failed to load the never-built nmask variant.

What changed

  • flashinfer/prefill_rocm.py_aiter_bootstrap_single_prefill_varlen now takes a causal argument and threads it into is_causal, so the bootstrap compiles the .so variant matching the actual request instead of hardcoding is_causal=True. AITER splits the varlen .so by causality (mask vs nmask); the caller in single_prefill_with_kv_cache now passes causal through. Added @functools.lru_cache to match the sibling bootstrap helpers and avoid re-running the warmup on every call.

Root cause

When logits_soft_cap > 0, single-prefill routes through mha_varlen_fwd (the mha_fwd template has no _logits arm). AITER ships non-logits variants prebuilt but lazy-JIT-builds the logits ones, keyed by causality. The bootstrap warmup only exercised is_causal=True, leaving the non-causal logits .so absent — so backend="aiter", causal=False, logits_soft_cap=8.0 raised RuntimeError: AITER .so not found: ...mha_varlen_fwd_fp16_logits_nbias_nmask_....

Test plan

  • pytest tests/rocm_tests/test_single_prefill_kernels_hip.py — previously failing aiter non-causal logits cases now pass
  • pre-commit run -a

…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>
Copilot AI review requested due to automatic review settings June 17, 2026 04:59

Copilot AI 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.

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 causal into _aiter_bootstrap_single_prefill_varlen(..., is_causal=causal) so the lazy-JIT builds the correct logits varlen artifact.
  • Add @functools.lru_cache to the varlen bootstrap helper to avoid repeating warmups.
  • Update the single-prefill caller to pass causal into the varlen bootstrap.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread flashinfer/prefill_rocm.py
Comment thread flashinfer/prefill_rocm.py
…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>
@demandal25 demandal25 merged commit d0e4f73 into ROCm:amd-integration Jun 17, 2026
1 check passed
@demandal25 demandal25 deleted the fix-aiter-single-prefill-noncausal-logits-bootstrap branch June 18, 2026 20:52
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.

2 participants