Drop stale docs/ references from scripts, tools and deploy files; add rope-regeneration.json
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
# * secrets - the tokens and the API key are generated into the /state volume on the first start;
|
||||
# * the sealed PTX is embedded in the binaries (sm_120, and the sm_86 companions when built with `sm86`).
|
||||
#
|
||||
# Build context = an unpacked release tarball (it holds bin/ and MANIFEST.json), see docs/deploy.md:
|
||||
# Build context = an unpacked release tarball (it holds bin/ and MANIFEST.json),:
|
||||
# tar -xJf leleka-VERSION-linux-x86_64.tar.xz && cd leleka-VERSION-linux-x86_64
|
||||
# docker build -f /path/to/deploy/Containerfile.rust-runtime -t leleka-runtime:VERSION .
|
||||
#
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# needed on the build machine. Build context: the repository root.
|
||||
# docker build -f deploy/Dockerfile.windows-build -o type=local,dest=dist/windows .
|
||||
# The binaries are written to dist/windows (ignored by Git). The mingw runtime is linked statically; OpenVINO is
|
||||
# still loaded at run time from a separately obtained install (see docs/windows-runtime.md).
|
||||
# still loaded at run time from a separately obtained install.
|
||||
FROM rust:1.99-bookworm AS build
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64 cmake \
|
||||
|
||||
+8
-8
@@ -4,7 +4,7 @@ Linux CI builds a statically linked musl CLI/control-plane preview and publishes
|
||||
|
||||
For a local static CLI image smoke test, build `deploy/Dockerfile.static-cli` with a Linux/musl target. The final image is `scratch` plus the CLI binary. It is a packaging test, not the deployment image for inference.
|
||||
|
||||
The Rust engine pair (`leleka-inference` behind `leleka-daemon`) is a separate runtime from `leleka-api` plus the C++ engine described below: its run recipe, example configuration and systemd templates are in [`docs/rust-runtime-run.md`](../docs/rust-runtime-run.md) and [`deploy/rust-runtime/`](rust-runtime/), and the open delivery items are in [`docs/delivery-gap-audit.md`](../docs/delivery-gap-audit.md). It needs CUDA 12 `libcublas.so.12` (not the `.so.13` named below) and a driver of 595 or newer.
|
||||
The Rust engine pair (`leleka-inference` behind `leleka-daemon`) is a separate runtime from `leleka-api` plus the C++ engine described below: its run recipe, example configuration and systemd templates are in spec node `rust-runtime-run.md` and [`deploy/rust-runtime/`](rust-runtime/), and the open delivery items are in spec node `delivery-gap-audit.md`. It needs CUDA 12 `libcublas.so.12` (not the `.so.13` named below) and a driver of 595 or newer.
|
||||
|
||||
## Worker recovery
|
||||
|
||||
@@ -15,7 +15,7 @@ POSTs receive 429 `runtime_overloaded` and `Retry-After: 1` before parsing;
|
||||
drain still returns 503. This covers queued requests and streaming bodies,
|
||||
not GPU concurrency. `/admin/lifecycle` exposes the limit and available request
|
||||
slots; `check-config` validates and reports the limit. See
|
||||
[admission lifecycle](../docs/api-contract.md#admission-lifecycle) for scope.
|
||||
admission lifecycle (spec node `api-contract.md`) for scope.
|
||||
|
||||
The Rust supervisor defaults to three lifetime restarts after a post-READY
|
||||
worker failure, with 2/4/8-second backoff. Configure `engine.max_restarts` or
|
||||
@@ -23,7 +23,7 @@ worker failure, with 2/4/8-second backoff. Configure `engine.max_restarts` or
|
||||
queued generations are not replayed. Readiness stays false until the new
|
||||
worker handshake completes. A startup failure or an exhausted budget leaves
|
||||
the service unhealthy for inference until an operator restarts it; `/health`
|
||||
remains available. See [the API contract](../docs/api-contract.md).
|
||||
remains available. See the API contract (spec node `api-contract.md`).
|
||||
|
||||
Top-level `queue_timeout_s` (or `STRATA_QUEUE_TIMEOUT_S`, 1–86400 seconds) optionally
|
||||
bounds waiting for a worker to claim an inference command. It is disabled by
|
||||
@@ -56,7 +56,7 @@ than attempting to reuse its unfinished protocol stream. The failed command
|
||||
and queued work are never replayed. The existing finite restart budget applies;
|
||||
model loading and caches must be rebuilt after restart. With zero restarts the
|
||||
worker remains failed. Connected clients receive the terminal failure described
|
||||
in [the API contract](../docs/api-contract.md#active-generation-deadline).
|
||||
in the API contract (spec node `api-contract.md`).
|
||||
|
||||
## Native Linux service lifecycle
|
||||
|
||||
@@ -283,7 +283,7 @@ whitespace, because systemd interprets that directive as a filename pattern.
|
||||
also set; other documented environment overrides still apply. Keep the API
|
||||
bound to loopback and use SSH forwarding; optional bearer authentication does
|
||||
not provide transport encryption. Set `STRATA_API_KEY_FILE` to a private key
|
||||
file to enable the [native auth gate](../docs/api-contract.md#optional-bearer-authentication).
|
||||
file to enable the native auth gate (spec node `api-contract.md`).
|
||||
|
||||
Systemd process startup is not model readiness: check the configured `/ready`
|
||||
endpoint before connecting the console harness. `Restart=no` preserves the
|
||||
@@ -515,7 +515,7 @@ full payload and require memory and disk space proportional to its size.
|
||||
`leleka-api engine-help` materializes the embedded worker and runs its `--help`
|
||||
with no GPU visible; this checks loading and help output, not model readiness.
|
||||
`leleka-api --engine-license` prints the imported Strata MIT license. The
|
||||
upstream record in `docs/upstream.md` remains authoritative and unchanged.
|
||||
upstream record in `engine/upstream.md` remains authoritative and unchanged.
|
||||
Select the embedded worker explicitly in the usual configuration:
|
||||
|
||||
```json
|
||||
@@ -636,7 +636,7 @@ embedded identity verification and `engine-help` with `LD_LIBRARY_PATH` unset
|
||||
and no GPU visible. The outer musl executable has no ELF interpreter or
|
||||
DT_NEEDED entries; the embedded engine retains the glibc/driver requirements
|
||||
above. The earlier 63 MB combined preview remains a separate fallback containing
|
||||
the dynamic engine. See the [packaging report](../docs/experiments/2026-10-04-large-embedded-package.md).
|
||||
the dynamic engine. See the packaging report (spec node `experiments/2026-10-04-large-embedded-package.md`).
|
||||
No quality, numerical parity, speedup or production-ready claim follows from
|
||||
linking successfully. Keep the default profile until the model gates pass.
|
||||
|
||||
@@ -767,7 +767,7 @@ v3/v4 expert table against the unmodified pinned `tools/iq_pack.py` oracle on
|
||||
small single/split GGUF fixtures, including per-role shard offsets. Numerical
|
||||
and byte tolerance is zero. `scripts/offline/diff_native_pack.py` extends this to
|
||||
thousands of generated cases plus the full CLI with `--compat-bf16`, `--base` and
|
||||
`--experts-bin` (see `docs/offline-port.md`). Python/numpy are test-only dependencies. This does
|
||||
`--experts-bin` (see `spec node offline-port.md`). Python/numpy are test-only dependencies. This does
|
||||
not establish full-model GPU readiness: real-model pack parity and clean-node
|
||||
GPU startup still require their separate gates. Automatic fetch/prepare/start
|
||||
orchestration remains a subsequent integration step.
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
# Rust crates linked into the six shipped binaries (normal dependencies of leleka-deploy, leleka-control-plane, leleka-engine-host; x86_64-unknown-linux-gnu; default features)
|
||||
# Cargo.lock sha256 (LF-normalised) 84b74b1d6a56c3245104dbb8f3bd78671991a55e4aed4cceae1bbfcc03218ade ; generated offline with cargo metadata --locked --offline on 2026-11-03, base 4cbbd2729
|
||||
# name version SPDX licence expression (as declared by the crate) repository
|
||||
ahash 0.8.12 MIT OR Apache-2.0 https://github.com/tkaitchuck/ahash
|
||||
aho-corasick 1.1.5 Unlicense OR MIT https://github.com/BurntSushi/aho-corasick
|
||||
allocator-api2 0.2.21 MIT OR Apache-2.0 https://github.com/zakarumych/allocator-api2
|
||||
anyhow 1.0.104 MIT OR Apache-2.0 https://github.com/dtolnay/anyhow
|
||||
async-stream 0.3.6 MIT https://github.com/tokio-rs/async-stream
|
||||
async-stream-impl 0.3.6 MIT https://github.com/tokio-rs/async-stream
|
||||
async-trait 0.1.92 MIT OR Apache-2.0 https://github.com/dtolnay/async-trait
|
||||
atomic-waker 1.1.2 Apache-2.0 OR MIT https://github.com/smol-rs/atomic-waker
|
||||
aws-lc-rs 1.18.1 ISC AND (Apache-2.0 OR ISC) https://github.com/aws/aws-lc-rs
|
||||
aws-lc-sys 0.45.0 ISC AND (Apache-2.0 OR ISC) AND Apache-2.0 AND MIT AND BSD-3-Clause AND (Apache-2.0 OR ISC OR MIT) AND (Apache-2.0 OR ISC OR MIT-0) https://github.com/aws/aws-lc-rs
|
||||
axum 0.8.9 MIT https://github.com/tokio-rs/axum
|
||||
axum-core 0.5.6 MIT https://github.com/tokio-rs/axum
|
||||
base64 0.22.1 MIT OR Apache-2.0 https://github.com/marshallpierce/rust-base64
|
||||
base64 0.23.1 MIT OR Apache-2.0 https://github.com/marshallpierce/rust-base64
|
||||
bit-set 0.8.0 Apache-2.0 OR MIT https://github.com/contain-rs/bit-set
|
||||
bit-vec 0.8.0 Apache-2.0 OR MIT https://github.com/contain-rs/bit-vec
|
||||
bitflags 2.13.2 MIT OR Apache-2.0 https://github.com/bitflags/bitflags
|
||||
block-buffer 0.12.1 MIT OR Apache-2.0 https://github.com/RustCrypto/utils
|
||||
borrow-or-share 0.2.4 MIT-0 https://github.com/yescallop/borrow-or-share
|
||||
bytecount 0.6.9 Apache-2.0/MIT https://github.com/llogiq/bytecount
|
||||
bytes 1.12.1 MIT https://github.com/tokio-rs/bytes
|
||||
cfg-if 1.0.5 MIT OR Apache-2.0 https://github.com/rust-lang/cfg-if
|
||||
chacha20 0.10.2 MIT OR Apache-2.0 https://github.com/RustCrypto/stream-ciphers
|
||||
const-oid 0.10.2 Apache-2.0 OR MIT https://github.com/RustCrypto/formats
|
||||
cpufeatures 0.3.1 MIT OR Apache-2.0 https://github.com/RustCrypto/utils
|
||||
crypto-common 0.2.2 MIT OR Apache-2.0 https://github.com/RustCrypto/traits
|
||||
data-encoding 2.11.1 MIT https://github.com/ia0/data-encoding
|
||||
digest 0.11.3 MIT OR Apache-2.0 https://github.com/RustCrypto/traits
|
||||
displaydoc 0.2.7 MIT OR Apache-2.0 https://github.com/yaahc/displaydoc
|
||||
either 1.18.0 MIT OR Apache-2.0 https://github.com/rayon-rs/either
|
||||
email_address 0.2.9 MIT https://github.com/johnstonskj/rust-email_address.git
|
||||
equivalent 1.0.2 Apache-2.0 OR MIT https://github.com/indexmap-rs/equivalent
|
||||
errno 0.3.14 MIT OR Apache-2.0 https://github.com/lambda-fairy/rust-errno
|
||||
fancy-regex 0.19.2 MIT https://github.com/fancy-regex/fancy-regex
|
||||
fluent-uri 0.4.1 MIT https://github.com/yescallop/fluent-uri-rs
|
||||
fnv 1.0.7 Apache-2.0 / MIT https://github.com/servo/rust-fnv
|
||||
foldhash 0.2.0 Zlib https://github.com/orlp/foldhash
|
||||
form_urlencoded 1.2.2 MIT OR Apache-2.0 https://github.com/servo/rust-url
|
||||
fraction 0.17.0 MIT OR Apache-2.0 https://github.com/dnsl48/fraction.git
|
||||
futures-channel 0.3.34 MIT OR Apache-2.0 https://github.com/rust-lang/futures-rs
|
||||
futures-core 0.3.34 MIT OR Apache-2.0 https://github.com/rust-lang/futures-rs
|
||||
futures-io 0.3.34 MIT OR Apache-2.0 https://github.com/rust-lang/futures-rs
|
||||
futures-macro 0.3.34 MIT OR Apache-2.0 https://github.com/rust-lang/futures-rs
|
||||
futures-sink 0.3.34 MIT OR Apache-2.0 https://github.com/rust-lang/futures-rs
|
||||
futures-task 0.3.34 MIT OR Apache-2.0 https://github.com/rust-lang/futures-rs
|
||||
futures-util 0.3.34 MIT OR Apache-2.0 https://github.com/rust-lang/futures-rs
|
||||
getrandom 0.4.3 MIT OR Apache-2.0 https://github.com/rust-random/getrandom
|
||||
getrandom 0.3.4 MIT OR Apache-2.0 https://github.com/rust-random/getrandom
|
||||
getrandom 0.2.17 MIT OR Apache-2.0 https://github.com/rust-random/getrandom
|
||||
h2 0.4.19 MIT https://github.com/hyperium/h2
|
||||
hashbrown 0.17.1 MIT OR Apache-2.0 https://github.com/rust-lang/hashbrown
|
||||
heck 0.5.0 MIT OR Apache-2.0 https://github.com/withoutboats/heck
|
||||
hex 0.4.3 MIT OR Apache-2.0 https://github.com/KokaKiwi/rust-hex
|
||||
http 1.5.0 MIT OR Apache-2.0 https://github.com/hyperium/http
|
||||
http-body 1.1.0 MIT https://github.com/hyperium/http-body
|
||||
http-body-util 0.1.5 MIT https://github.com/hyperium/http-body
|
||||
httparse 1.10.1 MIT OR Apache-2.0 https://github.com/seanmonstar/httparse
|
||||
httpdate 1.0.3 MIT OR Apache-2.0 https://github.com/pyfisch/httpdate
|
||||
hybrid-array 0.4.15 MIT OR Apache-2.0 https://github.com/RustCrypto/hybrid-array
|
||||
hyper 1.11.1 MIT https://github.com/hyperium/hyper
|
||||
hyper-rustls 0.27.10 Apache-2.0 OR ISC OR MIT https://github.com/rustls/hyper-rustls
|
||||
hyper-timeout 0.5.2 MIT OR Apache-2.0 https://github.com/hjr3/hyper-timeout
|
||||
hyper-util 0.1.21 MIT https://github.com/hyperium/hyper-util
|
||||
icu_collections 2.3.0 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
icu_locale_core 2.3.0 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
icu_normalizer 2.3.0 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
icu_normalizer_data 2.3.0 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
icu_properties 2.3.0 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
icu_properties_data 2.3.0 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
icu_provider 2.3.1 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
idna 1.1.0 MIT OR Apache-2.0 https://github.com/servo/rust-url/
|
||||
idna_adapter 1.2.2 Apache-2.0 OR MIT https://github.com/hsivonen/idna_adapter
|
||||
indexmap 2.14.2 Apache-2.0 OR MIT https://github.com/indexmap-rs/indexmap
|
||||
ipnet 2.12.2 MIT OR Apache-2.0 https://github.com/krisprice/ipnet
|
||||
itertools 0.14.0 MIT OR Apache-2.0 https://github.com/rust-itertools/itertools
|
||||
itoa 1.0.18 MIT OR Apache-2.0 https://github.com/dtolnay/itoa
|
||||
jsonschema 0.58.5 MIT https://github.com/Stranger6667/jsonschema
|
||||
jsonschema-regex 0.58.5 MIT https://github.com/Stranger6667/jsonschema
|
||||
jsonschema-value 0.58.5 MIT https://github.com/Stranger6667/jsonschema
|
||||
libc 0.2.190 MIT OR Apache-2.0 https://github.com/rust-lang/libc
|
||||
libm 0.2.16 MIT https://github.com/rust-lang/compiler-builtins
|
||||
linux-raw-sys 0.12.1 Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT https://github.com/sunfishcode/linux-raw-sys
|
||||
litemap 0.8.3 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
lock_api 0.4.14 MIT OR Apache-2.0 https://github.com/Amanieu/parking_lot
|
||||
log 0.4.34 MIT OR Apache-2.0 https://github.com/rust-lang/log
|
||||
lru-slab 0.1.3 MIT OR Apache-2.0 OR Zlib https://github.com/Ralith/lru-slab
|
||||
matchit 0.8.4 MIT AND BSD-3-Clause https://github.com/ibraheemdev/matchit
|
||||
memchr 2.8.3 Unlicense OR MIT https://github.com/BurntSushi/memchr
|
||||
memo-map 0.3.4 Apache-2.0 https://github.com/mitsuhiko/memo-map
|
||||
micromap 0.3.0 MIT https://github.com/yegor256/micromap
|
||||
mime 0.3.17 MIT OR Apache-2.0 https://github.com/hyperium/mime
|
||||
minijinja 2.24.0 Apache-2.0 https://github.com/mitsuhiko/minijinja
|
||||
minijinja-contrib 2.24.0 Apache-2.0 https://github.com/mitsuhiko/minijinja
|
||||
mio 1.2.4 MIT https://github.com/tokio-rs/mio
|
||||
num 0.4.3 MIT OR Apache-2.0 https://github.com/rust-num/num
|
||||
num-bigint 0.4.8 MIT OR Apache-2.0 https://github.com/rust-num/num-bigint
|
||||
num-cmp 0.1.0 MIT/Apache-2.0 https://github.com/lifthrasiir/num-cmp
|
||||
num-complex 0.4.6 MIT OR Apache-2.0 https://github.com/rust-num/num-complex
|
||||
num-integer 0.1.47 MIT OR Apache-2.0 https://github.com/rust-num/num-integer
|
||||
num-iter 0.1.46 MIT OR Apache-2.0 https://github.com/rust-num/num-iter
|
||||
num-rational 0.4.2 MIT OR Apache-2.0 https://github.com/rust-num/num-rational
|
||||
num-traits 0.2.19 MIT OR Apache-2.0 https://github.com/rust-num/num-traits
|
||||
once_cell 1.21.4 MIT OR Apache-2.0 https://github.com/matklad/once_cell
|
||||
openssl-probe 0.2.1 MIT OR Apache-2.0 https://github.com/rustls/openssl-probe
|
||||
outref 0.5.2 MIT https://github.com/Nugine/outref
|
||||
parking_lot 0.12.5 MIT OR Apache-2.0 https://github.com/Amanieu/parking_lot
|
||||
parking_lot_core 0.9.12 MIT OR Apache-2.0 https://github.com/Amanieu/parking_lot
|
||||
percent-encoding 2.3.2 MIT OR Apache-2.0 https://github.com/servo/rust-url/
|
||||
pin-project 1.1.13 Apache-2.0 OR MIT https://github.com/taiki-e/pin-project
|
||||
pin-project-internal 1.1.13 Apache-2.0 OR MIT https://github.com/taiki-e/pin-project
|
||||
pin-project-lite 0.2.17 Apache-2.0 OR MIT https://github.com/taiki-e/pin-project-lite
|
||||
potential_utf 0.1.6 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
proc-macro2 1.0.107 MIT OR Apache-2.0 https://github.com/dtolnay/proc-macro2
|
||||
prost 0.14.4 Apache-2.0 https://github.com/tokio-rs/prost
|
||||
prost-derive 0.14.4 Apache-2.0 https://github.com/tokio-rs/prost
|
||||
quinn 0.11.12 MIT OR Apache-2.0 https://github.com/quinn-rs/quinn
|
||||
quinn-proto 0.11.19 MIT OR Apache-2.0 https://github.com/quinn-rs/quinn
|
||||
quinn-udp 0.5.16 MIT OR Apache-2.0 https://github.com/quinn-rs/quinn
|
||||
quote 1.0.47 MIT OR Apache-2.0 https://github.com/dtolnay/quote
|
||||
rand 0.10.3 MIT OR Apache-2.0 https://github.com/rust-random/rand
|
||||
rand_core 0.10.1 MIT OR Apache-2.0 https://github.com/rust-random/rand_core
|
||||
rand_pcg 0.10.2 MIT OR Apache-2.0 https://github.com/rust-random/rngs
|
||||
ref-cast 1.0.27 MIT OR Apache-2.0 https://github.com/dtolnay/ref-cast
|
||||
ref-cast-impl 1.0.27 MIT OR Apache-2.0 https://github.com/dtolnay/ref-cast
|
||||
referencing 0.58.5 MIT https://github.com/Stranger6667/jsonschema
|
||||
regex 1.13.1 MIT OR Apache-2.0 https://github.com/rust-lang/regex
|
||||
regex-automata 0.4.18 MIT OR Apache-2.0 https://github.com/rust-lang/regex
|
||||
regex-syntax 0.8.11 MIT OR Apache-2.0 https://github.com/rust-lang/regex
|
||||
reqwest 0.13.5 MIT OR Apache-2.0 https://github.com/seanmonstar/reqwest
|
||||
ring 0.17.14 Apache-2.0 AND ISC https://github.com/briansmith/ring
|
||||
rustc-hash 2.1.3 Apache-2.0 OR MIT https://github.com/rust-lang/rustc-hash
|
||||
rustix 1.1.5 Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT https://github.com/bytecodealliance/rustix
|
||||
rustls 0.23.45 Apache-2.0 OR ISC OR MIT https://github.com/rustls/rustls
|
||||
rustls-native-certs 0.8.4 Apache-2.0 OR ISC OR MIT https://github.com/rustls/rustls-native-certs
|
||||
rustls-pki-types 1.15.1 MIT OR Apache-2.0 https://github.com/rustls/pki-types
|
||||
rustls-platform-verifier 0.7.1 MIT OR Apache-2.0 https://github.com/rustls/rustls-platform-verifier
|
||||
rustls-webpki 0.103.15 ISC https://github.com/rustls/webpki
|
||||
ryu 1.0.23 Apache-2.0 OR BSL-1.0 https://github.com/dtolnay/ryu
|
||||
scopeguard 1.2.0 MIT OR Apache-2.0 https://github.com/bluss/scopeguard
|
||||
serde 1.0.229 MIT OR Apache-2.0 https://github.com/serde-rs/serde
|
||||
serde_core 1.0.229 MIT OR Apache-2.0 https://github.com/serde-rs/serde
|
||||
serde_derive 1.0.229 MIT OR Apache-2.0 https://github.com/serde-rs/serde
|
||||
serde_json 1.0.151 MIT OR Apache-2.0 https://github.com/serde-rs/json
|
||||
serde_path_to_error 0.1.20 MIT OR Apache-2.0 https://github.com/dtolnay/path-to-error
|
||||
serde_urlencoded 0.7.1 MIT/Apache-2.0 https://github.com/nox/serde_urlencoded
|
||||
sha2 0.11.0 MIT OR Apache-2.0 https://github.com/RustCrypto/hashes
|
||||
signal-hook-registry 1.4.8 MIT OR Apache-2.0 https://github.com/vorner/signal-hook
|
||||
slab 0.4.12 MIT https://github.com/tokio-rs/slab
|
||||
smallvec 1.16.2 MIT OR Apache-2.0 https://github.com/servo/rust-smallvec
|
||||
socket2 0.6.5 MIT OR Apache-2.0 https://github.com/rust-lang/socket2
|
||||
stable_deref_trait 1.2.1 MIT OR Apache-2.0 https://github.com/storyyeller/stable_deref_trait
|
||||
strum 0.28.0 MIT https://github.com/Peternator7/strum
|
||||
strum_macros 0.28.0 MIT https://github.com/Peternator7/strum
|
||||
subtle 2.6.1 BSD-3-Clause https://github.com/dalek-cryptography/subtle
|
||||
syn 3.0.6 MIT OR Apache-2.0 https://github.com/dtolnay/syn
|
||||
syn 2.0.119 MIT OR Apache-2.0 https://github.com/dtolnay/syn
|
||||
sync_wrapper 1.0.2 Apache-2.0 https://github.com/Actyx/sync_wrapper
|
||||
synstructure 0.14.0 MIT https://github.com/mystor/synstructure
|
||||
sysinfo 0.39.6 MIT https://github.com/GuillaumeGomez/sysinfo
|
||||
thiserror 2.0.21 MIT OR Apache-2.0 https://github.com/dtolnay/thiserror
|
||||
thiserror-impl 2.0.21 MIT OR Apache-2.0 https://github.com/dtolnay/thiserror
|
||||
tinystr 0.8.4 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
tinyvec 1.13.3 Zlib OR Apache-2.0 OR MIT https://github.com/Lokathor/tinyvec
|
||||
tokio 1.53.2 MIT https://github.com/tokio-rs/tokio
|
||||
tokio-macros 2.7.2 MIT https://github.com/tokio-rs/tokio
|
||||
tokio-rustls 0.26.6 MIT OR Apache-2.0 https://github.com/rustls/tokio-rustls
|
||||
tokio-stream 0.1.19 MIT https://github.com/tokio-rs/tokio
|
||||
tokio-util 0.7.19 MIT https://github.com/tokio-rs/tokio
|
||||
tonic 0.14.6 MIT https://github.com/hyperium/tonic
|
||||
tonic-prost 0.14.6 MIT https://github.com/hyperium/tonic
|
||||
tower 0.5.3 MIT https://github.com/tower-rs/tower
|
||||
tower-http 0.6.11 MIT https://github.com/tower-rs/tower-http
|
||||
tower-layer 0.3.3 MIT https://github.com/tower-rs/tower
|
||||
tower-service 0.3.3 MIT https://github.com/tower-rs/tower
|
||||
tracing 0.1.44 MIT https://github.com/tokio-rs/tracing
|
||||
tracing-attributes 0.1.31 MIT https://github.com/tokio-rs/tracing
|
||||
tracing-core 0.1.36 MIT https://github.com/tokio-rs/tracing
|
||||
try-lock 0.2.5 MIT https://github.com/seanmonstar/try-lock
|
||||
typenum 1.20.1 MIT OR Apache-2.0 https://github.com/paholg/typenum
|
||||
unicode-general-category 1.1.0 Apache-2.0 https://github.com/yeslogic/unicode-general-category
|
||||
unicode-ident 1.0.26 (MIT OR Apache-2.0) AND Unicode-3.0 https://github.com/dtolnay/unicode-ident
|
||||
untrusted 0.9.0 ISC https://github.com/briansmith/untrusted
|
||||
url 2.5.8 MIT OR Apache-2.0 https://github.com/servo/rust-url
|
||||
utf8_iter 1.0.4 Apache-2.0 OR MIT https://github.com/hsivonen/utf8_iter
|
||||
uuid 1.27.0 Apache-2.0 OR MIT https://github.com/uuid-rs/uuid
|
||||
uuid-simd 0.8.0 MIT https://github.com/Nugine/simd
|
||||
vsimd 0.8.0 MIT https://github.com/Nugine/simd
|
||||
want 0.3.1 MIT https://github.com/seanmonstar/want
|
||||
webpki-root-certs 1.0.9 CDLA-Permissive-2.0 https://github.com/rustls/webpki-roots
|
||||
writeable 0.6.4 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
yoke 0.8.3 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
yoke-derive 0.8.4 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
zerocopy 0.8.59 BSD-2-Clause OR Apache-2.0 OR MIT https://github.com/google/zerocopy
|
||||
zerocopy-derive 0.8.59 BSD-2-Clause OR Apache-2.0 OR MIT https://github.com/google/zerocopy
|
||||
zerofrom 0.1.8 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
zerofrom-derive 0.1.8 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
zeroize 1.9.0 Apache-2.0 OR MIT https://github.com/RustCrypto/utils
|
||||
zerotrie 0.2.5 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
zerovec 0.11.8 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
zerovec-derive 0.11.6 Unicode-3.0 https://github.com/unicode-org/icu4x
|
||||
zmij 1.0.23 MIT https://github.com/dtolnay/zmij
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# TEMPLATE, not run with the real model: user unit for the engine process (gRPC on loopback).
|
||||
# Replace @PREFIX@ (binaries), @ASSETS@ (model assets), @STATE@ (private state dir) and install runtime.env
|
||||
# next to it (mode 0600). The 55 GB KAR archive is copied into a sealed memfd at every start (RAM, minutes);
|
||||
# nothing loads the model afterwards: run `leleka-cli ... load-mtp` (docs/rust-runtime-run.md).
|
||||
# nothing loads the model afterwards: run `leleka-cli ... load-mtp`.
|
||||
[Unit]
|
||||
Description=Leleka inference engine (Original serve path, gRPC on loopback)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rtx3080-16g",
|
||||
"description": "RTX 3080 Laptop class (sm_86, 16 GB VRAM, 24-48 GB RAM, typically WSL2). The KAR archive stays an ordinary read-only file (no 55 GB memfd), routed experts are served from the memory-mapped shards. Context 262144 (the owner's real work; measured natively under the workstation preset), prompt chunk and prefix-cache grid 6144 with prompt-end checkpoints (paired 256k sessions on this laptop, docs/laptop-vs-vanilla.md: prefill 110 -> 176-290 tok/s, TTFT sum 2,100+ s -> 998-1,083 s with the conversation cache and about 5 % more with the prefix cache as shipped, against vanilla's 1,248 s; 6144 changes the rounding order of the prompt path and has no quality gate yet). Expert tier layout pinned to the global rank fill (engine_env LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=no, which is also the engine default: a pin, not a change). None of the other 5090 defaults is applied here: PCIe share 0.65, tail skip, swap bursts, PLE on chain and the sm_120 kernel switches are measured losses, lossy, unevidenced or inert on sm_86 (docs/laptop-profile.md \"Update 2026-11-13\"); the lossy route tail skip stays an opt-in key (LELEKA_ROUTE_TAIL_SKIP=7 in a copy of this profile). Experimental (docs/laptop-profile.md): measured on one laptop, no quality claim.",
|
||||
"description": "RTX 3080 Laptop class (sm_86, 16 GB VRAM, 24-48 GB RAM, typically WSL2). The KAR archive stays an ordinary read-only file (no 55 GB memfd), routed experts are served from the memory-mapped shards. Context 262144 (the owner's real work; measured natively under the workstation preset), prompt chunk and prefix-cache grid 6144 with prompt-end checkpoints (paired 256k sessions on this laptop, spec node laptop-vs-vanilla.md: prefill 110 -> 176-290 tok/s, TTFT sum 2,100+ s -> 998-1,083 s with the conversation cache and about 5 % more with the prefix cache as shipped, against vanilla's 1,248 s; 6144 changes the rounding order of the prompt path and has no quality gate yet). Expert tier layout pinned to the global rank fill (engine_env LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=no, which is also the engine default: a pin, not a change). None of the other 5090 defaults is applied here: PCIe share 0.65, tail skip, swap bursts, PLE on chain and the sm_120 kernel switches are measured losses, lossy, unevidenced or inert on sm_86 (spec node laptop-profile.md \"Update 2026-11-13\"); the lossy route tail skip stays an opt-in key (LELEKA_ROUTE_TAIL_SKIP=7 in a copy of this profile). Experimental (spec node laptop-profile.md): measured on one laptop, no quality claim.",
|
||||
"select": {"sm_min": 80, "sm_max": 120, "vram_mib_min": 14000, "vram_mib_max": 24000},
|
||||
"gpu_budget_bytes": 16106127360,
|
||||
"context_tokens": 262144,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rtx5090-32g-file",
|
||||
"description": "RTX 5090 class server with the KAR archive served as an ordinary read-only FILE instead of a 55 GB sealed memfd (EXPERIMENTAL, not auto-selected: pass --profile rtx5090-32g-file; everything else is rtx5090-32g). Nothing is copied into RAM and no holder is needed: the engine reads only the PLE rows a request needs (3 positional reads of a few bytes per row) through the OS page cache, which keeps what was read across engine restarts while RAM allows and gives it back under pressure instead of failing. Start-up reads the header, directory and books (~1 MB) when the verification stamp of the archive is current; the first start after the file changed hashes it once (55 GB) and records the stamp. Immutability rests on the file system (regular file, mode 0400, one link, owner = service user) and on the engine comparing the file's inode, size, mtime and ctime with the state it verified on every row read; the sealed memfd cannot change at all. A cold first request pays random 4 KiB reads from the model volume. Prefix cache explicit 6144 MiB so the RAM that the memfd no longer holds is not handed to the cache. No quality claim and no speed claim: the A/B is scripts/e2e/decode/kar-file-ab.sh (docs/kar-file-source.md).",
|
||||
"description": "RTX 5090 class server with the KAR archive served as an ordinary read-only FILE instead of a 55 GB sealed memfd (EXPERIMENTAL, not auto-selected: pass --profile rtx5090-32g-file; everything else is rtx5090-32g). Nothing is copied into RAM and no holder is needed: the engine reads only the PLE rows a request needs (3 positional reads of a few bytes per row) through the OS page cache, which keeps what was read across engine restarts while RAM allows and gives it back under pressure instead of failing. Start-up reads the header, directory and books (~1 MB) when the verification stamp of the archive is current; the first start after the file changed hashes it once (55 GB) and records the stamp. Immutability rests on the file system (regular file, mode 0400, one link, owner = service user) and on the engine comparing the file's inode, size, mtime and ctime with the state it verified on every row read; the sealed memfd cannot change at all. A cold first request pays random 4 KiB reads from the model volume. Prefix cache explicit 6144 MiB so the RAM that the memfd no longer holds is not handed to the cache. No quality claim and no speed claim: the A/B is scripts/e2e/decode/kar-file-ab.sh (spec node kar-file-source.md).",
|
||||
"select": {"sm_min": 0, "sm_max": 0, "vram_mib_min": 0, "vram_mib_max": 0},
|
||||
"gpu_budget_bytes": 32819404800,
|
||||
"spec_min_p": 0.0,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rtx5090-32g-gguf-ple",
|
||||
"description": "RTX 5090 class server WITHOUT the KAR level-2 PLE archive (EXPERIMENTAL A/B arm, not auto-selected: pass --profile rtx5090-32g-gguf-ple; everything else is rtx5090-32g). kar_source none: no archive is required, verified, sealed or passed to the engine, and the model is loaded as qwen4exp-native-mtp-v1, whose per-layer n-gram (PLE) rows come from the 28.8 GB GGUF shard 1 exactly as the Original reads them (lossless against the shard; KAR level 2 is a quantised re-encoding of that table). The shard is read through the OS page cache (engine_env LELEKA_PLE_DIRECT 0: after the first pass the table is RAM-resident, the form vanilla Strata gets with --ple-io ram, instead of O_DIRECT reads of the SSD that the engine defaults to on Linux); the row cache and reader depth keep the engine defaults. No memfd and no holder is needed. Prefix cache explicit 6144 MiB like the server profile. No quality claim and no speed claim: the paired A/B against rtx5090-32g is docs/experiments/kar-off-ab-5090.md.",
|
||||
"description": "RTX 5090 class server WITHOUT the KAR level-2 PLE archive (EXPERIMENTAL A/B arm, not auto-selected: pass --profile rtx5090-32g-gguf-ple; everything else is rtx5090-32g). kar_source none: no archive is required, verified, sealed or passed to the engine, and the model is loaded as qwen4exp-native-mtp-v1, whose per-layer n-gram (PLE) rows come from the 28.8 GB GGUF shard 1 exactly as the Original reads them (lossless against the shard; KAR level 2 is a quantised re-encoding of that table). The shard is read through the OS page cache (engine_env LELEKA_PLE_DIRECT 0: after the first pass the table is RAM-resident, the form vanilla Strata gets with --ple-io ram, instead of O_DIRECT reads of the SSD that the engine defaults to on Linux); the row cache and reader depth keep the engine defaults. No memfd and no holder is needed. Prefix cache explicit 6144 MiB like the server profile. No quality claim and no speed claim: the paired A/B against rtx5090-32g is spec node experiments/kar-off-ab-5090.md.",
|
||||
"select": {"sm_min": 0, "sm_max": 0, "vram_mib_min": 0, "vram_mib_max": 0},
|
||||
"gpu_budget_bytes": 32819404800,
|
||||
"spec_min_p": 0.0,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rtx5090-32g",
|
||||
"description": "RTX 5090 class server (sm_120, 32 GB VRAM, >= 100 GiB RAM). Single copy of every model byte in host RAM: the 50 GB routed-expert bank is the one page-locked RAM copy (from GGUF shard 0), and of the 55 GB level-2 KAR archive only the 16.0 GB the serve path reads (the PLE rows, 2 extents) is copied once into a sealed sparse memfd (memfd_extents ple_only: holes elsewhere, verified against the pinned digest of the extents), read O_DIRECT so no page-cache copy remains. Reference-equivalent agent configuration (docs/e2e-run.md 7d; GPU budget 32,819,404,800 B (31,299 MiB) since the dense-slab commits, was 30 GiB: the slab saves physical bytes the Context never counted, so the budget must rise by about that much for the slot gain to appear, docs/experiments/vram-footprint-5090.md; expert tier auto-sized per layer from data/expert-profile.bin, adaptive speculative window with spec-min-p 0, MTP draft vocabulary, prefix cache 6144 MiB (explicit cap: what `auto` resolves to on this host, 5.7-6.1 GiB; unlike `auto` it cannot grow when RAM is freed) with request-end checkpoints (reply), chain kernels): no speed claim is made in this text (the paired 245k series against vanilla Strata is docs/experiments/baseline-pair-5090.md). Prompt chunk and prefix-cache grid 8192 (paired 256k session on the 5090: TTFT sum 131 s at 2048 against 55-60 s at 8192, docs/upstream-port-plan.md). Prompt-routing seed OFF (engine_env LELEKA_ORIGINAL_SERVE_SEED=off, placement class, owner to confirm; docs/experiments/decode-tail-5090.md: +27 % decode at 45k-247k prompts). MTP draft attention = upstream pre75 chunk + merge v2 (engine_env LELEKA_SM120_ATTN_DAILY_MTP=1, bitwise identical on the replay gate, draft round 0.29 ms and whole round 0.37 ms shorter at 245k, docs/experiments/draft-round-5090.md). Main attention and gate/up SwiGLU sm_120 kernels on (engine_env LELEKA_SM120_ATTN_DAILY=1, LELEKA_SM120_GU_SWIGLU=1: bitwise identical on the teacher-forced gate, decode +1.85 % paired, docs/experiments/codex-compare-speed-gap.md). GDN gates and gate projection on two side streams of the verify graph (engine_env LELEKA_SM120_SIDE_MIXER=1: identical top-16 logprob rows and draft trace on the teacher-forced gate, decode +1.39 % paired, CI +0.46..+2.32 %, docs/experiments/step-ledger.md V3a). QSA indexer/query chains (LELEKA_SM120_SIDE_QSA=1, mixer phase of a QSA layer -14.8 us) and the shared expert (LELEKA_SM120_SIDE_SHARED=1, doorbell to first expert 27.6 -> 10.9 us) on side streams too: identical rows and draft trace, section deltas in step-ledger.md V3b/V4a. Expert tier layout: global rank fill (engine_env LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=no) and a PCIe share of 0.65 (LELEKA_ORIGINAL_SERVE_PCIE_FRAC), default on by the owner 2026-11-12; placement class, paired 5-pair group A/B on release 02c784249a7e: decode +8.2 % (CI +6.5..+9.9), ms/round -7.2 %, A/A floor +0.2 %, minimum free VRAM 478 MiB at the 256k configuration (docs/experiments/step-ledger.md H4). LOSSY route tail skip ON by the owner 2026-11-13 (engine_env LELEKA_ROUTE_TAIL_SKIP=7, LELEKA_ROUTE_TAIL_SKIP_MAX_CACHED=100): a missed expert that every token of the window routes at rank 7 or lower is neither copied nor computed and its weight is not renormalised, so the OUTPUT CHANGES; the engine logs 'EXPERIMENTAL route tail skip is ON'; gate on release 83bdd85bb482 n=3: CRM decode +14.5 %, ttt +11.5 %, logit flips 3.6 % against the Original's 2.8 % envelope (open points accepted by the owner, docs/deploy.md section 4, docs/experiments/step-ledger.md H9); turn it off with LELEKA_ROUTE_TAIL_SKIP=0 in a copy of the profile. Tier swap bursts ON by the owner 2026-11-13 (engine_env LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=2, LELEKA_ORIGINAL_SERVE_ADAPT_SWAPS=48; engine defaults 4 and 96): the adaptive tier keeps the same swap throughput per round (96 per 4 rounds) in bursts of 48 every 2 rounds that fit under the draft, placement class; swap wait 0.351 -> 0.098 ms, paired decode +1.53 % (CI +0.26..+2.79, 3 blocks), release 83bdd85bb482 at 67k; it passes the control-relative placement gate against the worst of three PCIe-share controls and not against the single 0.55 control, accepted by the owner (docs/experiments/host-round.md, docs/deploy.md section 4); to revert set ADAPT_EVERY=4 and ADAPT_SWAPS=96 or remove both keys. Not a formally quality-gated profile.",
|
||||
"description": "RTX 5090 class server (sm_120, 32 GB VRAM, >= 100 GiB RAM). Single copy of every model byte in host RAM: the 50 GB routed-expert bank is the one page-locked RAM copy (from GGUF shard 0), and of the 55 GB level-2 KAR archive only the 16.0 GB the serve path reads (the PLE rows, 2 extents) is copied once into a sealed sparse memfd (memfd_extents ple_only: holes elsewhere, verified against the pinned digest of the extents), read O_DIRECT so no page-cache copy remains. Reference-equivalent agent configuration (spec node e2e-run.md 7d; GPU budget 32,819,404,800 B (31,299 MiB) since the dense-slab commits, was 30 GiB: the slab saves physical bytes the Context never counted, so the budget must rise by about that much for the slot gain to appear, spec node experiments/vram-footprint-5090.md; expert tier auto-sized per layer from data/expert-profile.bin, adaptive speculative window with spec-min-p 0, MTP draft vocabulary, prefix cache 6144 MiB (explicit cap: what `auto` resolves to on this host, 5.7-6.1 GiB; unlike `auto` it cannot grow when RAM is freed) with request-end checkpoints (reply), chain kernels): no speed claim is made in this text (the paired 245k series against vanilla Strata is spec node experiments/baseline-pair-5090.md). Prompt chunk and prefix-cache grid 8192 (paired 256k session on the 5090: TTFT sum 131 s at 2048 against 55-60 s at 8192, spec node upstream-port-plan.md). Prompt-routing seed OFF (engine_env LELEKA_ORIGINAL_SERVE_SEED=off, placement class, owner to confirm; spec node experiments/decode-tail-5090.md: +27 % decode at 45k-247k prompts). MTP draft attention = upstream pre75 chunk + merge v2 (engine_env LELEKA_SM120_ATTN_DAILY_MTP=1, bitwise identical on the replay gate, draft round 0.29 ms and whole round 0.37 ms shorter at 245k, spec node experiments/draft-round-5090.md). Main attention and gate/up SwiGLU sm_120 kernels on (engine_env LELEKA_SM120_ATTN_DAILY=1, LELEKA_SM120_GU_SWIGLU=1: bitwise identical on the teacher-forced gate, decode +1.85 % paired, spec node experiments/codex-compare-speed-gap.md). GDN gates and gate projection on two side streams of the verify graph (engine_env LELEKA_SM120_SIDE_MIXER=1: identical top-16 logprob rows and draft trace on the teacher-forced gate, decode +1.39 % paired, CI +0.46..+2.32 %, spec node experiments/step-ledger.md V3a). QSA indexer/query chains (LELEKA_SM120_SIDE_QSA=1, mixer phase of a QSA layer -14.8 us) and the shared expert (LELEKA_SM120_SIDE_SHARED=1, doorbell to first expert 27.6 -> 10.9 us) on side streams too: identical rows and draft trace, section deltas in step-ledger.md V3b/V4a. Expert tier layout: global rank fill (engine_env LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=no) and a PCIe share of 0.65 (LELEKA_ORIGINAL_SERVE_PCIE_FRAC), default on by the owner 2026-11-12; placement class, paired 5-pair group A/B on release 02c784249a7e: decode +8.2 % (CI +6.5..+9.9), ms/round -7.2 %, A/A floor +0.2 %, minimum free VRAM 478 MiB at the 256k configuration (spec node experiments/step-ledger.md H4). LOSSY route tail skip ON by the owner 2026-11-13 (engine_env LELEKA_ROUTE_TAIL_SKIP=7, LELEKA_ROUTE_TAIL_SKIP_MAX_CACHED=100): a missed expert that every token of the window routes at rank 7 or lower is neither copied nor computed and its weight is not renormalised, so the OUTPUT CHANGES; the engine logs 'EXPERIMENTAL route tail skip is ON'; gate on release 83bdd85bb482 n=3: CRM decode +14.5 %, ttt +11.5 %, logit flips 3.6 % against the Original's 2.8 % envelope (open points accepted by the owner, spec node deploy.md section 4, spec node experiments/step-ledger.md H9); turn it off with LELEKA_ROUTE_TAIL_SKIP=0 in a copy of the profile. Tier swap bursts ON by the owner 2026-11-13 (engine_env LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=2, LELEKA_ORIGINAL_SERVE_ADAPT_SWAPS=48; engine defaults 4 and 96): the adaptive tier keeps the same swap throughput per round (96 per 4 rounds) in bursts of 48 every 2 rounds that fit under the draft, placement class; swap wait 0.351 -> 0.098 ms, paired decode +1.53 % (CI +0.26..+2.79, 3 blocks), release 83bdd85bb482 at 67k; it passes the control-relative placement gate against the worst of three PCIe-share controls and not against the single 0.55 control, accepted by the owner (spec node experiments/host-round.md, spec node deploy.md section 4); to revert set ADAPT_EVERY=4 and ADAPT_SWAPS=96 or remove both keys. Not a formally quality-gated profile.",
|
||||
"select": {"sm_min": 120, "sm_max": 130, "vram_mib_min": 30000, "vram_mib_max": 1000000},
|
||||
"gpu_budget_bytes": 32819404800,
|
||||
"spec_min_p": 0.0,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Fail when a workspace package is not covered by a CI step (docs/ci-audit.md).
|
||||
"""Fail when a workspace package is not covered by a CI step.
|
||||
|
||||
`scripts/ci-coverage.json` assigns every workspace member exactly one level:
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
shrink.
|
||||
census the legacy that exists today is counted per crate in limits-baseline.json; a total may only fall.
|
||||
|
||||
Measures and rules: docs/architecture/limits-gate.md. Stdlib Python, no network, no GPU.
|
||||
Stdlib Python, no network, no GPU.
|
||||
|
||||
Usage: scripts/check-limits.py [--base REF] [--update-baseline [--allow-increase]]
|
||||
[--allowlist-add --reason R --owner K] [--skip-diff] [--skip-census] [--report]
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# scripts/check-local.sh fast path, Linux type-check, port oracles, then the full legacy suite
|
||||
# scripts/check-local.sh --fast only the fast path (seconds to a few minutes, works on macOS)
|
||||
# scripts/check-local.sh --port fast path, Linux type-check and the CPU oracle differentials of the Rust port
|
||||
# scripts/check-local.sh --product what ships (docs/ci-audit.md): the CI coverage gate, a build of every default-member,
|
||||
# scripts/check-local.sh --product what ships: the CI coverage gate, a build of every default-member,
|
||||
# the release build of the six product binaries (leleka, leleka-api, leleka-inference,
|
||||
# leleka-daemon, leleka-cli, leleka-seal-exec), the tests of the product crates, the
|
||||
# type-check of the CUDA-feature crates, Clippy and rustfmt (known debt is reported)
|
||||
@@ -15,7 +15,7 @@
|
||||
# STRICT_DEBT=1 fail on the known format/Clippy debt listed below instead of warning
|
||||
# SKIP_LINUX_TYPECHECK=1 skip the x86_64-unknown-linux-gnu type-check (needs `rustup target add` otherwise)
|
||||
# OFFLINE_ORACLE_PYTHON, STRATA_GGUF_PY
|
||||
# enable the live Python-oracle differentials (docs/offline-port.md)
|
||||
# enable the live Python-oracle differentials
|
||||
# LELEKA_LINUX_TESTS=1 also run scripts/linux-tests/run.sh (Docker Linux harness, branch claude/port-linux-tests)
|
||||
#
|
||||
# No model weights, tokens or network access to model hosts are used by any step.
|
||||
@@ -67,7 +67,7 @@ fast_path() {
|
||||
cargo clippy --manifest-path "${repo_root}/Cargo.toml" --locked -p leleka-experimental-ref --all-targets --no-deps -- -D warnings
|
||||
debt cargo clippy --manifest-path "${repo_root}/Cargo.toml" --locked -p leleka-model-format --all-targets --no-deps -- -D warnings
|
||||
# leleka-experimental-ref includes tests/literal_port.rs, the drift guard between engine/strata/src/kernels/cuda and the checked-in
|
||||
# experimental ports (re-synced to the upstream 41cf05a0 kernels on 2026-11-03, docs/experiments/2026-10-14-experimental-modes-port.md).
|
||||
# experimental ports (re-synced to the upstream 41cf05a0 kernels on 2026-11-03).
|
||||
cargo test --manifest-path "${repo_root}/Cargo.toml" --locked -p leleka-experimental-ref -p leleka-model-format
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ port_oracles() {
|
||||
offline_oracles
|
||||
}
|
||||
|
||||
# Live differentials against the unmodified Python oracle (docs/offline-port.md). Opt in with a venv that has
|
||||
# Live differentials against the unmodified Python oracle. Opt in with a venv that has
|
||||
# numpy, pyyaml, tqdm, jinja2 and regex, and the pinned llama.cpp gguf-py:
|
||||
# OFFLINE_ORACLE_PYTHON=/venv/bin/python STRATA_GGUF_PY=/llama.cpp/gguf-py scripts/check-local.sh
|
||||
offline_oracles() {
|
||||
@@ -123,7 +123,7 @@ linux_harness() {
|
||||
}
|
||||
|
||||
# What ships. Everything here runs without a GPU, model weights or network access to model hosts; the CUDA crates are built and
|
||||
# their Linux-gated tests run, but no kernel is executed (docs/ci-audit.md lists what this cannot prove).
|
||||
# their Linux-gated tests run, but no kernel is executed (lists what this cannot prove).
|
||||
product_path() {
|
||||
# A failing step is recorded and the rest still runs, so one red run lists everything that is broken.
|
||||
local failed=()
|
||||
@@ -144,7 +144,7 @@ product_path() {
|
||||
local manifest=(--manifest-path "${repo_root}/Cargo.toml" --locked)
|
||||
echo "== product: build every default-member"
|
||||
gate cargo build "${manifest[@]}"
|
||||
echo "== product: release build of the six shipped binaries (docs/deploy.md section 8)"
|
||||
echo "== product: release build of the six shipped binaries (spec node deploy.md section 8)"
|
||||
gate cargo build "${manifest[@]}" --release -p leleka-deploy --bin leleka
|
||||
gate cargo build "${manifest[@]}" --release -p leleka-control-plane --bin leleka-api
|
||||
gate cargo build "${manifest[@]}" --release -p leleka-engine-host --features sm86 \
|
||||
@@ -163,7 +163,7 @@ product_path() {
|
||||
[[ "${LELEKA_REAL_NVIDIA_SMI:-0}" == 1 ]] || smi_path="${repo_root}/scripts/ci:${PATH}"
|
||||
# Two end-to-end tests depend on the class of the host GPU, on >= 142 GiB free disk and on the default loopback ports, and expect
|
||||
# opposite GPUs (dry_run wants a 5090-class host, a_failing_preflight wants one that cannot hold the 5090 profile): they cannot both
|
||||
# pass on one stand-in. They are reported as debt until the tests carry their own nvidia-smi (docs/ci-audit.md, finding 7).
|
||||
# pass on one stand-in. They are reported as debt until the tests carry their own nvidia-smi.
|
||||
local host_tests=(dry_run_prints_the_plan_and_changes_nothing a_failing_preflight_stops_before_any_change_and_says_how_to_fix_it)
|
||||
PATH="${smi_path}" gate cargo test "${manifest[@]}" --no-fail-fast -p leleka-deploy --features test-fakes -- --skip "${host_tests[0]}" --skip "${host_tests[1]}"
|
||||
PATH="${smi_path}" gate debt cargo test "${manifest[@]}" -p leleka-deploy --features test-fakes --test e2e -- "${host_tests[@]}"
|
||||
@@ -184,7 +184,7 @@ product_path() {
|
||||
for crate in leleka-memory leleka-memory-os leleka-runtime-client leleka-control-plane leleka-engine-host leleka-deploy; do
|
||||
gate cargo clippy "${manifest[@]}" -p "${crate}" --all-targets --no-deps -- -D warnings
|
||||
done
|
||||
# Known debt (docs/ci-audit.md lists the counts); STRICT_DEBT=1 makes it fatal. Other agents own these sources.
|
||||
# Known debt (lists the counts); STRICT_DEBT=1 makes it fatal. Other agents own these sources.
|
||||
gate debt cargo fmt -p leleka-deploy -p leleka-memory -p leleka-cuda-model -p leleka-cuda-driver -p leleka-engine-qwen35-cuda -p leleka-native-cpu-expert --check
|
||||
gate debt cargo clippy "${manifest[@]}" -p leleka-cuda-driver --all-targets --all-features --no-deps -- -D warnings
|
||||
gate debt cargo clippy "${manifest[@]}" -p leleka-engine-qwen35-cuda --all-targets --no-deps -- -D warnings
|
||||
@@ -233,7 +233,7 @@ if [[ "${host_os}" == Linux ]]; then
|
||||
cargo test --manifest-path "${repo_root}/Cargo.toml" --locked -p leleka-cuda-model -p leleka-cuda-driver --features cuda-driver
|
||||
# Stale since leleka-cuda-driver gained path dependencies (leleka-context, -model-format, -experimental-ref): the script builds a
|
||||
# synthetic workspace of the crate alone (cargo metadata fails) and also runs `cargo fmt --check` / Clippy `-D warnings` on it, which
|
||||
# carry the debt of finding 9 in docs/ci-audit.md. scripts/linux-tests/run.sh --mocks runs the same mock-ELF gates on the real tree.
|
||||
# carry the debt of finding 9. scripts/linux-tests/run.sh --mocks runs the same mock-ELF gates on the real tree.
|
||||
debt "${repo_root}/scripts/test-cuda-driver-bootstrap.sh"
|
||||
else
|
||||
echo "== Linux-only crate tests skipped on ${host_os}"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"_comment": "Read by scripts/check-ci-coverage.py (CI job 'Product' and check-local.sh --product). Every workspace member appears exactly once. 'tested' = built and cargo-tested by a CI step that names it; 'typechecked' = cargo check only; 'exempt' = deliberately not covered, with the reason. Adding a crate to the workspace without a line here fails CI. What a green CI cannot prove: docs/ci-audit.md.",
|
||||
"_comment": "Read by scripts/check-ci-coverage.py (CI job 'Product' and check-local.sh --product). Every workspace member appears exactly once. 'tested' = built and cargo-tested by a CI step that names it; 'typechecked' = cargo check only; 'exempt' = deliberately not covered, with the reason. Adding a crate to the workspace without a line here fails CI. What a green CI cannot prove: spec node ci-audit.md.",
|
||||
"tested": [
|
||||
"leleka-backend-api",
|
||||
"leleka-tokenizer",
|
||||
@@ -48,6 +48,6 @@
|
||||
"leleka-native-parity-bench"
|
||||
],
|
||||
"exempt": {
|
||||
"leleka-libc-shim": "Windows-only (dlopen family -> LoadLibrary for leleka-cuda-driver on Windows); it compiles to nothing on Linux, so no Linux CI step can build it. Covered by the Windows laptop runs recorded in docs/ci-audit.md."
|
||||
"leleka-libc-shim": "Windows-only (dlopen family -> LoadLibrary for leleka-cuda-driver on Windows); it compiles to nothing on Linux, so no Linux CI step can build it. Covered by the Windows laptop runs recorded in spec node ci-audit.md."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Interleaved A/B of the host-side request path on the instant engine (docs/cp-latency.md), repeats alternating base and new so a shared
|
||||
# Interleaved A/B of the host-side request path on the instant engine, repeats alternating base and new so a shared
|
||||
# machine hurts both arms alike. Builds only; the model, the GPU and Python are not involved except for the summary table.
|
||||
#
|
||||
# run-ab.sh BASE_TREE NEW_TREE TOKENIZER_DIR SESSION.json OUT_DIR [REPS] [cp_replay args...]
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Offline experiment (Python is allowed for experiments): allocates N buffers of each size through the CUDA driver API
|
||||
(ctypes, no toolkit needed) and prints the drop of cuMemGetInfo free memory per allocation. The leleka dense weights are
|
||||
~700 separate cuMemAlloc calls of 0.5-10 MiB; if the driver rounds each one above 1 MiB up to a multiple of 2 MiB, about
|
||||
0.7 GiB of the fixed footprint is rounding (docs/experiments/vram-footprint-5090.md).
|
||||
0.7 GiB of the fixed footprint is rounding.
|
||||
|
||||
python3 -I scripts/dev/alloc-granularity-probe.py
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ def main():
|
||||
with open(file, "w", encoding="utf-8", newline="\n") as handle:
|
||||
handle.write(new_text)
|
||||
docs = subprocess.run(
|
||||
["git", "-C", root, "grep", "-l", "-F", old_name + ".rs", "--", "docs", "scripts", "*.md", "*.json"],
|
||||
["git", "-C", root, "grep", "-l", "-F", old_name + ".rs", "--", "scripts", "*.md", "*.json"],
|
||||
capture_output=True, text=True,
|
||||
).stdout.split()
|
||||
if docs:
|
||||
|
||||
@@ -16,7 +16,7 @@ import subprocess
|
||||
import sys
|
||||
|
||||
SKIP_PREFIXES = (
|
||||
"engine/strata/", "experiments/", "artifacts/", "docs/experiments/", "docs/e2e-data/", "docs/upstream/",
|
||||
"engine/strata/", "experiments/", "artifacts/", "docs/experiments/", "docs/e2e-data/", "benchmarks/e2e-data/", "docs/upstream/",
|
||||
"docs/ledger", "Cargo.lock", "scripts/dev/rename_strata_names.py",
|
||||
)
|
||||
HYPHEN = (("strata-next", "leleka-api"), ("strata-control", "leleka-control-plane"),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Codex + runtime + model comparison, vanilla Strata against Leleka, on the owner's two tasks (docs/experiments/codex-compare-5090.md). Test tooling, never in serving.
|
||||
# Codex + runtime + model comparison, vanilla Strata against Leleka, on the owner's two tasks. Test tooling, never in serving.
|
||||
#
|
||||
# ONE BLOCK = one stack start of one arm, then the warm-up cell and the requested cells of ONE repetition. A queue stub sets CMP_ARM / CMP_REPS / CMP_TASKS:
|
||||
# CMP_ARM=ours HOLDER JOB (inherits the sealed KAR memfd): the release package, `leleka up --foreground --kar-fd`, shipped configuration (KAR PLE, prefix cache auto / tail reply).
|
||||
|
||||
@@ -54,7 +54,7 @@ def orchestrator_task_md(control_md, control_prompt):
|
||||
head, rest = control_md.split("## Prompt", 1)
|
||||
head = head.replace("id: nestng-crm\n", "id: %s\n" % ORCH_ID).replace("title: Simple NestJS + Angular CRM", "title: Simple NestJS + Angular CRM, orchestrator with two sub-agents")
|
||||
ext = rest.split("<!-- PROMPT END -->", 1)[1]
|
||||
note = "\nOrchestrator variant of nestng-crm (docs/experiments/orchestrator-subagents-smoke.md): same seed and acceptance, prompt built by make_orchestrator_tasks.py.\n\n"
|
||||
note = "\nOrchestrator variant of nestng-crm (spec node experiments/orchestrator-subagents-smoke.md): same seed and acceptance, prompt built by make_orchestrator_tasks.py.\n\n"
|
||||
return head.rstrip("\n") + "\n" + note + "## Prompt\n<!-- PROMPT BEGIN -->\n" + orchestrator_prompt(control_prompt) + "\n<!-- PROMPT END -->" + ext
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
mock_subagent_server.py PORT CAPTURE.jsonl [N_CHILDREN] [CHILD_DELAY_S]
|
||||
|
||||
Step P0 of docs/experiments/orchestrator-subagents-smoke.md. The root thread (the thread of the first request) is scripted: its first request is
|
||||
Step P0. The root thread (the thread of the first request) is scripted: its first request is
|
||||
answered with N_CHILDREN `multi_agent_v1.spawn_agent` calls in one response, the next request with a `wait_agent` call on the agent ids that
|
||||
the spawn outputs returned, the last one with a final text. Every other thread (a sub-agent) answers with a one-line message after
|
||||
CHILD_DELAY_S seconds. CAPTURE.jsonl gets one line per request: arrival and finish time, thread id, agent name, input and tool counts, the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Orchestrator sub-agent smoke job (docs/experiments/orchestrator-subagents-smoke.md). Test tooling, never in serving. Runs ON the 5090 server inside a holder
|
||||
# Orchestrator sub-agent smoke job. Test tooling, never in serving. Runs ON the 5090 server inside a holder
|
||||
# job (inherits the sealed KAR memfd), derived from cmp_codex_job_profile.sh (arm "ours" only): the release package, `leleka up --foreground --kar-fd`,
|
||||
# shipped configuration, the cell runner of the Codex comparison (logging proxy, temperature 0, real Codex CLI 0.163.0, task acceptance).
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Queue stub of the orchestrator sub-agent smoke (docs/experiments/orchestrator-subagents-smoke.md): the real Codex CLI 0.163.0 told to act as an orchestrator on the
|
||||
# Queue stub of the orchestrator sub-agent smoke: the real Codex CLI 0.163.0 told to act as an orchestrator on the
|
||||
# nestng-crm task (spawn a backend and a frontend sub-agent), release 83bdd85bb482 (owner default), 1 repetition, orchestrator cell wall limit 1500 s, then the
|
||||
# single-agent control cell (unchanged nestng-crm, wall limit 900 s). The job refuses to start when an input differs from INPUTS.sha256 or the PROVENANCE commit is not 83bdd85bb482.
|
||||
unset CMP_ARM CMP_TASKS CMP_OPTIONAL CMP_REPS CMP_VANILLA_LOSSY CMP_WALL CMP_ROUNDS CMP_RUN CMP_TARBALL CMP_ARM_PROFILE_SET CMP_ARM_PROFILE_OFF CMP_OURS_TAG CMP_CONTROL CMP_WALL_ORCH CMP_WALL_CONTROL
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Codex + runtime + model comparison, vanilla Strata against Leleka, on the owner's two tasks (docs/experiments/codex-compare-5090.md). Test tooling, never in serving.
|
||||
# Codex + runtime + model comparison, vanilla Strata against Leleka, on the owner's two tasks. Test tooling, never in serving.
|
||||
#
|
||||
# ONE BLOCK = one stack start of one arm, then the warm-up cell and the requested cells of ONE repetition. A queue stub sets CMP_ARM / CMP_REPS / CMP_TASKS:
|
||||
# CMP_ARM=ours HOLDER JOB (inherits the sealed KAR memfd): the release package, `leleka up --foreground --kar-fd`, shipped configuration (KAR PLE, prefix cache auto / tail reply).
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Codex + runtime + model comparison, vanilla Strata against Leleka, on the owner's two tasks (docs/experiments/codex-compare-5090.md). Test tooling, never in serving.
|
||||
# Codex + runtime + model comparison, vanilla Strata against Leleka, on the owner's two tasks. Test tooling, never in serving.
|
||||
#
|
||||
# ONE BLOCK = one stack start of one arm, then the warm-up cell and the requested cells of ONE repetition. A queue stub sets CMP_ARM / CMP_REPS / CMP_TASKS:
|
||||
# CMP_ARM=ours HOLDER JOB (inherits the sealed KAR memfd): the release package, `leleka up --foreground --kar-fd`, shipped configuration (KAR PLE, prefix cache auto / tail reply).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Sourced by the stubs of the confirmation series of the DEFAULT 5090 profile with the lossy route tail skip ON (owner decision 2026-11-13, docs/deploy.md section 4,
|
||||
# step-ledger H9). The tail skip comes from the profile keys of the package ONLY: the stub unsets every route/placement variable of the shell, so a pass proves the
|
||||
# Sourced by the stubs of the confirmation series of the DEFAULT 5090 profile with the lossy route tail skip ON (owner decision 2026-11-13).
|
||||
# The tail skip comes from the profile keys of the package ONLY: the stub unsets every route/placement variable of the shell, so a pass proves the
|
||||
# profile alone delivers `LELEKA_ROUTE_TAIL_SKIP=7`, `..._MAX_CACHED=100`, pcie_frac=0.65 and expert_per_layer=0.
|
||||
TSD_TOOLS=/data/leleka-e2e/prefill-latency/tools
|
||||
TSD_TAG=945fc44f32fb
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Sourced by the stubs of the route-tail-skip quality gate (docs/experiments/step-ledger.md, plan stage 6f). EXPERIMENTAL, LOSSY, OFF in every shipped profile.
|
||||
# Sourced by the stubs of the route-tail-skip quality gate (plan stage 6f). EXPERIMENTAL, LOSSY, OFF in every shipped profile.
|
||||
# Package: the owner-default release 83bdd85bb482 (release-s22). The mode is switched by the SHELL environment of the job, not by a profile key: the profile key
|
||||
# allow-list (crates/deploy/src/profile/profile_limits.rs) has no LELEKA_ROUTE_ prefix, and the built-in profile only overrides the keys it holds, so
|
||||
# LELEKA_ROUTE_TAIL_SKIP / ..._MAX_CACHED pass through to the engine (as in the earlier lever 7 gate, jobs spd-g1..g9). Proof = the engine log line
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Sourced by the stubs of the confirmation series of the DEFAULT 5090 profile with the lossy route tail skip ON (owner decision 2026-11-13, docs/deploy.md section 4,
|
||||
# step-ledger H9) and the tier swap bursts ON (owner decision 2026-11-13, step-ledger 6c paragraph). Everything comes from the profile keys of the package ONLY: the stub unsets every
|
||||
# Sourced by the stubs of the confirmation series of the DEFAULT 5090 profile with the lossy route tail skip ON (owner decision 2026-11-13)
|
||||
# and the tier swap bursts ON (owner decision 2026-11-13, step-ledger 6c paragraph). Everything comes from the profile keys of the package ONLY: the stub unsets every
|
||||
# route/placement/adapt variable of the shell, so a pass proves the profile alone delivers `LELEKA_ROUTE_TAIL_SKIP=7`, `..._MAX_CACHED=100`, `LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=2`, `..._ADAPT_SWAPS=48`, pcie_frac=0.65 and expert_per_layer=0.
|
||||
TBD_TOOLS=/data/leleka-e2e/prefill-latency/tools
|
||||
TBD_TAG=26647522b115
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Prefill fixed-latency A/B driver (docs/prefill-throughput.md, "Prefill fixed latency per request"): a copy of the speed program's spd_ab_job.sh
|
||||
# Prefill fixed-latency A/B driver: a copy of the speed program's spd_ab_job.sh
|
||||
# (scripts/e2e/codex/speed) that runs against its own package, state and prefix directories, so it never touches the codex-compare release state.
|
||||
# The SAME recorded Codex prompts are replayed through the packaged stack; a variant is named NAME or NAME.BLOCK (A.1 L.1 L.2 A.2 ...), BLOCK only names the output directory.
|
||||
# replay_hash.py (next to this file in the server tools dir) records the sha256 of each request's output.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Stage 6b step 3: pool thread trace (LELEKA_POOL_TIMING=layers) with the new CPU expert kernels (PTK, release bcbfa2c99422) against the base kernels (PTB, release c1f15db2fa99), same owner default
|
||||
# profile, replay VANL/nestng-crm-r2 (30 requests). Report: scripts/e2e/codex/prefill/pool_layer_report.py <block>/engine.log; earlier numbers: docs/experiments/pool-thread-trace.md (release 0ac612d2df74).
|
||||
# profile, replay VANL/nestng-crm-r2 (30 requests). Report: scripts/e2e/codex/prefill/pool_layer_report.py <block>/engine.log; earlier numbers: release 0ac612d2df74.
|
||||
( cd /data/leleka-e2e/prefill-latency/kernel-iq3s-register-indices && sha256sum --quiet -c MANIFEST.sha256 ) || { echo "kernel-iq3s inputs do not match MANIFEST.sha256" >&2; exit 3; }
|
||||
export PF_ARMS="base new"
|
||||
export PF_ARM_base_PKG=/data/leleka-e2e/prefill-latency/kernel-iq3s-register-indices/pkg-base PF_ARM_base_TAG=c1f15db2fa99 PF_ARM_base_STATE=/data/leleka-e2e/prefill-latency/kernel-iq3s-register-indices/state-base PF_ARM_base_PREFIX=/data/leleka-e2e/prefill-latency/kernel-iq3s-register-indices/prefix-base
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Prefill fixed-latency A/B driver (docs/prefill-throughput.md, "Prefill fixed latency per request"): a copy of the speed program's spd_ab_job.sh
|
||||
# Prefill fixed-latency A/B driver: a copy of the speed program's spd_ab_job.sh
|
||||
# (scripts/e2e/codex/speed) that runs against its own package, state and prefix directories, so it never touches the codex-compare release state.
|
||||
# The SAME recorded Codex prompts are replayed through the packaged stack; a variant is named NAME or NAME.BLOCK (A.1 L.1 L.2 A.2 ...), BLOCK only names the output directory.
|
||||
# replay_hash.py (next to this file in the server tools dir) records the sha256 of each request's output.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Prefill fixed-latency program: restart the lab holder with a SPARSE sealed memfd (docs/design/single-copy-ram-2026-11-09.md, step 1) and record what it frees.
|
||||
# Prefill fixed-latency program: restart the lab holder with a SPARSE sealed memfd and record what it frees.
|
||||
# A holder-free window started DETACHED by a queue stub that has touched jobs/STOP and closed the holder's descriptor. Test tooling, never in serving. pf_holder_window.sh LABEL [full]
|
||||
# 1. waits until the lab holder has ended and its memfd is gone; 2. records the host memory (before); 3. starts the holder with the sparse seal (the `full` argument: the old full copy);
|
||||
# 4. waits for jobs/READY and records the host memory (after) and the holder's `ready ... allocated=` line. Records: $PL/runs/holder/LABEL.txt, notes.md.
|
||||
|
||||
@@ -13,7 +13,7 @@ W=$HOME/work/codex-e2e
|
||||
CODEX_BIN=${CODEX_BIN:-$W/bin/codex}
|
||||
OUT=${E2E_OUT_DIR:?run through run-e2e.sh}
|
||||
TIMEOUT_S=${CODEX_TIMEOUT_S:-5400}
|
||||
[ -x "$CODEX_BIN" ] || { echo "codex binary not installed at $CODEX_BIN (see docs/e2e-run.md, Codex runs)"; exit 7; }
|
||||
[ -x "$CODEX_BIN" ] || { echo "codex binary not installed at $CODEX_BIN (see spec node e2e-run.md, Codex runs)"; exit 7; }
|
||||
[ -n "${E2E_API_KEY:-}" ] || { echo "E2E_API_KEY not set"; exit 7; }
|
||||
|
||||
case "$TASK" in
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# HOLDER JOB. Plan 6b step A (critical path of the decode round, docs/experiments/step-ledger.md, "Critical path of the verify graph").
|
||||
# HOLDER JOB. Plan 6b step A (critical path of the decode round).
|
||||
# RERUN: the first run (…/decode-critical-path-cupti-windows-67k-default-vs-quota-no-pcie065-and-twin) never started an engine: release 02c784249a7e rejects LELEKA_SPEC_STATS in a profile engine_env (profile_limits.rs ENGINE_ENV_PREFIXES); spd_arm_guard.py make now keeps only allowed prefixes in the profile.
|
||||
# 67k replay (cell nestng-crm-r2, 30 requests), release package 02c784249a7e (own package/state/prefix directories, SPD_TAG), arm profile per arm (SPD_ARM_PROFILE):
|
||||
# RP final profile set, shipped placement (EXPERT_PER_LAYER=yes, PCIe share 0.45) 3 CUPTI windows per session (after requests 10, 19, 28)
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# HOLDER JOB. Plan 6b step A (critical path of the decode round, docs/experiments/step-ledger.md, "Critical path of the verify graph").
|
||||
# HOLDER JOB. Plan 6b step A (critical path of the decode round).
|
||||
# 67k replay (cell nestng-crm-r2, 30 requests), release package 02c784249a7e (own package/state/prefix directories, SPD_TAG), arm profile per arm (SPD_ARM_PROFILE):
|
||||
# RP final profile set, shipped placement (EXPERT_PER_LAYER=yes, PCIe share 0.45) 3 CUPTI windows per session (after requests 10, 19, 28)
|
||||
# RC hex-finish candidate: EXPERT_PER_LAYER=no + LELEKA_ORIGINAL_SERVE_PCIE_FRAC=0.65 3 windows
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# RERUN 2026-11-12: the first run's arms were all refused by a faulty A/A guard (it looked for the engine-log switch line at ready, which appears with the first request); guard fixed, no data from the first run.
|
||||
# Group A/B of two env-only tier levers against the final profile set PG (placement class, experiments 1 and 2 of docs/experiments/vram-hit-share-gap.md), n = 5 pairs each, one binary bin-pcie-auto (both switches off in it):
|
||||
# Group A/B of two env-only tier levers against the final profile set PG (placement class, experiments 1 and 2), n = 5 pairs each, one binary bin-pcie-auto (both switches off in it):
|
||||
# PS = PG + LELEKA_PROMPT_EMBED_ALIAS=1 + LELEKA_ORIGINAL_SERVE_DECODE_RESERVE_MIB=130 (12,384 slots against 12,192; free VRAM at decode must stay >= 315 MiB: read DBG vram lines / status), PW = PG + LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=2.
|
||||
# Report: ab_report.py RUN_DIR PG PS ; ab_report.py RUN_DIR PG PW ; plus `expert cache N slots` from each engine.log.
|
||||
# A/A control: PH (twin of PG) / QQ (twin of QP) run under the same conditions; the report compares the twin with its control as well as the variants with it.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Group A/B of two env-only tier levers against the final profile set PG (placement class, experiments 1 and 2 of docs/experiments/vram-hit-share-gap.md), n = 5 pairs each, one binary bin-pcie-auto (both switches off in it):
|
||||
# Group A/B of two env-only tier levers against the final profile set PG (placement class, experiments 1 and 2), n = 5 pairs each, one binary bin-pcie-auto (both switches off in it):
|
||||
# PS = PG + LELEKA_PROMPT_EMBED_ALIAS=1 + LELEKA_ORIGINAL_SERVE_DECODE_RESERVE_MIB=130 (12,384 slots against 12,192; free VRAM at decode must stay >= 315 MiB: read DBG vram lines / status), PW = PG + LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=2.
|
||||
# Report: ab_report.py RUN_DIR PG PS ; ab_report.py RUN_DIR PG PW ; plus `expert cache N slots` from each engine.log.
|
||||
unset SPD_VARIANTS SPD_CELLS SPD_OUT SPD_MAX SPD_TUNES SPD_BIN
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
# idP3 candidate TW LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=2 (twice the throughput; the "PW" arm)
|
||||
# idP4 control LELEKA_ORIGINAL_SERVE_PCIE_FRAC=0.55 (an ordinary placement change of 0.10 in the share; the 2026-11-12 controls 0.35 / 0.55 on the old placement gave
|
||||
# p99 0.224 / 0.215, max 0.746 / 0.665, flips 2.23 / 2.56 %)
|
||||
# Rule (docs/quality-gate.md, q_tail_gate --control): p99, max and flip rate of a candidate each <= 1.25 x the control's, read from the q_pair lines "idP2/idP3 against the reference"
|
||||
# Rule (q_tail_gate --control): p99, max and flip rate of a candidate each <= 1.25 x the control's, read from the q_pair lines "idP2/idP3 against the reference"
|
||||
# next to "idP4 against the reference". A candidate that fails it is not a default.
|
||||
( cd /data/leleka-e2e/prefill-latency/host-round && sha256sum --quiet -c MANIFEST.sha256 ) || { echo "host-round inputs do not match MANIFEST.sha256" >&2; exit 3; }
|
||||
unset ID_BIN P1_ENV P2_ENV P3_ENV P4_ENV ID_OUT MAX_NEW ADAPT SKIP_P1 D DR
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""VRAM hit share of the routed experts, ours against vanilla (docs/experiments/vram-hit-share-gap.md).
|
||||
"""VRAM hit share of the routed experts, ours against vanilla.
|
||||
|
||||
Read-only, stdlib only, no GPU; run on the server with `nice python3 -I - SUBCOMMAND ... < hit_share_gap.py`.
|
||||
arms hit share per experiment and arm: token-weighted, unweighted, time-weighted, tok/round
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Host-round A/B driver (plan stage 6c, docs/experiments/host-round.md): the decode round's host work between verify graphs.
|
||||
# Host-round A/B driver (plan stage 6c): the decode round's host work between verify graphs.
|
||||
# Derived from prefill/group-ab/pf_ab_job_q.sh (own package, state and prefix directories under the task root, release identity by PROVENANCE
|
||||
# git_commit + SHA256SUMS), with CUPTI windows over chosen requests and the arms of this stage. The SAME recorded Codex prompts are replayed
|
||||
# (67k cell nestng-crm-r2, 30 requests); a variant is NAME or NAME.BLOCK, BLOCK only names the output directory.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Counts of the status column of docs/experiments/step-ledger.md (offline tool, stdlib only): per status and per owner.
|
||||
"""Counts of the status column of the step ledger table (offline tool, stdlib only): per status and per owner.
|
||||
|
||||
ledger_counts.py [LEDGER.md]
|
||||
"""
|
||||
@@ -7,7 +7,9 @@ import collections
|
||||
import re
|
||||
import sys
|
||||
|
||||
path = sys.argv[1] if len(sys.argv) > 1 else "docs/experiments/step-ledger.md"
|
||||
if len(sys.argv) < 2:
|
||||
sys.exit("usage: ledger_counts.py LEDGER.md (the ledger now lives in the LeaseVibe documentation, not in the repository)")
|
||||
path = sys.argv[1]
|
||||
by_status, by_owner = collections.Counter(), collections.Counter()
|
||||
for line in open(path, encoding="utf-8"):
|
||||
cells = [c.strip() for c in line.strip().strip("|").split("|")]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# HOLDER JOB. 256k safety check of the slot lever PS (docs/experiments/vram-hit-share-gap.md experiment 1; ledger H4): the real Codex CLI at ~220-240k context (pad) through
|
||||
# HOLDER JOB. 256k safety check of the slot lever PS (ledger H4): the real Codex CLI at ~220-240k context (pad) through
|
||||
# `leleka up` of the release package of main 02c784249 with LELEKA_PROMPT_EMBED_ALIAS=1 + LELEKA_ORIGINAL_SERVE_DECODE_RESERVE_MIB=130 (12,384 expert slots against 12,192), arm reply, task fixbug-ledger, 3 repeats.
|
||||
# Pass criteria (memory owner, 2026-11-11): minimum free VRAM by 100 ms nvidia-smi sampling over the WHOLE job >= 315 MiB (vanilla's own floor), 0 request failures / CudaExecution / OOM, 3 repeats.
|
||||
# Output: $QC_RUN/vram-free.csv (memory.free MiB per 100 ms), $QC_RUN/vram-floor.txt (summary), the q245 cell dirs. Model-free of any lossy default; the profile of the package is main's as of 02c784249.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# RETRY 2026-11-12 of the reserve-130 run (min free 212 MiB, 12,432 slots, FAILED the 315 floor): reserve 240 (+110 MiB, about -60 slots, so about 322 MiB expected). Pass: min free >= 315 MiB, 0 OOM/CudaExecution, 3 accepted.
|
||||
# HOLDER JOB. 256k safety check of the slot lever PS (docs/experiments/vram-hit-share-gap.md experiment 1; ledger H4): the real Codex CLI at ~220-240k context (pad) through
|
||||
# HOLDER JOB. 256k safety check of the slot lever PS (ledger H4): the real Codex CLI at ~220-240k context (pad) through
|
||||
# `leleka up` of the release package of main 02c784249 with LELEKA_PROMPT_EMBED_ALIAS=1 + LELEKA_ORIGINAL_SERVE_DECODE_RESERVE_MIB=240 (expect about 12,370 slots), arm reply, task fixbug-ledger, 3 repeats.
|
||||
# Pass criteria (memory owner, 2026-11-11): minimum free VRAM by 100 ms nvidia-smi sampling over the WHOLE job >= 315 MiB (vanilla's own floor), 0 request failures / CudaExecution / OOM, 3 repeats.
|
||||
# Output: $QC_RUN/vram-free.csv (memory.free MiB per 100 ms), $QC_RUN/vram-floor.txt (summary), the q245 cell dirs. Model-free of any lossy default; the profile of the package is main's as of 02c784249.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Speed program A/B driver (docs/experiments/codex-compare-speed-gap.md): copy of the spd-gap job7 with block names and the lossless variant L.
|
||||
# Speed program A/B driver: copy of the spd-gap job7 with block names and the lossless variant L.
|
||||
# The SAME recorded Codex prompts replayed through the release package; a variant is named NAME or NAME.BLOCK (A.1 L.1 L.2 A.2 ...), BLOCK only names the output directory.
|
||||
# replay_hash.py (next to this file in the server tools dir) records the sha256 of each request's output, the identity record.
|
||||
# HOLDER JOB (inherits the sealed KAR memfd), like cmp_codex_job.sh with CMP_ARM=ours. Test tooling, never in serving.
|
||||
@@ -16,7 +16,7 @@
|
||||
# PH = PG and QQ = QP: A/A twins (same engine environment under another name) for the A/A control of a group A/B / a CUPTI window pair
|
||||
# S as E, and the replay is repeated once per entry of SPD_TUNES (default "none 0.35 0.30 none 0.35 0.30"): `strata_tune.pcie_frac` per request, files replay-<i>-<tune>.jsonl; the engine log is cut by request count
|
||||
# T<NN>[b] as E with LELEKA_ORIGINAL_SERVE_PCIE_FRAC=0.<NN> (T45 = the shipped 0.45, no override); a trailing b only names a repeat (T45b)
|
||||
# K[b] as T45 (E) with the sm_120 kernel sets on (LELEKA_SM120_ATTN_DAILY, _GU_SWIGLU, _SIDE_MIXER = 1): the vanilla 0.1.50 defaults (docs/upstream.md); a trailing b names a repeat
|
||||
# K[b] as T45 (E) with the sm_120 kernel sets on (LELEKA_SM120_ATTN_DAILY, _GU_SWIGLU, _SIDE_MIXER = 1): the vanilla 0.1.50 defaults (engine/upstream.md); a trailing b names a repeat
|
||||
# KA[x] as K without SIDE_MIXER (ATTN_DAILY + GU_SWIGLU: byte-identical in the model-free probe and the 243-row replay of 2026-10-29); KS[x] as K with SIDE_MIXER only
|
||||
# L shipped (lossless, tail skip OFF) + sm_120 ATTN_DAILY + GU_SWIGLU (lever 1: byte-identical expected, gate = every out_sha equal to A)
|
||||
# FA frozen placement: tier swaps off (LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=0) and the fixed Original window (LELEKA_SPEC_ADAPTIVE=off LELEKA_SPEC=4, floor 0), nothing else; the identity-gate base
|
||||
@@ -114,7 +114,7 @@ for v in $VARS; do
|
||||
QP|QQ|QT) export LELEKA_SM120_ATTN_DAILY=1 LELEKA_SM120_GU_SWIGLU=1 LELEKA_SM120_SIDE_MIXER=1 LELEKA_SM120_SIDE_QSA=1 LELEKA_SM120_SIDE_SHARED=1 LELEKA_SM120_FUSED_QSA_PRELUDE=1 LELEKA_DRAFT_FUSED_COMMIT=1 LELEKA_SM120_COMBINE_VEC4=1 LELEKA_SM120_DOWN_SUB16=1 LELEKA_SM120_HITS_IN_COMBINE=1; [ "$vb" = QT ] && export LELEKA_SM120_HEAD_CHAIN_BATCH=1; export CUDA_INJECTION64_PATH=$DRT/tools/libleleka_cupti_trace.so LELEKA_CUPTI_TRIGGER=$D/cupti.trigger LCT_MAX_SECONDS=60 LD_LIBRARY_PATH=$DRT/cupti/lib:$LD_LIBRARY_PATH;; # CUPTI windows of the final profile set (QP, control) and + the batched head chain (QT, R8)
|
||||
RP|RC|RD|SP|SC) export LELEKA_SM120_ATTN_DAILY=1 LELEKA_SM120_GU_SWIGLU=1 LELEKA_SM120_SIDE_MIXER=1 LELEKA_SM120_SIDE_QSA=1 LELEKA_SM120_SIDE_SHARED=1 LELEKA_SM120_FUSED_QSA_PRELUDE=1 LELEKA_DRAFT_FUSED_COMMIT=1 LELEKA_SM120_COMBINE_VEC4=1 LELEKA_SM120_DOWN_SUB16=1 LELEKA_SM120_HITS_IN_COMBINE=1; case $vb in RP|SP) export LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=yes;; *) export LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=no LELEKA_ORIGINAL_SERVE_PCIE_FRAC=0.65;; esac; case $vb in S*) export LELEKA_SERVE_PROFILE=1 STRATA_VERIFY_PROFILE=1;; *) export CUDA_INJECTION64_PATH=$DRT/tools/libleleka_cupti_trace.so LELEKA_CUPTI_TRIGGER=$D/cupti.trigger LCT_MAX_SECONDS=60 LD_LIBRARY_PATH=$DRT/cupti/lib:$LD_LIBRARY_PATH;; esac;; # critical-path windows (plan 6b): RP = final profile set with the shipped placement (per-layer quota, share 0.45), RC = the hex-finish candidate (quota=no + PCIe 0.65), RD = its A/A twin; SP/SC = the same two placements with the step profile on and no CUPTI window (experts, pcie_experts, entries per window from the `DBG tier request` lines)
|
||||
TP|TC) export LELEKA_SM120_ATTN_DAILY=1 LELEKA_SM120_GU_SWIGLU=1 LELEKA_SM120_SIDE_MIXER=1 LELEKA_SM120_SIDE_QSA=1 LELEKA_SM120_SIDE_SHARED=1 LELEKA_SM120_FUSED_QSA_PRELUDE=1 LELEKA_DRAFT_FUSED_COMMIT=1 LELEKA_SM120_COMBINE_VEC4=1 LELEKA_SM120_DOWN_SUB16=1 LELEKA_SM120_HITS_IN_COMBINE=1; export LELEKA_POOL_TIMING=layers; case $vb in TP) export LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=yes;; *) export LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=no LELEKA_ORIGINAL_SERVE_PCIE_FRAC=0.65;; esac;; # pool-layer trace (hex-finish, release 0ac612d2df74): the shipped placement (TP) and the candidate (TC), no CUPTI, no step profile; `leleka-serve pool-layer` lines in engine.log
|
||||
PS) export LELEKA_SM120_ATTN_DAILY=1 LELEKA_SM120_GU_SWIGLU=1 LELEKA_SM120_SIDE_MIXER=1 LELEKA_SM120_SIDE_QSA=1 LELEKA_SM120_SIDE_SHARED=1 LELEKA_SM120_FUSED_QSA_PRELUDE=1 LELEKA_DRAFT_FUSED_COMMIT=1 LELEKA_SM120_COMBINE_VEC4=1 LELEKA_SM120_DOWN_SUB16=1 LELEKA_SM120_HITS_IN_COMBINE=1 LELEKA_PROMPT_EMBED_ALIAS=1 LELEKA_ORIGINAL_SERVE_DECODE_RESERVE_MIB=130;; # PG + the embedding alias and a decode reserve of 130 MiB: 12,384 expert slots instead of 12,192 (docs/experiments/vram-hit-share-gap.md, experiment 1; placement class)
|
||||
PS) export LELEKA_SM120_ATTN_DAILY=1 LELEKA_SM120_GU_SWIGLU=1 LELEKA_SM120_SIDE_MIXER=1 LELEKA_SM120_SIDE_QSA=1 LELEKA_SM120_SIDE_SHARED=1 LELEKA_SM120_FUSED_QSA_PRELUDE=1 LELEKA_DRAFT_FUSED_COMMIT=1 LELEKA_SM120_COMBINE_VEC4=1 LELEKA_SM120_DOWN_SUB16=1 LELEKA_SM120_HITS_IN_COMBINE=1 LELEKA_PROMPT_EMBED_ALIAS=1 LELEKA_ORIGINAL_SERVE_DECODE_RESERVE_MIB=130;; # PG + the embedding alias and a decode reserve of 130 MiB: 12,384 expert slots instead of 12,192 (placement class)
|
||||
PW) export LELEKA_SM120_ATTN_DAILY=1 LELEKA_SM120_GU_SWIGLU=1 LELEKA_SM120_SIDE_MIXER=1 LELEKA_SM120_SIDE_QSA=1 LELEKA_SM120_SIDE_SHARED=1 LELEKA_SM120_FUSED_QSA_PRELUDE=1 LELEKA_DRAFT_FUSED_COMMIT=1 LELEKA_SM120_COMBINE_VEC4=1 LELEKA_SM120_DOWN_SUB16=1 LELEKA_SM120_HITS_IN_COMBINE=1 LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=2;; # PG + a tier swap round every 2 verify rounds (vram-hit-share-gap.md, experiment 2; placement class)
|
||||
R) export LELEKA_REFILL_DEFER=on;; # lever 5: the lent-slot refill queued inside the decode phase's assembly (same copies, other time)
|
||||
S) export LELEKA_ROUTE_TAIL_SKIP=7 LELEKA_ROUTE_TAIL_SKIP_MAX_CACHED=100;;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Vanilla Strata 0.2.6 on the same recorded prompts as spd_replay_job.sh, with the verifier step profile on (STRATA_VERIFY_PROFILE=1), for the step-by-step comparison with the release
|
||||
# (docs/experiments/codex-compare-speed-gap.md). Holder-free window payload (started by spd_window.sh). Test tooling, never in serving.
|
||||
# Vanilla Strata 0.2.6 on the same recorded prompts as spd_replay_job.sh, with the verifier step profile on (STRATA_VERIFY_PROFILE=1), for the step-by-step comparison with the release.
|
||||
# Holder-free window payload (started by spd_window.sh). Test tooling, never in serving.
|
||||
# SPD_LOSSY=0 (default) lossy defaults off (VANL); 1 = shipped defaults (VAN) SPD_MAX (requests per cell, default 30) SPD_CELLS SPD_RUN (result dir)
|
||||
set -uo pipefail
|
||||
SPD=/data/leleka-e2e/spd-gap
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Ledger row U5 (docs/experiments/step-ledger.md C2u): kernel micro-benchmark of upstream Strata's hyper-connection down kernel
|
||||
# Ledger row U5: kernel micro-benchmark of upstream Strata's hyper-connection down kernel
|
||||
# (gr_down_v3_kernel, STRATA_GR_V3_PF masks 0 / 5 / 133) against our chain_gr_down_t2w8_nb4, window rows T = 1..8, on the 5090.
|
||||
# Small GPU job (about 3 minutes, a few hundred MB of device memory, no model): takes /data/leleka-e2e/gpu.lock like the other short stubs
|
||||
# (poll up to 30 min) and does not take MODEL.lock. Copy to ~/work/gpu-runs/holder2/jobs/ (installed and queued by the orchestrator).
|
||||
# Method, inputs, how to read the result: docs/experiments/verify-hc-down-kernel-microbench-vs-upstream.md
|
||||
# Method, inputs, how to read the result:
|
||||
# MB_ARGS="--tmin 1 --tmax 2 --rounds 2" optional: a short run (the full defaults are in the doc)
|
||||
set -uo pipefail
|
||||
D=/data/leleka-e2e/spd-gap/microbench/verify-hc-down-kernel-microbench-vs-upstream
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Kernel micro-benchmark: upstream Strata's hyper-connection down kernel (gr_down_v3_kernel, STRATA_GR_V3_PF masks 0 / 5 / 133) against
|
||||
// our chain_gr_down_t2w8_nb4 (sealed PTX through the driver API, as the product loads it; and the same source built by nvcc), window
|
||||
// rows T = 1..8, same random inputs. Method, inputs and how to read the result: docs/experiments/verify-hc-down-kernel-microbench-vs-upstream.md
|
||||
// rows T = 1..8, same random inputs.
|
||||
//
|
||||
// One translation unit: upstream's fused_gr.cu is #included whole (unmodified, from git object strata-upstream/main), so the kernels, the
|
||||
// geometry constants and the launch helpers are upstream's own.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The tail of the verify graph and the idle gaps inside it (ledger rows R6, R7, R8; docs/experiments/verify-tail-and-gaps.md).
|
||||
"""The tail of the verify graph and the idle gaps inside it (ledger rows R6, R7, R8).
|
||||
|
||||
Offline analysis of CUPTI trace directories (tools/cupti-trace, `lct.py`); host-side Python, stdlib only, no GPU.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Codex task set for the lossy-vs-lossless delta study
|
||||
|
||||
Task set of the study `claude/codex-lossy-delta` (runner: `scripts/e2e/codex/delta/`, plan: `docs/experiments/codex-lossy-delta.md`).
|
||||
Task set of the study `claude/codex-lossy-delta` (runner: `scripts/e2e/codex/delta/`, plan: `spec node experiments/codex-lossy-delta.md`).
|
||||
Every task is run by the real Codex CLI 0.163.0 against four stacks (vanilla Strata lossy / lossless, our port lossy / lossless).
|
||||
The prompt, the seed workspace and the acceptance script are byte-identical for all four variants and are checked against `MANIFEST.sha256`
|
||||
before every run (`scripts/e2e/codex/delta/verify_tasks.py`); a mismatch stops the runner.
|
||||
|
||||
@@ -6,7 +6,7 @@ expected_rounds: 60-110
|
||||
---
|
||||
# Small CRM web app (two phases)
|
||||
|
||||
Existing task of docs/e2e-run.md (jobs 945*), prompt text unchanged from `scripts/e2e/codex/prompt-crm.txt` (sha256 2ab4d92db393334f1ac953086116cefb9744b522b98bfd4ea6efd7e02e319af9 of the file). Empty seed. Acceptance: `accept.py` = `crm_acceptance.py` (21 checks, REST API plus the app's own unittest suite) run on a copy of the workspace.
|
||||
Existing task of spec node e2e-run.md (jobs 945*), prompt text unchanged from `scripts/e2e/codex/prompt-crm.txt` (sha256 2ab4d92db393334f1ac953086116cefb9744b522b98bfd4ea6efd7e02e319af9 of the file). Empty seed. Acceptance: `accept.py` = `crm_acceptance.py` (21 checks, REST API plus the app's own unittest suite) run on a copy of the workspace.
|
||||
|
||||
## Prompt
|
||||
<!-- PROMPT BEGIN -->
|
||||
|
||||
@@ -6,7 +6,7 @@ expected_rounds: 15-60
|
||||
---
|
||||
# Three.js tic-tac-toe in one file
|
||||
|
||||
Existing task of docs/e2e-run.md (jobs 943*), prompt text unchanged from `scripts/e2e/codex/prompt-threejs.txt` (sha256 f57248412f69b4a6a76aab00c2ff33ee3ce676849768f847d412c7e9e9d8a074 of the file; the file ends with a newline that `$(cat file)` stripped, the extracted prompt is the same string).
|
||||
Existing task of spec node e2e-run.md (jobs 943*), prompt text unchanged from `scripts/e2e/codex/prompt-threejs.txt` (sha256 f57248412f69b4a6a76aab00c2ff33ee3ce676849768f847d412c7e9e9d8a074 of the file; the file ends with a newline that `$(cat file)` stripped, the extracted prompt is the same string).
|
||||
The vendored three.module.min.js is an external seed file (third-party, not in Git).
|
||||
Acceptance on the server is STATIC (`accept.py`: file present, imports the vendored module by a relative path, no network URL, WebGL renderer, raycaster, #status, #restart, win/draw logic, click handler, and the page's script is syntactically plausible). The six real-mouse browser checks of `scripts/e2e/codex/check_ttt.mjs` need Node + Playwright, which the server does not have; they run afterwards on a machine that has them over the stored workspaces (`delta/browser_check_ttt.sh`) and are reported separately.
|
||||
|
||||
|
||||
@@ -24,5 +24,5 @@ ENG=$(ls -d /home/para/.local/share/strata/components/engine/*/strata | head -1)
|
||||
} >"$BP/MANIFEST.sha256.new"
|
||||
mv "$BP/MANIFEST.sha256.new" "$BP/MANIFEST.sha256"
|
||||
cat "$D/bin-footprint3b/COMMIT.txt" "$D/bin-cpuservice/COMMIT.txt" >"$BP/PROVENANCE.txt"
|
||||
{ echo "vanilla engine component: $ENG"; echo "vanilla launcher: $HOME/work/vanilla-strata/control/bin/strata (Strata 0.2.6 per docs/upstream.md)"; date -u +%FT%TZ; } >>"$BP/PROVENANCE.txt"
|
||||
{ echo "vanilla engine component: $ENG"; echo "vanilla launcher: $HOME/work/vanilla-strata/control/bin/strata (Strata 0.2.6 per engine/upstream.md)"; date -u +%FT%TZ; } >>"$BP/PROVENANCE.txt"
|
||||
echo "installed; $(wc -l <"$BP/MANIFEST.sha256") inputs in $BP/MANIFEST.sha256"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# one line in jobs/PRIORITY (back PRIORITY up first). gpu.lock per arm; ~5 min an arm.
|
||||
#
|
||||
# Arms (one session each: the frozen 245k corpus, 5 turns, --max-output 300, final-turn input >= 200k tokens, the harness of speedtrain3-ab.sh):
|
||||
# ours dt/bin-footprint3b = code of main e381c3082 (git diff 9e13fc809 e381c3082 outside docs/ and scripts/ is empty), shipped lossless defaults: seed off (the profile
|
||||
# ours dt/bin-footprint3b = code of main e381c3082 (git diff 9e13fc809 e381c3082 outside scripts/ is empty), shipped lossless defaults: seed off (the profile
|
||||
# default), upstream ranked profile, auto expert slots (12,192), budget 31,300 MiB, spec-min-p 0, prefix cache auto. Nothing experimental.
|
||||
# v1 vanilla Strata 0.2.6 shipped defaults: route tail skip ON (rank 7, lossy), prefill CPU share ON (below 1024-token chunks).
|
||||
# v2 vanilla with STRATA_ROUTE_TAIL_SKIP=0 STRATA_PREFILL_CPU_SHARE=0 (lossless-comparable).
|
||||
|
||||
@@ -1,156 +1,156 @@
|
||||
#!/usr/bin/env bash
|
||||
# baseline-pair part e: ONE ARM PER FRESH BOOT. Runs on the LAPTOP (git bash), drives rnr5090 over ssh. Owner-authorised (chat, 2026-11-01): rebooting rnr5090 between runs.
|
||||
# Allowed on the server: `sudo -n systemctl reboot` and nothing else privileged (no systemd units, sysctl, grub, drop_caches, compact_memory; `sudo -n dmesg` is read-only).
|
||||
#
|
||||
# [START_CYCLE=2] bash baseline-reboot-series.sh [BLOCKS="1 2 3"] env: SERIES_LOG (local log), STOPFILE (touch it to stop after the current cycle), START_CYCLE (resume)
|
||||
#
|
||||
# Per cycle: (1) nothing foreign may run (jobs pending/running other than our stubs, gpu.lock, a GPU process); wait otherwise, never reboot under a job;
|
||||
# (2) `sync`, reboot, wait for ssh (new boot_id) up to 10 min; on timeout try the rescue sshd (:2222, `rboot`) once, then STOP; (3) safety net check (rescue sshd :2222, /dev/watchdog0,
|
||||
# hung_task_panic=1, swap off, no NVMe errors in dmesg): any failure STOPs the series; (4) pre-read the KAR file (large WILLNEED requests), restart the KAR holder the way decode/notes.md did
|
||||
# after a boot (remove the empty stale MODEL.lock, delete jobs/READY, `setsid nohup bash run_holder2.sh`), wait for READY (90 min);
|
||||
# (5) EVICT the page cache of the files read so far with per-file posix_fadvise(DONTNEED) (KAR file, both model shards, MTP files, vanilla pack; read-only files, user level): the holder's read
|
||||
# leaves ~50 GB of page cache that makes vanilla find no free 2 MiB blocks and run without huge pages; record MemFree and the free 2 MiB blocks; (6) queue ONE holder job (the arm) via
|
||||
# ENTRIES, wait for its .done, read VALIDITY.txt; (7) a vanilla arm must show AnonHugePages >= 46.4 GiB (baseline-thpcheck.py), otherwise the run is moved to _poor/ and the cycle is
|
||||
# repeated ONCE (a second poor run is kept and flagged); an invalid run is moved to _invalid/ and the cycle repeated once, a second failure STOPs the series; (8) next reboot.
|
||||
# Arms: ours = dt/bin-main-ffd9322 (main d29e3dba2 has the same code outside docs/scripts), PCIe 0.45 pinned, defaults; v1 = vanilla shipped defaults; v2 = tail skip off + prefill CPU share 0.
|
||||
# The job (baseline-pair-ab.sh) records settle.txt, pre.jsonl (uptime = time since boot, buddyinfo, meminfo), state.jsonl, post.jsonl, hook.txt (cycle-hook.sh: boot id/time, safety net, nvme dmesg hits).
|
||||
set -uo pipefail
|
||||
BLOCKS=${1:-"1 2 3"}
|
||||
SSH="ssh -o ConnectTimeout=6 -o BatchMode=yes rnr5090"
|
||||
OUTR=/data/leleka-e2e/runs/baseline-pair-e
|
||||
TOOLS=/data/leleka-e2e/baseline-pair/tools
|
||||
PF=$TOOLS/baseline-prefetch.py
|
||||
EV=$TOOLS/baseline-evict.py
|
||||
TC=$TOOLS/baseline-thpcheck.py
|
||||
JOBS='$HOME/work/gpu-runs/holder2/jobs'
|
||||
KAR=/home/para/work/leleka/models/leleka-gates/assets/qwen-iq3-s-l2-v4.kar
|
||||
MODELDIR=/home/para/work/leleka/models/leleka-gates/assets/model
|
||||
SERIES_LOG=${SERIES_LOG:-./baseline-reboot-series.log}
|
||||
STOPFILE=${STOPFILE:-./baseline-reboot-series.STOP}
|
||||
perm() { case $1 in 1) echo "ours v1 v2";; 2) echo "v2 v1 ours";; 3) echo "v1 v2 ours";; 4) echo "ours v2 v1";; 5) echo "v2 ours v1";; 6) echo "v1 ours v2";; esac; }
|
||||
CYLOG=""
|
||||
log() { local l="[$(date -u +%FT%TZ)] $*"; echo "$l" | tee -a "$SERIES_LOG"; CYLOG="$CYLOG$l"$'\n'; }
|
||||
die() { log "STOP SERIES: $*"; push_log; exit 1; }
|
||||
push_log() { [ -n "$CYLOG" ] && printf '%s' "$CYLOG" | $SSH "mkdir -p $OUTR/_cycles && cat >> $OUTR/_cycles/series.log" 2>/dev/null; CYLOG=""; }
|
||||
|
||||
foreign() { # prints what is running/queued that is not ours
|
||||
$SSH 'cd ~/work/gpu-runs/holder2/jobs 2>/dev/null || exit 0
|
||||
for f in *.sh; do b=${f%.sh}; case $b in 220-expert-tier|decode-sass-trace2|bpe-*) continue;; esac; [ -e $b.done ] || echo "job:$b"; done
|
||||
for r in *.running; do b=${r%.running}; case $b in 220-expert-tier|decode-sass-trace2|bpe-*) continue;; esac; echo "running:$b"; done
|
||||
[ -d /data/leleka-e2e/gpu.lock ] && echo "gpu.lock:$(cat /data/leleka-e2e/gpu.lock/owner 2>/dev/null)"
|
||||
nvidia-smi --query-compute-apps=pid --format=csv,noheader | sed "s/^/gpu-pid:/"
|
||||
pgrep -f "[l]eleka-inference|[s]trata-next|[/]strata --serve" | sed "s/^/proc:/"' 2>/dev/null
|
||||
}
|
||||
wait_quiet() { # up to 4 h
|
||||
local n=0 f
|
||||
while :; do
|
||||
f=$(foreign | tr '\n' ' ')
|
||||
[ -z "${f// /}" ] && return 0
|
||||
n=$((n + 1)); [ $((n % 5)) = 1 ] && log "waiting for foreign work to finish: $f"
|
||||
[ $n -gt 240 ] && die "foreign work still present after 4 h: $f"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
wait_boot() { # $1 old boot_id ; up to 10 min after the reboot command
|
||||
local t0=$SECONDS id
|
||||
sleep 30
|
||||
while [ $((SECONDS - t0)) -lt 600 ]; do
|
||||
id=$($SSH 'cat /proc/sys/kernel/random/boot_id' 2>/dev/null) && [ -n "$id" ] && [ "$id" != "$1" ] && { log "ssh back after $((SECONDS - t0)) s, new boot_id $id"; return 0; }
|
||||
sleep 10
|
||||
done
|
||||
log "no ssh within 10 min; trying the rescue sshd :2222"
|
||||
ssh -o ConnectTimeout=10 -o BatchMode=yes -p 2222 -l root rnr5090 'uptime; dmesg | tail -15' 2>&1 | tail -20 | while read -r l; do log "rescue: $l"; done
|
||||
ssh -o ConnectTimeout=10 -o BatchMode=yes -p 2222 -l root rnr5090 'rboot' >/dev/null 2>&1
|
||||
t0=$SECONDS; sleep 30
|
||||
while [ $((SECONDS - t0)) -lt 600 ]; do
|
||||
id=$($SSH 'cat /proc/sys/kernel/random/boot_id' 2>/dev/null) && [ -n "$id" ] && [ "$id" != "$1" ] && { log "ssh back after rboot, $((SECONDS - t0)) s"; return 2; }
|
||||
sleep 10
|
||||
done
|
||||
die "server did not come back after reboot and rboot"
|
||||
}
|
||||
memstate() { # MemFree / Cached / free 2 MiB+ blocks (buddyinfo orders 9-10, Normal + DMA32)
|
||||
$SSH 'echo "MemFree_GiB=$(awk "/^MemFree/{printf \"%.1f\",\$2/2^20}" /proc/meminfo) Cached_GiB=$(awk "/^Cached/{printf \"%.1f\",\$2/2^20}" /proc/meminfo) Shmem_GiB=$(awk "/^Shmem:/{printf \"%.1f\",\$2/2^20}" /proc/meminfo) free2M_GiB=$(awk "/Normal|DMA32/{for(o=9;o<=10;o++) s+=\$(5+o)*4096*2^o} END{printf \"%.1f\",s/2^30}" /proc/buddyinfo)"'
|
||||
}
|
||||
|
||||
mkdir -p "$(dirname "$SERIES_LOG")" 2>/dev/null
|
||||
$SSH 'sudo -n true' || die "passwordless sudo not available"
|
||||
cyc=0
|
||||
for b in $BLOCKS; do
|
||||
pos=0
|
||||
for arm in $(perm "$b"); do
|
||||
pos=$((pos + 1)); cyc=$((cyc + 1)); tag=$(printf "b%02dp%d-%s" "$b" "$pos" "$arm")
|
||||
[ $cyc -lt ${START_CYCLE:-1} ] && continue # resume after a stopped series
|
||||
[ -e "$STOPFILE" ] && die "stop file present before $tag"
|
||||
tries=0; attempt=0; fails=0
|
||||
while :; do
|
||||
tries=$((tries + 1)); attempt=$((attempt + 1)); [ $tries -gt 4 ] && die "cycle $cyc ($tag) kept getting foreign work / retries"
|
||||
log "=== cycle $cyc $tag (attempt $attempt)"
|
||||
wait_quiet
|
||||
old=$($SSH 'cat /proc/sys/kernel/random/boot_id') || die "ssh failed before reboot"
|
||||
$SSH 'sudo -n true' || die "passwordless sudo vanished"
|
||||
log "sync + reboot (old boot_id $old, uptime $($SSH 'uptime -p'))"
|
||||
timeout 30 $SSH 'sync; sudo -n systemctl reboot' >/dev/null 2>&1
|
||||
wait_boot "$old"; rc=$?
|
||||
[ $rc = 2 ] && die "needed the rescue sshd (rboot) to come back: report to the owner"
|
||||
# safety net after boot (retry briefly: services come up a little after sshd)
|
||||
ok=0
|
||||
for _ in 1 2 3 4 5 6; do
|
||||
net=$($SSH 'echo rescue=$(ss -ltn | grep -c ":2222 ") wd=$(ls /dev/watchdog0 2>/dev/null | wc -l) hung=$(sysctl -n kernel.hung_task_panic) swap=$(swapon --show --noheadings | wc -l) nvme=$(sudo -n dmesg 2>/dev/null | grep -i -c -E "nvme.*(timeout|reset|abort|error)") up=$(cut -d" " -f1 /proc/uptime)')
|
||||
case "$net" in *"rescue=1 "*"wd=1 hung=1 swap=0 nvme=0 "*) ok=1; break;; esac
|
||||
sleep 10
|
||||
done
|
||||
log "safety net: $net"
|
||||
[ $ok = 1 ] || die "safety net check failed after boot ($net)"
|
||||
# cold page cache + this NVMe = ~30 MB/s for buffered reads (measured); pre-read the KAR file with large WILLNEED requests before the holder reads it
|
||||
$SSH "python3 -I $PF $KAR" 2>&1 | while read -r l; do log "prefetch: $l"; done
|
||||
# KAR holder, as after the boot of 2026-10-29 (notes.md): stale empty MODEL.lock removed, ONE holder started, READY rewritten
|
||||
$SSH 'pgrep -f "[k]ar_holder2" >/dev/null && echo HOLDER_ALREADY_RUNNING; rm -f '"$JOBS"'/READY; [ -d $HOME/work/gpu-runs/MODEL.lock ] && { rmdir $HOME/work/gpu-runs/MODEL.lock || echo MODEL_LOCK_NOT_EMPTY; }
|
||||
cd $HOME/work/gpu-runs/holder2 && { setsid nohup bash run_holder2.sh >> holder2.out 2>&1 < /dev/null & } ; sleep 1; echo started' | while read -r l; do log "holder: $l"; done
|
||||
for _ in $(seq 1 480); do $SSH 'test -s '"$JOBS"'/READY' 2>/dev/null && break; sleep 10; done
|
||||
$SSH 'test -s '"$JOBS"'/READY' || die "KAR holder not READY within 90 min"
|
||||
log "holder READY: $($SSH 'cat '"$JOBS"'/READY; echo " uptime_s=$(cut -d" " -f1 /proc/uptime)"')"
|
||||
log "memory before eviction: $(memstate)"
|
||||
# evict the page cache of every file read so far (per-file posix_fadvise DONTNEED, twice), then record what is left
|
||||
$SSH "python3 -I $EV $KAR $MODELDIR \$HOME/.local/share/strata/Strata-data/mtp \$HOME/.local/share/strata/Strata-data/packs/iq3_s; python3 -I $EV $KAR $MODELDIR; fincore $KAR | tail -1" 2>&1 | while read -r l; do log "evict: $l"; done
|
||||
ms=$(memstate); log "memory after eviction: $ms"
|
||||
f=$(foreign | grep -v '^proc:' | tr '\n' ' ')
|
||||
if [ -n "${f// /}" ]; then log "foreign work appeared after boot ($f): waiting for it, then redoing the reboot for a fresh state"; wait_quiet; continue; fi
|
||||
stub="bpe-$(printf '%02d' $cyc)-a$attempt"
|
||||
$SSH "mkdir -p $OUTR; cat > $JOBS/$stub.sh <<EOF
|
||||
#!/usr/bin/env bash
|
||||
# baseline-pair part e, cycle $cyc attempt $attempt: one arm on a fresh boot (memory after eviction: $ms)
|
||||
export OUTR=$OUTR BINDIR=bin-main-ffd9322 PCIE_FRAC=0.45 ENTRIES=\"$b:$pos:$arm\" PRE_ARM_HOOK=$TOOLS/cycle-hook.sh
|
||||
exec bash $TOOLS/baseline-pair-ab.sh
|
||||
EOF"
|
||||
log "queued $stub ($tag)"
|
||||
for _ in $(seq 1 270); do $SSH "test -e $JOBS/$stub.done" 2>/dev/null && break; sleep 10; done
|
||||
$SSH "test -e $JOBS/$stub.done" || die "$stub did not finish within 45 min"
|
||||
val=$($SSH "cat $OUTR/$tag/VALIDITY.txt 2>&1 | cut -c1-160")
|
||||
log "$stub done rc=$($SSH "cat $JOBS/$stub.done") validity: $val"
|
||||
$SSH "mkdir -p $OUTR/_cycles; cp $JOBS/$stub.log $OUTR/_cycles/$stub.log" 2>/dev/null
|
||||
case "$val" in
|
||||
VALID*) ;;
|
||||
*) fails=$((fails + 1)); $SSH "mkdir -p $OUTR/_invalid && mv $OUTR/$tag $OUTR/_invalid/$tag-a$attempt"
|
||||
[ $fails -ge 2 ] && die "cycle $cyc ($tag) failed twice: $val"
|
||||
log "invalid run moved to _invalid; repeating the cycle once"; push_log; continue;;
|
||||
esac
|
||||
case $arm in
|
||||
v1|v2)
|
||||
thp=$($SSH "python3 -I $TC $OUTR/$tag")
|
||||
log "THP check $tag: $thp"
|
||||
case "$thp" in
|
||||
*POOR*) if [ $attempt -lt 2 ]; then
|
||||
$SSH "mkdir -p $OUTR/_poor && mv $OUTR/$tag $OUTR/_poor/$tag-a$attempt"
|
||||
log "poor state (no full huge-page coverage): run moved to _poor; repeating the cycle once"; push_log; continue
|
||||
else
|
||||
$SSH "echo 'POOR STATE after the repeat: kept' > $OUTR/$tag/POOR.txt"; log "poor state again after the repeat: kept and flagged"
|
||||
fi;;
|
||||
esac;;
|
||||
esac
|
||||
push_log
|
||||
break
|
||||
done
|
||||
done
|
||||
done
|
||||
log "series complete: $cyc cycles"
|
||||
push_log
|
||||
#!/usr/bin/env bash
|
||||
# baseline-pair part e: ONE ARM PER FRESH BOOT. Runs on the LAPTOP (git bash), drives rnr5090 over ssh. Owner-authorised (chat, 2026-11-01): rebooting rnr5090 between runs.
|
||||
# Allowed on the server: `sudo -n systemctl reboot` and nothing else privileged (no systemd units, sysctl, grub, drop_caches, compact_memory; `sudo -n dmesg` is read-only).
|
||||
#
|
||||
# [START_CYCLE=2] bash baseline-reboot-series.sh [BLOCKS="1 2 3"] env: SERIES_LOG (local log), STOPFILE (touch it to stop after the current cycle), START_CYCLE (resume)
|
||||
#
|
||||
# Per cycle: (1) nothing foreign may run (jobs pending/running other than our stubs, gpu.lock, a GPU process); wait otherwise, never reboot under a job;
|
||||
# (2) `sync`, reboot, wait for ssh (new boot_id) up to 10 min; on timeout try the rescue sshd (:2222, `rboot`) once, then STOP; (3) safety net check (rescue sshd :2222, /dev/watchdog0,
|
||||
# hung_task_panic=1, swap off, no NVMe errors in dmesg): any failure STOPs the series; (4) pre-read the KAR file (large WILLNEED requests), restart the KAR holder the way decode/notes.md did
|
||||
# after a boot (remove the empty stale MODEL.lock, delete jobs/READY, `setsid nohup bash run_holder2.sh`), wait for READY (90 min);
|
||||
# (5) EVICT the page cache of the files read so far with per-file posix_fadvise(DONTNEED) (KAR file, both model shards, MTP files, vanilla pack; read-only files, user level): the holder's read
|
||||
# leaves ~50 GB of page cache that makes vanilla find no free 2 MiB blocks and run without huge pages; record MemFree and the free 2 MiB blocks; (6) queue ONE holder job (the arm) via
|
||||
# ENTRIES, wait for its .done, read VALIDITY.txt; (7) a vanilla arm must show AnonHugePages >= 46.4 GiB (baseline-thpcheck.py), otherwise the run is moved to _poor/ and the cycle is
|
||||
# repeated ONCE (a second poor run is kept and flagged); an invalid run is moved to _invalid/ and the cycle repeated once, a second failure STOPs the series; (8) next reboot.
|
||||
# Arms: ours = dt/bin-main-ffd9322 (main d29e3dba2 has the same code outside), PCIe 0.45 pinned, defaults; v1 = vanilla shipped defaults; v2 = tail skip off + prefill CPU share 0.
|
||||
# The job (baseline-pair-ab.sh) records settle.txt, pre.jsonl (uptime = time since boot, buddyinfo, meminfo), state.jsonl, post.jsonl, hook.txt (cycle-hook.sh: boot id/time, safety net, nvme dmesg hits).
|
||||
set -uo pipefail
|
||||
BLOCKS=${1:-"1 2 3"}
|
||||
SSH="ssh -o ConnectTimeout=6 -o BatchMode=yes rnr5090"
|
||||
OUTR=/data/leleka-e2e/runs/baseline-pair-e
|
||||
TOOLS=/data/leleka-e2e/baseline-pair/tools
|
||||
PF=$TOOLS/baseline-prefetch.py
|
||||
EV=$TOOLS/baseline-evict.py
|
||||
TC=$TOOLS/baseline-thpcheck.py
|
||||
JOBS='$HOME/work/gpu-runs/holder2/jobs'
|
||||
KAR=/home/para/work/leleka/models/leleka-gates/assets/qwen-iq3-s-l2-v4.kar
|
||||
MODELDIR=/home/para/work/leleka/models/leleka-gates/assets/model
|
||||
SERIES_LOG=${SERIES_LOG:-./baseline-reboot-series.log}
|
||||
STOPFILE=${STOPFILE:-./baseline-reboot-series.STOP}
|
||||
perm() { case $1 in 1) echo "ours v1 v2";; 2) echo "v2 v1 ours";; 3) echo "v1 v2 ours";; 4) echo "ours v2 v1";; 5) echo "v2 ours v1";; 6) echo "v1 ours v2";; esac; }
|
||||
CYLOG=""
|
||||
log() { local l="[$(date -u +%FT%TZ)] $*"; echo "$l" | tee -a "$SERIES_LOG"; CYLOG="$CYLOG$l"$'\n'; }
|
||||
die() { log "STOP SERIES: $*"; push_log; exit 1; }
|
||||
push_log() { [ -n "$CYLOG" ] && printf '%s' "$CYLOG" | $SSH "mkdir -p $OUTR/_cycles && cat >> $OUTR/_cycles/series.log" 2>/dev/null; CYLOG=""; }
|
||||
|
||||
foreign() { # prints what is running/queued that is not ours
|
||||
$SSH 'cd ~/work/gpu-runs/holder2/jobs 2>/dev/null || exit 0
|
||||
for f in *.sh; do b=${f%.sh}; case $b in 220-expert-tier|decode-sass-trace2|bpe-*) continue;; esac; [ -e $b.done ] || echo "job:$b"; done
|
||||
for r in *.running; do b=${r%.running}; case $b in 220-expert-tier|decode-sass-trace2|bpe-*) continue;; esac; echo "running:$b"; done
|
||||
[ -d /data/leleka-e2e/gpu.lock ] && echo "gpu.lock:$(cat /data/leleka-e2e/gpu.lock/owner 2>/dev/null)"
|
||||
nvidia-smi --query-compute-apps=pid --format=csv,noheader | sed "s/^/gpu-pid:/"
|
||||
pgrep -f "[l]eleka-inference|[s]trata-next|[/]strata --serve" | sed "s/^/proc:/"' 2>/dev/null
|
||||
}
|
||||
wait_quiet() { # up to 4 h
|
||||
local n=0 f
|
||||
while :; do
|
||||
f=$(foreign | tr '\n' ' ')
|
||||
[ -z "${f// /}" ] && return 0
|
||||
n=$((n + 1)); [ $((n % 5)) = 1 ] && log "waiting for foreign work to finish: $f"
|
||||
[ $n -gt 240 ] && die "foreign work still present after 4 h: $f"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
wait_boot() { # $1 old boot_id ; up to 10 min after the reboot command
|
||||
local t0=$SECONDS id
|
||||
sleep 30
|
||||
while [ $((SECONDS - t0)) -lt 600 ]; do
|
||||
id=$($SSH 'cat /proc/sys/kernel/random/boot_id' 2>/dev/null) && [ -n "$id" ] && [ "$id" != "$1" ] && { log "ssh back after $((SECONDS - t0)) s, new boot_id $id"; return 0; }
|
||||
sleep 10
|
||||
done
|
||||
log "no ssh within 10 min; trying the rescue sshd :2222"
|
||||
ssh -o ConnectTimeout=10 -o BatchMode=yes -p 2222 -l root rnr5090 'uptime; dmesg | tail -15' 2>&1 | tail -20 | while read -r l; do log "rescue: $l"; done
|
||||
ssh -o ConnectTimeout=10 -o BatchMode=yes -p 2222 -l root rnr5090 'rboot' >/dev/null 2>&1
|
||||
t0=$SECONDS; sleep 30
|
||||
while [ $((SECONDS - t0)) -lt 600 ]; do
|
||||
id=$($SSH 'cat /proc/sys/kernel/random/boot_id' 2>/dev/null) && [ -n "$id" ] && [ "$id" != "$1" ] && { log "ssh back after rboot, $((SECONDS - t0)) s"; return 2; }
|
||||
sleep 10
|
||||
done
|
||||
die "server did not come back after reboot and rboot"
|
||||
}
|
||||
memstate() { # MemFree / Cached / free 2 MiB+ blocks (buddyinfo orders 9-10, Normal + DMA32)
|
||||
$SSH 'echo "MemFree_GiB=$(awk "/^MemFree/{printf \"%.1f\",\$2/2^20}" /proc/meminfo) Cached_GiB=$(awk "/^Cached/{printf \"%.1f\",\$2/2^20}" /proc/meminfo) Shmem_GiB=$(awk "/^Shmem:/{printf \"%.1f\",\$2/2^20}" /proc/meminfo) free2M_GiB=$(awk "/Normal|DMA32/{for(o=9;o<=10;o++) s+=\$(5+o)*4096*2^o} END{printf \"%.1f\",s/2^30}" /proc/buddyinfo)"'
|
||||
}
|
||||
|
||||
mkdir -p "$(dirname "$SERIES_LOG")" 2>/dev/null
|
||||
$SSH 'sudo -n true' || die "passwordless sudo not available"
|
||||
cyc=0
|
||||
for b in $BLOCKS; do
|
||||
pos=0
|
||||
for arm in $(perm "$b"); do
|
||||
pos=$((pos + 1)); cyc=$((cyc + 1)); tag=$(printf "b%02dp%d-%s" "$b" "$pos" "$arm")
|
||||
[ $cyc -lt ${START_CYCLE:-1} ] && continue # resume after a stopped series
|
||||
[ -e "$STOPFILE" ] && die "stop file present before $tag"
|
||||
tries=0; attempt=0; fails=0
|
||||
while :; do
|
||||
tries=$((tries + 1)); attempt=$((attempt + 1)); [ $tries -gt 4 ] && die "cycle $cyc ($tag) kept getting foreign work / retries"
|
||||
log "=== cycle $cyc $tag (attempt $attempt)"
|
||||
wait_quiet
|
||||
old=$($SSH 'cat /proc/sys/kernel/random/boot_id') || die "ssh failed before reboot"
|
||||
$SSH 'sudo -n true' || die "passwordless sudo vanished"
|
||||
log "sync + reboot (old boot_id $old, uptime $($SSH 'uptime -p'))"
|
||||
timeout 30 $SSH 'sync; sudo -n systemctl reboot' >/dev/null 2>&1
|
||||
wait_boot "$old"; rc=$?
|
||||
[ $rc = 2 ] && die "needed the rescue sshd (rboot) to come back: report to the owner"
|
||||
# safety net after boot (retry briefly: services come up a little after sshd)
|
||||
ok=0
|
||||
for _ in 1 2 3 4 5 6; do
|
||||
net=$($SSH 'echo rescue=$(ss -ltn | grep -c ":2222 ") wd=$(ls /dev/watchdog0 2>/dev/null | wc -l) hung=$(sysctl -n kernel.hung_task_panic) swap=$(swapon --show --noheadings | wc -l) nvme=$(sudo -n dmesg 2>/dev/null | grep -i -c -E "nvme.*(timeout|reset|abort|error)") up=$(cut -d" " -f1 /proc/uptime)')
|
||||
case "$net" in *"rescue=1 "*"wd=1 hung=1 swap=0 nvme=0 "*) ok=1; break;; esac
|
||||
sleep 10
|
||||
done
|
||||
log "safety net: $net"
|
||||
[ $ok = 1 ] || die "safety net check failed after boot ($net)"
|
||||
# cold page cache + this NVMe = ~30 MB/s for buffered reads (measured); pre-read the KAR file with large WILLNEED requests before the holder reads it
|
||||
$SSH "python3 -I $PF $KAR" 2>&1 | while read -r l; do log "prefetch: $l"; done
|
||||
# KAR holder, as after the boot of 2026-10-29 (notes.md): stale empty MODEL.lock removed, ONE holder started, READY rewritten
|
||||
$SSH 'pgrep -f "[k]ar_holder2" >/dev/null && echo HOLDER_ALREADY_RUNNING; rm -f '"$JOBS"'/READY; [ -d $HOME/work/gpu-runs/MODEL.lock ] && { rmdir $HOME/work/gpu-runs/MODEL.lock || echo MODEL_LOCK_NOT_EMPTY; }
|
||||
cd $HOME/work/gpu-runs/holder2 && { setsid nohup bash run_holder2.sh >> holder2.out 2>&1 < /dev/null & } ; sleep 1; echo started' | while read -r l; do log "holder: $l"; done
|
||||
for _ in $(seq 1 480); do $SSH 'test -s '"$JOBS"'/READY' 2>/dev/null && break; sleep 10; done
|
||||
$SSH 'test -s '"$JOBS"'/READY' || die "KAR holder not READY within 90 min"
|
||||
log "holder READY: $($SSH 'cat '"$JOBS"'/READY; echo " uptime_s=$(cut -d" " -f1 /proc/uptime)"')"
|
||||
log "memory before eviction: $(memstate)"
|
||||
# evict the page cache of every file read so far (per-file posix_fadvise DONTNEED, twice), then record what is left
|
||||
$SSH "python3 -I $EV $KAR $MODELDIR \$HOME/.local/share/strata/Strata-data/mtp \$HOME/.local/share/strata/Strata-data/packs/iq3_s; python3 -I $EV $KAR $MODELDIR; fincore $KAR | tail -1" 2>&1 | while read -r l; do log "evict: $l"; done
|
||||
ms=$(memstate); log "memory after eviction: $ms"
|
||||
f=$(foreign | grep -v '^proc:' | tr '\n' ' ')
|
||||
if [ -n "${f// /}" ]; then log "foreign work appeared after boot ($f): waiting for it, then redoing the reboot for a fresh state"; wait_quiet; continue; fi
|
||||
stub="bpe-$(printf '%02d' $cyc)-a$attempt"
|
||||
$SSH "mkdir -p $OUTR; cat > $JOBS/$stub.sh <<EOF
|
||||
#!/usr/bin/env bash
|
||||
# baseline-pair part e, cycle $cyc attempt $attempt: one arm on a fresh boot (memory after eviction: $ms)
|
||||
export OUTR=$OUTR BINDIR=bin-main-ffd9322 PCIE_FRAC=0.45 ENTRIES=\"$b:$pos:$arm\" PRE_ARM_HOOK=$TOOLS/cycle-hook.sh
|
||||
exec bash $TOOLS/baseline-pair-ab.sh
|
||||
EOF"
|
||||
log "queued $stub ($tag)"
|
||||
for _ in $(seq 1 270); do $SSH "test -e $JOBS/$stub.done" 2>/dev/null && break; sleep 10; done
|
||||
$SSH "test -e $JOBS/$stub.done" || die "$stub did not finish within 45 min"
|
||||
val=$($SSH "cat $OUTR/$tag/VALIDITY.txt 2>&1 | cut -c1-160")
|
||||
log "$stub done rc=$($SSH "cat $JOBS/$stub.done") validity: $val"
|
||||
$SSH "mkdir -p $OUTR/_cycles; cp $JOBS/$stub.log $OUTR/_cycles/$stub.log" 2>/dev/null
|
||||
case "$val" in
|
||||
VALID*) ;;
|
||||
*) fails=$((fails + 1)); $SSH "mkdir -p $OUTR/_invalid && mv $OUTR/$tag $OUTR/_invalid/$tag-a$attempt"
|
||||
[ $fails -ge 2 ] && die "cycle $cyc ($tag) failed twice: $val"
|
||||
log "invalid run moved to _invalid; repeating the cycle once"; push_log; continue;;
|
||||
esac
|
||||
case $arm in
|
||||
v1|v2)
|
||||
thp=$($SSH "python3 -I $TC $OUTR/$tag")
|
||||
log "THP check $tag: $thp"
|
||||
case "$thp" in
|
||||
*POOR*) if [ $attempt -lt 2 ]; then
|
||||
$SSH "mkdir -p $OUTR/_poor && mv $OUTR/$tag $OUTR/_poor/$tag-a$attempt"
|
||||
log "poor state (no full huge-page coverage): run moved to _poor; repeating the cycle once"; push_log; continue
|
||||
else
|
||||
$SSH "echo 'POOR STATE after the repeat: kept' > $OUTR/$tag/POOR.txt"; log "poor state again after the repeat: kept and flagged"
|
||||
fi;;
|
||||
esac;;
|
||||
esac
|
||||
push_log
|
||||
break
|
||||
done
|
||||
done
|
||||
done
|
||||
log "series complete: $cyc cycles"
|
||||
push_log
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# KAR file source A/B: the 5090 profile with the level-2 KAR archive as a sealed memfd (today, 55.3 GB of shmem made by a holder) against the same archive as an ordinary
|
||||
# READ-ONLY FILE served through the page cache (profile rtx5090-32g-file, engine flag --kar-archive-file; docs/kar-file-source.md). Same binary, same frozen corpus, same
|
||||
# READ-ONLY FILE served through the page cache (profile rtx5090-32g-file, engine flag --kar-archive-file). Same binary, same frozen corpus, same
|
||||
# 5-turn ~245k session as speedtrain3-ab.sh, seed OFF, upstream ranked profile, alternating arms.
|
||||
#
|
||||
# NOT A HOLDER JOB. The file arms need the RAM that the holder's memfd pins, so the holder must be stopped first (and MODEL.lock free): this script takes MODEL.lock and gpu.lock
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# OWNER-RUN, NOT RUN BY THE AGENT. Needs root. Hypothesis test for docs/experiments/baseline-pair-5090.md section 5: a vanilla run that follows an ours run gets fewer transparent
|
||||
# huge pages (free memory in blocks of 2 MiB or more is 40-46 GiB instead of 49 GiB), so compact memory before every vanilla launch and see whether the "after ours" penalty disappears.
|
||||
# It changes no setting: it only asks the kernel to compact free memory once (writes 1 to /proc/sys/vm/compact_memory) and prints the free 2 MiB-or-larger blocks before and after.
|
||||
#
|
||||
# Use with the job: sudo-install this file, then queue
|
||||
# PRE_ARM_HOOK=/path/to/owner-compact-memory.sh SEQ="v2 ours v2 ours v2 ours v2 ours v2 ours" OUTR=/data/leleka-e2e/runs/baseline-pair-c ... bash baseline-pair-ab.sh
|
||||
# (the hook is called as `hook <arm>` and must itself be allowed to write /proc/sys/vm/compact_memory, e.g. run the whole holder job as root or give this one script a sudoers NOPASSWD entry).
|
||||
# Compare against bp-b (same sequence without the hook). Do not leave the hook in place for any other measurement.
|
||||
set -u
|
||||
free_hi() { awk '/Normal|DMA32/ { for (o = 9; o <= 10; o++) s += $(5 + o) * (4096 * 2 ^ o) } END { printf "%.1f GiB\n", s / 2 ^ 30 }' /proc/buddyinfo; }
|
||||
echo "arm=$1 free>=2MiB before: $(free_hi)"
|
||||
sync
|
||||
echo 1 > /proc/sys/vm/compact_memory
|
||||
echo "free>=2MiB after: $(free_hi)"
|
||||
#!/usr/bin/env bash
|
||||
# OWNER-RUN, NOT RUN BY THE AGENT. Needs root. Hypothesis test: a vanilla run that follows an ours run gets fewer transparent
|
||||
# huge pages (free memory in blocks of 2 MiB or more is 40-46 GiB instead of 49 GiB), so compact memory before every vanilla launch and see whether the "after ours" penalty disappears.
|
||||
# It changes no setting: it only asks the kernel to compact free memory once (writes 1 to /proc/sys/vm/compact_memory) and prints the free 2 MiB-or-larger blocks before and after.
|
||||
#
|
||||
# Use with the job: sudo-install this file, then queue
|
||||
# PRE_ARM_HOOK=/path/to/owner-compact-memory.sh SEQ="v2 ours v2 ours v2 ours v2 ours v2 ours" OUTR=/data/leleka-e2e/runs/baseline-pair-c ... bash baseline-pair-ab.sh
|
||||
# (the hook is called as `hook <arm>` and must itself be allowed to write /proc/sys/vm/compact_memory, e.g. run the whole holder job as root or give this one script a sudoers NOPASSWD entry).
|
||||
# Compare against bp-b (same sequence without the hook). Do not leave the hook in place for any other measurement.
|
||||
set -u
|
||||
free_hi() { awk '/Normal|DMA32/ { for (o = 9; o <= 10; o++) s += $(5 + o) * (4096 * 2 ^ o) } END { printf "%.1f GiB\n", s / 2 ^ 30 }' /proc/buddyinfo; }
|
||||
echo "arm=$1 free>=2MiB before: $(free_hi)"
|
||||
sync
|
||||
echo 1 > /proc/sys/vm/compact_memory
|
||||
echo "free>=2MiB after: $(free_hi)"
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
# OWNER-RUN (root), NOT run by agents. claude/hugepages, 2026-11-01. Changes ONE runtime THP knob, reversibly; nothing persists across a reboot.
|
||||
#
|
||||
# Why (and why it is optional): the KAR holder's sealed memfd (51.5 GiB, memfd_create = shmem) cannot get transparent huge pages while
|
||||
# /sys/kernel/mm/transparent_hugepage/shmem_enabled is "never" (rnr5090 default): MADV_HUGEPAGE on shmem is ignored, MFD_HUGETLB needs reserved hugetlbfs pages
|
||||
# (vm.nr_hugepages=0). The serve path does NOT map that memfd during decode (the PLE rows are pread() copies through the kernel's own large-page direct map, and the
|
||||
# experts are read from the separate resident bank copy, which LELEKA_HUGEPAGES=on puts on huge pages from userspace), so this knob is not needed for the
|
||||
# decode path measured in docs/experiments/hugepages-5090.md. It only matters if a future path maps the memfd (e.g. a zero-copy KAR expert source).
|
||||
#
|
||||
# sudo bash owner-shmem-thp.sh show # print the knobs (default action)
|
||||
# sudo bash owner-shmem-thp.sh advise # shmem_enabled=advise: shmem/memfd regions get THP where MADV_HUGEPAGE is asked (and on khugepaged collapse)
|
||||
# sudo bash owner-shmem-thp.sh never # revert to the rnr5090 default
|
||||
# After "advise" the existing memfd keeps its 4 KiB pages; it gets huge pages only when the holder re-creates it (restart kar_holder2.py between jobs) AND the
|
||||
# holder maps it with MADV_HUGEPAGE before writing, or when a process MADV_COLLAPSEs a mapping of it.
|
||||
set -euo pipefail
|
||||
K=/sys/kernel/mm/transparent_hugepage
|
||||
case "${1:-show}" in
|
||||
show) ;;
|
||||
advise|never)
|
||||
[ "$(id -u)" = 0 ] || { echo "run as root" >&2; exit 1; }
|
||||
echo "shmem_enabled before: $(cat $K/shmem_enabled)"
|
||||
echo "$1" > $K/shmem_enabled
|
||||
;;
|
||||
*) echo "usage: $0 show|advise|never" >&2; exit 2 ;;
|
||||
esac
|
||||
for f in enabled defrag shmem_enabled hugepages-2048kB/shmem_enabled khugepaged/defrag; do echo "$f: $(cat $K/$f 2>/dev/null)"; done
|
||||
grep -E "ShmemHugePages|ShmemPmdMapped|AnonHugePages|HugePages_Total" /proc/meminfo
|
||||
#!/usr/bin/env bash
|
||||
# OWNER-RUN (root), NOT run by agents. claude/hugepages, 2026-11-01. Changes ONE runtime THP knob, reversibly; nothing persists across a reboot.
|
||||
#
|
||||
# Why (and why it is optional): the KAR holder's sealed memfd (51.5 GiB, memfd_create = shmem) cannot get transparent huge pages while
|
||||
# /sys/kernel/mm/transparent_hugepage/shmem_enabled is "never" (rnr5090 default): MADV_HUGEPAGE on shmem is ignored, MFD_HUGETLB needs reserved hugetlbfs pages
|
||||
# (vm.nr_hugepages=0). The serve path does NOT map that memfd during decode (the PLE rows are pread() copies through the kernel's own large-page direct map, and the
|
||||
# experts are read from the separate resident bank copy, which LELEKA_HUGEPAGES=on puts on huge pages from userspace), so this knob is not needed for the
|
||||
# decode path measured. It only matters if a future path maps the memfd (e.g. a zero-copy KAR expert source).
|
||||
#
|
||||
# sudo bash owner-shmem-thp.sh show # print the knobs (default action)
|
||||
# sudo bash owner-shmem-thp.sh advise # shmem_enabled=advise: shmem/memfd regions get THP where MADV_HUGEPAGE is asked (and on khugepaged collapse)
|
||||
# sudo bash owner-shmem-thp.sh never # revert to the rnr5090 default
|
||||
# After "advise" the existing memfd keeps its 4 KiB pages; it gets huge pages only when the holder re-creates it (restart kar_holder2.py between jobs) AND the
|
||||
# holder maps it with MADV_HUGEPAGE before writing, or when a process MADV_COLLAPSEs a mapping of it.
|
||||
set -euo pipefail
|
||||
K=/sys/kernel/mm/transparent_hugepage
|
||||
case "${1:-show}" in
|
||||
show) ;;
|
||||
advise|never)
|
||||
[ "$(id -u)" = 0 ] || { echo "run as root" >&2; exit 1; }
|
||||
echo "shmem_enabled before: $(cat $K/shmem_enabled)"
|
||||
echo "$1" > $K/shmem_enabled
|
||||
;;
|
||||
*) echo "usage: $0 show|advise|never" >&2; exit 2 ;;
|
||||
esac
|
||||
for f in enabled defrag shmem_enabled hugepages-2048kB/shmem_enabled khugepaged/defrag; do echo "$f: $(cat $K/$f 2>/dev/null)"; done
|
||||
grep -E "ShmemHugePages|ShmemPmdMapped|AnonHugePages|HugePages_Total" /proc/meminfo
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# STRA-245 parity audit (docs/experiments/parity-audit-5090.md): paired settings A/B, ours against ours, on the 5-turn 245k Codex-shaped session of the 5090 decode gap.
|
||||
# STRA-245 parity audit: paired settings A/B, ours against ours, on the 5-turn 245k Codex-shaped session of the 5090 decode gap.
|
||||
# HOLDER JOB. Queue stub: ~/work/gpu-runs/holder2/jobs/parity-audit-ab.sh = `exec bash /data/leleka-e2e/parity-audit/jobs/parity-audit-ab.sh`, entry LAST in jobs/PRIORITY
|
||||
# (after dt-ab3, dt-profile-ab, sm120-replay-id, sm120-e2e-ab). It needs the sealed KAR memfd fd of the holder exactly like run-e2e.sh; no second holder is ever started.
|
||||
# It takes /data/leleka-e2e/gpu.lock per arm (one arm at a time) and skips an arm when something else uses the GPU.
|
||||
@@ -20,7 +20,7 @@
|
||||
# pa-gather STRATA_IQ_GATHER=1 (AVX-512 grid gathers in the CPU IQ kernels; same words, same results) lossless
|
||||
# pa-lto E2E_BIN=$LTO_BIN, a `cargo build --profile release-lto` build (only if one exists; none is built on the server) lossless
|
||||
# Placement-class arms (PCIe share, decode reserve) change which device computes an expert or how many experts are resident. They are experimental flags: they stay OFF by
|
||||
# default in every profile and in the engine until a q_tail_gate result exists for them (docs/experiments/2026-10-28-s6-1-lossy-audit.md, finding F4).
|
||||
# default in every profile and in the engine until a q_tail_gate result exists for them.
|
||||
# Metric: per-turn decode_tok_s of the client (long-session.json), same prompts per turn index; compare per-turn means of the repeats, never a single run.
|
||||
set -uo pipefail
|
||||
D=/data/leleka-e2e/parity-audit
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Start the lab holder with the fast, page-cache-free seal (see single-copy-holder.py). Same MODEL.lock contract as run_holder2.sh.
|
||||
# single-copy-holder.sh [BIN_DIR] BIN_DIR holds `leleka` (default /data/leleka-e2e/decode/dt/bin-singlecopy)
|
||||
# The memfd is SPARSE by default (`--sparse-ple`: only the 14.9 GiB the serve path reads; holes elsewhere), the form of profile rtx5090-32g. A full 55.3 GB memfd is a second
|
||||
# copy of model bytes next to the resident expert bank (36.6 GiB nobody reads; the 2026-11-09 server measurement, docs/design/single-copy-ram-2026-11-09.md), and `leleka run`
|
||||
# copy of model bytes next to the resident expert bank (36.6 GiB nobody reads; the 2026-11-09 server measurement), and `leleka run`
|
||||
# now refuses it for a ple_only profile. HOLDER_MEMFD=full restores the full copy (jobs whose profile is memfd_extents=full, with LELEKA_ALLOW_FULL_MEMFD=1 where needed).
|
||||
# Run it detached: cd ~/work/gpu-runs/holder2 && rm -f jobs/STOP && setsid nohup bash /data/leleka-e2e/single-copy/tools/single-copy-holder.sh > holder3.out 2>&1 &
|
||||
set -u
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# Sparse-memfd A/B: the sealed KAR memfd that holds ONLY the byte ranges the serve path reads (the PLE rows, header, directory; about 16 GB of 55.3 GB, the rest is a hole)
|
||||
# against the full memfd, SAME binaries in both arms, paired 5-turn ~245k session on the frozen corpus, counterbalanced arm order. Shape copied from draftvocab-ab.sh /
|
||||
# speedtrain3-ab.sh (+ draftvocab-id.sh for the identity part). Design and the claims it tests: docs/kar-sparse-memfd.md, docs/design/memory-single-copy-and-elastic-state.md B0.
|
||||
# THIS IS NOT A HOLDER JOB. It makes its own sealed memfd per arm (`leleka seal-exec`), and the holder's 55 GB memfd would not fit next to it (55.3 + 16 + 54 GiB of bank
|
||||
# speedtrain3-ab.sh (+ draftvocab-id.sh for the identity part). Design and the claims it tests:.
|
||||
# It makes its own sealed memfd per arm (`leleka seal-exec`), and the holder's 55 GB memfd would not fit next to it (55.3 + 16 + 54 GiB of bank
|
||||
# on a 121 GiB host). Run it with the holder STOPPED: it refuses to start while $G/MODEL.lock exists or while Shmem is above 8 GiB, and it takes MODEL.lock itself.
|
||||
# It takes /data/leleka-e2e/gpu.lock per arm, one arm at a time, and skips an arm when something else uses the GPU. NOT QUEUED by its author: the orchestrator decides when.
|
||||
#
|
||||
@@ -11,7 +11,7 @@
|
||||
# binaries, built once from claude/sparse-memfd in release mode and frozen read-only (record their sha256 in dt/BUILD.md):
|
||||
# dt/bin-sparsememfd/{leleka,leleka-inference,leleka-daemon,leleka-cli,leleka-api} the same five for both arms
|
||||
# dt/rt-sparsememfd the leleka-runtime lib test binary (replay smoke) of the same commit
|
||||
# EXTENTS_SHA256=<64 hex> the pinned digest of the archive's extents, from `kar_census ARCHIVE --hash-extents` on the archive that matched its full SHA-256 (docs/kar-sparse-memfd.md)
|
||||
# EXTENTS_SHA256=<64 hex> the pinned digest of the archive's extents, from `kar_census ARCHIVE --hash-extents` on the archive that matched its full SHA-256
|
||||
#
|
||||
# EXTENTS_SHA256=... bash sparse-memfd-ab.sh # PHASES="id e2e": identity, then the 4-arm session A/B (about 90 GPU-min)
|
||||
# PHASES=id EXTENTS_SHA256=... bash sparse-memfd-ab.sh # only the teacher-forced identity gate (2 processes, about 20 min)
|
||||
@@ -69,7 +69,7 @@ need_pin=0
|
||||
case " $ARMS " in *" sparse "*) need_pin=1 ;; esac
|
||||
case " $PHASES " in *" id "*) need_pin=1 ;; esac
|
||||
if [ $need_pin = 1 ]; then
|
||||
echo "$EXTENTS_SHA256" | grep -Eq '^[0-9a-f]{64}$' || { echo "EXTENTS_SHA256 must be the 64 hex digits printed by 'kar_census ARCHIVE --hash-extents' (docs/kar-sparse-memfd.md)" >&2; exit 3; }
|
||||
echo "$EXTENTS_SHA256" | grep -Eq '^[0-9a-f]{64}$' || { echo "EXTENTS_SHA256 must be the 64 hex digits printed by 'kar_census ARCHIVE --hash-extents' (spec node kar-sparse-memfd.md)" >&2; exit 3; }
|
||||
fi
|
||||
[ "$(stat -c %s "$KAR")" = "$KAR_BYTES" ] || { echo "$KAR is not $KAR_BYTES bytes" >&2; exit 3; }
|
||||
if [ -d "$G/MODEL.lock" ]; then echo "refusing to start: $G/MODEL.lock exists (the holder is running). This job makes its own memfd; stop the holder first, a second 55 GB memfd does not fit" >&2; exit 3; fi
|
||||
|
||||
@@ -771,7 +771,7 @@ def sc_long(ctx, sc):
|
||||
if s.comments:
|
||||
sc.note(f"long turn1: {len(s.comments)} keep-alive comment(s) during prefill")
|
||||
# Informational: the same long context with the Codex tool list. The model decides whether to call a tool; a malformed call
|
||||
# ends the stream with response.failed (the model's format error, see docs/e2e-run.md), which is recorded, not scored.
|
||||
# ends the stream with response.failed (the model's format error), which is recorded, not scored.
|
||||
body4 = codex_body(ctx.model, "Repository context follows.\n" + ctxt + "\n\n" + q1, tools=True, max_out=256, temperature=0)
|
||||
s4 = ctx.c.stream("/v1/responses", body4)
|
||||
r4 = s4.response()
|
||||
|
||||
@@ -78,7 +78,7 @@ import tempfile
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
DEFAULT_ANALYZE = os.path.normpath(os.path.join(HERE, "..", "analyze_session.py"))
|
||||
DEFAULT_UPSTREAM_DOC = os.path.normpath(os.path.join(HERE, "..", "..", "..", "docs", "upstream.md"))
|
||||
DEFAULT_UPSTREAM_DOC = os.path.normpath(os.path.join(HERE, "..", "..", "..", "engine", "upstream.md"))
|
||||
|
||||
EXIT_OK, EXIT_NO_CPU, EXIT_INPUT, EXIT_POWER_NA, EXIT_ANALYZE, EXIT_USAGE = 0, 2, 3, 4, 5, 64
|
||||
GAP_S = 10.0 # a sample gap above this is counted (scripts/laptop/monitor.sh uses 10 s)
|
||||
@@ -492,10 +492,10 @@ def upstream_commit(doc_path):
|
||||
with open(doc_path, encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
except OSError as exc:
|
||||
raise fail_input("docs/upstream.md not readable (%s): %s" % (doc_path, exc.strerror or exc))
|
||||
raise fail_input("engine/upstream.md not readable (%s): %s" % (doc_path, exc.strerror or exc))
|
||||
m = re.search(r"\|\s*Upstream commit SHA\s*\|\s*`([0-9a-f]{40})`", text)
|
||||
if not m:
|
||||
raise fail_input("docs/upstream.md: no `Upstream commit SHA` row with a 40-hex commit")
|
||||
raise fail_input("engine/upstream.md: no `Upstream commit SHA` row with a 40-hex commit")
|
||||
return m.group(1)
|
||||
|
||||
|
||||
@@ -655,7 +655,7 @@ def main(argv=None):
|
||||
ap.add_argument("--power-series", required=True)
|
||||
ap.add_argument("--out", required=True)
|
||||
ap.add_argument("--analyze-session", default=DEFAULT_ANALYZE, help="path of analyze_session.py (default: the sibling in scripts/e2e)")
|
||||
ap.add_argument("--upstream-doc", default=DEFAULT_UPSTREAM_DOC, help="docs/upstream.md (default: this checkout's)")
|
||||
ap.add_argument("--upstream-doc", default=DEFAULT_UPSTREAM_DOC, help="engine/upstream.md (default: this checkout's)")
|
||||
args = ap.parse_args(argv)
|
||||
try:
|
||||
return run(args)
|
||||
|
||||
@@ -19,7 +19,7 @@ Exit codes
|
||||
4 the ENFORCED GPU power limit is N/A, empty or not a positive number in a sample (fail closed, as capture.py)
|
||||
64 usage error (`ours` is refused here: it is captured by capture.py)
|
||||
|
||||
The vanilla engine log (the lines STRA-247 names, docs/experiments/2026-10-28-s0-7-vanilla-arms.md section 6; stderr of `strata --serve`, one set of lines
|
||||
The vanilla engine log (the lines STRA-247 names; stderr of `strata --serve`, one set of lines
|
||||
per request, the warm-up request of the launcher first):
|
||||
strata decode timing: N windows, avg T x, y tokens/window, z ms/window = verify v (GPU-reach wait ..) ... STRATA_DECODE_TIMING=1, per request
|
||||
strata decode GPU stages (ms/window): GDN layers: ... | QSA layers: ... | total t ms/window over n windows STRATA_VERIFY_PROFILE=1, per request
|
||||
@@ -34,7 +34,7 @@ fit the S0.1 turn object (additionalProperties false): it is parsed and written
|
||||
synthetic, long_session_argv, source_snapshot_sha256, owner_attestation, foreign_load) PLUS the facts a vanilla log cannot carry:
|
||||
model {digest, digest_mapping}, configuration {context_tokens, kv, slots, batch, speculation}, cache {state, metric, value, unit},
|
||||
hardware {cpu_model, gpu_name (optional: sampler or nvidia-smi), os (optional: this machine)}, software {cuda_version, driver_version (optional),
|
||||
strata_upstream_commit (optional: docs/upstream.md)}, vanilla_noskip_environment [NAME=VALUE, ...] (vanilla_noskip only: the environment the engine
|
||||
strata_upstream_commit (optional: engine/upstream.md)}, vanilla_noskip_environment [NAME=VALUE, ...] (vanilla_noskip only: the environment the engine
|
||||
was started with), vanilla_family {control_printed [lines], predicate {tool, output} | "unavailable: <blocker>", binary_identity {engine_version, sha256}}
|
||||
(the fallback of --family-dir).
|
||||
--family-dir: control.log (the engine log of the start-up with STRATA_FORCE_AVX2=1), predicate.json ({tool, output}; absent and not in --meta =
|
||||
@@ -611,8 +611,8 @@ def main(argv=None):
|
||||
ap.add_argument("--out", required=True)
|
||||
ap.add_argument("--family-dir", default=None, help="control.log, predicate.json, binary_identity.json")
|
||||
ap.add_argument("--parsed-out", default=None, help="write the parsed per-turn engine values and per-round timing here (not part of the record)")
|
||||
ap.add_argument("--upstream-doc", default=os.path.normpath(os.path.join(HERE, "..", "..", "..", "docs", "upstream.md")),
|
||||
help="docs/upstream.md (default: this checkout's)")
|
||||
ap.add_argument("--upstream-doc", default=os.path.normpath(os.path.join(HERE, "..", "..", "..", "engine", "upstream.md")),
|
||||
help="engine/upstream.md (default: this checkout's)")
|
||||
return run_capture(ap.parse_args(argv))
|
||||
except Fail as exc:
|
||||
sys.stderr.write("capture_vanilla: %s\n" % exc.message)
|
||||
|
||||
@@ -519,7 +519,7 @@ def build_cases():
|
||||
one_pair("laptop", {"ours": pw(99.9, 112.0, 105.0), "vanilla_default": pw(100.5, 112.0, 105.0), "vanilla_noskip": pw(100.5, 112.0, 105.0)}),
|
||||
pairs_expected((1, X(False, ["POWER"])))))
|
||||
add(case("power_51w_recorded_run", "POWER", "pairs",
|
||||
"The recorded run of docs/laptop-vs-vanilla.md section 14 (the run with the prefix-checkpoint fix: 'the GPU power limit read 51 W (P3) for the whole run'): ours min = max = mean = 51.0 W. 51.0 < 100 -> POWER (also: mean difference to the 122.0 W arms = 71.0 > 10). The other two arms keep the clean template band 118.0..126.5.",
|
||||
"The recorded run of spec node laptop-vs-vanilla.md section 14 (the run with the prefix-checkpoint fix: 'the GPU power limit read 51 W (P3) for the whole run'): ours min = max = mean = 51.0 W. 51.0 < 100 -> POWER (also: mean difference to the 122.0 W arms = 71.0 > 10). The other two arms keep the clean template band 118.0..126.5.",
|
||||
one_pair("laptop", {"ours": pw(51.0, 51.0, 51.0)}),
|
||||
pairs_expected((1, X(False, ["POWER"])))))
|
||||
add(case("power_sample_above_max_limit", "POWER", "pairs",
|
||||
@@ -547,7 +547,7 @@ def build_cases():
|
||||
one_pair("laptop", {"ours": pw(110.0, 130.0, 120.0)}),
|
||||
pairs_expected((1, X(True)))))
|
||||
add(case("clean_laptop_run", "POWER", "pairs",
|
||||
"The recorded clean run g2-vanilla-noskip of docs/laptop-vs-vanilla.md section 11: limit 110.0 rising to 126.6 W over the whole run. Spread 126.6 - 110.0 = 16.6 <= 20; floor 110.0 >= 100; max 126.6 <= 150.0; all three arms 110.0..126.6 mean 118.3 so the mean difference is 0.0. The limit changed during the run (start 110.0, end 126.6, power_limit_changed true) and the pair MUST stay valid (SDET remark H, QA-2).",
|
||||
"The recorded clean run g2-vanilla-noskip of spec node laptop-vs-vanilla.md section 11: limit 110.0 rising to 126.6 W over the whole run. Spread 126.6 - 110.0 = 16.6 <= 20; floor 110.0 >= 100; max 126.6 <= 150.0; all three arms 110.0..126.6 mean 118.3 so the mean difference is 0.0. The limit changed during the run (start 110.0, end 126.6, power_limit_changed true) and the pair MUST stay valid (SDET remark H, QA-2).",
|
||||
one_pair("laptop", {a: pw(110.0, 126.6, 118.3) for a in ARMS}),
|
||||
pairs_expected((1, X(True)))))
|
||||
# ---- POWER (server) ----
|
||||
|
||||
@@ -930,7 +930,7 @@
|
||||
"name": "power_51w_recorded_run",
|
||||
"class": "POWER",
|
||||
"kind": "pairs",
|
||||
"basis": "The recorded run of docs/laptop-vs-vanilla.md section 14 (the run with the prefix-checkpoint fix: 'the GPU power limit read 51 W (P3) for the whole run'): ours min = max = mean = 51.0 W. 51.0 < 100 -> POWER (also: mean difference to the 122.0 W arms = 71.0 > 10). The other two arms keep the clean template band 118.0..126.5.",
|
||||
"basis": "The recorded run of spec node laptop-vs-vanilla.md section 14 (the run with the prefix-checkpoint fix: 'the GPU power limit read 51 W (P3) for the whole run'): ours min = max = mean = 51.0 W. 51.0 < 100 -> POWER (also: mean difference to the 122.0 W arms = 71.0 > 10). The other two arms keep the clean template band 118.0..126.5.",
|
||||
"input": {
|
||||
"machine": "laptop",
|
||||
"schedule": "pairs_n6",
|
||||
@@ -1312,7 +1312,7 @@
|
||||
"name": "clean_laptop_run",
|
||||
"class": "POWER",
|
||||
"kind": "pairs",
|
||||
"basis": "The recorded clean run g2-vanilla-noskip of docs/laptop-vs-vanilla.md section 11: limit 110.0 rising to 126.6 W over the whole run. Spread 126.6 - 110.0 = 16.6 <= 20; floor 110.0 >= 100; max 126.6 <= 150.0; all three arms 110.0..126.6 mean 118.3 so the mean difference is 0.0. The limit changed during the run (start 110.0, end 126.6, power_limit_changed true) and the pair MUST stay valid (SDET remark H, QA-2).",
|
||||
"basis": "The recorded clean run g2-vanilla-noskip of spec node laptop-vs-vanilla.md section 11: limit 110.0 rising to 126.6 W over the whole run. Spread 126.6 - 110.0 = 16.6 <= 20; floor 110.0 >= 100; max 126.6 <= 150.0; all three arms 110.0..126.6 mean 118.3 so the mean difference is 0.0. The limit changed during the run (start 110.0, end 126.6, power_limit_changed true) and the pair MUST stay valid (SDET remark H, QA-2).",
|
||||
"input": {
|
||||
"machine": "laptop",
|
||||
"schedule": "pairs_n6",
|
||||
|
||||
@@ -14,7 +14,7 @@ The result is written into the `quality` block of the S0.1 record (schema.json,
|
||||
verdict is one of: identical | within recorded tolerance | differs. If --record does not exist, a fragment {"quality": {...}} is created.
|
||||
This step is called AFTER a FASTER verdict of a 30-pair series (round 5, BA D10), never inside a screening stage.
|
||||
|
||||
Non-lossy check (the logs are port smoke logs, docs/quality-gate.md). Each kind of evidence that BOTH logs carry is compared:
|
||||
Non-lossy check (the logs are port smoke logs). Each kind of evidence that BOTH logs carry is compared:
|
||||
q_pair scripts/quality/q_pair.py LOG_A LOG_B by subprocess (needs forced rows): exit 0 = every common forced row bit-identical.
|
||||
r_chunk the `PREFILL-R first=F rows=N fnv1a64=H` lines (LELEKA_TRACE_PREFILL_R, executor_original_prompt.rs): the (first, rows, hash)
|
||||
sequence per `REPLAY-ARM start label=` arm (one sequence when the log has none) must be equal.
|
||||
@@ -22,7 +22,7 @@ Non-lossy check (the logs are port smoke logs, docs/quality-gate.md). Each kind
|
||||
At least one kind must be present in both logs, else exit 2. All present kinds equal -> identical.
|
||||
Tolerance x (needs --basis): the only measured quantity is q_pair's d_top1 over the differing rows. Verdict `within recorded tolerance`
|
||||
needs q_pair present, 0 argmax flips and max d_top1 <= x. An r_chunk difference alone is then accepted (a chunk-size change alters the
|
||||
rounding order, docs/prefill-throughput.md; its effect is what d_top1 measures); a greedy-id difference never is (the output changed).
|
||||
rounding order; its effect is what d_top1 measures); a greedy-id difference never is (the output changed).
|
||||
Hashes and ids have no measure, so without q_pair a difference is `differs` whatever x is.
|
||||
|
||||
--lossy: the candidate log is the replay log of scripts/quality/q_tail_gate.py (arms = passes; --ref N is the reference pass, default 0),
|
||||
|
||||
@@ -21,7 +21,6 @@ import unittest
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
CAPTURE_VANILLA = os.path.join(HERE, "capture_vanilla.py")
|
||||
VALIDATE = os.path.join(HERE, "validate.py")
|
||||
PAGE = os.path.normpath(os.path.join(HERE, "..", "..", "..", "docs", "experiments", "2026-10-28-s0-7-vanilla-arms.md"))
|
||||
|
||||
COMMIT = "0123456789abcdef0123456789abcdef01234567"
|
||||
PROFILE = "f467e6a6af8f3bc29f37fe326d5dd922ebcf260e69561d160a1637fe8cd04dd0"
|
||||
@@ -594,44 +593,5 @@ class TestCheckSet(Base):
|
||||
self.assertEqual(v.returncode, 0, v.stdout + v.stderr)
|
||||
|
||||
|
||||
class TestS07Page(Base):
|
||||
def test_s0_7_block_validates(self): # AC6
|
||||
"""The sample vanilla_cpu_family block quoted on the STRA-247 page (read from the page text), wrapped into an otherwise valid sanitized vanilla
|
||||
S0.1 record, must pass validate.py. KNOWN DRIFT, reported not hidden: the page quotes control.printed as one string where the STRA-246
|
||||
schema wants a list of lines (or "none printed"); that single difference is normalised below, loudly, so the test still checks every other key,
|
||||
type and rule. When the page is corrected the as-quoted validation passes and the notice disappears."""
|
||||
with open(PAGE, encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
blocks = re.findall(r"```json\n(.*?)```", text, re.S)
|
||||
quoted = [json.loads(b) for b in blocks if "vanilla_cpu_family" in b]
|
||||
self.assertEqual(len(quoted), 1, "expected one fenced json block with vanilla_cpu_family on the page")
|
||||
block = quoted[0]["vanilla_cpu_family"]
|
||||
with open(os.path.join(HERE, "sample_vanilla_default.json"), encoding="utf-8") as f:
|
||||
rec = json.load(f)
|
||||
rec["vanilla_cpu_family"] = block
|
||||
d = tempfile.mkdtemp(prefix="capv-page-")
|
||||
self.addCleanup(lambda: shutil.rmtree(d, ignore_errors=True))
|
||||
path = os.path.join(d, "page-block-record.json")
|
||||
write_json(path, rec)
|
||||
v = validate(path)
|
||||
if v.returncode != 0:
|
||||
self.assertEqual(v.returncode, 1, v.stdout + v.stderr)
|
||||
self.assertIsInstance(block["control"]["printed"], str, "rejected for a reason other than the known drift: " + v.stdout)
|
||||
self.assertIn("/vanilla_cpu_family/control/printed", v.stdout)
|
||||
sys.stderr.write("\nNOTICE test_s0_7_block_validates: the STRA-247 page quotes control.printed as a bare string, validate.py wants a list: %s\n"
|
||||
% v.stdout.strip().splitlines()[0][:160])
|
||||
block["control"]["printed"] = [block["control"]["printed"]]
|
||||
write_json(path, rec)
|
||||
v = validate(path)
|
||||
self.assertEqual(v.returncode, 0, v.stdout + v.stderr)
|
||||
self.assertTrue(v.stdout.startswith("OK vanilla_default"), v.stdout)
|
||||
# the key set of the block equals what capture_vanilla.py writes
|
||||
r = Run(self)
|
||||
self.ok(r.run())
|
||||
self.assertEqual(set(r.record()["vanilla_cpu_family"]), set(block))
|
||||
self.assertEqual(set(r.record()["vanilla_cpu_family"]["control"]), set(block["control"]))
|
||||
self.assertEqual(set(r.record()["vanilla_cpu_family"]["binary_identity"]), set(block["binary_identity"]))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -141,12 +141,12 @@ class NonLossy(Base):
|
||||
def test_within_tolerance_carries_tolerance_and_basis(self):
|
||||
a = self.write("a.log", port_log(rchunks=[(0, 2048, "00000000000000aa")]))
|
||||
b = self.write("b.log", port_log(shift=0.01, rchunks=[(0, 2048, "00000000000000bb")]))
|
||||
code, out, err = self.run_step(a, b, "--tolerance", "0.05", "--basis", "chunk 2048 vs 4096 changes rounding order (docs/prefill-throughput.md)")
|
||||
code, out, err = self.run_step(a, b, "--tolerance", "0.05", "--basis", "chunk 2048 vs 4096 changes rounding order (spec node prefill-throughput.md)")
|
||||
self.assertEqual(code, 0, out + err)
|
||||
q = self.quality()
|
||||
self.assertEqual(q["verdict"], "within recorded tolerance")
|
||||
self.assertEqual(q["tolerance"], 0.05)
|
||||
self.assertEqual(q["basis"], "chunk 2048 vs 4096 changes rounding order (docs/prefill-throughput.md)")
|
||||
self.assertEqual(q["basis"], "chunk 2048 vs 4096 changes rounding order (spec node prefill-throughput.md)")
|
||||
self.assertEqual(self.validate()[0], 0)
|
||||
|
||||
def test_difference_beyond_tolerance_differs(self):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# KAR on / off at agent level (docs/experiments/kar-off-ab-5090.md): real Codex CLI sessions on the two frozen tasks of the codex-compare study, same cell runner (cell.py, logging proxy,
|
||||
# KAR on / off at agent level: real Codex CLI sessions on the two frozen tasks of the codex-compare study, same cell runner (cell.py, logging proxy,
|
||||
# temperature 0 injected, acceptance), arm by arm. Payload of a holder-free window (kar_off_window.sh). Variants: LELK = KAR (shipped rtx5090-32g, own sparse memfd), LELG = GGUF PLE
|
||||
# (rtx5090-32g-gguf-ple); both are STANDALONE stacks of the same package, so they differ only in the PLE source.
|
||||
# KO_SEQ space separated "arm:rep" blocks, default "kar:1 gguf:1 gguf:2 kar:2 kar:3 gguf:3" (balanced) KO_TASKS (default "ttt nestng-crm") KO_WALL (3000) KO_ROUNDS (150)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# KAR on / off A/B (docs/experiments/kar-off-ab-5090.md): shared shell functions. Test tooling, never in serving. Source it, do not run it.
|
||||
# KAR on / off A/B: shared shell functions. Test tooling, never in serving. Source it, do not run it.
|
||||
# Both arms run STANDALONE (holder-free window): the lab holder's sealed memfd is the FULL 51.5 GiB archive and leaves ~66 GiB, which cannot hold the 50 GB expert bank AND the 28.8 GB
|
||||
# PLE table in the page cache. Arm KAR = the shipped profile rtx5090-32g (own sparse memfd of 16 GB, as `leleka run` makes it); arm GGUF = rtx5090-32g-gguf-ple (no archive, PLE rows from
|
||||
# GGUF shard 1 through the page cache, LELEKA_PLE_DIRECT=0). Same binaries (engine, gateway, API), same assets, same expert profile, same flags otherwise.
|
||||
|
||||
@@ -20,7 +20,7 @@ import hashlib, json, sys
|
||||
m = json.load(open(sys.argv[1]))
|
||||
for b in ("leleka", "leleka-inference"):
|
||||
m["binaries"][b] = hashlib.sha256(open(sys.argv[3] + "/" + b, "rb").read()).hexdigest()
|
||||
m["kar_off_ab_note"] = "`leleka` and `leleka-inference` rebuilt from the kar_source=none commits (docs/experiments/kar-off-ab-5090.md); the other binaries are the release 17e3729 ones"
|
||||
m["kar_off_ab_note"] = "`leleka` and `leleka-inference` rebuilt from the kar_source=none commits (spec node experiments/kar-off-ab-5090.md); the other binaries are the release 17e3729 ones"
|
||||
json.dump(m, open(sys.argv[2], "w"), indent=2)
|
||||
PY
|
||||
( cd "$K/pkg" && sha256sum bin/* MANIFEST.json > ../pkg.sha256 )
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# KAR level-2 PLE against GGUF PLE in the Leleka serve stack, teacher forced (docs/experiments/kar-off-ab-5090.md section "Quality (a)"; the method of docs/quality-gate.md section 1 and 6).
|
||||
# KAR level-2 PLE against GGUF PLE in the Leleka serve stack, teacher forced (section "Quality (a)"; the method).
|
||||
# HOLDER JOB (the KAR arm inherits the sealed memfd; the GGUF arm does not need it: LELEKA_REPLAY_GGUF_PLE=1 binds the model without any archive).
|
||||
# Both arms run the SAME test executable (rt-kar-off = the replay smoke of this branch), the same capture (quality-245k data/cap-both: five prompts of 45k-243k tokens, each with the recorded
|
||||
# Original reply and the recorded port reply, 300 tokens) forced along the recorded text, top-16 log-probabilities of every row (LELEKA_TRACE_LOGPROBS=16), STATIC expert tier (adapt-every 0:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Speed tables of the KAR on / off replay A/B (docs/experiments/kar-off-ab-5090.md). Offline, stdlib only; test tooling.
|
||||
"""Speed tables of the KAR on / off replay A/B. Offline, stdlib only; test tooling.
|
||||
|
||||
kar_off_speed.py RUN_DIR [--md OUT.md] [--json OUT.json]
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# KAR on / off speed A/B (docs/experiments/kar-off-ab-5090.md). Payload of a holder-free window (kar_off_window.sh), NOT a holder job.
|
||||
# KAR on / off speed A/B. Payload of a holder-free window (kar_off_window.sh), NOT a holder job.
|
||||
# The SAME recorded Codex prompts (the VANL cells nestng-crm-r2 and ttt-r3 of the codex-compare run, 59 requests, 10-120k tokens) are replayed through each arm's service by replay_fwd.py,
|
||||
# one request at a time, temperature 0; the vanilla `encrypted_content` is stripped by the tool. One stack start per pass; the arms are interleaved (KO_ORDER, default a balanced
|
||||
# K G G K K G = three passes of each arm, every arm first, second and last in turn). Speed per request is the stack's own record (engine.log `ev:request`: prefill / decode ms,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Holder-free window for the KAR on / off payloads (docs/experiments/kar-off-ab-5090.md), started DETACHED by a queue stub that has touched jobs/STOP and closed the holder's descriptor
|
||||
# Holder-free window for the KAR on / off payloads, started DETACHED by a queue stub that has touched jobs/STOP and closed the holder's descriptor
|
||||
# (the mechanism of cmp_window.sh): kar_off_window.sh LABEL PAYLOAD.sh
|
||||
# 1. waits until the lab holder has ended and its memfd is gone; 2. runs the payload; 3. ALWAYS restarts the lab holder afterwards, so the queue goes on.
|
||||
set -u
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"thresholds_source": "BOOTSTRAP",
|
||||
"power_limit_source": "enforced.power.limit",
|
||||
"unreadable": {"preflight": "REFUSE", "run": "ABORT"},
|
||||
"sampling": {
|
||||
"interval_s": 1,
|
||||
"nvidia_smi_timeout_s": 5,
|
||||
"timeout_counts_as_missing_sample": true,
|
||||
"stall_check_off_sampler_thread": true,
|
||||
"confirm_samples": 1
|
||||
},
|
||||
"idle_preflight": {
|
||||
"limit_min_w": 100,
|
||||
"sw_power_cap_active_refuses": true,
|
||||
"sw_thermal_slowdown_active_refuses": true,
|
||||
"p5_refuses": true
|
||||
},
|
||||
"under_load": {
|
||||
"power_limit_floor_w": 100,
|
||||
"temperature_ceiling_c": 85,
|
||||
"stall_gap_s": 10,
|
||||
"oem_profile": {"pstate": "P5", "memory_clock_mhz_below": 2000, "throttle_reason_bits": [4, 32]}
|
||||
},
|
||||
"run": {"timeout_source": "caller_parameter", "cap_minutes": 15},
|
||||
"cooldown": {"between_arms_s": 120, "after_abort_s": 600},
|
||||
"retry": {"max_reruns_per_arm_slot": 1, "consecutive_invalid_pairs_end_block": 2},
|
||||
"halt": {"on_events": ["BSOD", "UNEXPECTED_REBOOT", "STALL"], "scope": "ALL_LAPTOP_GPU_WORK"},
|
||||
"resume": {
|
||||
"requires_orchestrator_recorded_owner_inspection": true,
|
||||
"source": "pair_ledger",
|
||||
"interrupted_pair_invalid": true
|
||||
},
|
||||
"lock": {"method": "mkdir", "path": "$HOME/LAPTOP_GPU.lock", "one_gpu_job_at_a_time": true},
|
||||
"preconditions": {"on_unmet": "STOP_NO_CHANGE_RECORD_OWNER_PRECONDITION_NOT_MET", "agent_may_change_settings": false},
|
||||
"validity_band": {"limit_floor_w": 100, "arms_mean_limit_within_w": 10, "spread_within_arm_w": 20},
|
||||
"records": {"must_carry": ["thresholds_source", "thresholds_sha256"], "countable_under_bootstrap": false},
|
||||
"basis": {
|
||||
"limit_floor_w": "recorded good run 110.0-126.6 W (spec node laptop-vs-vanilla.md section 11) against the bad event at 51 W (section 13)",
|
||||
"floors": "the S3.1 BOOTSTRAP instance (scripts/laptop/win/thresholds/2026-10-28-s3-1-laptop-thresholds.bootstrap.json) with one change: temperature_ceiling_c 85 instead of 90 (stricter; owner rule of 2026-10-26 for native laptop runs: stop at 85 C)",
|
||||
"start_up_only": "laptop-pair-3080 (spec node experiments/laptop-pair-3080.md): BOOTSTRAP caps one arm at 15 minutes; the 128k and 245k-session stages need an S3.7 thresholds file"
|
||||
}
|
||||
}
|
||||
@@ -1,334 +1,334 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Analysis of a laptop-pair series (docs/experiments/laptop-pair-3080.md). Stdlib only, Python >= 3.9.
|
||||
|
||||
laptop-pair-analyze.py SERIES_DIR [--csv OUT.csv] [--smoke]
|
||||
|
||||
Run directories: s<size>-b<block>p<pos>-<arm> (arm = ours | v1 | v2), each with guard/ (guard_summary.json), wd/ (samples.tsv,
|
||||
watchdog_summary.json), arm/ (arm.json, client/session.json, progress.tsv, env.txt, ours-logs/*.log or engine.log), pre-state.json,
|
||||
post-state.json. The ideas are those of scripts/e2e/decode/baseline-analyze.py (validity per run, block-paired deltas, order effects,
|
||||
machine state next to every number), adapted to the laptop: the GPU state comes from the watchdog's 1 Hz series, the power plan and AC
|
||||
from state.ps1 before and after the arm.
|
||||
|
||||
Per run: request 1 (cold prefill of about N tokens + 300 tokens of decode at depth N) and request 2 (prefix reuse + 2k-token delta +
|
||||
300 tokens of decode): TTFT, client prefill rate (input - cached) / TTFT, decode tok/s, output tokens; engine-side ms/round and
|
||||
tokens/round (ours: "leleka-serve request outcome ... rounds=R" and the client decode time; vanilla: "G generated in X ms, drafts
|
||||
accepted A of D", rounds = G - A); load to ready; GPU: SM / memory clock, power, limit (min / max / spread), temperature max, P0 share
|
||||
and SW-power-cap share of the busy samples (util >= 50 %), VRAM peak; engine working set / private peak, minimum available RAM.
|
||||
VALID needs: guard and arm completed, both requests answered, Turbo + AC before and after, AC on in every 30 s sample, enforced limit
|
||||
>= 100 W with a spread <= 20 W, P0 in >= 90 % of the busy samples, the arm's switches visible in its log (v1: tail skip ON; v2: tail
|
||||
skip and CPU share off; ours: outcome lines), and the request bodies identical to the other arms of the size.
|
||||
Then per size: arm table and block-paired deltas (ours - v1, ours - v2, v1 - v2; a pair also needs the two arms' mean limits within
|
||||
10 W), order effects, and a projection of the next size's arm time from the measured load time and prefill rate.
|
||||
"""
|
||||
import glob
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
import re
|
||||
import statistics as st
|
||||
import sys
|
||||
|
||||
ARGS = sys.argv[1:]
|
||||
if not ARGS:
|
||||
print(__doc__)
|
||||
sys.exit(2)
|
||||
ROOT = ARGS[0]
|
||||
CSV = ARGS[ARGS.index("--csv") + 1] if "--csv" in ARGS else None
|
||||
SMOKE = "--smoke" in ARGS
|
||||
LIMIT_FLOOR, LIMIT_SPREAD, PAIR_LIMIT_DIFF, P0_SHARE = 100.0, 20.0, 10.0, 0.90
|
||||
BUSY_UTIL = 50.0
|
||||
NEXT_SIZE = {8192: 32768, 32768: 65536, 65536: 98304, 98304: 131072, 131072: 229376}
|
||||
|
||||
|
||||
def rj(path):
|
||||
try:
|
||||
with open(path, encoding="utf-8-sig") as f:
|
||||
return json.load(f)
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
def num(x):
|
||||
try:
|
||||
v = float(x)
|
||||
return None if math.isnan(v) else v
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
def mean(v):
|
||||
v = [x for x in v if x is not None]
|
||||
return st.mean(v) if v else None
|
||||
|
||||
|
||||
def fmt(v, p=1):
|
||||
return "-" if v is None else ("%." + str(p) + "f") % v
|
||||
|
||||
|
||||
def samples(path):
|
||||
out = []
|
||||
if not os.path.exists(path):
|
||||
return out
|
||||
for ln in open(path, encoding="utf-8", errors="replace"):
|
||||
if ln.startswith("#") or ln.startswith("phase"):
|
||||
continue
|
||||
f = ln.rstrip("\n").split("\t")
|
||||
if len(f) < 14 or f[3] != "1":
|
||||
continue
|
||||
thr = f[9]
|
||||
out.append({"phase": f[0], "utc": num(f[2]), "pstate": f[5], "sm": num(f[6]), "mem": num(f[7]), "power": num(f[8]),
|
||||
"throttle": int(thr, 16) if thr.startswith("0x") else None, "limit": num(f[10]), "temp": num(f[11]), "util": num(f[12]), "vram": num(f[13])})
|
||||
return out
|
||||
|
||||
|
||||
def read_logs(d):
|
||||
txt = ""
|
||||
for p in sorted(glob.glob(os.path.join(d, "arm", "ours-logs", "*.log*"))) + [os.path.join(d, "arm", "engine.log")]:
|
||||
if os.path.isfile(p):
|
||||
with open(p, encoding="utf-8", errors="replace") as f:
|
||||
txt += f.read() + "\n"
|
||||
return txt
|
||||
|
||||
|
||||
def parse_run(d):
|
||||
name = os.path.basename(d)
|
||||
m = re.match(r"s(\d+)-b(\d+)p(\d+)-(\w+)$", name) or re.match(r"s(\d+)-(smoke)-(\w+)$", name)
|
||||
if not m:
|
||||
return None
|
||||
if m.group(2) == "smoke":
|
||||
r = {"name": name, "size": int(m.group(1)), "block": 0, "pos": 1, "arm": m.group(3)}
|
||||
else:
|
||||
r = {"name": name, "size": int(m.group(1)), "block": int(m.group(2)), "pos": int(m.group(3)), "arm": m.group(4)}
|
||||
why = []
|
||||
g = rj(os.path.join(d, "guard", "guard_summary.json")) or {}
|
||||
w = rj(os.path.join(d, "wd", "watchdog_summary.json")) or {}
|
||||
a = rj(os.path.join(d, "arm", "arm.json")) or {}
|
||||
s = rj(os.path.join(d, "arm", "client", "session.json")) or {}
|
||||
r.update({"guard_exit": g.get("guard_exit_code"), "guard_outcome": g.get("outcome"), "containment": g.get("containment"), "wd_outcome": w.get("outcome"),
|
||||
"wd_reason": w.get("reason"), "samples_good": w.get("samples_good"), "samples_missing": w.get("samples_missing"),
|
||||
"thresholds_source": w.get("thresholds_source"), "arm_outcome": a.get("outcome"), "arm_reason": a.get("reason"),
|
||||
"ready_s": a.get("ready_s"), "stop_s": a.get("stop_s"), "peak_ws_gib": a.get("peak_engine_ws_gib"), "peak_private_gib": a.get("peak_engine_private_gib"),
|
||||
"min_avail_gib": a.get("min_avail_gib"), "ac_all_on": a.get("ac_all_on")})
|
||||
if r["guard_exit"] != 0:
|
||||
why.append("guard exit %s (%s)" % (r["guard_exit"], r["guard_outcome"]))
|
||||
if r["arm_outcome"] != "COMPLETED":
|
||||
why.append("arm %s: %s" % (r["arm_outcome"], (r["arm_reason"] or "")[:160]))
|
||||
reqs = s.get("requests") or []
|
||||
r["requests"] = reqs
|
||||
for i, q in enumerate(reqs[:2], 1):
|
||||
k = "r%d_" % i
|
||||
r[k + "in"] = q.get("input_tokens")
|
||||
r[k + "cached"] = q.get("cached_tokens")
|
||||
r[k + "out"] = q.get("output_tokens")
|
||||
r[k + "ttft"] = q.get("ttft_s")
|
||||
r[k + "dec"] = q.get("decode_tok_s")
|
||||
r[k + "dec_s"] = q.get("decode_s")
|
||||
r[k + "wall"] = q.get("wall_s")
|
||||
r[k + "sha"] = q.get("request_body_sha256")
|
||||
fresh = (q.get("input_tokens") or 0) - (q.get("cached_tokens") or 0)
|
||||
r[k + "pf"] = fresh / q["ttft_s"] if q.get("ttft_s") and fresh > 0 else None
|
||||
if "error" in q:
|
||||
why.append("request %d error %s" % (i, q.get("error")))
|
||||
want = 1 if SMOKE else 2
|
||||
if len([q for q in reqs if "error" not in q and q.get("output_tokens")]) < want:
|
||||
why.append("%d of %d requests answered" % (len(reqs), want))
|
||||
r["session_wall"] = sum(q.get("wall_s") or 0 for q in reqs[:want]) if reqs else None
|
||||
# machine state before / after
|
||||
for tag in ("pre", "post"):
|
||||
stt = rj(os.path.join(d, tag + "-state.json")) or {}
|
||||
se = stt.get("settings") or {}
|
||||
r[tag + "_scheme"] = se.get("power_scheme_name")
|
||||
r[tag + "_ac"] = (se.get("ac_status") or {}).get("state")
|
||||
r[tag + "_limit"] = se.get("enforced_power_limit")
|
||||
if r[tag + "_scheme"] != "Turbo" or r[tag + "_ac"] != "on_ac":
|
||||
why.append("%s-state: scheme %s, %s" % (tag, r[tag + "_scheme"], r[tag + "_ac"]))
|
||||
if r["ac_all_on"] is False:
|
||||
why.append("AC lost during the run")
|
||||
# GPU series
|
||||
sm = [x for x in samples(os.path.join(d, "wd", "samples.tsv")) if x["phase"] == "run"]
|
||||
busy = [x for x in sm if x["util"] is not None and x["util"] >= BUSY_UTIL]
|
||||
lim = [x["limit"] for x in sm if x["limit"] is not None]
|
||||
r["n_samples"], r["n_busy"] = len(sm), len(busy)
|
||||
r["limit_min"], r["limit_max"], r["limit_mean"] = (min(lim), max(lim), st.mean(lim)) if lim else (None, None, None)
|
||||
r["limit_spread"] = (r["limit_max"] - r["limit_min"]) if lim else None
|
||||
r["sm_mhz"], r["mem_mhz"] = mean([x["sm"] for x in busy]), mean([x["mem"] for x in busy])
|
||||
r["power_mean"] = mean([x["power"] for x in busy])
|
||||
r["power_max"] = max([x["power"] for x in sm if x["power"] is not None], default=None)
|
||||
r["temp_max"] = max([x["temp"] for x in sm if x["temp"] is not None], default=None)
|
||||
r["vram_peak"] = max([x["vram"] for x in sm if x["vram"] is not None], default=None)
|
||||
r["p0_share"] = (sum(1 for x in busy if x["pstate"] == "P0") / len(busy)) if busy else None
|
||||
r["pcap_share"] = (sum(1 for x in busy if x["throttle"] is not None and x["throttle"] & 4) / len(busy)) if busy else None
|
||||
r["pstates"] = ",".join(sorted(set(x["pstate"] for x in busy)))
|
||||
if not lim or r["limit_min"] < LIMIT_FLOOR:
|
||||
why.append("enforced limit min %s W < %d" % (fmt(r["limit_min"]), LIMIT_FLOOR))
|
||||
elif r["limit_spread"] > LIMIT_SPREAD:
|
||||
why.append("limit spread %.1f W > %d" % (r["limit_spread"], LIMIT_SPREAD))
|
||||
if r["p0_share"] is None or r["p0_share"] < P0_SHARE:
|
||||
why.append("P0 in %s of the busy samples (< %.0f %%; states %s)" % (fmt(None if r["p0_share"] is None else 100 * r["p0_share"], 0) + " %", 100 * P0_SHARE, r["pstates"]))
|
||||
# engine lines
|
||||
log = read_logs(d)
|
||||
r["log_bytes"] = len(log)
|
||||
tok_rd, ms_rd, eng_pf = [], [], []
|
||||
if r["arm"] == "ours":
|
||||
outs = re.findall(r"leleka-serve request outcome=completed produced=(\d+) rounds=(\d+) reused=(\d+)", log)
|
||||
if len(outs) < want:
|
||||
why.append("ours: %d request outcome lines (trace env missing?)" % len(outs))
|
||||
for (prod, rd, _reu), q in zip(outs[-want:], reqs[:want]):
|
||||
prod, rd = int(prod), int(rd)
|
||||
if rd:
|
||||
tok_rd.append(prod / rd)
|
||||
if q.get("decode_s"):
|
||||
ms_rd.append(1000.0 * q["decode_s"] / rd)
|
||||
# PREFILL-PROFILE lines of request 1 (before the first outcome line)
|
||||
first = log.find("leleka-serve request outcome")
|
||||
pp = re.findall(r"PREFILL-PROFILE first=\d+ tokens=(\d+) total_ms=([\d.]+)", log[: first if first > 0 else len(log)])
|
||||
if pp:
|
||||
t = sum(int(a_) for a_, _ in pp)
|
||||
ms = sum(float(b_) for _, b_ in pp)
|
||||
eng_pf.append(1000.0 * t / ms if ms else None)
|
||||
r["engine_ok"] = len(outs) >= want
|
||||
else:
|
||||
skip_on = re.search(r"STRATA_ROUTE_TAIL_SKIP=\d+ is ON", log) is not None
|
||||
share_on = "the CPU share is ON by default" in log
|
||||
r["tail_skip_on"], r["cpu_share_on"] = skip_on, share_on
|
||||
if not log:
|
||||
why.append("no vanilla engine log copied")
|
||||
elif r["arm"] == "v1" and not skip_on:
|
||||
why.append("v1 but the tail skip is not ON in the engine log")
|
||||
elif r["arm"] == "v2" and (skip_on or share_on):
|
||||
why.append("v2 but tail skip on=%s / cpu share on=%s in the engine log" % (skip_on, share_on))
|
||||
lines = re.findall(r"strata serve: prompt (\d+) tokens = (\d+) reused \+ (\d+)(?: of \d+)? read in (\d+) ms .*?(\d+) generated in (\d+) ms .*?drafts accepted (\d+) of (\d+)", log)
|
||||
for (n, reu, rd_n, rd_ms, gen, dms, acc, _dn) in lines[-want:]:
|
||||
gen, acc = int(gen), int(acc)
|
||||
rounds = gen - acc
|
||||
if rounds > 0 and gen > 1:
|
||||
tok_rd.append(gen / rounds)
|
||||
ms_rd.append(int(dms) / rounds)
|
||||
if lines:
|
||||
n, reu, rd_n, rd_ms = lines[-want][:4]
|
||||
eng_pf.append(1000.0 * int(rd_n) / int(rd_ms) if int(rd_ms) else None)
|
||||
if len(lines) < want and log:
|
||||
why.append("vanilla: %d request lines" % len(lines))
|
||||
r["tok_round"], r["ms_round"] = mean(tok_rd), mean(ms_rd)
|
||||
r["ms_round_r1"] = ms_rd[0] if ms_rd else None
|
||||
r["ms_round_r2"] = ms_rd[1] if len(ms_rd) > 1 else None
|
||||
r["engine_prefill_tok_s"] = eng_pf[0] if eng_pf else None
|
||||
r["why"] = why
|
||||
r["valid"] = not why
|
||||
return r
|
||||
|
||||
|
||||
runs = []
|
||||
for d in sorted(glob.glob(os.path.join(ROOT, "s*-*"))):
|
||||
if os.path.isdir(d):
|
||||
x = parse_run(d)
|
||||
if x:
|
||||
runs.append(x)
|
||||
if not runs:
|
||||
print("no run directories under", ROOT)
|
||||
sys.exit(0)
|
||||
|
||||
# prompt identity across the arms of one size (same frozen prompt file -> same request bytes)
|
||||
for size in sorted(set(r["size"] for r in runs)):
|
||||
for k in ("r1_sha", "r2_sha"):
|
||||
shas = set(r.get(k) for r in runs if r["size"] == size and r.get(k))
|
||||
if len(shas) > 1:
|
||||
for r in runs:
|
||||
if r["size"] == size:
|
||||
r["why"].append("%s differs between arms of size %d" % (k, size))
|
||||
r["valid"] = False
|
||||
|
||||
if SMOKE:
|
||||
for r in runs:
|
||||
print("SMOKE %s (thresholds %s, containment %s)" % (r["name"], r["thresholds_source"], r["containment"]))
|
||||
checks = [
|
||||
("guard exit 0 and outcome COMPLETED", r["guard_exit"] == 0 and r["guard_outcome"] == "COMPLETED", "%s %s" % (r["guard_exit"], r["guard_outcome"])),
|
||||
("watchdog COMPLETED, no missing sample", r["wd_outcome"] == "COMPLETED" and (r["samples_missing"] or 0) == 0, "%s, good %s, missing %s" % (r["wd_outcome"], r["samples_good"], r["samples_missing"])),
|
||||
("1 Hz series covers the run", r["n_samples"] >= 0.9 * (r["samples_good"] or 1), "%d run rows" % r["n_samples"]),
|
||||
("engine ready, request answered", r["arm_outcome"] == "COMPLETED", "ready %s s, R1 in %s cached %s out %s TTFT %s s decode %s tok/s" % (r["ready_s"], r.get("r1_in"), r.get("r1_cached"), r.get("r1_out"), r.get("r1_ttft"), r.get("r1_dec"))),
|
||||
("under load in P0", (r["p0_share"] or 0) >= P0_SHARE, "P0 share %s of %d busy samples (%s)" % (fmt(r["p0_share"], 2), r["n_busy"], r["pstates"])),
|
||||
("enforced limit >= 100 W throughout", r["limit_min"] is not None and r["limit_min"] >= LIMIT_FLOOR, "%s..%s W" % (fmt(r["limit_min"]), fmt(r["limit_max"]))),
|
||||
("no SW power cap under load", (r["pcap_share"] or 0) < 0.05, "cap share %s" % fmt(r["pcap_share"], 2)),
|
||||
("temperature below 85 C", r["temp_max"] is not None and r["temp_max"] < 85, "max %s C, power max %s W, SM %s MHz, mem %s MHz" % (fmt(r["temp_max"], 0), fmt(r["power_max"], 0), fmt(r["sm_mhz"], 0), fmt(r["mem_mhz"], 0))),
|
||||
("Turbo + AC before and after", not any(w.startswith(("pre-state", "post-state", "AC lost")) for w in r["why"]), "%s/%s -> %s/%s" % (r["pre_scheme"], r["pre_ac"], r["post_scheme"], r["post_ac"])),
|
||||
("engine stopped, nothing left", "left after the stop" not in (r["arm_reason"] or ""), "stop %s s" % r["stop_s"]),
|
||||
]
|
||||
for label, ok, detail in checks:
|
||||
print(" %s %-40s %s" % ("PASS" if ok else "FAIL", label, detail))
|
||||
print(" VRAM peak %s MiB, engine working set peak %s GiB, min available RAM %s GiB" % (fmt(r["vram_peak"], 0), r["peak_ws_gib"], r["min_avail_gib"]))
|
||||
sys.exit(0)
|
||||
|
||||
print("== per run (R1 = cold prompt, R2 = reuse + 2k delta; prefill tok/s = (input - cached) / TTFT) ==")
|
||||
print("run valid R1 in TTFT1 pf1 dec1 R2 cached TTFT2 dec2 ms/rd tok/rd ready wall SM MHz W(mean/max) limit W maxC P0 VRAM WS GiB")
|
||||
for r in sorted(runs, key=lambda r: (r["size"], r["block"], r["pos"])):
|
||||
print("%-19s %-6s %-7s %-6s %-6s %-6s %-9s %-6s %-6s %-6s %-6s %-6s %-6s %-7s %-11s %-12s %-4s %-5s %-5s %s" % (
|
||||
r["name"], "yes" if r["valid"] else "NO", r.get("r1_in", "-"), fmt(r.get("r1_ttft")), fmt(r.get("r1_pf"), 0), fmt(r.get("r1_dec"), 2), r.get("r2_cached", "-"), fmt(r.get("r2_ttft")),
|
||||
fmt(r.get("r2_dec"), 2), fmt(r["ms_round"]), fmt(r["tok_round"], 2), fmt(r["ready_s"], 0), fmt(r["session_wall"], 0), fmt(r["sm_mhz"], 0),
|
||||
"%s/%s" % (fmt(r["power_mean"], 0), fmt(r["power_max"], 0)), "%s-%s" % (fmt(r["limit_min"], 0), fmt(r["limit_max"], 0)), fmt(r["temp_max"], 0),
|
||||
fmt(r["p0_share"], 2), fmt(r["vram_peak"], 0), r["peak_ws_gib"]))
|
||||
if not r["valid"]:
|
||||
print(" not valid: " + "; ".join(r["why"]))
|
||||
|
||||
METRICS = [("r1_ttft", "R1 TTFT s", False), ("r1_pf", "R1 prefill tok/s", True), ("r1_dec", "R1 decode tok/s", True), ("r2_ttft", "R2 TTFT s", False),
|
||||
("r2_dec", "R2 decode tok/s", True), ("session_wall", "R1+R2 wall s", False), ("ms_round", "ms/round", False), ("tok_round", "tokens/round", True),
|
||||
("engine_prefill_tok_s", "engine prefill tok/s (R1)", True), ("ready_s", "load to ready s", False)]
|
||||
valid = [r for r in runs if r["valid"]]
|
||||
for size in sorted(set(r["size"] for r in runs)):
|
||||
vs = [r for r in valid if r["size"] == size]
|
||||
print("\n== size %d: %d valid of %d runs ==" % (size, len(vs), len([r for r in runs if r["size"] == size])))
|
||||
by = {a: [r for r in vs if r["arm"] == a] for a in ("ours", "v1", "v2")}
|
||||
for key, label, _hi in METRICS:
|
||||
row = []
|
||||
for a in ("ours", "v1", "v2"):
|
||||
v = [r[key] for r in by[a] if r.get(key) is not None]
|
||||
row.append("%s n=%d %s (sd %s, %s..%s)" % (a, len(v), fmt(st.mean(v) if v else None, 2), fmt(st.stdev(v) if len(v) > 1 else None, 2),
|
||||
fmt(min(v) if v else None, 2), fmt(max(v) if v else None, 2)))
|
||||
print(" %-26s %s" % (label, " | ".join(row)))
|
||||
print(" block-paired deltas (a - b in the same block; %% = a / b - 1; 'better' = faster / shorter; pair needs mean limits within %d W):" % PAIR_LIMIT_DIFF)
|
||||
for a, b in (("ours", "v1"), ("ours", "v2"), ("v1", "v2")):
|
||||
pairs = []
|
||||
for bl in sorted(set(r["block"] for r in vs)):
|
||||
ra = [r for r in by[a] if r["block"] == bl]
|
||||
rb = [r for r in by[b] if r["block"] == bl]
|
||||
if ra and rb:
|
||||
if ra[0]["limit_mean"] is not None and rb[0]["limit_mean"] is not None and abs(ra[0]["limit_mean"] - rb[0]["limit_mean"]) <= PAIR_LIMIT_DIFF:
|
||||
pairs.append((bl, ra[0], rb[0]))
|
||||
else:
|
||||
print(" %s - %s block %d: pair not valid (mean limits %s / %s W)" % (a, b, bl, fmt(ra[0]["limit_mean"]), fmt(rb[0]["limit_mean"])))
|
||||
if not pairs:
|
||||
continue
|
||||
print(" %s - %s: n=%d pairs (blocks %s)" % (a, b, len(pairs), ",".join(str(p[0]) for p in pairs)))
|
||||
for key, label, hi in METRICS:
|
||||
dl = [(pa[key], pb[key]) for _, pa, pb in pairs if pa.get(key) is not None and pb.get(key)]
|
||||
if not dl:
|
||||
continue
|
||||
pc = [100.0 * (x / y - 1) for x, y in dl]
|
||||
better = sum(1 for x, y in dl if (x > y if hi else x < y))
|
||||
sd = st.stdev(pc) if len(pc) > 1 else None
|
||||
print(" %-26s %s mean %+.1f %% (sd %s), %s better in %d of %d" % (label, " ".join("%+.1f%%" % x for x in pc), st.mean(pc), fmt(sd), a, better, len(dl)))
|
||||
print(" order: R1+R2 wall by position in the block")
|
||||
for a in ("ours", "v1", "v2"):
|
||||
print(" %-4s %s" % (a, " | ".join("pos%d %s" % (p, fmt(mean([r["session_wall"] for r in by[a] if r["pos"] == p]), 0)) for p in (1, 2, 3))))
|
||||
nxt = NEXT_SIZE.get(size)
|
||||
if nxt:
|
||||
print(" projection for size %d (arm time = load + (N / R1 prefill tok/s) + 2 x decode time + stop; BOOTSTRAP cap 900 s):" % nxt)
|
||||
for a in ("ours", "v1", "v2"):
|
||||
rs = by[a]
|
||||
if not rs:
|
||||
continue
|
||||
load = mean([r["ready_s"] for r in rs]); pf = mean([r.get("r1_pf") for r in rs]); dec = mean([(r.get("r1_dec_s") or 0) + (r.get("r2_dec_s") or 0) for r in rs])
|
||||
stop = mean([r["stop_s"] for r in rs]) or 15
|
||||
if load and pf:
|
||||
est = load + nxt / pf + (dec or 0) + 2048 / pf + stop
|
||||
print(" %-4s about %.0f s (load %.0f, prefill %.0f tok/s, decode %.0f s)%s" % (a, est, load, pf, dec or 0, " > 900 s: needs the S3.7 thresholds" if est > 840 else ""))
|
||||
|
||||
if CSV:
|
||||
cols = ["name", "size", "block", "pos", "arm", "valid", "r1_in", "r1_cached", "r1_out", "r1_ttft", "r1_pf", "r1_dec", "r2_in", "r2_cached", "r2_out", "r2_ttft", "r2_pf", "r2_dec",
|
||||
"session_wall", "ms_round", "ms_round_r1", "ms_round_r2", "tok_round", "engine_prefill_tok_s", "ready_s", "stop_s", "sm_mhz", "mem_mhz", "power_mean", "power_max",
|
||||
"limit_min", "limit_max", "limit_mean", "temp_max", "p0_share", "pcap_share", "vram_peak", "peak_ws_gib", "peak_private_gib", "min_avail_gib", "pre_scheme", "pre_ac",
|
||||
"pre_limit", "post_scheme", "post_ac", "post_limit", "guard_exit", "wd_outcome", "samples_good", "samples_missing", "thresholds_source"]
|
||||
with open(CSV, "w", encoding="utf-8") as f:
|
||||
f.write(",".join(cols + ["why"]) + "\n")
|
||||
for r in runs:
|
||||
f.write(",".join("" if r.get(c) is None else str(r.get(c)) for c in cols) + ',"' + "; ".join(r["why"]).replace('"', "'") + '"\n')
|
||||
print("\ncsv:", CSV)
|
||||
#!/usr/bin/env python3
|
||||
"""Analysis of a laptop-pair series. Stdlib only, Python >= 3.9.
|
||||
|
||||
laptop-pair-analyze.py SERIES_DIR [--csv OUT.csv] [--smoke]
|
||||
|
||||
Run directories: s<size>-b<block>p<pos>-<arm> (arm = ours | v1 | v2), each with guard/ (guard_summary.json), wd/ (samples.tsv,
|
||||
watchdog_summary.json), arm/ (arm.json, client/session.json, progress.tsv, env.txt, ours-logs/*.log or engine.log), pre-state.json,
|
||||
post-state.json. The ideas are those of scripts/e2e/decode/baseline-analyze.py (validity per run, block-paired deltas, order effects,
|
||||
machine state next to every number), adapted to the laptop: the GPU state comes from the watchdog's 1 Hz series, the power plan and AC
|
||||
from state.ps1 before and after the arm.
|
||||
|
||||
Per run: request 1 (cold prefill of about N tokens + 300 tokens of decode at depth N) and request 2 (prefix reuse + 2k-token delta +
|
||||
300 tokens of decode): TTFT, client prefill rate (input - cached) / TTFT, decode tok/s, output tokens; engine-side ms/round and
|
||||
tokens/round (ours: "leleka-serve request outcome ... rounds=R" and the client decode time; vanilla: "G generated in X ms, drafts
|
||||
accepted A of D", rounds = G - A); load to ready; GPU: SM / memory clock, power, limit (min / max / spread), temperature max, P0 share
|
||||
and SW-power-cap share of the busy samples (util >= 50 %), VRAM peak; engine working set / private peak, minimum available RAM.
|
||||
VALID needs: guard and arm completed, both requests answered, Turbo + AC before and after, AC on in every 30 s sample, enforced limit
|
||||
>= 100 W with a spread <= 20 W, P0 in >= 90 % of the busy samples, the arm's switches visible in its log (v1: tail skip ON; v2: tail
|
||||
skip and CPU share off; ours: outcome lines), and the request bodies identical to the other arms of the size.
|
||||
Then per size: arm table and block-paired deltas (ours - v1, ours - v2, v1 - v2; a pair also needs the two arms' mean limits within
|
||||
10 W), order effects, and a projection of the next size's arm time from the measured load time and prefill rate.
|
||||
"""
|
||||
import glob
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
import re
|
||||
import statistics as st
|
||||
import sys
|
||||
|
||||
ARGS = sys.argv[1:]
|
||||
if not ARGS:
|
||||
print(__doc__)
|
||||
sys.exit(2)
|
||||
ROOT = ARGS[0]
|
||||
CSV = ARGS[ARGS.index("--csv") + 1] if "--csv" in ARGS else None
|
||||
SMOKE = "--smoke" in ARGS
|
||||
LIMIT_FLOOR, LIMIT_SPREAD, PAIR_LIMIT_DIFF, P0_SHARE = 100.0, 20.0, 10.0, 0.90
|
||||
BUSY_UTIL = 50.0
|
||||
NEXT_SIZE = {8192: 32768, 32768: 65536, 65536: 98304, 98304: 131072, 131072: 229376}
|
||||
|
||||
|
||||
def rj(path):
|
||||
try:
|
||||
with open(path, encoding="utf-8-sig") as f:
|
||||
return json.load(f)
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
def num(x):
|
||||
try:
|
||||
v = float(x)
|
||||
return None if math.isnan(v) else v
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
def mean(v):
|
||||
v = [x for x in v if x is not None]
|
||||
return st.mean(v) if v else None
|
||||
|
||||
|
||||
def fmt(v, p=1):
|
||||
return "-" if v is None else ("%." + str(p) + "f") % v
|
||||
|
||||
|
||||
def samples(path):
|
||||
out = []
|
||||
if not os.path.exists(path):
|
||||
return out
|
||||
for ln in open(path, encoding="utf-8", errors="replace"):
|
||||
if ln.startswith("#") or ln.startswith("phase"):
|
||||
continue
|
||||
f = ln.rstrip("\n").split("\t")
|
||||
if len(f) < 14 or f[3] != "1":
|
||||
continue
|
||||
thr = f[9]
|
||||
out.append({"phase": f[0], "utc": num(f[2]), "pstate": f[5], "sm": num(f[6]), "mem": num(f[7]), "power": num(f[8]),
|
||||
"throttle": int(thr, 16) if thr.startswith("0x") else None, "limit": num(f[10]), "temp": num(f[11]), "util": num(f[12]), "vram": num(f[13])})
|
||||
return out
|
||||
|
||||
|
||||
def read_logs(d):
|
||||
txt = ""
|
||||
for p in sorted(glob.glob(os.path.join(d, "arm", "ours-logs", "*.log*"))) + [os.path.join(d, "arm", "engine.log")]:
|
||||
if os.path.isfile(p):
|
||||
with open(p, encoding="utf-8", errors="replace") as f:
|
||||
txt += f.read() + "\n"
|
||||
return txt
|
||||
|
||||
|
||||
def parse_run(d):
|
||||
name = os.path.basename(d)
|
||||
m = re.match(r"s(\d+)-b(\d+)p(\d+)-(\w+)$", name) or re.match(r"s(\d+)-(smoke)-(\w+)$", name)
|
||||
if not m:
|
||||
return None
|
||||
if m.group(2) == "smoke":
|
||||
r = {"name": name, "size": int(m.group(1)), "block": 0, "pos": 1, "arm": m.group(3)}
|
||||
else:
|
||||
r = {"name": name, "size": int(m.group(1)), "block": int(m.group(2)), "pos": int(m.group(3)), "arm": m.group(4)}
|
||||
why = []
|
||||
g = rj(os.path.join(d, "guard", "guard_summary.json")) or {}
|
||||
w = rj(os.path.join(d, "wd", "watchdog_summary.json")) or {}
|
||||
a = rj(os.path.join(d, "arm", "arm.json")) or {}
|
||||
s = rj(os.path.join(d, "arm", "client", "session.json")) or {}
|
||||
r.update({"guard_exit": g.get("guard_exit_code"), "guard_outcome": g.get("outcome"), "containment": g.get("containment"), "wd_outcome": w.get("outcome"),
|
||||
"wd_reason": w.get("reason"), "samples_good": w.get("samples_good"), "samples_missing": w.get("samples_missing"),
|
||||
"thresholds_source": w.get("thresholds_source"), "arm_outcome": a.get("outcome"), "arm_reason": a.get("reason"),
|
||||
"ready_s": a.get("ready_s"), "stop_s": a.get("stop_s"), "peak_ws_gib": a.get("peak_engine_ws_gib"), "peak_private_gib": a.get("peak_engine_private_gib"),
|
||||
"min_avail_gib": a.get("min_avail_gib"), "ac_all_on": a.get("ac_all_on")})
|
||||
if r["guard_exit"] != 0:
|
||||
why.append("guard exit %s (%s)" % (r["guard_exit"], r["guard_outcome"]))
|
||||
if r["arm_outcome"] != "COMPLETED":
|
||||
why.append("arm %s: %s" % (r["arm_outcome"], (r["arm_reason"] or "")[:160]))
|
||||
reqs = s.get("requests") or []
|
||||
r["requests"] = reqs
|
||||
for i, q in enumerate(reqs[:2], 1):
|
||||
k = "r%d_" % i
|
||||
r[k + "in"] = q.get("input_tokens")
|
||||
r[k + "cached"] = q.get("cached_tokens")
|
||||
r[k + "out"] = q.get("output_tokens")
|
||||
r[k + "ttft"] = q.get("ttft_s")
|
||||
r[k + "dec"] = q.get("decode_tok_s")
|
||||
r[k + "dec_s"] = q.get("decode_s")
|
||||
r[k + "wall"] = q.get("wall_s")
|
||||
r[k + "sha"] = q.get("request_body_sha256")
|
||||
fresh = (q.get("input_tokens") or 0) - (q.get("cached_tokens") or 0)
|
||||
r[k + "pf"] = fresh / q["ttft_s"] if q.get("ttft_s") and fresh > 0 else None
|
||||
if "error" in q:
|
||||
why.append("request %d error %s" % (i, q.get("error")))
|
||||
want = 1 if SMOKE else 2
|
||||
if len([q for q in reqs if "error" not in q and q.get("output_tokens")]) < want:
|
||||
why.append("%d of %d requests answered" % (len(reqs), want))
|
||||
r["session_wall"] = sum(q.get("wall_s") or 0 for q in reqs[:want]) if reqs else None
|
||||
# machine state before / after
|
||||
for tag in ("pre", "post"):
|
||||
stt = rj(os.path.join(d, tag + "-state.json")) or {}
|
||||
se = stt.get("settings") or {}
|
||||
r[tag + "_scheme"] = se.get("power_scheme_name")
|
||||
r[tag + "_ac"] = (se.get("ac_status") or {}).get("state")
|
||||
r[tag + "_limit"] = se.get("enforced_power_limit")
|
||||
if r[tag + "_scheme"] != "Turbo" or r[tag + "_ac"] != "on_ac":
|
||||
why.append("%s-state: scheme %s, %s" % (tag, r[tag + "_scheme"], r[tag + "_ac"]))
|
||||
if r["ac_all_on"] is False:
|
||||
why.append("AC lost during the run")
|
||||
# GPU series
|
||||
sm = [x for x in samples(os.path.join(d, "wd", "samples.tsv")) if x["phase"] == "run"]
|
||||
busy = [x for x in sm if x["util"] is not None and x["util"] >= BUSY_UTIL]
|
||||
lim = [x["limit"] for x in sm if x["limit"] is not None]
|
||||
r["n_samples"], r["n_busy"] = len(sm), len(busy)
|
||||
r["limit_min"], r["limit_max"], r["limit_mean"] = (min(lim), max(lim), st.mean(lim)) if lim else (None, None, None)
|
||||
r["limit_spread"] = (r["limit_max"] - r["limit_min"]) if lim else None
|
||||
r["sm_mhz"], r["mem_mhz"] = mean([x["sm"] for x in busy]), mean([x["mem"] for x in busy])
|
||||
r["power_mean"] = mean([x["power"] for x in busy])
|
||||
r["power_max"] = max([x["power"] for x in sm if x["power"] is not None], default=None)
|
||||
r["temp_max"] = max([x["temp"] for x in sm if x["temp"] is not None], default=None)
|
||||
r["vram_peak"] = max([x["vram"] for x in sm if x["vram"] is not None], default=None)
|
||||
r["p0_share"] = (sum(1 for x in busy if x["pstate"] == "P0") / len(busy)) if busy else None
|
||||
r["pcap_share"] = (sum(1 for x in busy if x["throttle"] is not None and x["throttle"] & 4) / len(busy)) if busy else None
|
||||
r["pstates"] = ",".join(sorted(set(x["pstate"] for x in busy)))
|
||||
if not lim or r["limit_min"] < LIMIT_FLOOR:
|
||||
why.append("enforced limit min %s W < %d" % (fmt(r["limit_min"]), LIMIT_FLOOR))
|
||||
elif r["limit_spread"] > LIMIT_SPREAD:
|
||||
why.append("limit spread %.1f W > %d" % (r["limit_spread"], LIMIT_SPREAD))
|
||||
if r["p0_share"] is None or r["p0_share"] < P0_SHARE:
|
||||
why.append("P0 in %s of the busy samples (< %.0f %%; states %s)" % (fmt(None if r["p0_share"] is None else 100 * r["p0_share"], 0) + " %", 100 * P0_SHARE, r["pstates"]))
|
||||
# engine lines
|
||||
log = read_logs(d)
|
||||
r["log_bytes"] = len(log)
|
||||
tok_rd, ms_rd, eng_pf = [], [], []
|
||||
if r["arm"] == "ours":
|
||||
outs = re.findall(r"leleka-serve request outcome=completed produced=(\d+) rounds=(\d+) reused=(\d+)", log)
|
||||
if len(outs) < want:
|
||||
why.append("ours: %d request outcome lines (trace env missing?)" % len(outs))
|
||||
for (prod, rd, _reu), q in zip(outs[-want:], reqs[:want]):
|
||||
prod, rd = int(prod), int(rd)
|
||||
if rd:
|
||||
tok_rd.append(prod / rd)
|
||||
if q.get("decode_s"):
|
||||
ms_rd.append(1000.0 * q["decode_s"] / rd)
|
||||
# PREFILL-PROFILE lines of request 1 (before the first outcome line)
|
||||
first = log.find("leleka-serve request outcome")
|
||||
pp = re.findall(r"PREFILL-PROFILE first=\d+ tokens=(\d+) total_ms=([\d.]+)", log[: first if first > 0 else len(log)])
|
||||
if pp:
|
||||
t = sum(int(a_) for a_, _ in pp)
|
||||
ms = sum(float(b_) for _, b_ in pp)
|
||||
eng_pf.append(1000.0 * t / ms if ms else None)
|
||||
r["engine_ok"] = len(outs) >= want
|
||||
else:
|
||||
skip_on = re.search(r"STRATA_ROUTE_TAIL_SKIP=\d+ is ON", log) is not None
|
||||
share_on = "the CPU share is ON by default" in log
|
||||
r["tail_skip_on"], r["cpu_share_on"] = skip_on, share_on
|
||||
if not log:
|
||||
why.append("no vanilla engine log copied")
|
||||
elif r["arm"] == "v1" and not skip_on:
|
||||
why.append("v1 but the tail skip is not ON in the engine log")
|
||||
elif r["arm"] == "v2" and (skip_on or share_on):
|
||||
why.append("v2 but tail skip on=%s / cpu share on=%s in the engine log" % (skip_on, share_on))
|
||||
lines = re.findall(r"strata serve: prompt (\d+) tokens = (\d+) reused \+ (\d+)(?: of \d+)? read in (\d+) ms .*?(\d+) generated in (\d+) ms .*?drafts accepted (\d+) of (\d+)", log)
|
||||
for (n, reu, rd_n, rd_ms, gen, dms, acc, _dn) in lines[-want:]:
|
||||
gen, acc = int(gen), int(acc)
|
||||
rounds = gen - acc
|
||||
if rounds > 0 and gen > 1:
|
||||
tok_rd.append(gen / rounds)
|
||||
ms_rd.append(int(dms) / rounds)
|
||||
if lines:
|
||||
n, reu, rd_n, rd_ms = lines[-want][:4]
|
||||
eng_pf.append(1000.0 * int(rd_n) / int(rd_ms) if int(rd_ms) else None)
|
||||
if len(lines) < want and log:
|
||||
why.append("vanilla: %d request lines" % len(lines))
|
||||
r["tok_round"], r["ms_round"] = mean(tok_rd), mean(ms_rd)
|
||||
r["ms_round_r1"] = ms_rd[0] if ms_rd else None
|
||||
r["ms_round_r2"] = ms_rd[1] if len(ms_rd) > 1 else None
|
||||
r["engine_prefill_tok_s"] = eng_pf[0] if eng_pf else None
|
||||
r["why"] = why
|
||||
r["valid"] = not why
|
||||
return r
|
||||
|
||||
|
||||
runs = []
|
||||
for d in sorted(glob.glob(os.path.join(ROOT, "s*-*"))):
|
||||
if os.path.isdir(d):
|
||||
x = parse_run(d)
|
||||
if x:
|
||||
runs.append(x)
|
||||
if not runs:
|
||||
print("no run directories under", ROOT)
|
||||
sys.exit(0)
|
||||
|
||||
# prompt identity across the arms of one size (same frozen prompt file -> same request bytes)
|
||||
for size in sorted(set(r["size"] for r in runs)):
|
||||
for k in ("r1_sha", "r2_sha"):
|
||||
shas = set(r.get(k) for r in runs if r["size"] == size and r.get(k))
|
||||
if len(shas) > 1:
|
||||
for r in runs:
|
||||
if r["size"] == size:
|
||||
r["why"].append("%s differs between arms of size %d" % (k, size))
|
||||
r["valid"] = False
|
||||
|
||||
if SMOKE:
|
||||
for r in runs:
|
||||
print("SMOKE %s (thresholds %s, containment %s)" % (r["name"], r["thresholds_source"], r["containment"]))
|
||||
checks = [
|
||||
("guard exit 0 and outcome COMPLETED", r["guard_exit"] == 0 and r["guard_outcome"] == "COMPLETED", "%s %s" % (r["guard_exit"], r["guard_outcome"])),
|
||||
("watchdog COMPLETED, no missing sample", r["wd_outcome"] == "COMPLETED" and (r["samples_missing"] or 0) == 0, "%s, good %s, missing %s" % (r["wd_outcome"], r["samples_good"], r["samples_missing"])),
|
||||
("1 Hz series covers the run", r["n_samples"] >= 0.9 * (r["samples_good"] or 1), "%d run rows" % r["n_samples"]),
|
||||
("engine ready, request answered", r["arm_outcome"] == "COMPLETED", "ready %s s, R1 in %s cached %s out %s TTFT %s s decode %s tok/s" % (r["ready_s"], r.get("r1_in"), r.get("r1_cached"), r.get("r1_out"), r.get("r1_ttft"), r.get("r1_dec"))),
|
||||
("under load in P0", (r["p0_share"] or 0) >= P0_SHARE, "P0 share %s of %d busy samples (%s)" % (fmt(r["p0_share"], 2), r["n_busy"], r["pstates"])),
|
||||
("enforced limit >= 100 W throughout", r["limit_min"] is not None and r["limit_min"] >= LIMIT_FLOOR, "%s..%s W" % (fmt(r["limit_min"]), fmt(r["limit_max"]))),
|
||||
("no SW power cap under load", (r["pcap_share"] or 0) < 0.05, "cap share %s" % fmt(r["pcap_share"], 2)),
|
||||
("temperature below 85 C", r["temp_max"] is not None and r["temp_max"] < 85, "max %s C, power max %s W, SM %s MHz, mem %s MHz" % (fmt(r["temp_max"], 0), fmt(r["power_max"], 0), fmt(r["sm_mhz"], 0), fmt(r["mem_mhz"], 0))),
|
||||
("Turbo + AC before and after", not any(w.startswith(("pre-state", "post-state", "AC lost")) for w in r["why"]), "%s/%s -> %s/%s" % (r["pre_scheme"], r["pre_ac"], r["post_scheme"], r["post_ac"])),
|
||||
("engine stopped, nothing left", "left after the stop" not in (r["arm_reason"] or ""), "stop %s s" % r["stop_s"]),
|
||||
]
|
||||
for label, ok, detail in checks:
|
||||
print(" %s %-40s %s" % ("PASS" if ok else "FAIL", label, detail))
|
||||
print(" VRAM peak %s MiB, engine working set peak %s GiB, min available RAM %s GiB" % (fmt(r["vram_peak"], 0), r["peak_ws_gib"], r["min_avail_gib"]))
|
||||
sys.exit(0)
|
||||
|
||||
print("== per run (R1 = cold prompt, R2 = reuse + 2k delta; prefill tok/s = (input - cached) / TTFT) ==")
|
||||
print("run valid R1 in TTFT1 pf1 dec1 R2 cached TTFT2 dec2 ms/rd tok/rd ready wall SM MHz W(mean/max) limit W maxC P0 VRAM WS GiB")
|
||||
for r in sorted(runs, key=lambda r: (r["size"], r["block"], r["pos"])):
|
||||
print("%-19s %-6s %-7s %-6s %-6s %-6s %-9s %-6s %-6s %-6s %-6s %-6s %-6s %-7s %-11s %-12s %-4s %-5s %-5s %s" % (
|
||||
r["name"], "yes" if r["valid"] else "NO", r.get("r1_in", "-"), fmt(r.get("r1_ttft")), fmt(r.get("r1_pf"), 0), fmt(r.get("r1_dec"), 2), r.get("r2_cached", "-"), fmt(r.get("r2_ttft")),
|
||||
fmt(r.get("r2_dec"), 2), fmt(r["ms_round"]), fmt(r["tok_round"], 2), fmt(r["ready_s"], 0), fmt(r["session_wall"], 0), fmt(r["sm_mhz"], 0),
|
||||
"%s/%s" % (fmt(r["power_mean"], 0), fmt(r["power_max"], 0)), "%s-%s" % (fmt(r["limit_min"], 0), fmt(r["limit_max"], 0)), fmt(r["temp_max"], 0),
|
||||
fmt(r["p0_share"], 2), fmt(r["vram_peak"], 0), r["peak_ws_gib"]))
|
||||
if not r["valid"]:
|
||||
print(" not valid: " + "; ".join(r["why"]))
|
||||
|
||||
METRICS = [("r1_ttft", "R1 TTFT s", False), ("r1_pf", "R1 prefill tok/s", True), ("r1_dec", "R1 decode tok/s", True), ("r2_ttft", "R2 TTFT s", False),
|
||||
("r2_dec", "R2 decode tok/s", True), ("session_wall", "R1+R2 wall s", False), ("ms_round", "ms/round", False), ("tok_round", "tokens/round", True),
|
||||
("engine_prefill_tok_s", "engine prefill tok/s (R1)", True), ("ready_s", "load to ready s", False)]
|
||||
valid = [r for r in runs if r["valid"]]
|
||||
for size in sorted(set(r["size"] for r in runs)):
|
||||
vs = [r for r in valid if r["size"] == size]
|
||||
print("\n== size %d: %d valid of %d runs ==" % (size, len(vs), len([r for r in runs if r["size"] == size])))
|
||||
by = {a: [r for r in vs if r["arm"] == a] for a in ("ours", "v1", "v2")}
|
||||
for key, label, _hi in METRICS:
|
||||
row = []
|
||||
for a in ("ours", "v1", "v2"):
|
||||
v = [r[key] for r in by[a] if r.get(key) is not None]
|
||||
row.append("%s n=%d %s (sd %s, %s..%s)" % (a, len(v), fmt(st.mean(v) if v else None, 2), fmt(st.stdev(v) if len(v) > 1 else None, 2),
|
||||
fmt(min(v) if v else None, 2), fmt(max(v) if v else None, 2)))
|
||||
print(" %-26s %s" % (label, " | ".join(row)))
|
||||
print(" block-paired deltas (a - b in the same block; %% = a / b - 1; 'better' = faster / shorter; pair needs mean limits within %d W):" % PAIR_LIMIT_DIFF)
|
||||
for a, b in (("ours", "v1"), ("ours", "v2"), ("v1", "v2")):
|
||||
pairs = []
|
||||
for bl in sorted(set(r["block"] for r in vs)):
|
||||
ra = [r for r in by[a] if r["block"] == bl]
|
||||
rb = [r for r in by[b] if r["block"] == bl]
|
||||
if ra and rb:
|
||||
if ra[0]["limit_mean"] is not None and rb[0]["limit_mean"] is not None and abs(ra[0]["limit_mean"] - rb[0]["limit_mean"]) <= PAIR_LIMIT_DIFF:
|
||||
pairs.append((bl, ra[0], rb[0]))
|
||||
else:
|
||||
print(" %s - %s block %d: pair not valid (mean limits %s / %s W)" % (a, b, bl, fmt(ra[0]["limit_mean"]), fmt(rb[0]["limit_mean"])))
|
||||
if not pairs:
|
||||
continue
|
||||
print(" %s - %s: n=%d pairs (blocks %s)" % (a, b, len(pairs), ",".join(str(p[0]) for p in pairs)))
|
||||
for key, label, hi in METRICS:
|
||||
dl = [(pa[key], pb[key]) for _, pa, pb in pairs if pa.get(key) is not None and pb.get(key)]
|
||||
if not dl:
|
||||
continue
|
||||
pc = [100.0 * (x / y - 1) for x, y in dl]
|
||||
better = sum(1 for x, y in dl if (x > y if hi else x < y))
|
||||
sd = st.stdev(pc) if len(pc) > 1 else None
|
||||
print(" %-26s %s mean %+.1f %% (sd %s), %s better in %d of %d" % (label, " ".join("%+.1f%%" % x for x in pc), st.mean(pc), fmt(sd), a, better, len(dl)))
|
||||
print(" order: R1+R2 wall by position in the block")
|
||||
for a in ("ours", "v1", "v2"):
|
||||
print(" %-4s %s" % (a, " | ".join("pos%d %s" % (p, fmt(mean([r["session_wall"] for r in by[a] if r["pos"] == p]), 0)) for p in (1, 2, 3))))
|
||||
nxt = NEXT_SIZE.get(size)
|
||||
if nxt:
|
||||
print(" projection for size %d (arm time = load + (N / R1 prefill tok/s) + 2 x decode time + stop; BOOTSTRAP cap 900 s):" % nxt)
|
||||
for a in ("ours", "v1", "v2"):
|
||||
rs = by[a]
|
||||
if not rs:
|
||||
continue
|
||||
load = mean([r["ready_s"] for r in rs]); pf = mean([r.get("r1_pf") for r in rs]); dec = mean([(r.get("r1_dec_s") or 0) + (r.get("r2_dec_s") or 0) for r in rs])
|
||||
stop = mean([r["stop_s"] for r in rs]) or 15
|
||||
if load and pf:
|
||||
est = load + nxt / pf + (dec or 0) + 2048 / pf + stop
|
||||
print(" %-4s about %.0f s (load %.0f, prefill %.0f tok/s, decode %.0f s)%s" % (a, est, load, pf, dec or 0, " > 900 s: needs the S3.7 thresholds" if est > 840 else ""))
|
||||
|
||||
if CSV:
|
||||
cols = ["name", "size", "block", "pos", "arm", "valid", "r1_in", "r1_cached", "r1_out", "r1_ttft", "r1_pf", "r1_dec", "r2_in", "r2_cached", "r2_out", "r2_ttft", "r2_pf", "r2_dec",
|
||||
"session_wall", "ms_round", "ms_round_r1", "ms_round_r2", "tok_round", "engine_prefill_tok_s", "ready_s", "stop_s", "sm_mhz", "mem_mhz", "power_mean", "power_max",
|
||||
"limit_min", "limit_max", "limit_mean", "temp_max", "p0_share", "pcap_share", "vram_peak", "peak_ws_gib", "peak_private_gib", "min_avail_gib", "pre_scheme", "pre_ac",
|
||||
"pre_limit", "post_scheme", "post_ac", "post_limit", "guard_exit", "wd_outcome", "samples_good", "samples_missing", "thresholds_source"]
|
||||
with open(CSV, "w", encoding="utf-8") as f:
|
||||
f.write(",".join(cols + ["why"]) + "\n")
|
||||
for r in runs:
|
||||
f.write(",".join("" if r.get(c) is None else str(r.get(c)) for c in cols) + ',"' + "; ".join(r["why"]).replace('"', "'") + '"\n')
|
||||
print("\ncsv:", CSV)
|
||||
|
||||
@@ -1,249 +1,249 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Client of the 3080 laptop pair series (docs/experiments/laptop-pair-3080.md). Stdlib only, Python >= 3.9, offline.
|
||||
|
||||
Two modes:
|
||||
|
||||
prompts --corpus DIR --out DIR [--sizes 8192,32768,65536,98304] [--delta 2048] [--chars-per-token 3.3]
|
||||
Builds the frozen request texts once (install time): for every size N, prompt-N.json holds the text of request 1
|
||||
(about N tokens of real Rust source from the corpus, files in sorted path order, then a question) and the text of the
|
||||
delta that request 2 appends (about --delta tokens of the next source files, then a second question). Both arms send
|
||||
these exact bytes, so the prompts are identical by construction; the token count is an estimate (3.3 characters per
|
||||
token, the ratio long_session.py measured on this corpus) and the real count is what the engines report.
|
||||
|
||||
session --prompt FILE --base-url URL --out DIR [--key-file FILE] [--max-output 300] [--temperature 0] [--r1-only]
|
||||
[--timeout-s 3600]
|
||||
Request 1 = [user: r1_text] (cold prefill of about N tokens, then decode at depth N).
|
||||
Request 2 = [user: r1_text, user: delta] (the prefix of request 1 is reusable: agent-like delta of about 2k tokens,
|
||||
then decode at depth N + delta). The model's reply is NOT put into the history, so request 2 is the same bytes on
|
||||
every arm. Both are streamed /v1/responses requests with temperature 0 and max_output_tokens = --max-output.
|
||||
Output: DIR/session.json (per request: send time, TTFT, decode tok/s, token counts, status, request-body sha256,
|
||||
reply sha256 prefix; never the prompt or reply text) and DIR/progress.json (rewritten on every stream event: phase
|
||||
prefill|decode|done, events, bytes, monotonic and wall time), which the arm driver reads for its log-stall rule.
|
||||
The API key is read from --key-file (never printed); without it no Authorization header is sent (vanilla, --access local).
|
||||
|
||||
Exit codes: 0 ok, 1 a request failed or returned an error status, 2 usage / missing input.
|
||||
"""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
Q1 = "Which function in the code above is the most complex, and why? Answer in at most six sentences."
|
||||
Q2 = "Given the additional code just above, list the three places where memory pressure is decided, and what each decides. Be brief."
|
||||
|
||||
|
||||
def collect(src):
|
||||
files = []
|
||||
for root, _dirs, names in os.walk(src):
|
||||
for name in sorted(names):
|
||||
if name.endswith(".rs"):
|
||||
path = os.path.join(root, name)
|
||||
if os.path.getsize(path) > 1500:
|
||||
files.append(path)
|
||||
files.sort()
|
||||
return files
|
||||
|
||||
|
||||
def take(files, base, start, chars):
|
||||
parts, used, i = [], 0, start
|
||||
while i < len(files) and used < chars:
|
||||
with open(files[i], "rb") as f:
|
||||
text = f.read().decode("utf-8", "replace").replace("\r\n", "\n")[: chars - used]
|
||||
parts.append("// ==== " + os.path.relpath(files[i], base).replace("\\", "/") + "\n" + text)
|
||||
used += len(text)
|
||||
i += 1
|
||||
return "\n".join(parts), i, used
|
||||
|
||||
|
||||
def cmd_prompts(a):
|
||||
files = collect(a.corpus)
|
||||
if not files:
|
||||
print("laptop-pair-client: --corpus %s holds no .rs file larger than 1500 bytes" % a.corpus, file=sys.stderr)
|
||||
return 2
|
||||
os.makedirs(a.out, exist_ok=True)
|
||||
manifest = []
|
||||
for n in [int(x) for x in a.sizes.split(",") if x.strip()]:
|
||||
r1, pos, used1 = take(files, a.corpus, 0, int(n * a.chars_per_token))
|
||||
if used1 < int(n * a.chars_per_token) * 0.98:
|
||||
print("laptop-pair-client: the corpus is too short for %d tokens (%d chars)" % (n, used1), file=sys.stderr)
|
||||
return 2
|
||||
delta, _pos2, used2 = take(files, a.corpus, pos, int(a.delta * a.chars_per_token))
|
||||
doc = {"size_tokens_target": n, "delta_tokens_target": a.delta, "chars_per_token_estimate": a.chars_per_token,
|
||||
"r1_text": r1 + "\n\n" + Q1, "r2_delta_text": delta + "\n\n" + Q2}
|
||||
path = os.path.join(a.out, "prompt-%d.json" % n)
|
||||
data = json.dumps(doc, ensure_ascii=False, sort_keys=True).encode("utf-8")
|
||||
with open(path, "wb") as f:
|
||||
f.write(data)
|
||||
manifest.append("%s %s r1_chars=%d delta_chars=%d" % (hashlib.sha256(data).hexdigest(), os.path.basename(path), used1, used2))
|
||||
with open(os.path.join(a.out, "PROMPTS.txt"), "w") as f:
|
||||
f.write("\n".join(manifest) + "\n")
|
||||
print("\n".join(manifest))
|
||||
return 0
|
||||
|
||||
|
||||
def write_json(path, obj):
|
||||
tmp = path + ".tmp"
|
||||
with open(tmp, "w") as f:
|
||||
json.dump(obj, f, indent=1)
|
||||
os.replace(tmp, path)
|
||||
|
||||
|
||||
class Progress:
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
self.state = {"phase": "idle", "request": 0, "events": 0, "bytes": 0, "t_mono": time.monotonic(), "t_wall": time.time()}
|
||||
self.last_write = 0.0
|
||||
self.flush(force=True)
|
||||
|
||||
def update(self, force=False, **kw):
|
||||
self.state.update(kw)
|
||||
self.state["t_mono"] = time.monotonic()
|
||||
self.state["t_wall"] = time.time()
|
||||
self.flush(force)
|
||||
|
||||
def flush(self, force=False):
|
||||
now = time.monotonic()
|
||||
if force or now - self.last_write >= 1.0:
|
||||
try:
|
||||
write_json(self.path, self.state)
|
||||
except OSError:
|
||||
pass
|
||||
self.last_write = now
|
||||
|
||||
|
||||
def stream(base, key, model, items, max_out, temperature, timeout_s, prog, req_no):
|
||||
body = {"model": model, "input": items, "max_output_tokens": max_out, "temperature": temperature, "stream": True}
|
||||
raw_body = json.dumps(body, ensure_ascii=False, sort_keys=True).encode("utf-8")
|
||||
headers = {"Content-Type": "application/json"}
|
||||
if key:
|
||||
headers["Authorization"] = "Bearer " + key
|
||||
req = urllib.request.Request(base + "/v1/responses", raw_body, headers)
|
||||
info = {"request": req_no, "request_body_sha256": hashlib.sha256(raw_body).hexdigest(), "t_send_wall": time.time()}
|
||||
t0 = time.monotonic()
|
||||
first = last = None
|
||||
deltas = 0
|
||||
nbytes = 0
|
||||
text = []
|
||||
usage = {}
|
||||
status = None
|
||||
prog.update(force=True, phase="prefill", request=req_no, events=0, bytes=0)
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=timeout_s) as r:
|
||||
for line_raw in r:
|
||||
nbytes += len(line_raw)
|
||||
line = line_raw.decode("utf8", "replace").strip()
|
||||
if not line.startswith("data:"):
|
||||
prog.update(bytes=nbytes)
|
||||
continue
|
||||
try:
|
||||
d = json.loads(line[5:])
|
||||
except ValueError:
|
||||
continue
|
||||
ty = d.get("type", "")
|
||||
if ty.endswith("output_text.delta") or ty.endswith("reasoning_text.delta"):
|
||||
now = time.monotonic()
|
||||
first = first or now
|
||||
last = now
|
||||
deltas += 1
|
||||
if ty.endswith("output_text.delta"):
|
||||
text.append(d.get("delta", ""))
|
||||
prog.update(phase="decode", events=deltas, bytes=nbytes)
|
||||
elif ty in ("response.completed", "response.incomplete", "response.failed"):
|
||||
resp = d.get("response", {})
|
||||
usage = resp.get("usage") or {}
|
||||
status = resp.get("status")
|
||||
else:
|
||||
prog.update(bytes=nbytes)
|
||||
except urllib.error.HTTPError as e:
|
||||
info.update({"error": e.code, "body": e.read()[:300].decode("utf8", "replace"), "wall_s": round(time.monotonic() - t0, 3)})
|
||||
return info
|
||||
except Exception as e: # connection reset, timeout: recorded, the arm is invalid
|
||||
info.update({"error": type(e).__name__, "body": str(e)[:300], "wall_s": round(time.monotonic() - t0, 3)})
|
||||
return info
|
||||
end = time.monotonic()
|
||||
out = usage.get("output_tokens") or deltas
|
||||
reply = "".join(text)
|
||||
info.update({
|
||||
"wall_s": round(end - t0, 3),
|
||||
"ttft_s": round(first - t0, 3) if first else None,
|
||||
"decode_s": round(last - first, 3) if first and last else None,
|
||||
"decode_tok_s": round((out - 1) / (last - first), 3) if first and last and last > first and out > 1 else None,
|
||||
"input_tokens": usage.get("input_tokens"),
|
||||
"cached_tokens": (usage.get("input_tokens_details") or {}).get("cached_tokens"),
|
||||
"output_tokens": usage.get("output_tokens"),
|
||||
"stream_deltas": deltas,
|
||||
"status": status,
|
||||
"reply_sha256": hashlib.sha256(reply.encode()).hexdigest()[:16],
|
||||
"t_first_wall": info["t_send_wall"] + (first - t0) if first else None,
|
||||
"t_end_wall": info["t_send_wall"] + (end - t0),
|
||||
})
|
||||
return info
|
||||
|
||||
|
||||
def cmd_session(a):
|
||||
with open(a.prompt, "rb") as f:
|
||||
pdata = f.read()
|
||||
doc = json.loads(pdata.decode("utf-8"))
|
||||
key = ""
|
||||
if a.key_file:
|
||||
with open(a.key_file, encoding="utf-8") as f:
|
||||
key = f.read().strip()
|
||||
os.makedirs(a.out, exist_ok=True)
|
||||
prog = Progress(os.path.join(a.out, "progress.json"))
|
||||
try:
|
||||
with urllib.request.urlopen(urllib.request.Request(a.base_url + "/v1/models", headers={"Authorization": "Bearer " + key} if key else {}), timeout=30) as r:
|
||||
model = json.loads(r.read().decode("utf-8"))["data"][0]["id"]
|
||||
except Exception as e:
|
||||
print("laptop-pair-client: GET /v1/models failed: %s" % type(e).__name__, file=sys.stderr)
|
||||
return 1
|
||||
res = {"prompt_file": os.path.basename(a.prompt), "prompt_sha256": hashlib.sha256(pdata).hexdigest(), "model": model,
|
||||
"max_output": a.max_output, "temperature": a.temperature, "python": sys.version.split()[0], "requests": []}
|
||||
u1 = {"role": "user", "content": [{"type": "input_text", "text": doc["r1_text"]}]}
|
||||
u2 = {"role": "user", "content": [{"type": "input_text", "text": doc["r2_delta_text"]}]}
|
||||
plan = [[u1]] if a.r1_only else [[u1], [u1, u2]]
|
||||
rc = 0
|
||||
for i, items in enumerate(plan, 1):
|
||||
info = stream(a.base_url, key, model, items, a.max_output, a.temperature, a.timeout_s, prog, i)
|
||||
res["requests"].append(info)
|
||||
print(json.dumps({k: v for k, v in info.items() if k != "body"}), flush=True)
|
||||
write_json(os.path.join(a.out, "session.json"), res)
|
||||
if "error" in info or info.get("status") == "failed":
|
||||
rc = 1
|
||||
break
|
||||
prog.update(force=True, phase="done")
|
||||
return rc
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
sub = ap.add_subparsers(dest="cmd")
|
||||
p = sub.add_parser("prompts")
|
||||
p.add_argument("--corpus", required=True)
|
||||
p.add_argument("--out", required=True)
|
||||
p.add_argument("--sizes", default="8192,32768,65536,98304,131072,229376")
|
||||
p.add_argument("--delta", type=int, default=2048)
|
||||
p.add_argument("--chars-per-token", type=float, default=3.3)
|
||||
s = sub.add_parser("session")
|
||||
s.add_argument("--prompt", required=True)
|
||||
s.add_argument("--base-url", required=True)
|
||||
s.add_argument("--out", required=True)
|
||||
s.add_argument("--key-file", default="")
|
||||
s.add_argument("--max-output", type=int, default=300)
|
||||
s.add_argument("--temperature", type=float, default=0.0)
|
||||
s.add_argument("--r1-only", action="store_true")
|
||||
s.add_argument("--timeout-s", type=float, default=3600)
|
||||
a = ap.parse_args()
|
||||
if a.cmd == "prompts":
|
||||
return cmd_prompts(a)
|
||||
if a.cmd == "session":
|
||||
return cmd_session(a)
|
||||
ap.print_help()
|
||||
return 2
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
#!/usr/bin/env python3
|
||||
"""Client of the 3080 laptop pair series. Stdlib only, Python >= 3.9, offline.
|
||||
|
||||
Two modes:
|
||||
|
||||
prompts --corpus DIR --out DIR [--sizes 8192,32768,65536,98304] [--delta 2048] [--chars-per-token 3.3]
|
||||
Builds the frozen request texts once (install time): for every size N, prompt-N.json holds the text of request 1
|
||||
(about N tokens of real Rust source from the corpus, files in sorted path order, then a question) and the text of the
|
||||
delta that request 2 appends (about --delta tokens of the next source files, then a second question). Both arms send
|
||||
these exact bytes, so the prompts are identical by construction; the token count is an estimate (3.3 characters per
|
||||
token, the ratio long_session.py measured on this corpus) and the real count is what the engines report.
|
||||
|
||||
session --prompt FILE --base-url URL --out DIR [--key-file FILE] [--max-output 300] [--temperature 0] [--r1-only]
|
||||
[--timeout-s 3600]
|
||||
Request 1 = [user: r1_text] (cold prefill of about N tokens, then decode at depth N).
|
||||
Request 2 = [user: r1_text, user: delta] (the prefix of request 1 is reusable: agent-like delta of about 2k tokens,
|
||||
then decode at depth N + delta). The model's reply is NOT put into the history, so request 2 is the same bytes on
|
||||
every arm. Both are streamed /v1/responses requests with temperature 0 and max_output_tokens = --max-output.
|
||||
Output: DIR/session.json (per request: send time, TTFT, decode tok/s, token counts, status, request-body sha256,
|
||||
reply sha256 prefix; never the prompt or reply text) and DIR/progress.json (rewritten on every stream event: phase
|
||||
prefill|decode|done, events, bytes, monotonic and wall time), which the arm driver reads for its log-stall rule.
|
||||
The API key is read from --key-file (never printed); without it no Authorization header is sent (vanilla, --access local).
|
||||
|
||||
Exit codes: 0 ok, 1 a request failed or returned an error status, 2 usage / missing input.
|
||||
"""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
Q1 = "Which function in the code above is the most complex, and why? Answer in at most six sentences."
|
||||
Q2 = "Given the additional code just above, list the three places where memory pressure is decided, and what each decides. Be brief."
|
||||
|
||||
|
||||
def collect(src):
|
||||
files = []
|
||||
for root, _dirs, names in os.walk(src):
|
||||
for name in sorted(names):
|
||||
if name.endswith(".rs"):
|
||||
path = os.path.join(root, name)
|
||||
if os.path.getsize(path) > 1500:
|
||||
files.append(path)
|
||||
files.sort()
|
||||
return files
|
||||
|
||||
|
||||
def take(files, base, start, chars):
|
||||
parts, used, i = [], 0, start
|
||||
while i < len(files) and used < chars:
|
||||
with open(files[i], "rb") as f:
|
||||
text = f.read().decode("utf-8", "replace").replace("\r\n", "\n")[: chars - used]
|
||||
parts.append("// ==== " + os.path.relpath(files[i], base).replace("\\", "/") + "\n" + text)
|
||||
used += len(text)
|
||||
i += 1
|
||||
return "\n".join(parts), i, used
|
||||
|
||||
|
||||
def cmd_prompts(a):
|
||||
files = collect(a.corpus)
|
||||
if not files:
|
||||
print("laptop-pair-client: --corpus %s holds no .rs file larger than 1500 bytes" % a.corpus, file=sys.stderr)
|
||||
return 2
|
||||
os.makedirs(a.out, exist_ok=True)
|
||||
manifest = []
|
||||
for n in [int(x) for x in a.sizes.split(",") if x.strip()]:
|
||||
r1, pos, used1 = take(files, a.corpus, 0, int(n * a.chars_per_token))
|
||||
if used1 < int(n * a.chars_per_token) * 0.98:
|
||||
print("laptop-pair-client: the corpus is too short for %d tokens (%d chars)" % (n, used1), file=sys.stderr)
|
||||
return 2
|
||||
delta, _pos2, used2 = take(files, a.corpus, pos, int(a.delta * a.chars_per_token))
|
||||
doc = {"size_tokens_target": n, "delta_tokens_target": a.delta, "chars_per_token_estimate": a.chars_per_token,
|
||||
"r1_text": r1 + "\n\n" + Q1, "r2_delta_text": delta + "\n\n" + Q2}
|
||||
path = os.path.join(a.out, "prompt-%d.json" % n)
|
||||
data = json.dumps(doc, ensure_ascii=False, sort_keys=True).encode("utf-8")
|
||||
with open(path, "wb") as f:
|
||||
f.write(data)
|
||||
manifest.append("%s %s r1_chars=%d delta_chars=%d" % (hashlib.sha256(data).hexdigest(), os.path.basename(path), used1, used2))
|
||||
with open(os.path.join(a.out, "PROMPTS.txt"), "w") as f:
|
||||
f.write("\n".join(manifest) + "\n")
|
||||
print("\n".join(manifest))
|
||||
return 0
|
||||
|
||||
|
||||
def write_json(path, obj):
|
||||
tmp = path + ".tmp"
|
||||
with open(tmp, "w") as f:
|
||||
json.dump(obj, f, indent=1)
|
||||
os.replace(tmp, path)
|
||||
|
||||
|
||||
class Progress:
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
self.state = {"phase": "idle", "request": 0, "events": 0, "bytes": 0, "t_mono": time.monotonic(), "t_wall": time.time()}
|
||||
self.last_write = 0.0
|
||||
self.flush(force=True)
|
||||
|
||||
def update(self, force=False, **kw):
|
||||
self.state.update(kw)
|
||||
self.state["t_mono"] = time.monotonic()
|
||||
self.state["t_wall"] = time.time()
|
||||
self.flush(force)
|
||||
|
||||
def flush(self, force=False):
|
||||
now = time.monotonic()
|
||||
if force or now - self.last_write >= 1.0:
|
||||
try:
|
||||
write_json(self.path, self.state)
|
||||
except OSError:
|
||||
pass
|
||||
self.last_write = now
|
||||
|
||||
|
||||
def stream(base, key, model, items, max_out, temperature, timeout_s, prog, req_no):
|
||||
body = {"model": model, "input": items, "max_output_tokens": max_out, "temperature": temperature, "stream": True}
|
||||
raw_body = json.dumps(body, ensure_ascii=False, sort_keys=True).encode("utf-8")
|
||||
headers = {"Content-Type": "application/json"}
|
||||
if key:
|
||||
headers["Authorization"] = "Bearer " + key
|
||||
req = urllib.request.Request(base + "/v1/responses", raw_body, headers)
|
||||
info = {"request": req_no, "request_body_sha256": hashlib.sha256(raw_body).hexdigest(), "t_send_wall": time.time()}
|
||||
t0 = time.monotonic()
|
||||
first = last = None
|
||||
deltas = 0
|
||||
nbytes = 0
|
||||
text = []
|
||||
usage = {}
|
||||
status = None
|
||||
prog.update(force=True, phase="prefill", request=req_no, events=0, bytes=0)
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=timeout_s) as r:
|
||||
for line_raw in r:
|
||||
nbytes += len(line_raw)
|
||||
line = line_raw.decode("utf8", "replace").strip()
|
||||
if not line.startswith("data:"):
|
||||
prog.update(bytes=nbytes)
|
||||
continue
|
||||
try:
|
||||
d = json.loads(line[5:])
|
||||
except ValueError:
|
||||
continue
|
||||
ty = d.get("type", "")
|
||||
if ty.endswith("output_text.delta") or ty.endswith("reasoning_text.delta"):
|
||||
now = time.monotonic()
|
||||
first = first or now
|
||||
last = now
|
||||
deltas += 1
|
||||
if ty.endswith("output_text.delta"):
|
||||
text.append(d.get("delta", ""))
|
||||
prog.update(phase="decode", events=deltas, bytes=nbytes)
|
||||
elif ty in ("response.completed", "response.incomplete", "response.failed"):
|
||||
resp = d.get("response", {})
|
||||
usage = resp.get("usage") or {}
|
||||
status = resp.get("status")
|
||||
else:
|
||||
prog.update(bytes=nbytes)
|
||||
except urllib.error.HTTPError as e:
|
||||
info.update({"error": e.code, "body": e.read()[:300].decode("utf8", "replace"), "wall_s": round(time.monotonic() - t0, 3)})
|
||||
return info
|
||||
except Exception as e: # connection reset, timeout: recorded, the arm is invalid
|
||||
info.update({"error": type(e).__name__, "body": str(e)[:300], "wall_s": round(time.monotonic() - t0, 3)})
|
||||
return info
|
||||
end = time.monotonic()
|
||||
out = usage.get("output_tokens") or deltas
|
||||
reply = "".join(text)
|
||||
info.update({
|
||||
"wall_s": round(end - t0, 3),
|
||||
"ttft_s": round(first - t0, 3) if first else None,
|
||||
"decode_s": round(last - first, 3) if first and last else None,
|
||||
"decode_tok_s": round((out - 1) / (last - first), 3) if first and last and last > first and out > 1 else None,
|
||||
"input_tokens": usage.get("input_tokens"),
|
||||
"cached_tokens": (usage.get("input_tokens_details") or {}).get("cached_tokens"),
|
||||
"output_tokens": usage.get("output_tokens"),
|
||||
"stream_deltas": deltas,
|
||||
"status": status,
|
||||
"reply_sha256": hashlib.sha256(reply.encode()).hexdigest()[:16],
|
||||
"t_first_wall": info["t_send_wall"] + (first - t0) if first else None,
|
||||
"t_end_wall": info["t_send_wall"] + (end - t0),
|
||||
})
|
||||
return info
|
||||
|
||||
|
||||
def cmd_session(a):
|
||||
with open(a.prompt, "rb") as f:
|
||||
pdata = f.read()
|
||||
doc = json.loads(pdata.decode("utf-8"))
|
||||
key = ""
|
||||
if a.key_file:
|
||||
with open(a.key_file, encoding="utf-8") as f:
|
||||
key = f.read().strip()
|
||||
os.makedirs(a.out, exist_ok=True)
|
||||
prog = Progress(os.path.join(a.out, "progress.json"))
|
||||
try:
|
||||
with urllib.request.urlopen(urllib.request.Request(a.base_url + "/v1/models", headers={"Authorization": "Bearer " + key} if key else {}), timeout=30) as r:
|
||||
model = json.loads(r.read().decode("utf-8"))["data"][0]["id"]
|
||||
except Exception as e:
|
||||
print("laptop-pair-client: GET /v1/models failed: %s" % type(e).__name__, file=sys.stderr)
|
||||
return 1
|
||||
res = {"prompt_file": os.path.basename(a.prompt), "prompt_sha256": hashlib.sha256(pdata).hexdigest(), "model": model,
|
||||
"max_output": a.max_output, "temperature": a.temperature, "python": sys.version.split()[0], "requests": []}
|
||||
u1 = {"role": "user", "content": [{"type": "input_text", "text": doc["r1_text"]}]}
|
||||
u2 = {"role": "user", "content": [{"type": "input_text", "text": doc["r2_delta_text"]}]}
|
||||
plan = [[u1]] if a.r1_only else [[u1], [u1, u2]]
|
||||
rc = 0
|
||||
for i, items in enumerate(plan, 1):
|
||||
info = stream(a.base_url, key, model, items, a.max_output, a.temperature, a.timeout_s, prog, i)
|
||||
res["requests"].append(info)
|
||||
print(json.dumps({k: v for k, v in info.items() if k != "body"}), flush=True)
|
||||
write_json(os.path.join(a.out, "session.json"), res)
|
||||
if "error" in info or info.get("status") == "failed":
|
||||
rc = 1
|
||||
break
|
||||
prog.update(force=True, phase="done")
|
||||
return rc
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
sub = ap.add_subparsers(dest="cmd")
|
||||
p = sub.add_parser("prompts")
|
||||
p.add_argument("--corpus", required=True)
|
||||
p.add_argument("--out", required=True)
|
||||
p.add_argument("--sizes", default="8192,32768,65536,98304,131072,229376")
|
||||
p.add_argument("--delta", type=int, default=2048)
|
||||
p.add_argument("--chars-per-token", type=float, default=3.3)
|
||||
s = sub.add_parser("session")
|
||||
s.add_argument("--prompt", required=True)
|
||||
s.add_argument("--base-url", required=True)
|
||||
s.add_argument("--out", required=True)
|
||||
s.add_argument("--key-file", default="")
|
||||
s.add_argument("--max-output", type=int, default=300)
|
||||
s.add_argument("--temperature", type=float, default=0.0)
|
||||
s.add_argument("--r1-only", action="store_true")
|
||||
s.add_argument("--timeout-s", type=float, default=3600)
|
||||
a = ap.parse_args()
|
||||
if a.cmd == "prompts":
|
||||
return cmd_prompts(a)
|
||||
if a.cmd == "session":
|
||||
return cmd_session(a)
|
||||
ap.print_help()
|
||||
return 2
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# laptop-pair.ps1 - paired, interleaved ours-vs-vanilla series on the RTX 3080 laptop (native Windows), guarded.
|
||||
# Plan, preconditions and owner actions: docs/experiments/laptop-pair-3080.md. Windows PowerShell 5.1, stdlib only.
|
||||
# Plan, preconditions and owner actions:. Windows PowerShell 5.1, stdlib only.
|
||||
#
|
||||
# Every GPU arm runs as guard.ps1 (lock, STOP file, crash check, Job Object containment, post-abort check, cool-down)
|
||||
# -> watchdog.ps1 (idle preflight, 1 Hz nvidia-smi: P5 + power cap / thermal slowdown, enforced limit < 100 W,
|
||||
@@ -162,7 +162,7 @@ function Invoke-Install {
|
||||
$toolFiles = @(
|
||||
@{ From = 'scripts\e2e\laptop\laptop-pair.ps1' }, @{ From = 'scripts\e2e\laptop\laptop-pair-client.py' }, @{ From = 'scripts\e2e\laptop\laptop-pair-analyze.py' },
|
||||
@{ From = 'scripts\laptop\win\guard.ps1' }, @{ From = 'scripts\laptop\win\watchdog.ps1' }, @{ From = 'scripts\laptop\win\state.ps1' },
|
||||
@{ From = 'docs\experiments\laptop-pair-3080.thresholds.json' })
|
||||
@{ From = 'scripts\e2e\laptop\laptop-pair-3080.thresholds.json' })
|
||||
foreach ($t in $toolFiles) { Copy-Item -LiteralPath (Join-Path $src $t.From) -Destination $Tools }
|
||||
foreach ($n in 'leleka.exe', 'leleka-api.exe', 'leleka-inference.exe', 'leleka-daemon.exe', 'leleka-cli.exe') { Copy-Item -LiteralPath (Join-Path $OursBinSrc $n) -Destination $OursBin }
|
||||
$rustc = (& rustc --version) -join ' '
|
||||
|
||||
@@ -5,7 +5,7 @@ OFFLINE TEST DRIVER, stdlib only, Python >= 3.9; never part of serving. It launc
|
||||
`leleka-serve` instances on the 5090 (not at the same time as other GPU jobs) and this script talks to both over /v1/responses.
|
||||
|
||||
THE QUESTION. With `--prefix-cache-tail reply` the next turn of an agent session resumes from a checkpoint taken after the committed reply, so the
|
||||
cells past the prompt were written by the DECODE kernels, not by prefill (docs/prefix-cache.md, "Request-end checkpoints"). A cold prefill of the
|
||||
cells past the prompt were written by the DECODE kernels, not by prefill. A cold prefill of the
|
||||
very same tokens writes them with the prefill kernels. The two states are not bit-identical by construction; the existing evidence (job 9d4,
|
||||
flips 1.45 % vs a chunk-cut control 1.45 %) shows only that `reply` sits at the noise floor and could not score `reply` itself (a replay's greedy
|
||||
replies diverge from the recorded ones). This script scores it live: the SAME input goes to both arms at every request of a multi-turn agent
|
||||
@@ -14,7 +14,7 @@ session, the history being built from the reply-arm's own output (so the reply a
|
||||
ARMS (identical in everything except the cache; the operator starts them, this script only checks what it can see)
|
||||
cold `--prefix-cache-mib 0` (no prefix cache, every request prefilled from token 0) [or a fresh process per request: see --cold-note]
|
||||
reply `--prefix-cache-mib <N or auto> --prefix-cache-tail reply`
|
||||
Same model digest, context, KV type, speculation settings, seed policy and `LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=0` (docs/prefix-cache.md: the
|
||||
Same model digest, context, KV type, speculation settings, seed policy and `LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=0` (the
|
||||
static tier, so the expert placement does not move between arms). Greedy: every request carries temperature 0.
|
||||
|
||||
PER REQUEST (one pair = the same body to both arms; request order inside a pair is reply first, then cold, so the reply arm's cache state is the
|
||||
|
||||
@@ -11,7 +11,7 @@ After a request the `reply` tail stores a checkpoint at the end of prompt + comm
|
||||
kernels. The next agent turn resumes from there; a cold prefill of the same tokens would write them with the prefill kernels. The states are not
|
||||
bit-identical by construction, so the question is whether the continuation is the same and whether tool calls stay intact.
|
||||
|
||||
Existing evidence (`docs/prefix-cache.md`, job 9d4/9d5, `scripts/quality/q_tail_gate.py`): d_top1 p99 0.401 and flips 1.45 % for `reply` against 0.394 and
|
||||
Existing evidence (`spec node prefix-cache.md`, job 9d4/9d5, `scripts/quality/q_tail_gate.py`): d_top1 p99 0.401 and flips 1.45 % for `reply` against 0.394 and
|
||||
1.45 % for a chunk-cut control, teacher-forced on 40 requests. That shows the noise floor only. A replay cannot score `reply` itself (an arm's own greedy
|
||||
replies diverge from the recorded ones, so the next recorded prompt no longer extends them) and no tool-call integrity check was recorded.
|
||||
|
||||
@@ -64,7 +64,7 @@ sessions of job 9e3. Until then this plan gives the greedy-identity and tool-cal
|
||||
## Decision rule
|
||||
|
||||
* `PASS` on all sessions and the numeric gate within the control: keep `reply` as the default; add the evidence (verdict JSONs, command lines,
|
||||
hardware / software / digest) to `docs/prefix-cache.md`.
|
||||
hardware / software / digest) to `spec node prefix-cache.md`.
|
||||
* Any `FAIL_*`: make `prompt` (or `off`) the profile default and mark `reply` as an explicitly experimental mode. That is a separate change that
|
||||
needs the owner.
|
||||
* `INCONCLUSIVE_*`: fix the setup and re-run; the default stays as it is, flagged as unproven.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Summarize an e2e results.json as text (offline helper for docs/e2e-run.md; not shipped)."""
|
||||
"""Summarize an e2e results.json as text (offline helper; not shipped)."""
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ chmod 600 "$KEYFILE"
|
||||
export LELEKA_ORIGINAL_SERVE_EXPERT_SLOTS=${LELEKA_ORIGINAL_SERVE_EXPERT_SLOTS:-2048}
|
||||
export LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=${LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER:-yes}
|
||||
export LELEKA_ORIGINAL_SERVE_PCIE_FRAC=${LELEKA_ORIGINAL_SERVE_PCIE_FRAC:-0.45}
|
||||
# MTP draft attention = upstream pre75 chunk + merge v2 (bitwise identical to the Original, docs/experiments/draft-round-5090.md): on in the rtx5090-32g profile's
|
||||
# MTP draft attention = upstream pre75 chunk + merge v2 (bitwise identical to the Original): on in the rtx5090-32g profile's
|
||||
# engine_env, so on in the harness too (set LELEKA_SM120_ATTN_DAILY_MTP=0 for the old kernels; only the value 1 enables it).
|
||||
export LELEKA_SM120_ATTN_DAILY_MTP=${LELEKA_SM120_ATTN_DAILY_MTP:-1}
|
||||
# The ranked upstream profile (data/expert-profile.bin, the file crates/deploy pins as EXPERT_PROFILE_SHA256 and vanilla Strata runs) is the default.
|
||||
@@ -157,7 +157,7 @@ ls "$TOK" "$TOK/tokenizer" 2>&1 | head -5
|
||||
log "starting leleka-inference (sm: $(sha256sum "$BIN/leleka-inference" | cut -c1-16))"
|
||||
# The sealed KAR descriptor is inherited by the engine only: close it for the other processes started below.
|
||||
# Optional on-demand kernel tracing of the live engine (tools/cupti-trace of claude/ledger): the library is injected at process
|
||||
# start, idle until a trigger file appears (docs/e2e-run.md, "CUPTI hook"). Not set -> nothing changes.
|
||||
# start, idle until a trigger file appears. Not set -> nothing changes.
|
||||
if [ -n "${LELEKA_CUPTI_LIB:-}" ]; then
|
||||
[ -r "$LELEKA_CUPTI_LIB" ] || { echo "LELEKA_CUPTI_LIB not readable"; exit 3; }
|
||||
export CUDA_INJECTION64_PATH=$LELEKA_CUPTI_LIB LELEKA_CUPTI_TRIGGER=${LELEKA_CUPTI_TRIGGER:-$OUT/cupti.trigger}
|
||||
|
||||
@@ -17,7 +17,8 @@ REPO = HERE.parents[1]
|
||||
MAX_PTX_BYTES = 16 * 1024 * 1024
|
||||
TOOLKIT_LOCK = "deploy/cuda-toolkit.lock.json"
|
||||
EXTRA_PLAN = "scripts/gpu-bringup/extra-seal-plan.json"
|
||||
ROPE_DOC = "docs/rope-and-memory-plan.md"
|
||||
SEAL_PLAN_DIR = "crates/cuda-driver/seal-plans"
|
||||
ROPE_DOC = "scripts/gpu-bringup/rope-regeneration.json"
|
||||
ABI_SOURCE = "crates/context/src/ptx_abi.rs"
|
||||
|
||||
# -I set of scripts/build-original-verify-ptx.sh (repo-root relative).
|
||||
@@ -215,7 +216,7 @@ def load_plan_file(path: Path) -> List[Asset]:
|
||||
|
||||
def window_sealed_bound(root: Path) -> List[dict]:
|
||||
"""sealed_assets_bound of the window plan: committed PTX the producers pin by sha256 (not to be rebuilt)."""
|
||||
path = root / "docs/cuda-seal-plan-additions-window.json"
|
||||
path = root / SEAL_PLAN_DIR / "cuda-seal-plan-additions-window.json"
|
||||
if not path.is_file():
|
||||
return []
|
||||
return list(json.loads(path.read_text(encoding="utf-8")).get("sealed_assets_bound", []))
|
||||
@@ -224,34 +225,16 @@ def window_sealed_bound(root: Path) -> List[dict]:
|
||||
# ----------------------------------------------------------------------------------- rope doc / ABI
|
||||
|
||||
|
||||
def parse_rope_doc(text: str) -> Tuple[List[str], List[str], List[str]]:
|
||||
"""Return (nvcc flags, include dirs repo-relative, source basenames) from the Regeneration section."""
|
||||
m = re.search(r"```sh\s*\n(nvcc .*?)```", text, re.S)
|
||||
if not m:
|
||||
raise PlanError("rope doc: no ```sh nvcc block found")
|
||||
block = m.group(1).replace("\\\n", " ")
|
||||
toks = block.split()
|
||||
if toks[0] != "nvcc":
|
||||
raise PlanError("rope doc: block does not start with nvcc")
|
||||
toks = toks[1:]
|
||||
# the trailing "<source>.cu -o ....ptx" part is a template
|
||||
cut = [i for i, t in enumerate(toks) if "<source>" in t]
|
||||
if not cut:
|
||||
raise PlanError("rope doc: no <source> placeholder in the nvcc block")
|
||||
toks = toks[: cut[0]]
|
||||
flags, includes = split_nvcc_flags(toks)
|
||||
rel = []
|
||||
for inc in includes:
|
||||
if not inc.startswith("$R/"):
|
||||
raise PlanError(f"rope doc: include {inc!r} is not under $R")
|
||||
rel.append(inc[3:])
|
||||
sm = re.search(r"for `<source>` in ((?:`[^`]+`(?:,\s*)?)+)", text)
|
||||
if not sm:
|
||||
raise PlanError("rope doc: no 'for `<source>` in ...' list")
|
||||
sources = re.findall(r"`([^`]+)`", sm.group(1))
|
||||
if not sources:
|
||||
raise PlanError("rope doc: empty source list")
|
||||
return flags, rel, sources
|
||||
def parse_rope_recipe(text: str) -> Tuple[List[str], List[str], List[str]]:
|
||||
"""Return (nvcc flags, include dirs repo-relative, source basenames) from rope-regeneration.json."""
|
||||
try:
|
||||
data = json.loads(text)
|
||||
except ValueError as exc:
|
||||
raise PlanError(f"rope recipe: not JSON: {exc}")
|
||||
for key in ("flags", "includes", "sources"):
|
||||
if not isinstance(data.get(key), list) or not data[key]:
|
||||
raise PlanError(f"rope recipe: '{key}' must be a non-empty list")
|
||||
return list(data["flags"]), list(data["includes"]), list(data["sources"])
|
||||
|
||||
|
||||
def parse_abi_tuples(text: str) -> Dict[str, Dict[str, Tuple[int, int]]]:
|
||||
@@ -274,13 +257,13 @@ ROPE_REPIN_EXPECT = {
|
||||
"qsa_prompt_resolver": {"crates/cuda-driver/src/original_verify/qsa.rs": 1},
|
||||
}
|
||||
# hex pins in the window plan (sealed_assets_bound)
|
||||
ROPE_HEX_DOC = "docs/cuda-seal-plan-additions-window.json"
|
||||
ROPE_HEX_DOC = SEAL_PLAN_DIR + "/cuda-seal-plan-additions-window.json"
|
||||
|
||||
|
||||
def rope_assets(root: Path, variant: str) -> List[Asset]:
|
||||
"""The four QSA PTX that docs/rope-and-memory-plan.md says must be regenerated.
|
||||
"""The four QSA PTX that rope-regeneration.json lists for regeneration.
|
||||
|
||||
variant 'precise' : the doc's flags verbatim (--fmad=true --ftz=false) for all four.
|
||||
variant 'precise' : the recipe's flags verbatim (--fmad=true --ftz=false) for all four.
|
||||
variant 'preserve' : same, except qsa_prompt_indexer / qsa_decode_postops keep --use_fast_math (how the
|
||||
committed PTX were built; the Original compiles native_qsa_indexer/native_rope fast-math).
|
||||
"""
|
||||
@@ -288,7 +271,7 @@ def rope_assets(root: Path, variant: str) -> List[Asset]:
|
||||
raise PlanError(f"rope variant must be one of {ROPE_VARIANTS}")
|
||||
doc = root / ROPE_DOC
|
||||
abi = root / ABI_SOURCE
|
||||
flags, includes, sources = parse_rope_doc(doc.read_text(encoding="utf-8"))
|
||||
flags, includes, sources = parse_rope_recipe(doc.read_text(encoding="utf-8"))
|
||||
tuples = parse_abi_tuples(abi.read_text(encoding="utf-8"))
|
||||
out: List[Asset] = []
|
||||
for src in sources:
|
||||
@@ -307,7 +290,7 @@ def rope_assets(root: Path, variant: str) -> List[Asset]:
|
||||
cu_pin=None,
|
||||
entries=sorted(entries),
|
||||
encoding="include_bytes",
|
||||
plan=ROPE_DOC,
|
||||
plan=Path(ROPE_DOC).name,
|
||||
group="rope",
|
||||
policy=f"rope regeneration, variant {variant}",
|
||||
params={e: fr + ex for e, (fr, ex) in entries.items()},
|
||||
@@ -322,14 +305,14 @@ def rope_assets(root: Path, variant: str) -> List[Asset]:
|
||||
|
||||
|
||||
def load_all_assets(root: Path, rope_variant: Optional[str]) -> Tuple[List[Asset], List[str]]:
|
||||
"""Every docs/cuda-seal-plan*.json, the extra plan and (if rope_variant) the rope doc list.
|
||||
"""Every crates/cuda-driver/seal-plans/cuda-seal-plan*.json, the extra plan and (if rope_variant) the rope recipe.
|
||||
|
||||
Returns (assets, warnings). Duplicate asset ids across plans are an error."""
|
||||
assets: List[Asset] = []
|
||||
warnings: List[str] = []
|
||||
plans = sorted((root / "docs").glob("cuda-seal-plan*.json"))
|
||||
plans = sorted((root / SEAL_PLAN_DIR).glob("cuda-seal-plan*.json"))
|
||||
if not plans:
|
||||
raise PlanError(f"no docs/cuda-seal-plan*.json under {root}")
|
||||
raise PlanError(f"no {SEAL_PLAN_DIR}/cuda-seal-plan*.json under {root}")
|
||||
for p in plans:
|
||||
assets += load_plan_file(p)
|
||||
extra = root / EXTRA_PLAN
|
||||
@@ -436,7 +419,7 @@ def entry_param_count(text: str, entry: str) -> Optional[int]:
|
||||
|
||||
|
||||
# CUDA 13.2.0 and 13.2.1 (nvcc 13.2.51) miscompile some sm_120 kernels (IQ2_S / IQ3_S products wrong, relative error 0.5-1.0;
|
||||
# upstream docs/TROUBLESHOOTING.md, #892, #968); 13.2.2 (nvcc 13.2.86) is right. Their PTX names the build in its header.
|
||||
# upstream engine/strata/docs/TROUBLESHOOTING.md, #892, #968); 13.2.2 (nvcc 13.2.86) is right. Their PTX names the build in its header.
|
||||
BAD_NVCC_BUILDS = ("13.2.0", "13.2.1", "13.2.51")
|
||||
_NVCC_HEADER = re.compile(r"Cuda compilation tools, release [0-9.]+, V([0-9]+\.[0-9]+\.[0-9]+)")
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compile every unsealed CUDA asset to PTX with the exact recipe of its seal plan (no GPU needed).
|
||||
|
||||
Reads docs/cuda-seal-plan*.json (assets / new_sources formats), scripts/gpu-bringup/extra-seal-plan.json and the
|
||||
four-PTX rope regeneration list of docs/rope-and-memory-plan.md. For each asset: verify the .cu pin, run nvcc with
|
||||
Reads crates/cuda-driver/seal-plans/cuda-seal-plan*.json (assets / new_sources formats), scripts/gpu-bringup/extra-seal-plan.json and the
|
||||
four-PTX rope regeneration list. For each asset: verify the .cu pin, run nvcc with
|
||||
the plan's flags, validate the PTX (ASCII, no NUL, sm_120, exported .entry names, ABI parameter counts) and write
|
||||
it to --out together with build-manifest.json. The tree is NOT modified; scripts/gpu-bringup/seal_pins.py
|
||||
installs the PTX and patches the Rust pins.
|
||||
@@ -284,7 +284,7 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
ap.add_argument("--ccbin", help="host compiler for nvcc (-ccbin), e.g. /usr/bin/g++-13 if the default is too new; PTX is unaffected")
|
||||
ap.add_argument("--expect-version", help="required nvcc version (default: cuda_nvcc of deploy/cuda-toolkit.lock.json; 'any' skips)")
|
||||
ap.add_argument("--rope-flags", choices=L.ROPE_VARIANTS,
|
||||
help="flag variant for the four rope PTX; required when they are selected (see docs/gpu-bringup.md D1)")
|
||||
help="flag variant for the four rope PTX; required when they are selected (see spec node gpu-bringup.md D1)")
|
||||
ap.add_argument("--no-rope", action="store_true", help="leave the four rope PTX out")
|
||||
ap.add_argument("--group", help="comma list of groups (additions, experimental, window, kar, rope, mmq_group, ...)")
|
||||
ap.add_argument("--only", help="comma list of asset ids")
|
||||
@@ -328,7 +328,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
if args.preflight:
|
||||
return preflight(root, selected, assets)
|
||||
if not args.no_rope and not args.rope_flags:
|
||||
print("error: choose --rope-flags precise|preserve (or --no-rope); see docs/gpu-bringup.md decision D1", file=sys.stderr)
|
||||
print("error: choose --rope-flags precise|preserve (or --no-rope); see spec node gpu-bringup.md decision D1", file=sys.stderr)
|
||||
return 2
|
||||
runnable = [a for a in selected if not a.deferred]
|
||||
deferred = [a for a in selected if a.deferred]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schema": 1,
|
||||
"note": "Assets that are unsealed placeholders in crates/cuda-driver/src but are covered by none of docs/cuda-seal-plan*.json. Same entry format as those plans (plus group/optional/deferred/entry_prefix_counts/include_profile). Recipes are taken from the placeholder/.cu headers; none has been compiled. Sibling plans carry cu_pin; these entries have none because no pin was ever written, so the compile manifest (cu sha256 at compile time) is the pin. The six reseal-fastmath entries are the verifier reviewer's audit (docs/cuda-seal-plan-additions-window.json numerics_risk_fast_math.audit): they REPLACE already-sealed PTX, so their old digests are re-pinned wherever they appear (repin_expect).",
|
||||
"note": "Assets that are unsealed placeholders in crates/cuda-driver/src but are covered by none of crates/cuda-driver/seal-plans/cuda-seal-plan*.json. Same entry format as those plans (plus group/optional/deferred/entry_prefix_counts/include_profile). Recipes are taken from the placeholder/.cu headers; none has been compiled. Sibling plans carry cu_pin; these entries have none because no pin was ever written, so the compile manifest (cu sha256 at compile time) is the pin. The six reseal-fastmath entries are the verifier reviewer's audit (crates/cuda-driver/seal-plans/cuda-seal-plan-additions-window.json numerics_risk_fast_math.audit): they REPLACE already-sealed PTX, so their old digests are re-pinned wherever they appear (repin_expect).",
|
||||
"assets": [
|
||||
{
|
||||
"cu": "crates/cuda-driver/src/kar_decode_levels.cu",
|
||||
@@ -987,7 +987,7 @@
|
||||
"--prec-sqrt=true",
|
||||
"--fmad=true"
|
||||
],
|
||||
"policy": "precise (the recipe of prefill_stage; EXPERIMENTAL and LOSSY by design, LELEKA_PREFILL_GDN_TC: the prompt GDN recurrence as a chunked scan on f16x3 tensor-core products, a port of Strata upstream gdn_tc.cuh, not bitwise equal to leleka_prefill_gdn_rec_kh; the lossy gate of docs/quality-gate.md decides)",
|
||||
"policy": "precise (the recipe of prefill_stage; EXPERIMENTAL and LOSSY by design, LELEKA_PREFILL_GDN_TC: the prompt GDN recurrence as a chunked scan on f16x3 tensor-core products, a port of Strata upstream gdn_tc.cuh, not bitwise equal to leleka_prefill_gdn_rec_kh; the lossy gate of spec node quality-gate.md decides)",
|
||||
"entries": [
|
||||
"leleka_gdn_tc_prep",
|
||||
"leleka_gdn_tc_scan_t1",
|
||||
|
||||
@@ -119,7 +119,7 @@ log=target/gpu-bringup/logs/build-\$(date -u +%Y%m%dT%H%M%SZ).log
|
||||
exec > >(tee -a "\$log") 2>&1
|
||||
echo "== host \$(hostname) user \$(id -un) \$(date -u +%FT%TZ)"
|
||||
[ -f "\$HOME/.cargo/env" ] && . "\$HOME/.cargo/env"
|
||||
command -v cargo >/dev/null || { echo "cargo not installed on the host: run scripts/install-pinned-rustup.sh (see docs/gpu-bringup.md step d)"; exit 3; }
|
||||
command -v cargo >/dev/null || { echo "cargo not installed on the host: run scripts/install-pinned-rustup.sh (see spec node gpu-bringup.md step d)"; exit 3; }
|
||||
command -v cc >/dev/null || { echo "no C compiler (cc): apt install build-essential"; exit 3; }
|
||||
echo "head: \$(cat .synced-from-head 2>/dev/null || echo unknown)"
|
||||
rustc --version; cargo --version; cc --version | head -1
|
||||
|
||||
@@ -10,11 +10,11 @@ the plan names (`rust_fields_to_fill`) with the SHA-256 of the .cu bytes and of
|
||||
reseal_own.py --ptx-dir DIR ASSET_ID [ASSET_ID ...] # dry run: prints what would change
|
||||
reseal_own.py --ptx-dir DIR --write ASSET_ID [ASSET_ID ...]
|
||||
|
||||
`--plan docs/cuda-seal-plan-additions-experimental.json` names another plan file (default: extra-seal-plan.json). The six
|
||||
`--plan crates/cuda-driver/seal-plans/cuda-seal-plan-additions-experimental.json` names another plan file (default: extra-seal-plan.json). The six
|
||||
experimental programs (`experimental_{kv_q4,kv_q8,kv_stream,keyless,qsa_attn,cvec}`, group `experimental`) live there; when the
|
||||
plan entry has `seal_sha256` / `seal_length` slots they are refreshed too (text-level, formatting untouched).
|
||||
|
||||
The sm_86 companions and the generated table are rebuilt afterwards with `scripts/gpu-bringup/sm86_assets.py build` (docs/sm86-assets.md).
|
||||
The sm_86 companions and the generated table are rebuilt afterwards with `scripts/gpu-bringup/sm86_assets.py build`.
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"note": "Regeneration recipe of the four QSA PTX files that carry the RoPE scaling arguments (flags, include set, sources). It replaces the nvcc block that used to be parsed out of the rope and memory plan document; scripts/gpu-bringup/bringup_lib.py rope_assets() reads it. The include set is bringup_lib.STANDARD_INCLUDES (the test pins the equality).",
|
||||
"flags": ["--ptx", "-std=c++17", "-O3", "-arch=sm_120", "--fmad=true", "--ftz=false"],
|
||||
"includes": [
|
||||
"engine/strata/include",
|
||||
"engine/strata/third_party/ggml",
|
||||
"crates/cuda-driver/src/third_party/llamacpp/ggml-cuda",
|
||||
"crates/cuda-driver/src/third_party/llamacpp/ggml-include",
|
||||
"crates/cuda-driver/src/third_party/llamacpp/ggml-src"
|
||||
],
|
||||
"sources": ["qsa_prompt_indexer", "qsa_prompt_postops", "qsa_decode_postops", "qsa_prompt_resolver"]
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
#
|
||||
# Environment: SMOKE_TIMEOUT (seconds per test, default 900), CARGO_PROFILE_FLAG (default empty = debug; use
|
||||
# --release only if remote_sync.sh built with it), RUN_DIR via --run-dir.
|
||||
# SMOKE_SM86=1 adds the `sm86` cargo feature (sm_86 companions of the sealed PTX, docs/sm86-assets.md) to the
|
||||
# SMOKE_SM86=1 adds the `sm86` cargo feature (sm_86 companions of the sealed PTX) to the
|
||||
# leleka-cuda-driver and leleka-engine-qwen35-cuda test builds: for an RTX 30-series card such as the laptop RTX 3080 (cc 8.6).
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Text-level readers/patchers for the Rust pin constants that guard sealed PTX.
|
||||
|
||||
Every patcher either performs exactly one replacement or raises PinError; none guesses. The forms handled
|
||||
are the ones that exist in crates/cuda-driver (see docs/gpu-bringup.md, "Pin forms"):
|
||||
are the ones that exist in crates/cuda-driver:
|
||||
|
||||
FIELD SPEC DECLARATION IT PATCHES
|
||||
------------------------------------------- ----------------------------------------------------------------
|
||||
|
||||
@@ -273,7 +273,7 @@ def seal(root: Path, ptx_dir: Path, *, allow_fake: bool, only: Optional[set], ru
|
||||
"after_sealing": [
|
||||
"These tests assert the placeholder state and WILL fail until updated (listed per file in followup_tests).",
|
||||
"Files in format_notes were not rustfmt-clean before; they are left as patched (do not run cargo fmt over the crate).",
|
||||
"Sealing is not qualification: run the GPU smokes (docs/gpu-bringup.md step e) before trusting any pin.",
|
||||
"Sealing is not qualification: run the GPU smokes (spec node gpu-bringup.md step e) before trusting any pin.",
|
||||
],
|
||||
}
|
||||
return result, ws
|
||||
@@ -289,7 +289,7 @@ def manifest_file(manifest: dict, asset_id: str) -> str:
|
||||
def _fill_plan_seal_fields(root: Path, ws: Workspace, asset: L.Asset, raw: bytes, out: dict) -> None:
|
||||
"""Record the seal in the plan JSON itself (seal_sha256 / seal_length of the asset's entry), text-level so the
|
||||
file's formatting is untouched. Assets without a Rust pin have no other in-tree record of their digest."""
|
||||
rel = f"docs/{asset.plan}"
|
||||
rel = f"{L.SEAL_PLAN_DIR}/{asset.plan}"
|
||||
if not (root / rel).is_file():
|
||||
return
|
||||
text = ws.read(rel)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Per-architecture (sm_86) companion set for the sealed sm_120 PTX of crates/cuda-driver.
|
||||
|
||||
Design (docs/sm86-assets.md): the sealed sm_120 files and every Rust pin stay untouched and remain the default.
|
||||
Design: the sealed sm_120 files and every Rust pin stay untouched and remain the default.
|
||||
For each sealed sm_120 PTX this tool builds an sm_86 companion in crates/cuda-driver/ptx-sm86/ and a generated
|
||||
Rust table (crates/cuda-driver/src/sm86_table.rs) keyed by the SHA-256 of the sm_120 body. With the cargo feature
|
||||
`sm86` the driver swaps the module image at cuModuleLoadData time when the current device is 8.6 <= cc < 12.0.
|
||||
@@ -527,7 +527,7 @@ def write_table(installed: Dict[str, dict]) -> None:
|
||||
by_key[k] = r
|
||||
lines = [
|
||||
"// @generated by scripts/gpu-bringup/sm86_assets.py build -- do not edit.",
|
||||
"// Table of the sm_86 companions of the sealed sm_120 PTX (see docs/sm86-assets.md).",
|
||||
"// Table of the sm_86 companions of the sealed sm_120 PTX (see spec node sm86-assets.md).",
|
||||
"// `key` = SHA-256 of the sealed sm_120 body (file without its terminal NUL); `len` = companion length",
|
||||
"// including the terminal NUL that is appended here; `sha` = SHA-256 of the companion body.",
|
||||
"",
|
||||
|
||||
@@ -5,11 +5,11 @@ Scans crates/**/*.rs for `#[ignore]` attributes (real attributes only, not doc c
|
||||
LELEKA_* variables each test reads, classifies it and assigns it to a group of scripts/gpu-bringup/smoke-groups.json.
|
||||
|
||||
smoke_inventory.py --emit table # human table
|
||||
smoke_inventory.py --emit markdown # the table embedded in docs/gpu-bringup.md
|
||||
smoke_inventory.py --emit markdown # the table as markdown
|
||||
smoke_inventory.py --emit plan # TSV consumed by run_gpu_smokes.sh
|
||||
smoke_inventory.py --emit groups # TSV: group, deps, kind, description
|
||||
smoke_inventory.py --emit json
|
||||
smoke_inventory.py --update-doc docs/gpu-bringup.md # rewrite the table between the markers
|
||||
smoke_inventory.py --update-doc FILE # rewrite the table between the markers of FILE
|
||||
|
||||
Classes: device (needs only the GPU and a flag), assets (reads model/pack/oracle paths: never run without
|
||||
--allow-model-runs), mock (isolated CPU harness, not a GPU test).
|
||||
|
||||
@@ -74,15 +74,15 @@ class PlanParsing(unittest.TestCase):
|
||||
def test_duplicate_ids_across_plans_are_an_error(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
root = Path(d)
|
||||
(root / "docs").mkdir()
|
||||
(root / L.SEAL_PLAN_DIR).mkdir(parents=True)
|
||||
entry = {"cu": "a.cu", "ptx": "x/a.ptx", "flags": ["-ptx"]}
|
||||
for n in ("a", "b"):
|
||||
(root / "docs" / f"cuda-seal-plan-{n}.json").write_text(json.dumps({"assets": [entry]}))
|
||||
(root / L.SEAL_PLAN_DIR / f"cuda-seal-plan-{n}.json").write_text(json.dumps({"assets": [entry]}))
|
||||
with self.assertRaises(L.PlanError):
|
||||
L.load_all_assets(root, None)
|
||||
|
||||
def test_rope_list_and_abi_are_read_from_the_docs_not_hardcoded(self):
|
||||
flags, incs, sources = L.parse_rope_doc((REPO / L.ROPE_DOC).read_text())
|
||||
def test_rope_list_and_abi_are_read_from_the_recipe_not_hardcoded(self):
|
||||
flags, incs, sources = L.parse_rope_recipe((REPO / L.ROPE_DOC).read_text())
|
||||
self.assertEqual(sources, ["qsa_prompt_indexer", "qsa_prompt_postops", "qsa_decode_postops", "qsa_prompt_resolver"])
|
||||
self.assertEqual(flags, ["--ptx", "-std=c++17", "-O3", "-arch=sm_120", "--fmad=true", "--ftz=false"])
|
||||
self.assertEqual(incs, L.STANDARD_INCLUDES)
|
||||
@@ -361,7 +361,7 @@ class RustPinForms(unittest.TestCase):
|
||||
def mini_repo(root: Path, cu_pin=True):
|
||||
src = root / "crates/cuda-driver/src"
|
||||
src.mkdir(parents=True)
|
||||
(root / "docs").mkdir()
|
||||
(root / L.SEAL_PLAN_DIR).mkdir(parents=True, exist_ok=True)
|
||||
(root / "deploy").mkdir()
|
||||
(root / "deploy/cuda-toolkit.lock.json").write_text(json.dumps({"components": [{"component": "cuda_nvcc", "version": "13.2.86"}]}))
|
||||
cu = 'extern "C" __global__ void leleka_a(int x){}\nextern "C" __global__ void leleka_b(int x){}\n'
|
||||
@@ -378,7 +378,7 @@ def mini_repo(root: Path, cu_pin=True):
|
||||
"policy": "fastmath", "encoding": "concat_include_str",
|
||||
"rust_fields_to_fill": {"cons.rs": ["B_PIN.source_sha256", "B_PIN.ptx_sha256"]}},
|
||||
]}
|
||||
(root / "docs/cuda-seal-plan-mini.json").write_text(json.dumps(plan))
|
||||
(root / L.SEAL_PLAN_DIR / "cuda-seal-plan-mini.json").write_text(json.dumps(plan))
|
||||
(src / "cons.rs").write_text(
|
||||
"const A_LEN: usize = 0;\nconst A_SHA: [u8; 32] = [0; 32];\n"
|
||||
"pub const B_PIN: PtxPin = PtxPin {\n source_sha256: [0; 32],\n ptx_sha256: [0; 32],\n};\n")
|
||||
@@ -512,9 +512,9 @@ class EndToEnd(unittest.TestCase):
|
||||
|
||||
def test_stale_plan_pin_at_seal_time_is_refused(self):
|
||||
self.assertEqual(self.compile()[0], 0)
|
||||
plan = json.loads((self.root / "docs/cuda-seal-plan-mini.json").read_text())
|
||||
plan = json.loads((self.root / L.SEAL_PLAN_DIR / "cuda-seal-plan-mini.json").read_text())
|
||||
plan["assets"][0]["cu_pin"]["sha256"] = "1" * 64
|
||||
(self.root / "docs/cuda-seal-plan-mini.json").write_text(json.dumps(plan))
|
||||
(self.root / L.SEAL_PLAN_DIR / "cuda-seal-plan-mini.json").write_text(json.dumps(plan))
|
||||
code, _, err = run_quiet(S.main, ["--ptx-dir", str(self.out), "--root", str(self.root), "--allow-fake"])
|
||||
self.assertEqual(code, 1)
|
||||
self.assertIn("stale source", err)
|
||||
@@ -572,10 +572,10 @@ class EndToEnd(unittest.TestCase):
|
||||
self.assertIn("contradicts itself", out)
|
||||
|
||||
def test_atomic_groups_must_move_together(self):
|
||||
plan = json.loads((self.root / "docs/cuda-seal-plan-mini.json").read_text())
|
||||
plan = json.loads((self.root / L.SEAL_PLAN_DIR / "cuda-seal-plan-mini.json").read_text())
|
||||
for a in plan["assets"]:
|
||||
a["atomic_group"] = "g"
|
||||
(self.root / "docs/cuda-seal-plan-mini.json").write_text(json.dumps(plan))
|
||||
(self.root / L.SEAL_PLAN_DIR / "cuda-seal-plan-mini.json").write_text(json.dumps(plan))
|
||||
self.assertEqual(self.compile()[0], 0)
|
||||
code, _, err = run_quiet(S.main, ["--ptx-dir", str(self.out), "--root", str(self.root), "--allow-fake", "--only", "a"])
|
||||
self.assertEqual(code, 1)
|
||||
@@ -589,7 +589,7 @@ class RealTreeFakeSeal(unittest.TestCase):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
scratch = Path(d) / "tree"
|
||||
ignore = shutil.ignore_patterns(".git", "target", "*.gguf")
|
||||
for sub in ("crates", "docs", "deploy", "engine/strata/include", "engine/strata/third_party", "scripts/gpu-bringup"):
|
||||
for sub in ("crates", "deploy", "engine/strata/include", "engine/strata/third_party", "scripts/gpu-bringup"):
|
||||
shutil.copytree(REPO / sub, scratch / sub, ignore=ignore)
|
||||
out = Path(d) / "ptx"
|
||||
code, _, err = run_quiet(C.main, ["--root", str(scratch), "--fake-nvcc", "--out", str(out), "--rope-flags", "preserve",
|
||||
@@ -670,17 +670,6 @@ class SmokeInventory(unittest.TestCase):
|
||||
self.assertNotIn("model-assets", SI.select_order(data, None, [], False))
|
||||
self.assertIn("model-assets", SI.select_order(data, None, [], True))
|
||||
|
||||
def test_doc_table_is_current(self):
|
||||
doc = REPO / "docs/gpu-bringup.md"
|
||||
if not doc.exists():
|
||||
self.skipTest("docs/gpu-bringup.md not written yet")
|
||||
smokes = SI.scan(REPO)
|
||||
SI.assign(smokes, SI.load_groups())
|
||||
text = doc.read_text()
|
||||
start, end = text.index(SI.TABLE_START) + len(SI.TABLE_START), text.index(SI.TABLE_END)
|
||||
self.assertEqual(text[start:end].strip("\n"), SI.emit_table(smokes, markdown=True),
|
||||
"run: python3 scripts/gpu-bringup/smoke_inventory.py --update-doc docs/gpu-bringup.md")
|
||||
|
||||
def test_synthetic_tree(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
src = Path(d) / "crates/cuda-driver/src"
|
||||
|
||||
@@ -55,7 +55,12 @@ build_test_binary() { # label sha
|
||||
make_inputs() { # frozen corpus and the two prompts, from the BASE tree
|
||||
[ -s "$out/inputs/MANIFEST.sha256" ] && return 0
|
||||
local dir tok; dir=$(export_tree base "$base_sha"); tok="$HOME/leleka-assets/tokenizer-assets/tokenizer"
|
||||
cat "$dir"/docs/laptop-profile.md "$dir"/docs/windows.md "$dir"/docs/deploy.md "$dir"/docs/laptop-vs-vanilla.md > "$out/inputs/corpus.txt"
|
||||
# the corpus is prose of the BASE tree: the four docs pages when that tree still has them (older base commits), else the repository READMEs
|
||||
if [ -f "$dir/docs/laptop-profile.md" ]; then
|
||||
cat "$dir"/docs/laptop-profile.md "$dir"/docs/windows.md "$dir"/docs/deploy.md "$dir"/docs/laptop-vs-vanilla.md > "$out/inputs/corpus.txt"
|
||||
else
|
||||
cat "$dir"/README.md "$dir"/deploy/README.md "$dir"/PROJECT_CHARTER.md "$dir"/benchmarks/README.md > "$out/inputs/corpus.txt"
|
||||
fi
|
||||
( cd "$dir" && CARGO_TARGET_DIR="$dir/target" cargo run --release --locked -q -p leleka-tokenizer --example long_prompts -- "$tok" "$out/inputs/corpus.txt" "$out/inputs" 2048 3072 ) || return 1
|
||||
cat "$out/inputs/prompt-2048.ids" "$out/inputs/prompt-3072.ids" > "$out/inputs/prompts.ids"
|
||||
( cd "$out/inputs" && sha256sum corpus.txt prompt-2048.ids prompt-3072.ids prompts.ids > MANIFEST.sha256 && chmod a-w ./* )
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# lap_guard.sh OUT.tsv ENGINE_LOG LELEKA_BIN [INTERVAL_S=15] (stop it with: touch OUT.tsv.done)
|
||||
#
|
||||
# Trips (the owner's safety protocol, docs/laptop-profile.md "Update 2026-11-13"):
|
||||
# Trips (the owner's safety protocol):
|
||||
# TEMP GPU temperature >= 85 C
|
||||
# P5CAP performance state P5 with the SW power cap / SW thermal slowdown reasons (0x4 | 0x20) and the memory clock under 2 GHz
|
||||
# (the OEM profile of the 0x19C blue screens); a plain P5 at idle is not a trip
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Shared gates of the laptop GPU runs (source it; inside WSL2): the fairness flag, the build and memory gates, the lock, the preflight and the
|
||||
# guard. The protocol is the owner's safety protocol of 2026-11-13 (docs/laptop-profile.md "Update 2026-11-13"); lap_stretch.sh carries an older
|
||||
# guard. The protocol is the owner's safety protocol of 2026-11-13; lap_stretch.sh carries an older
|
||||
# copy of the same logic and is to be reduced to a user of this file once no stretch is waiting on it.
|
||||
#
|
||||
# lap_want_gpu LABEL create the flag C:\...\.git\laptop-gpu-wanted.flag (only at a moment the stretch can start at once; lap_done and the lock remove it)
|
||||
|
||||
@@ -10,7 +10,7 @@ first token's own step). The reply text is never stored, only its hash.
|
||||
lap_replay.py --label A-30k --first-tokens 30000 --followups 3 --out RESULTS.jsonl
|
||||
E2E_BASE_URL (default http://127.0.0.1:8081), E2E_API_KEY or --key-file, E2E_MODEL (default: the first /v1/models id)
|
||||
|
||||
Test tooling for docs/laptop-profile.md; it reuses the streaming client of scripts/e2e/long_session.py.
|
||||
Test tooling: it reuses the streaming client of scripts/e2e/long_session.py.
|
||||
"""
|
||||
import argparse
|
||||
import hashlib
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# One laptop run of the integrated head (docs/laptop-profile.md, claude/laptop-opt): production-like configuration of the
|
||||
# One laptop run of the integrated head (claude/laptop-opt): production-like configuration of the
|
||||
# Original serve stack on the RTX 3080 laptop (mapped experts, VRAM tier auto + profile, KAR level 2 as a read-only file,
|
||||
# MTP depth 4 with the draft vocabulary bound, spec-min-p 0.5, INT8 KV, seed on by default), holding ~/LAPTOP_GPU.lock.
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# One GPU stretch of the laptop validation (docs/laptop-profile.md "Update 2026-11-13"): wait for the machine, take the lock, start the
|
||||
# One GPU stretch of the laptop validation: wait for the machine, take the lock, start the
|
||||
# engine with `leleka up --profile ARM.json`, replay one agent-shaped conversation, stop the engine, release the lock. Inside WSL2.
|
||||
#
|
||||
# lap_stretch.sh LABEL ARM.json FIRST_TOKENS [FOLLOWUPS=3]
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user