Repository navigation
fix(xla): size the static context shape from the request - #2856
Conversation
The OpenXLA static capacity defaulted to 256 tokens, so any prompt of 255 tokens or more was refused at admission, and the default `-n` (unlimited) resolved to the whole checkpoint window and was refused even for short prompts. Size the CLI shape from the request through a capacity ladder bounded by the checkpoint window, bound the unlimited budget to a 512-token sizing default and clamp the admitted budget to the room the shape leaves, and derive a 4096 serving bucket next to the 256 floor while keeping the short-request shape. A pinned `MLXCEL_XLA_CONTEXT_CAPACITY` and a pinned `MLXCEL_XLA_CONTEXT_BUCKETS` keep their existing precedence and single-shape behavior. Refs #2855
The sentinel capture is only read by the xla-backend branch, so default-feature builds saw an unused binding and CI clippy failed under -D warnings. Refs #2855
Runtime validation on gfx1151 (hip, release build at 1b1ced7)Checkpoint
Server on the same checkpoint: the startup log shows The release binary was built at 1b1ced7. The follow-up commit f803d6c only adds Refs #2855 |
|
|
|
recheck |
Summary
Two defects had one cause: the OpenXLA path pinned its static sequence capacity at 256 and never related it to the request.
-ndefaults to-1, resolves to the checkpoint window minus the prompt, and admission refused it:effective_prompt_len=6 + max_new_tokens=131066 > context_capacity=256.-n 1any prompt of 255 tokens or more was refused while the same request runs on MLX. Serving had the same problem because a text-only checkpoint derived[256]only.Changes
mlxcel-xla: add the ladder[256, 512, 1024, 2048, 4096, 8192, 16384, 32768],resolve_context_capacity, andDEFAULT_XLA_GENERATION_BUDGET = 512. The resolver keeps a pinnedMLXCEL_XLA_CONTEXT_CAPACITYfirst, then picks the smallest rung that admits the request, bounded by the checkpoint window.create_session_for_requeston the backend seam lets onlyXlaBackendsize the static shape.generate_xlapasses prompt plus sizing budget plus worst-case image expansion, prints the chosen capacity, and clamps the admitted budget to the room the shape leaves, mirroring the serve-path clamp from fix: harden the OpenXLA continuous-batching engine after #469 #2848.[256, min(4096, checkpoint window)]plus the image floor when larger, so short requests keep the 256 shape and ordinary prompts are admitted.MLXCEL_XLA_CONTEXT_BUCKETSstill overrides.Validation
cargo test -p mlxcel-xla --lib: 382 passed, 0 failed, 19 ignored.cargo test --features xla-backend --bin mlxcel -- commands::generate: 113 passed, 0 failed, 1 ignored.cargo check --features xla-iree --all-targets: clean.cargo clippy -p mlxcel-xla --all-targets -- -D warnings: clean.cargo fmt --all -- --check: clean.make verify-env-var-docs: OK, 351 names checked.Fixes #2855