Skip to content

ATOM: hybrid KV tables and single-block PD (#207, #231, #236) - #280

Merged
gspark-etri merged 1 commit into
optimus-rmfrom
feat/231-atom-hybrid-pd-land
Oct 30, 2026
Merged

gspark-etri merged 1 commit into
optimus-rmfrom
feat/231-atom-hybrid-pd-land

Conversation

@gspark-etri

Copy link
Copy Markdown
Collaborator

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, InvalidKVImport validation 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.
  • Same two files against the optimus-rm version of batching.py: 13 failed, 20 passed (the new cases fail without the change).
  • Full suite: CI (cpu-tests).

Compatibility and limits

  • Non-hybrid models with kv_blocks >= lanes + 1 behave as before.
  • Hybrid prefix caching, host caching and partial remote prefixes are rejected (sliding-state restoration is not implemented, ATOM hybrid attention requires local KV table ownership #207).
  • Single-block PD requires batch 1, a prefill worker, prefix/host caching off and a full prompt KV from position zero; the block is released after each request.
  • No hardware run is claimed by this PR.

Related Issue

Closes #231
Closes #236
Refs #207 (stays open for sliding-state restoration)

Supersedes #210, #232, #237.

🤖 Generated with Claude Code

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>
@gspark-etri
gspark-etri merged commit f352692 into optimus-rm Oct 30, 2026
1 check passed
@gspark-etri
gspark-etri deleted the feat/231-atom-hybrid-pd-land branch October 30, 2026 00:56
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.

1 participant