feat(xla): add prefill embeddings entry (#858)#879
Merged
Conversation
Emit a distinct StableHLO prefill path for post-scale embeddings with an explicit additive attention bias, stable input validation, frozen structural coverage, and real IREE parity checks for tied and untied checkpoints. Refs #858
inureyes
force-pushed
the
feature/issue-858-prefill-embeddings
branch
from
July 22, 2026 10:07
b871e68 to
6c3a23e
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
Adds a distinct
prefill_embeddings.mainStableHLO entry that accepts post-scale hidden states and an explicit additive attention bias while preserving the existing token-prefill output and KV-cache contract.Changes
embeddings,positions,real_len,attention_biasschema with fail-closed metadata and finite-mask validation.real_len = 1, and near-capacity input.Validation
cargo test -p mlxcel-xla --lib prefill_embeddings -- --nocapture(3 passed, 1 opt-in dump test ignored)cargo test -p mlxcel-xla --lib validation::tests::registered_fixtures_are_byte_exact -- --nocapturescripts/xla/validate_arch.sh --structural-only(9 architecture checks passed)cargo check -p mlxcel-xla --lib --testscargo clippy -p mlxcel-xla --lib --tests -- -D warningscargo fmt --all -- --checkspike/openxla/.venv/bin/python spike/openxla/prefill_embeddings_check.py(exact zero difference for logits and full K/V outputs in every scenario)Review
Correctness review confirms deterministic argument order, explicit mask polarity and padding semantics, tied/untied head selection, scalar argmax and logits variants, and byte-exact preservation of the token entry. Security review confirms malformed shape, dtype, length, NaN, infinity, and ambiguous mask values fail closed. Performance review found no new copies on the embeddings hot path; validation performs one bounded scan of the static bias before compilation or invocation.
Closes #858