Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion crates/core/src/engine/scheduler/vllm/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2598,7 +2598,8 @@ impl VllmCore {
end = aligned;
}
}
let last_full = known / alignment * alignment;
// Match the state cache's replay boundary, including prompts that end on a full block.
let last_full = prompt.saturating_sub(1) / alignment * alignment;
let tail = prompt / unit * unit;
let next = start.checked_add(alignment - start % alignment);
for stop in [
Expand Down Expand Up @@ -3723,6 +3724,31 @@ mod state_cache_tests {
core.try_execute_hidden_pass(0.0).unwrap()
}

#[test]
fn aligned_prompt_retains_a_reusable_state_after_long_decode() {
let mut config = args(64, true, None);
config.prefix_match_unit = Some(4);
let mut core = VllmCore::new(config);
submit(&mut core, 93_030, 16, 16);
for _ in 0..32 {
if core.state.requests.is_empty() {
break;
}
step(&mut core);
}
assert!(core.state.requests.is_empty());
let second = submit(&mut core, 93_031, 16, 1);
let pass = step(&mut core);
assert_eq!(
pass.admissions
.iter()
.find(|admission| admission.uuid == second)
.unwrap()
.reused_input_tokens,
12
);
}

#[test]
fn kda_prefill_executes_aligned_chunks_tail_and_remaining_tokens() {
let mut config = args(512, true, None);
Expand Down
Loading