Skip to content

train 1201032257: #5728 (CI only) - #5798

Closed
ashhart wants to merge 3 commits into
mainfrom
lead/train-1201032257
Closed

ashhart wants to merge 3 commits into
mainfrom
lead/train-1201032257

Conversation

@ashhart

@ashhart ashhart commented Dec 1, 2026

Copy link
Copy Markdown
Owner

CI for a landing train: #5728 stacked on main in that order. Nothing merges from this PR: each PR above lands on its own once this tip is green, and this PR is then closed.

AbrahamCete and others added 3 commits December 1, 2026 03:23
hip_engine.zig is the HIP twin of loop_engine.zig's Model without the
forward. Each stream owns a slot of five buffers: the visit cache that
loop.CacheLayout sizes, four 32-byte rewind sites a visit (conv.hip's
and ops.cu's RewindSite layout), the conv states' backup, a 16-row
window history and the last prompt row's FP32 logits. HIP's draws keep
no per-stream sampling rule, so stream_bytes has no rule buffer.
addSlots writes each slot's site table and zeroes its conv states;
reset zeroes the current slot's. The forward's shared scratch follows
CUDA's buffer list, with hip_attention.zig's partial slots and the
routed experts' activation and down rows, allocated once at init.

Before any allocation the state refuses, by name and with a log line,
a config without a loop, gates other than rank 64, global and sliding
KV widths that differ (CacheLayout sizes every conv by the sliding
width), a context of zero or past text_config.model_max_length (Mini
names max_position_embeddings only under mtp_config, so the HIP host
reads no window), and more than 16 streams.

test-inkling2-hip-state-host, also part of test-inkling2-hip-host,
runs it over a recording runtime: each stream's allocations at Mini's
and tiny-inkling2-mini's shapes at 8K, 32K, 128K and 1M (25,087,464 B
past the cache on Mini), the scratch, the site tables, the addSlots,
reset and deinit counts, each refusal and its message, and cleanup
after a failed allocation.
hip_snapshot.zig adapts loop.CacheLayout into kept_state.Visit slices
and delegates kept-row counting and packed-order traversal to the shared
kept_state.zig walk (the same walk CUDA's loop_engine.zig uses), then
appends the slot's conv region. Model.save, restore and drop queue one
device copy a piece on the stream, with CUDA's refusals by name
(NotAtMark, StateOfAnotherModel, BadLoopSnapshot) and log lines. A
snapshot is stored by position, so it restores into any slot whose
context holds it. A save whose copy fails waits for the stream before
it frees its buffer.

Host tests: the walk's rings equal hip_attention.zig's, its bytes at
Mini's and tiny-inkling2-mini's shapes, its pieces split at the ring
wrap and tile the snapshot; save and restore issue exactly those
copies; on host memory a restored slot equals a reference built from
positions byte for byte, in place and at another capacity.

inkling2-hip-state-test (built in test, run only on its own step)
does the same on gfx1151 with tiny-inkling2-mini's and Mini's shapes:
seeded slots saved, the snapshot compared with the walk's gather,
the slot clobbered, restored and compared whole, and restored into a
slot of another capacity.
@ashhart

ashhart commented Dec 1, 2026

Copy link
Copy Markdown
Owner Author

Landed: #5728 as main f17dedb. This PR only carried their CI.

@ashhart ashhart closed this Dec 1, 2026
@ashhart
ashhart deleted the lead/train-1201032257 branch December 1, 2026 06:08
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.

2 participants