Repository navigation
ATOM: hybrid KV tables and single-block PD (#207, #231, #236) - #280
Merged
Merged
Conversation
Lane-local sliding cache tables and global block tables for hybrid (Gemma3) external-cache serving; fresh full-prefix hybrid PD; batch-1 single-block PD with prefix/host caching off. Hybrid prefix and host caching stay rejected. From feat/236-atom-single-pd (#210, #232, #237): atom/batching.py, tests/test_atom_hybrid.py, tests/test_atom_batching.py. ATOM.md section rewritten to the supported scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 30, 2026
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.
Background
Hybrid-attention models (Gemma3) on ATOM need global block tables plus lane-local sliding cache tables when the batcher owns its KV block tables, and PD needs a path for batch-1 compiles that have only one KV block. This lands the code from a draft stack as one reviewable unit.
Changes
Taken from
feat/236-atom-single-pd(draft PRs #210, #232, #237), only these paths:opt_prime/opt_prime/accel/platforms/atom/batching.py: hybrid global/sliding table ownership, decode-mask reset after fresh prefill, fresh full-prefix hybrid PD import (global layers into the lane's block, latest sliding window into the lane cache), batch-1 single-block PD with caches off,InvalidKVImportvalidation before any device write, physical KV element size checked from allocation size.opt_prime/tests/test_atom_hybrid.py(new),opt_prime/tests/test_atom_batching.py.opt_prime/docs/validation/batching/ATOM.md: fix: initialize hybrid ATOM KV tables and per-request masks #210's "Hybrid attention" paragraph rewritten: fresh full-prefix hybrid PD and batch-1 single-block PD with caches off are supported; hybrid prefix and host caching are still rejected; no link to a runtime validation record.No evidence files, runtime records or validator scripts are included.
Verification
Run locally on this base (CPU,
TORCH_DEVICE_BACKEND_AUTOLOAD=0):pytest -q tests/test_atom_hybrid.py tests/test_atom_batching.py: 33 passed.optimus-rmversion ofbatching.py: 13 failed, 20 passed (the new cases fail without the change).Compatibility and limits
kv_blocks >= lanes + 1behave as before.Related Issue
Closes #231
Closes #236
Refs #207 (stays open for sliding-state restoration)
Supersedes #210, #232, #237.
🤖 Generated with Claude Code