Skip to content

Reuse slot-owned buffers for DCP metadata uploads #30

Open

Description

@whx-sjtu

Part of #1. Ready for bounded default-off metadata-buffer reuse; Next authors, Moe reviews, root schedules GPU work.

Implements / Consumes

Reuse _dcp_gathers, _build_dcp_indexer_fp4_prefill_meta, current forward_vars/slot ownership, CpuGpuBuffer and checked H2D publication. Stack on #27 at f928e8f48055ff94279d07eb6c8037ffe71bd7ff; CPU implementation need not wait for its performance landing.

File set

atom/model_ops/attentions/aiter_mla.py, atom/model_engine/model_runner.py, atom/utils/envs.py, tests/test_dcp_metadata_buffers.py, tests/test_dcp_index_staging.py.

Exit criteria

ATOM_DCP_FP4_PREFILL_PINNED defaults0. Disabled mode adds no allocation/clear. Initially admit only current singleton/prefix support; unsupported cases, capacity overflow and FP8 multipass keep existing uploads.

Allocate two fixed-capacity slot-owned CpuGpuBuffers before owner binding/capture. Write pinned NumPy slices directly, with separate read/stage segments replacing concatenate/copy. Publish at the existing finish position through independent single-member checked direct-copy groups. Preserve begin/finish, current-stream order and reuse gates; no resize or hot rebinding.

Keep int32 values and #27's downstream GPU computation unchanged. Verify exact metadata, bounds, prefix/slot binding, alternating-slot reuse and dirty/stale-reuse rejection. Count every slot/prefix allocation and complete preparation cost, including publication and memory. Compare same-source flag 0/1 with frozen inputs; no per-layer or model-gain claim from upload counts.

Named result

Qualified metadata-buffer reuse and complete metadata-preparation A/B deciding keep/reject/inconclusive; real C12 remains required for model benefit.

Effort

Code: 350 added, 0 moved, 40 deleted; weighted 360. Tests: 250 added, 0 moved, 0 deleted; weighted 250. Tests execute current builder/publication/slot contracts. Related source/numerical/lifetime checks and exact root-reviewed plan precede GPU; final quality/performance/landing gates remain.

Depends on #27

Concrete opportunity, capacity and dependency limits

Current measured C12 metadata performs two large upload_numpy operations per rank per prefill forward, not per layer: gather_index int32 at 401408 rows is 1605632 bytes; concatenated read/stage slots at 50176+401408 rows are 1806336 bytes. Together they stage/copy 3.254 MiB per rank. #27 does not remove them; benefit remains unmeasured.

The proposed capacities are M int32 entries for gather_index and M+ceil(M/8) entries for slots. At M=1048576 that is 8.5 MiB CPU pinned plus 8.5 MiB GPU per slot, not a free per-rank total. Enumerate actual slot and prefix instances, multiply their budgets, and report existing/new allocation and peak live memory before admission. Unsupported topology/shape/ownership or insufficient capacity retains the existing upload path; do not truncate, dynamically resize, alias concurrent slots or change serving limits.

Use only existing singleton/prefix publication machinery. Each buffer's independent single-member group must retain the checked direct-copy boundary at the original finish point. No new allocator, publication framework, communication backend, persistent cross-slot alias or synchronization shortcut. Reuse cannot begin until the existing owner/stream completion gate permits it. Preserve capture-visible addresses and all source/precision/graph/lifetime contracts.

Hold #27's combined-staging flag and all other recipe settings fixed in both arms, recording its value in the exact plan; only ATOM_DCP_FP4_PREFILL_PINNED changes0/1. Bind source/AITER/runtime, dimensions, slot/prefix count, active lengths, initialization and copy lifecycle before measurements. Include changing forwards, supported prefix cases, boundary/overflow refusals, disabled-mode parity, alternating slots and meaningful dirty-epoch/lifetime negative controls. A skipped import is not numerical coverage.

The first performance boundary is complete metadata preparation, including NumPy construction, pinned staging/publication, required synchronization and memory effects. Freeze timing/order/repetition and rejection criteria prospectively; retain failures/noise without automatic retry or tolerance widening. GPU/model actions require separately qualified exact commands and root lease. No synthetic preparation result is current C12 gain.

This task consumes the precise #27 source commit above, not an unpinned moving branch. Stack its PR on the matching #27 branch while open; record both source identities and keep their landing dependency explicit. Do not modify #27's active run/source, #29 or Mono's independent repair. No #3 documentation, general report or unrelated full-suite completion is an experimental preparation prerequisite.

Activity

  1. added
    k31-performance
    on Nov 22, 2026
  2. self-assigned this
    on Nov 22, 2026
  3. whx-sjtu commented on Nov 22, 2026

    @whx-sjtu
    OwnerAuthor

    Claimed #30 for this agent-team run. Checked the issue thread and open delivering PRs; no existing claim or delivery overlaps this task.

    MLA owns implementation and Moe owns independent review. Stack on #27 at f928e8f48055ff94279d07eb6c8037ffe71bd7ff in an isolated worktree. Preserve the failed model run and its source. Root schedules GPU validation after focused source, lifetime and numerical-plan checks.

  4. whx-sjtu commented on Nov 22, 2026

    @whx-sjtu
    OwnerAuthor

    Ready: Next owns #30 implementation under the existing claim; Moe reviews and root orchestrates. The clean task-30 tree remains at the pinned #27 source, with no inherited implementation changes. Technical scope and GPU ownership are unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

k31-performance

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions