Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
4 changes: 2 additions & 2 deletions .github/workflows/ci-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
- name: Publish immutable build and latest
run: |
set -euo pipefail
image=ghcr.io/general-inference/skippy-ci-cpu
image=ghcr.io/mesh-llm/skippy-ci-cpu
build_tag="build-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT"
docker image tag skippy-ci-cpu:build "$image:$build_tag"
docker image push "$image:$build_tag"
Expand Down Expand Up @@ -203,7 +203,7 @@ jobs:
ARCH: ${{ matrix.arch }}
run: |
set -euo pipefail
image="ghcr.io/general-inference/skippy-ci-$BACKEND"
image="ghcr.io/mesh-llm/skippy-ci-$BACKEND"
build_tag="build-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT"
latest_tag=latest
if [[ "$ARCH" == arm64 ]]; then
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ jobs:
contents: read
packages: read
container:
image: ghcr.io/general-inference/skippy-ci-cpu:latest
image: ghcr.io/mesh-llm/skippy-ci-cpu:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -436,7 +436,7 @@ jobs:
contents: read
packages: read
container:
image: ghcr.io/general-inference/skippy-ci-cuda12:latest
image: ghcr.io/mesh-llm/skippy-ci-cuda12:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -531,7 +531,7 @@ jobs:
contents: read
packages: read
container:
image: ghcr.io/general-inference/skippy-ci-cuda12:latest-arm64
image: ghcr.io/mesh-llm/skippy-ci-cuda12:latest-arm64
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -579,7 +579,7 @@ jobs:
contents: read
packages: read
container:
image: ghcr.io/general-inference/skippy-ci-cuda13:latest-arm64
image: ghcr.io/mesh-llm/skippy-ci-cuda13:latest-arm64
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
Expand Down
10 changes: 5 additions & 5 deletions ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ archives. JY hardware jobs declare literal runner groups and labels. The full
CI gate matches all package jobs to the plan and checks required device results.

The CPU-only `quality` job runs on GitHub-hosted `ubuntu-24.04` inside
`ghcr.io/general-inference/skippy-ci-cpu:latest` for lint, tests and FFI binding
`ghcr.io/mesh-llm/skippy-ci-cpu:latest` for lint, tests and FFI binding
freshness. The image supplies the pinned Rust toolchain, Just, sccache,
build-essential, mold and LLVM/Clang 22 development inputs. The job verifies
its tools and pulls the private image with its own `GITHUB_TOKEN` using
Expand Down Expand Up @@ -133,7 +133,7 @@ receive this secret.
### CPU dependency image

`ci/Dockerfile` builds the x86_64 CPU dependency image
`ghcr.io/general-inference/skippy-ci-cpu:latest`. It includes **build-essential
`ghcr.io/mesh-llm/skippy-ci-cpu:latest`. It includes **build-essential
and mold**, LLVM/Clang 22 development packages (including `libclang-cpp22-dev`),
libc++/libc++abi 22, OpenMP and sanitizers, Rust/Clippy/rustfmt
from `rust-toolchain.toml`, Just, sccache, CMake, Ninja, Python, jq, OpenSSH client tools and
Expand Down Expand Up @@ -168,9 +168,9 @@ keys. Private same-repository pulls use `GITHUB_TOKEN` with `packages: read`.
### CUDA and ROCm compiler images

The `CI images` workflow also builds
`ghcr.io/general-inference/skippy-ci-cuda12`,
`ghcr.io/general-inference/skippy-ci-cuda13`, and
`ghcr.io/general-inference/skippy-ci-rocm` from digest-pinned vendor development
`ghcr.io/mesh-llm/skippy-ci-cuda12`,
`ghcr.io/mesh-llm/skippy-ci-cuda13`, and
`ghcr.io/mesh-llm/skippy-ci-rocm` from digest-pinned vendor development
images. CUDA 12.9.2 and 13.1.2 use separate images, matching `targets.json`, so
each hosted runner only needs space for one toolkit. Both CUDA toolkits build
on native x86_64 and ARM64 Ubuntu runners.
Expand Down
10 changes: 7 additions & 3 deletions crates/skippy-correctness/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,12 @@ same activation/cache contracts without requiring a monolithic full GGUF.
- `state-handoff` validates state export/import for a whole model or a
stage range selected with `--state-layer-start`, `--state-layer-end`, and
`--state-stage-index`. `--state-payload-kind` selects `full-state`,
`resident-kv`, `recurrent-only`, or `kv-recurrent` payloads. All ranges use
direct local runtime handoff; `full-state` remains the default payload.
`resident-kv`, or `kv-recurrent` payloads. All ranges use direct local
runtime handoff; `full-state` remains the default payload. `kv-recurrent`
carries the parts the stage itself is checkpointed by: a KV page where it
holds attention layers, and recurrent state where it holds recurrent layers,
so a hybrid model's middle stage with no attention layers carries recurrent
state alone.
`--binary-control` is rejected because binary state export/import is
unavailable. Omit it to run the supported local handoff.
The report includes the handoff transport, payload kind, state payload size,
Expand All @@ -229,7 +233,7 @@ same activation/cache contracts without requiring a monolithic full GGUF.
input to exactly that prefix plus one continuation token. Use
`--cache-hit-repeats` to repeatedly attach the exported state and decode the
same continuation, producing a recompute-vs-cache-hit speedup estimate. Use
`--allow-mismatch` only for diagnostic payloads such as recurrent-only.
`--allow-mismatch` only for diagnostic payloads.
- `native-mtp-open-ai-ab` launches a real two-stage `skippy-serving
serve-binary` split three times through the embedded OpenAI frontend. The
baseline run sets `SKIPPY_NATIVE_MTP_ENABLED=0`, the n=1 run sets
Expand Down
3 changes: 2 additions & 1 deletion crates/skippy-correctness/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,8 @@ pub struct GlmDsaStage0TraceArgs {
pub enum StatePayloadKind {
ResidentKv,
FullState,
RecurrentOnly,
/// The stage's exact checkpoint: a KV page where it holds attention
/// layers, and the recurrent state where it holds recurrent layers.
KvRecurrent,
}

Expand Down
1 change: 0 additions & 1 deletion crates/skippy-correctness/src/runner/remote_handoff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,6 @@ fn payload_kind_name(kind: StatePayloadKind) -> &'static str {
match kind {
StatePayloadKind::ResidentKv => "resident-kv",
StatePayloadKind::FullState => "full-state",
StatePayloadKind::RecurrentOnly => "recurrent-only",
StatePayloadKind::KvRecurrent => "kv-recurrent",
}
}
Expand Down
104 changes: 40 additions & 64 deletions crates/skippy-correctness/src/runner/state_handoff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use skippy_protocol::binary::{
recv_reply, state_flags, write_stage_message,
};
use skippy_runtime::{
ActivationFrame, GgufStageRuntimePlan, MtpSource, RuntimeConfig, RuntimeKvPageDesc, StageModel,
StageSession,
ActivationFrame, CheckpointParts, CheckpointShape, GgufStageRuntimePlan, MtpSource,
RuntimeConfig, RuntimeKvPageDesc, StageModel, StageSession,
};

use crate::{
Expand Down Expand Up @@ -96,7 +96,6 @@ pub(in crate::runner) enum LocalStatePayload {
token_count: u64,
},
FullState(Vec<u8>),
RecurrentOnly(Vec<u8>),
KvRecurrent {
kv_desc: Option<RuntimeKvPageDesc>,
kv: Vec<u8>,
Expand All @@ -108,7 +107,7 @@ impl LocalStatePayload {
fn byte_len(&self) -> usize {
match self {
Self::ResidentKv { .. } => 0,
Self::FullState(bytes) | Self::RecurrentOnly(bytes) => bytes.len(),
Self::FullState(bytes) => bytes.len(),
Self::KvRecurrent { kv, recurrent, .. } => kv.len().saturating_add(recurrent.len()),
}
}
Expand All @@ -125,8 +124,7 @@ impl LocalStatePayload {
..
},
) => a_count == b_count,
(Self::FullState(a), Self::FullState(b))
| (Self::RecurrentOnly(a), Self::RecurrentOnly(b)) => a == b,
(Self::FullState(a), Self::FullState(b)) => a == b,
(
Self::KvRecurrent {
kv_desc: a_desc,
Expand Down Expand Up @@ -157,12 +155,6 @@ impl LocalStatePayload {
None,
None,
),
Self::RecurrentOnly(recurrent) => payload_digest_report(
state_payload_kind_name(StatePayloadKind::RecurrentOnly),
recurrent,
None,
Some(recurrent.as_slice()),
),
Self::KvRecurrent { kv, recurrent, .. } => {
let mut hasher = Sha256::new();
hasher.update(b"kv-recurrent:kv:");
Expand Down Expand Up @@ -796,7 +788,7 @@ fn run_local_state_handoff(
let source_prefill_ms = elapsed_ms(source_prefill_started);

let source_export_started = Instant::now();
let state_payload = export_local_state_payload(&mut source, args, prefix.len() as u64)
let state_payload = export_local_state_payload(&model, &mut source, args, prefix.len() as u64)
.context("local state handoff source export failed")?;
let source_export_ms = elapsed_ms(source_export_started);

Expand Down Expand Up @@ -850,7 +842,7 @@ fn run_local_state_handoff(
{
state_payload.clone()
} else {
export_local_state_payload(&mut restore, args, prefix.len() as u64)
export_local_state_payload(&model, &mut restore, args, prefix.len() as u64)
.context("local state handoff restore export failed")?
};
let restore_export_ms = elapsed_ms(restore_export_started);
Expand Down Expand Up @@ -1309,11 +1301,12 @@ fn create_local_cache_hit_session(
let mut session = model
.create_session()
.context("failed to create local state handoff cache-hit session")?;
import_local_state_payload(&mut session, args, payload, token_count, token_ids)?;
import_local_state_payload(model, &mut session, args, payload, token_count, token_ids)?;
Ok(session)
}

fn export_local_state_payload(
model: &StageModel,
session: &mut StageSession,
args: &BinaryStateHandoffConfig,
token_count: u64,
Expand All @@ -1331,18 +1324,24 @@ fn export_local_state_payload(
session
.export_full_state(args.state_layer_start as i32, args.state_layer_end as i32)?,
)),
StatePayloadKind::RecurrentOnly => Ok(LocalStatePayload::RecurrentOnly(
session.export_recurrent_state()?,
)),
StatePayloadKind::KvRecurrent => {
let page = export_optional_kv_page(
session,
args.state_layer_start as i32,
args.state_layer_end as i32,
0,
token_count,
)?;
let recurrent = session.export_recurrent_state()?;
let shape = stage_checkpoint_shape(model)?;
let page = shape
.has_page()
.then(|| {
session.export_kv_page(
args.state_layer_start as i32,
args.state_layer_end as i32,
0,
token_count,
)
})
.transpose()?;
let recurrent = if shape.has_recurrent() {
session.export_recurrent_state()?
} else {
Vec::new()
};
Ok(LocalStatePayload::KvRecurrent {
kv_desc: page.as_ref().map(|page| page.desc.clone()),
kv: page.map(|page| page.payload).unwrap_or_default(),
Expand Down Expand Up @@ -1374,7 +1373,14 @@ fn measure_resident_state_bytes(
))
}

fn stage_checkpoint_shape(model: &StageModel) -> Result<CheckpointShape> {
model
.checkpoint_shape()
.context("this stage has no exact checkpoint; use --state-payload-kind full-state")
}

fn import_local_state_payload(
model: &StageModel,
session: &mut StageSession,
args: &BinaryStateHandoffConfig,
payload: &LocalStatePayload,
Expand All @@ -1400,51 +1406,26 @@ fn import_local_state_payload(
bytes,
token_count,
),
LocalStatePayload::RecurrentOnly(bytes) => {
session.import_recurrent_state_for_token_count(bytes, token_count)
}
LocalStatePayload::KvRecurrent {
kv_desc,
kv,
recurrent,
} => {
if let Some(kv_desc) = kv_desc {
session.import_kv_page(kv_desc, kv)?;
} else if !kv.is_empty() {
bail!("KV-recurrent payload has KV bytes but no KV descriptor");
}
session.import_recurrent_state_for_token_count(recurrent, token_count)
let page = match kv_desc {
Some(kv_desc) => Some((kv_desc, kv.as_slice())),
None if kv.is_empty() => None,
None => bail!("KV-recurrent payload has KV bytes but no KV descriptor"),
};
let parts = CheckpointParts::fit(stage_checkpoint_shape(model)?, page, recurrent)?;
session.import_checkpoint(&parts, token_count, &[])
}
}
}

fn export_optional_kv_page(
session: &mut StageSession,
layer_start: i32,
layer_end: i32,
token_start: u64,
token_count: u64,
) -> Result<Option<skippy_runtime::RuntimeKvPage>> {
match session.export_kv_page(layer_start, layer_end, token_start, token_count) {
Ok(page) => Ok(Some(page)),
Err(error) if is_native_kv_unavailable(&error) => Ok(None),
Err(error) => Err(error),
}
}

fn is_native_kv_unavailable(error: &anyhow::Error) -> bool {
error.chain().any(|cause| {
let message = cause.to_string();
message.contains("runtime memory type is not supported for native KV pages")
|| message.contains("runtime has no attention KV cache")
})
}

fn state_payload_kind_name(kind: StatePayloadKind) -> &'static str {
match kind {
StatePayloadKind::ResidentKv => "resident-kv",
StatePayloadKind::FullState => "full-state",
StatePayloadKind::RecurrentOnly => "recurrent-only",
StatePayloadKind::KvRecurrent => "kv-recurrent",
}
}
Expand Down Expand Up @@ -1872,12 +1853,7 @@ mod tests {

#[test]
fn binary_control_rejects_every_payload_before_model_or_server_access() {
for payload in [
"resident-kv",
"full-state",
"recurrent-only",
"kv-recurrent",
] {
for payload in ["resident-kv", "full-state", "kv-recurrent"] {
let cli = Cli::try_parse_from([
"skippy-correctness",
"state-handoff",
Expand Down
Loading
Loading