Merge branch 'claude/port-experimental' into claude/port-main

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	crates/cuda-driver/Cargo.toml
#	crates/leleka-runtime/src/backend.rs
#	crates/leleka-runtime/src/lib.rs
This commit is contained in:
Pavlo Ratushnyi
2026-10-14 15:51:28 +02:00
69 changed files with 12878 additions and 3 deletions
Generated
+9
View File
@@ -1019,11 +1019,19 @@ name = "leleka-cuda-driver"
version = "0.1.0"
dependencies = [
"leleka-context",
"leleka-experimental-ref",
"leleka-model-format",
"libc",
"serde_json",
]
[[package]]
name = "leleka-experimental-ref"
version = "0.1.0"
dependencies = [
"serde_json",
]
[[package]]
name = "leleka-model-format"
version = "0.1.0"
@@ -1053,6 +1061,7 @@ dependencies = [
"leleka-backend-api",
"leleka-context",
"leleka-cuda-driver",
"leleka-experimental-ref",
"leleka-model-format",
"leleka-native-cpu-expert",
"leleka-quant-core",
+2 -2
View File
@@ -1,7 +1,7 @@
[workspace]
resolver = "3"
members = ["crates/backend-api", "crates/tokenizer", "crates/model-format", "crates/quant-core", "crates/context", "crates/cuda-driver", "crates/leleka-runtime", "crates/native-cpu-expert", "crates/sampler-ref", "control-plane", "desktop-core"]
default-members = ["crates/backend-api", "crates/tokenizer", "crates/model-format", "crates/quant-core", "crates/context", "crates/sampler-ref", "control-plane", "desktop-core"]
members = ["crates/backend-api", "crates/tokenizer", "crates/model-format", "crates/quant-core", "crates/context", "crates/cuda-driver", "crates/leleka-runtime", "crates/native-cpu-expert", "crates/sampler-ref", "crates/experimental-ref", "control-plane", "desktop-core"]
default-members = ["crates/backend-api", "crates/tokenizer", "crates/model-format", "crates/quant-core", "crates/context", "crates/sampler-ref", "crates/experimental-ref", "control-plane", "desktop-core"]
[workspace.package]
edition = "2024"
+1
View File
@@ -9,6 +9,7 @@ rust-version.workspace = true
[dependencies]
leleka-model-format = { path = "../model-format" }
leleka-context = { path = "../context" }
leleka-experimental-ref = { path = "../experimental-ref" }
[features]
default = []
+992
View File
@@ -0,0 +1,992 @@
//! Pure, platform-independent half of the EXPERIMENTAL Strata closed programs: the opt-in switches, the six
//! programs (literal ports of `kv_q4.cu`, `kv_q8.cu`, `kv_stream.cu`, `keyless.cu`, `qsa_decode_attn.cu` and
//! `cvec.cu`), their fixed entry/argument signatures, launch geometry and admission rules, the error type and the
//! fail-closed PTX pins. Nothing here touches CUDA, so it is unit-tested on any host. The Linux-gated driver half
//! is `experimental_gpu`; the CPU specifications are in `leleka-experimental-ref`.
//!
//! Every mode is OFF by default and named: [`OptIn::default`] enables nothing, and a program refuses to open
//! ([`ExperimentalError::NotEnabled`]) unless one of the modes that need it was explicitly enabled, then refuses
//! again ([`ExperimentalError::Unpinned`]) while its PTX pin is zero.
//!
//! STATUS: none of the six `.cu` files has been compiled (no nvcc on the authoring host) and no GPU run has
//! happened. Every pin below is zero, so [`admit_ptx`] refuses every asset until Root freezes real digests.
use crate::{Context, Error, qwen_ffi};
use leleka_experimental_ref::{cvec, keyless, kv_q8, layout::QsaShapes, q4_0};
use std::{ffi::CStr, fmt};
// ------------------------------------------------------------------------------------------------- modes
/// An explicitly named experimental mode. The name is what an operator types and what the digest mixes.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum Mode {
/// `--kv q4_0`: both K and V as 18-byte `block_q4_0` blocks, queries and outputs through the FWHT. Lossy.
KvQ40,
/// `--kv k8v4`: INT8 keys, Q4_0 values. Lossy; not streamable.
KvK8V4,
/// `STRATA_KV_ROT=1`: INT8 K/V through the orthonormal FWHT-256. Lossy.
KvRotatedInt8,
/// `STRATA_KEYLESS_ROUTING=<artifact>`: V-only INT8 cache, keys rebuilt by RoPE, per-head query routing.
KeylessVOnly,
/// `--kv-resident N` (and its ring): KV pages stream between pinned host memory and a VRAM slot pool.
KvStreamed,
/// `--control-vector`: steering vectors applied to the residual stream. Changes the model's outputs.
ControlVectors,
}
impl Mode {
pub const ALL: [Mode; 6] = [
Mode::KvQ40,
Mode::KvK8V4,
Mode::KvRotatedInt8,
Mode::KeylessVOnly,
Mode::KvStreamed,
Mode::ControlVectors,
];
pub const fn name(self) -> &'static str {
match self {
Self::KvQ40 => "kv-q4_0",
Self::KvK8V4 => "kv-k8v4",
Self::KvRotatedInt8 => "kv-int8-rotated",
Self::KeylessVOnly => "keyless-v-only",
Self::KvStreamed => "kv-streamed",
Self::ControlVectors => "control-vectors",
}
}
const fn bit(self) -> u8 {
1 << (self as u8)
}
}
/// The set of explicitly enabled experimental modes. `Default` is all-off; nothing in the engine turns a mode
/// on except an operator's explicit request.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
pub struct OptIn {
bits: u8,
}
impl OptIn {
pub const NONE: OptIn = OptIn { bits: 0 };
pub fn with(mut self, mode: Mode) -> Self {
self.bits |= mode.bit();
self
}
pub fn is_enabled(&self, mode: Mode) -> bool {
self.bits & mode.bit() != 0
}
pub fn is_empty(&self) -> bool {
self.bits == 0
}
pub fn modes(&self) -> impl Iterator<Item = Mode> + '_ {
Mode::ALL.into_iter().filter(|m| self.is_enabled(*m))
}
/// Whether any mode that needs `program` is enabled.
pub fn enables(&self, program: Program) -> bool {
program.needed_by().iter().any(|m| self.is_enabled(*m))
}
/// Stable text for a configuration digest: empty when nothing is enabled, otherwise the sorted mode names.
pub fn digest_text(&self) -> String {
self.modes().map(Mode::name).collect::<Vec<_>>().join(",")
}
}
// ----------------------------------------------------------------------------------------------- programs
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum Program {
/// `kv_q4.cu`: FWHT-256 plus Q4_0 append (step, batched) and gather.
KvQ4 = 0,
/// `kv_q8.cu`: INT8 append (K+V, K8V4's K, or V-only) and gather.
KvQ8 = 1,
/// `kv_stream.cu`: CLOCK residency resolver, block copy, ring table.
KvStream = 2,
/// `keyless.cu`: per-head query routing.
Keyless = 3,
/// `qsa_decode_attn.cu` modes 2/3/4 and the merge.
QsaAttn = 4,
/// `cvec.cu`: control-vector application.
Cvec = 5,
}
impl Program {
pub const ALL: [Program; 6] = [
Program::KvQ4,
Program::KvQ8,
Program::KvStream,
Program::Keyless,
Program::QsaAttn,
Program::Cvec,
];
pub const fn name(self) -> &'static str {
match self {
Self::KvQ4 => "kv_q4",
Self::KvQ8 => "kv_q8",
Self::KvStream => "kv_stream",
Self::Keyless => "keyless",
Self::QsaAttn => "qsa_attn",
Self::Cvec => "cvec",
}
}
/// The modes any one of which makes the program reachable.
pub const fn needed_by(self) -> &'static [Mode] {
match self {
Self::KvQ4 => &[Mode::KvQ40, Mode::KvK8V4, Mode::KvRotatedInt8],
Self::KvQ8 => &[Mode::KvK8V4, Mode::KvRotatedInt8, Mode::KeylessVOnly],
Self::KvStream => &[Mode::KvStreamed],
Self::Keyless => &[Mode::KeylessVOnly],
Self::QsaAttn => &[Mode::KvQ40, Mode::KvK8V4, Mode::KeylessVOnly],
Self::Cvec => &[Mode::ControlVectors],
}
}
pub fn ptx(self) -> &'static [u8] {
match self {
Self::KvQ4 => KV_Q4_PTX,
Self::KvQ8 => KV_Q8_PTX,
Self::KvStream => KV_STREAM_PTX,
Self::Keyless => KEYLESS_PTX,
Self::QsaAttn => QSA_ATTN_PTX,
Self::Cvec => CVEC_PTX,
}
}
pub const fn pin(self) -> &'static PtxPin {
&PINS[self as usize]
}
/// The checked-in CUDA C++ source of the program (a literal port of the named Original file).
pub const fn source(self) -> &'static str {
match self {
Self::KvQ4 => include_str!("experimental_kv_q4.cu"),
Self::KvQ8 => include_str!("experimental_kv_q8.cu"),
Self::KvStream => include_str!("experimental_kv_stream.cu"),
Self::Keyless => include_str!("experimental_keyless.cu"),
Self::QsaAttn => include_str!("experimental_qsa_attn.cu"),
Self::Cvec => include_str!("experimental_cvec.cu"),
}
}
pub fn entries(self) -> &'static [Entry] {
match self {
Self::KvQ4 => &KV_Q4_ENTRIES,
Self::KvQ8 => &KV_Q8_ENTRIES,
Self::KvStream => &KV_STREAM_ENTRIES,
Self::Keyless => &KEYLESS_ENTRIES,
Self::QsaAttn => &QSA_ATTN_ENTRIES,
Self::Cvec => &CVEC_ENTRIES,
}
}
}
macro_rules! ptx_asset {
($name:ident, $file:literal) => {
/// Frozen-asset bytes plus the single ABI NUL, like every other fixed asset.
pub static $name: &[u8] = concat!(include_str!($file), "\0").as_bytes();
};
}
ptx_asset!(KV_Q4_PTX, "experimental_kv_q4.ptx");
ptx_asset!(KV_Q8_PTX, "experimental_kv_q8.ptx");
ptx_asset!(KV_STREAM_PTX, "experimental_kv_stream.ptx");
ptx_asset!(KEYLESS_PTX, "experimental_keyless.ptx");
ptx_asset!(QSA_ATTN_PTX, "experimental_qsa_attn.ptx");
ptx_asset!(CVEC_PTX, "experimental_cvec.ptx");
// ------------------------------------------------------------------------------------------------- errors
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ExperimentalError {
/// Argument or geometry rejected before any driver use.
Invalid(&'static str),
/// No enabled experimental mode needs this program.
NotEnabled(&'static str),
/// The PTX asset is not pinned (all-zero digests) or its bytes differ.
Unpinned(&'static str),
Driver(Error),
}
impl fmt::Display for ExperimentalError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Invalid(message) => f.write_str(message),
Self::NotEnabled(program) => write!(
f,
"experimental program {program} is off: enable one of its modes explicitly"
),
Self::Unpinned(program) => write!(
f,
"experimental program {program} PTX is not pinned (TODO-ROOT)"
),
Self::Driver(error) => write!(f, "{error}"),
}
}
}
impl std::error::Error for ExperimentalError {}
impl From<Error> for ExperimentalError {
fn from(error: Error) -> Self {
Self::Driver(error)
}
}
pub type Result<T> = std::result::Result<T, ExperimentalError>;
pub(crate) fn invalid<T>(message: &'static str) -> Result<T> {
Err(ExperimentalError::Invalid(message))
}
// --------------------------------------------------------------------------------------------------- pins
/// Producer pin for one offline-compiled asset. Computing a hash is not qualification; only Root freezes real
/// values after a GPU smoke.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct PtxPin {
pub source_sha256: [u8; 32],
/// SHA-256 of the PTX file bytes excluding the terminating NUL.
pub ptx_sha256: [u8; 32],
}
/// TODO-ROOT: freeze each after `nvcc` builds the matching `.cu` and the `#[ignore]d` GPU smoke passes.
pub const PINS: [PtxPin; 6] = [PtxPin {
source_sha256: [0; 32],
ptx_sha256: [0; 32],
}; 6];
/// Fail closed: zero pins, malformed bytes or a digest mismatch all refuse.
pub fn admit_ptx(program: Program, ptx: &'static [u8], pin: &PtxPin) -> Result<()> {
let refuse = ExperimentalError::Unpinned(program.name());
if pin.source_sha256 == [0; 32] || pin.ptx_sha256 == [0; 32] {
return Err(refuse);
}
if ptx.len() < 2
|| ptx.last() != Some(&0)
|| ptx[..ptx.len() - 1].contains(&0)
|| !ptx.is_ascii()
{
return Err(refuse);
}
if qwen_ffi::sha256(&ptx[..ptx.len() - 1]) != pin.ptx_sha256 {
return Err(refuse);
}
Ok(())
}
/// Both gates in order: opt-in, then the pin. No driver call happens before both pass.
pub fn admit(program: Program, opt_in: &OptIn) -> Result<()> {
if !opt_in.enables(program) {
return Err(ExperimentalError::NotEnabled(program.name()));
}
admit_ptx(program, program.ptx(), program.pin())
}
// ------------------------------------------------------------------------------------- entry signatures
/// One kernel parameter of a closed entry. A pointer is a device address; `PtrOpt` may be a 64-bit zero (the
/// `.cu` documents what null means for that entry). Scalars occupy one launch slot each.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Arg {
Ptr,
PtrOpt,
I32,
I64,
F32,
}
#[derive(Debug)]
pub struct Entry {
pub name: &'static CStr,
/// Threads per block (the `.cu`'s `__launch_bounds__` is their product).
pub block: [u32; 3],
pub args: &'static [Arg],
}
use Arg::{F32 as F, I32 as I, I64 as L, Ptr as P, PtrOpt as N};
pub const MAX_ENTRY_ARGUMENTS: usize = 24;
pub const FWHT256: usize = 0;
pub const Q4_APPEND_STEP: usize = 1;
pub const Q4_APPEND_BATCH: usize = 2;
pub const Q4_GATHER_STEP: usize = 3;
pub static KV_Q4_ENTRIES: [Entry; 4] = [
Entry {
name: c"leleka_fwht256_f32",
block: [32, 4, 1],
args: &[P, P, L],
},
Entry {
name: c"leleka_kv_append_q4_step",
block: [32, 1, 1],
args: &[P, P, P, P, P, P, I, I, I, N, N],
},
Entry {
name: c"leleka_kv_append_q4_batch",
block: [32, 1, 1],
args: &[P, P, P, L, P, P, I, I, I, I, N, N, N, N],
},
Entry {
name: c"leleka_kv_gather_q4_step",
block: [32, 4, 1],
args: &[P, P, P, P, P, I, I, I, P, P],
},
];
pub const Q8_APPEND_STEP: usize = 0;
pub const Q8_GATHER_STEP: usize = 1;
pub static KV_Q8_ENTRIES: [Entry; 2] = [
Entry {
name: c"leleka_kv_append_q8_step",
block: [64, 1, 1],
args: &[N, P, N, P, P, P, N, P, I, I, I, N, N, N, N],
},
Entry {
name: c"leleka_kv_gather_q8_step",
block: [256, 1, 1],
args: &[P, P, P, P, P, P, P, I, I, I, P, P],
},
];
pub const STREAM_RESET: usize = 0;
pub const STREAM_RESOLVE: usize = 1;
pub const STREAM_COPY: usize = 2;
pub const RING_TABLE: usize = 3;
pub const COPY_U4: usize = 4;
pub static KV_STREAM_ENTRIES: [Entry; 5] = [
Entry {
name: c"leleka_kv_stream_reset",
block: [256, 1, 1],
args: &[P, P, P, P, P, L, L],
},
Entry {
name: c"leleka_kv_stream_resolve",
block: [1024, 1, 1],
args: &[P, P, P, P, P, P, P, L, P, P, I, I, I],
},
Entry {
name: c"leleka_kv_stream_copy",
block: [128, 1, 1],
args: &[P, P, P, P, N, N, N, P, N, N, N, I, I, I, I, I],
},
Entry {
name: c"leleka_kv_ring_table",
block: [256, 1, 1],
args: &[P, L, L],
},
Entry {
name: c"leleka_kv_copy_u4",
block: [128, 1, 1],
args: &[P, P, L],
},
];
pub const KEYLESS_ROUTE: usize = 0;
pub static KEYLESS_ENTRIES: [Entry; 1] = [Entry {
name: c"leleka_keyless_route_query",
block: [256, 1, 1],
args: &[P, P, I],
}];
pub const ATTN_CHUNK_M2: usize = 0;
pub const ATTN_CHUNK_M3: usize = 1;
pub const ATTN_CHUNK_M4: usize = 2;
pub const ATTN_MERGE: usize = 3;
pub static QSA_ATTN_ENTRIES: [Entry; 4] = [
Entry {
name: c"leleka_qsa_attn_chunk_m2",
block: [256, 1, 1],
args: &[P, P, P, P, P, P, I, I, P, P, P, I, I, L],
},
Entry {
name: c"leleka_qsa_attn_chunk_m3",
block: [256, 1, 1],
args: &[P, P, P, P, P, P, P, I, I, P, P, P, I, I, L],
},
Entry {
name: c"leleka_qsa_attn_chunk_m4",
block: [256, 1, 1],
args: &[P, P, P, P, P, P, N, I, P, P, I, I, P, P, P, I, I, L],
},
Entry {
name: c"leleka_qsa_attn_merge",
block: [256, 1, 1],
args: &[P, P, P, I, P, L],
},
];
pub const CVEC_APPLY: usize = 0;
pub static CVEC_ENTRIES: [Entry; 1] = [Entry {
name: c"leleka_cvec_apply",
block: [256, 1, 1],
args: &[P, P, P, P, I, L, I, I, L, N, L, N, L, I],
}];
#[allow(dead_code)]
const _: Arg = F; // `F32` arguments exist in the ABI (the attention scale is a compile-time constant here)
// ------------------------------------------------------------------------------------------- geometry
pub type Grid = [u32; 3];
/// CUDA's launch limits: x up to 2^31 - 1, y and z up to 65535.
const MAX_GRID_X: u64 = (1 << 31) - 1;
const MAX_GRID_YZ: u64 = 65_535;
fn grid_x(blocks: u64) -> Result<u32> {
if blocks == 0 || blocks > MAX_GRID_X {
return invalid("experimental launch grid exceeds the CUDA x limit (or is empty)");
}
Ok(blocks as u32)
}
fn grid_yz(value: u64) -> Result<u32> {
if value == 0 || value > MAX_GRID_YZ {
return invalid("experimental launch grid exceeds the CUDA y/z limit (or is empty)");
}
Ok(value as u32)
}
/// The three runtime integers of a paged KV cache (`QsaShapes` fields the KV kernels read).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct KvShape {
pub kv_heads: u32,
pub head_dim: u32,
pub page_size: u32,
}
impl KvShape {
pub const fn real() -> Self {
Self {
kv_heads: 2,
head_dim: 256,
page_size: 4,
}
}
pub fn as_qsa(&self) -> QsaShapes {
let mut s = QsaShapes::real();
s.n_head_kv = i64::from(self.kv_heads);
s.n_head = 12 * i64::from(self.kv_heads);
s.head_dim = i64::from(self.head_dim);
s.page_size = i64::from(self.page_size);
s
}
fn base(&self) -> Result<()> {
if self.kv_heads == 0 || self.page_size == 0 || self.head_dim == 0 {
return invalid("KV shape needs positive heads, head_dim and page_size");
}
if u64::from(self.kv_heads) > MAX_GRID_YZ || self.page_size > 1 << 20 || self.kv_heads > 64
{
return invalid("KV shape is beyond the closed programs' limits");
}
Ok(())
}
/// Q4_0 and the FWHT are 256-wide (`need_256`).
pub fn check_q4(&self) -> Result<()> {
self.base()?;
if self.head_dim != 256 {
return invalid("head_dim must be 256 (the Hadamard transform's size)");
}
Ok(())
}
/// INT8: whole 64-value groups (`validate`).
pub fn check_q8(&self) -> Result<()> {
self.base()?;
if !self.head_dim.is_multiple_of(kv_q8::KV_Q8_GROUP as u32) {
return invalid("head_dim must be a multiple of 64");
}
Ok(())
}
/// The attention kernels: `head_dim == 256`, `n_head == 12 * n_kv_heads` (derived here).
pub fn check_attn(&self) -> Result<()> {
self.check_q4()
}
pub fn n_head(&self) -> u32 {
12 * self.kv_heads
}
/// Rows of the pool arrays for `pages` pages.
pub fn rows(&self, pages: u64) -> u64 {
pages * u64::from(self.kv_heads) * u64::from(self.page_size)
}
pub fn q4_bytes(&self, pages: u64) -> u64 {
self.rows(pages) * q4_0::bytes_per_head(self.head_dim as usize)
}
pub fn q8_code_bytes(&self, pages: u64) -> u64 {
self.rows(pages) * u64::from(self.head_dim)
}
pub fn q8_scale_bytes(&self, pages: u64) -> u64 {
self.rows(pages) * u64::from(self.head_dim / kv_q8::KV_Q8_GROUP as u32) * 2
}
/// fp16 scratch of a gather: `[id][kv_head][head_dim]`.
pub fn gather_scratch_bytes(&self, max_ids: u64) -> u64 {
max_ids * u64::from(self.kv_heads) * u64::from(self.head_dim) * 2
}
}
/// `fwht256_cuda`: `rows` rows of 256 floats, 4 rows per block.
pub fn fwht_grid(rows: u64) -> Result<Grid> {
Ok([grid_x(rows.div_ceil(4))?, 1, 1])
}
pub fn fwht_bytes(rows: u64) -> u64 {
rows * 256 * 4
}
pub fn q4_step_grid(shape: &KvShape) -> Result<Grid> {
shape.check_q4()?;
Ok([shape.kv_heads, shape.head_dim / q4_0::QK4_0 as u32, 2])
}
pub fn q4_batch_grid(tokens: u64, shape: &KvShape) -> Result<Grid> {
shape.check_q4()?;
Ok([
grid_x(tokens)?,
shape.kv_heads,
shape.head_dim / q4_0::QK4_0 as u32,
])
}
pub fn q4_gather_grid(max_ids: u64, shape: &KvShape) -> Result<Grid> {
shape.check_q4()?;
let blocks =
max_ids * u64::from(shape.kv_heads) * u64::from(shape.head_dim / q4_0::QK4_0 as u32);
Ok([grid_x(blocks.div_ceil(4))?, 1, 1])
}
pub fn q8_step_grid(shape: &KvShape, with_keys: bool) -> Result<Grid> {
shape.check_q8()?;
Ok([
shape.kv_heads,
shape.head_dim / kv_q8::KV_Q8_GROUP as u32,
if with_keys { 2 } else { 1 },
])
}
pub fn q8_gather_grid(max_ids: u64, shape: &KvShape) -> Result<Grid> {
shape.check_q8()?;
let total = max_ids * u64::from(shape.kv_heads) * u64::from(shape.head_dim / 4);
Ok([grid_x(total.div_ceil(256))?, 1, 1])
}
pub const STREAM_RESET_GRID: Grid = [128, 1, 1];
pub const STREAM_RESOLVE_GRID: Grid = [1, 1, 1];
pub const STREAM_COPY_GRID: Grid = [96, 1, 1];
pub const RING_TABLE_GRID: Grid = [64, 1, 1];
/// `ceil(n_u4 / 128)` blocks of a grid-stride copy, capped at 4096.
pub fn copy_u4_grid(n_u4: u64) -> Result<Grid> {
Ok([grid_x(n_u4.div_ceil(128).min(4096))?, 1, 1])
}
/// `kv_stream_resolve`'s host guards (the slot sweep needs at least one resolve block of slots, a block's
/// scale run must be 16-byte aligned, one call's distinct blocks must fit).
pub fn check_stream_resolve(shape: &KvShape, n_slots: u64, n_q: u64, cap: u64) -> Result<()> {
shape.check_q8()?;
if n_q == 0 || n_q > MAX_GRID_YZ || cap == 0 || cap > i32::MAX as u64 {
return invalid("streaming resolve needs 1..=65535 queries and a positive cap");
}
if n_slots > i32::MAX as u64 {
return invalid("streaming resolve has too many slots");
}
leleka_experimental_ref::kv_stream::check_resolve(
&shape.as_qsa(),
n_slots as i64,
n_q as i64,
cap as i64,
)
.map_err(|e| ExperimentalError::Invalid(stream_error_text(e)))
}
fn stream_error_text(e: leleka_experimental_ref::kv_stream::StreamError) -> &'static str {
use leleka_experimental_ref::kv_stream::StreamError as E;
match e {
E::TooFewSlots => {
"kv_stream: fewer slots than the resolve block (1024): the clock sweep would take a slot twice"
}
E::CallTooLarge => "kv_stream: slots cannot hold the distinct blocks of one call",
E::ScaleRunAlignment => "kv_stream: a block's scale run must be a multiple of 16 bytes",
E::BadMissOrder => "kv_stream: bad miss order",
E::BlockOutOfRange => "kv_stream: block out of range",
E::NotStreamable => "kv_stream: the format cannot stream",
}
}
/// `keyless_route_query`: one block per (token, head).
pub fn keyless_grid(tokens: u64, heads: u64) -> Result<Grid> {
keyless::check_route_geometry(tokens as i64, heads as i64, keyless::DIM as i64)
.map_err(|_| ExperimentalError::Invalid("keyless routing geometry is invalid"))?;
Ok([grid_x(tokens * heads)?, 1, 1])
}
pub const fn keyless_matrices_bytes(heads: u64) -> u64 {
heads * 256 * 256 * 4
}
/// `cvec_apply`: one block per (hyper-connection stream, token).
pub fn cvec_grid(hc: u64, tokens: u64, n_embd: u64) -> Result<Grid> {
if n_embd == 0 || n_embd > (cvec::THREADS * cvec::MAXK) as u64 {
return invalid("control vector: unsupported n_embd");
}
Ok([grid_yz(hc)?, grid_yz(tokens)?, 1])
}
/// `qsa_decode_attn_batch`'s chunk launch: `(n_chunks, n_kv_heads, n_q)`.
pub fn attn_chunk_grid(cap: u64, shape: &KvShape, n_q: u64) -> Result<Grid> {
shape.check_attn()?;
if cap == 0 || cap > i32::MAX as u64 || n_q == 0 || n_q > MAX_GRID_YZ {
return invalid("attention needs a positive cap and 1..=65535 queries");
}
Ok([
grid_x(cap.div_ceil(leleka_experimental_ref::attn::CHUNK as u64))?,
shape.kv_heads,
n_q as u32,
])
}
pub fn attn_merge_grid(shape: &KvShape, n_q: u64) -> Result<Grid> {
shape.check_attn()?;
Ok([shape.n_head(), grid_yz(n_q)?, 1])
}
/// `qsa_decode_attn_scratch_floats(cap)`: the per-query stride of the three partial buffers.
pub fn attn_scratch_floats(cap: u64, shape: &KvShape) -> u64 {
leleka_experimental_ref::attn::scratch_floats(cap as i64, &shape.as_qsa())
}
/// Bytes of one query's step record (`kStepCount` ints).
pub const STEP_BYTES: u64 = 16;
// ------------------------------------------------------------------------------------ cached modules
/// The loaded entries of one program, cached per context like every other fixed kernel (the module is unloaded
/// by `Context::close`).
#[derive(Clone, Copy)]
pub(crate) struct LoadedProgram {
pub module: crate::ffi::ModuleHandle,
pub functions: [Option<crate::ffi::FunctionHandle>; 5],
}
impl Context<'_> {
/// Unload every cached experimental module, taking each slot before the single attempt. A poisoned context
/// only retains the driver.
pub(crate) fn unload_experimental(&self) -> crate::Result<()> {
let mut result = Ok(());
for slot in &self.experimental {
let Some(program) = slot.take() else { continue };
if self.poisoned.get() {
std::mem::forget(std::rc::Rc::clone(&self.driver.api));
continue;
}
let guard = match self.enter() {
Ok(guard) => guard,
Err(error) => {
self.poisoned.set(true);
result = crate::combine(result, Err(error));
continue;
}
};
let unload = self.driver.api.unload(program.module);
if unload.is_err() {
self.poisoned.set(true);
std::mem::forget(std::rc::Rc::clone(&self.driver.api));
}
result = crate::combine(result, crate::combine(unload, guard.finish()));
}
result
}
}
#[cfg(test)]
mod tests {
use super::*;
fn count_params(source: &str, name: &str) -> (Vec<&'static str>, u32) {
let at = source
.find(&format!(" {name}("))
.unwrap_or_else(|| panic!("{name} not in source"));
let head = &source[..at];
let decl = head
.rfind("extern \"C\" __global__")
.expect("extern C entry");
let bounds = head[decl..]
.split("__launch_bounds__(")
.nth(1)
.expect("launch bounds");
let threads: u32 = bounds.split(')').next().unwrap().trim().parse().unwrap();
let rest = &source[at + name.len() + 2..];
let close = rest.find(") {").expect("parameter list end");
let kinds = rest[..close]
.split(',')
.map(|param| {
let p = param.trim();
if p.contains('*') {
"ptr"
} else if p.starts_with("long long") {
"i64"
} else if p.starts_with("int ") {
"i32"
} else if p.starts_with("float ") {
"f32"
} else {
panic!("unrecognised parameter `{p}` of {name}")
}
})
.collect();
(kinds, threads)
}
#[test]
fn every_entry_signature_matches_its_cuda_source() {
let mut checked = 0;
for program in Program::ALL {
for entry in program.entries() {
let name = entry.name.to_str().unwrap();
let (kinds, threads) = count_params(program.source(), name);
let want: Vec<&str> = entry
.args
.iter()
.map(|a| match a {
Arg::Ptr | Arg::PtrOpt => "ptr",
Arg::I32 => "i32",
Arg::I64 => "i64",
Arg::F32 => "f32",
})
.collect();
assert_eq!(kinds, want, "{name}");
assert_eq!(
threads,
entry.block.iter().product::<u32>(),
"{name} launch bounds"
);
assert!(entry.args.len() <= MAX_ENTRY_ARGUMENTS, "{name}");
checked += 1;
}
}
assert_eq!(checked, 17);
}
#[test]
fn index_constants_point_at_the_named_entries() {
let n = |p: Program, i: usize| p.entries()[i].name.to_str().unwrap();
assert_eq!(n(Program::KvQ4, FWHT256), "leleka_fwht256_f32");
assert_eq!(n(Program::KvQ4, Q4_APPEND_STEP), "leleka_kv_append_q4_step");
assert_eq!(
n(Program::KvQ4, Q4_APPEND_BATCH),
"leleka_kv_append_q4_batch"
);
assert_eq!(n(Program::KvQ4, Q4_GATHER_STEP), "leleka_kv_gather_q4_step");
assert_eq!(n(Program::KvQ8, Q8_APPEND_STEP), "leleka_kv_append_q8_step");
assert_eq!(n(Program::KvQ8, Q8_GATHER_STEP), "leleka_kv_gather_q8_step");
assert_eq!(n(Program::KvStream, STREAM_RESET), "leleka_kv_stream_reset");
assert_eq!(
n(Program::KvStream, STREAM_RESOLVE),
"leleka_kv_stream_resolve"
);
assert_eq!(n(Program::KvStream, STREAM_COPY), "leleka_kv_stream_copy");
assert_eq!(n(Program::KvStream, RING_TABLE), "leleka_kv_ring_table");
assert_eq!(n(Program::KvStream, COPY_U4), "leleka_kv_copy_u4");
assert_eq!(
n(Program::Keyless, KEYLESS_ROUTE),
"leleka_keyless_route_query"
);
assert_eq!(
n(Program::QsaAttn, ATTN_CHUNK_M2),
"leleka_qsa_attn_chunk_m2"
);
assert_eq!(
n(Program::QsaAttn, ATTN_CHUNK_M3),
"leleka_qsa_attn_chunk_m3"
);
assert_eq!(
n(Program::QsaAttn, ATTN_CHUNK_M4),
"leleka_qsa_attn_chunk_m4"
);
assert_eq!(n(Program::QsaAttn, ATTN_MERGE), "leleka_qsa_attn_merge");
assert_eq!(n(Program::Cvec, CVEC_APPLY), "leleka_cvec_apply");
}
#[test]
fn every_mode_is_off_by_default_and_programs_need_an_explicit_one() {
let none = OptIn::default();
assert!(none.is_empty());
assert_eq!(none.digest_text(), "");
for program in Program::ALL {
assert!(!none.enables(program));
assert_eq!(
admit(program, &none),
Err(ExperimentalError::NotEnabled(program.name()))
);
assert!(!program.needed_by().is_empty());
}
let q4 = OptIn::default().with(Mode::KvQ40);
assert!(q4.enables(Program::KvQ4) && q4.enables(Program::QsaAttn));
assert!(
!q4.enables(Program::KvStream)
&& !q4.enables(Program::Cvec)
&& !q4.enables(Program::KvQ8)
);
let k = OptIn::default().with(Mode::KeylessVOnly);
assert!(
k.enables(Program::Keyless) && k.enables(Program::KvQ8) && !k.enables(Program::KvQ4)
);
assert_eq!(
OptIn::default()
.with(Mode::KvStreamed)
.with(Mode::KvQ40)
.digest_text(),
"kv-q4_0,kv-streamed"
);
// every mode reaches at least one program, and the names are unique
for mode in Mode::ALL {
assert!(
Program::ALL.iter().any(|p| p.needed_by().contains(&mode)),
"{mode:?}"
);
}
let names: std::collections::BTreeSet<_> = Mode::ALL.iter().map(|m| m.name()).collect();
assert_eq!(names.len(), Mode::ALL.len());
}
#[test]
fn placeholder_assets_are_well_formed_but_unpinned_so_admission_fails_closed() {
let all = OptIn::NONE
.with(Mode::KvQ40)
.with(Mode::KvK8V4)
.with(Mode::KeylessVOnly)
.with(Mode::KvStreamed)
.with(Mode::ControlVectors);
for program in Program::ALL {
let ptx = program.ptx();
assert_eq!(ptx.last(), Some(&0));
assert!(ptx[..ptx.len() - 1].is_ascii() && !ptx[..ptx.len() - 1].contains(&0));
assert!(
!std::str::from_utf8(ptx).unwrap().contains(".entry"),
"placeholder must define no entry"
);
assert_eq!(
*program.pin(),
PtxPin {
source_sha256: [0; 32],
ptx_sha256: [0; 32]
}
);
assert_eq!(
admit(program, &all),
Err(ExperimentalError::Unpinned(program.name()))
);
assert!(
program.source().contains("NOT COMPILED OR RUN"),
"{}",
program.name()
);
}
}
#[test]
fn a_matching_pin_admits_and_any_difference_refuses() {
static GOOD: &[u8] = b".version 8.7\n.target sm_120\n\0";
let pin = PtxPin {
source_sha256: [1; 32],
ptx_sha256: qwen_ffi::sha256(&GOOD[..GOOD.len() - 1]),
};
assert_eq!(admit_ptx(Program::Cvec, GOOD, &pin), Ok(()));
let wrong = PtxPin {
ptx_sha256: [2; 32],
..pin
};
assert_eq!(
admit_ptx(Program::Cvec, GOOD, &wrong),
Err(ExperimentalError::Unpinned("cvec"))
);
let half = PtxPin {
source_sha256: [0; 32],
..pin
};
assert_eq!(
admit_ptx(Program::Cvec, GOOD, &half),
Err(ExperimentalError::Unpinned("cvec"))
);
static NO_NUL: &[u8] = b".version 8.7\n";
let p2 = PtxPin {
source_sha256: [1; 32],
ptx_sha256: qwen_ffi::sha256(NO_NUL),
};
assert!(admit_ptx(Program::Cvec, NO_NUL, &p2).is_err());
static EMBEDDED: &[u8] = b"a\0b\0";
let p3 = PtxPin {
source_sha256: [1; 32],
ptx_sha256: qwen_ffi::sha256(b"a\0b"),
};
assert!(admit_ptx(Program::Cvec, EMBEDDED, &p3).is_err());
}
#[test]
fn kv_geometry_matches_the_originals_host_wrappers() {
let s = KvShape::real();
assert_eq!(fwht_grid(1), Ok([1, 1, 1]));
assert_eq!(fwht_grid(4), Ok([1, 1, 1]));
assert_eq!(fwht_grid(5), Ok([2, 1, 1]));
assert!(fwht_grid(0).is_err());
assert_eq!(q4_step_grid(&s), Ok([2, 8, 2]));
assert_eq!(q4_batch_grid(7, &s), Ok([7, 2, 8]));
assert!(q4_batch_grid(0, &s).is_err());
// 3 ids * 2 heads * 8 blocks = 48 blocks, 4 per grid block
assert_eq!(q4_gather_grid(3, &s), Ok([12, 1, 1]));
assert_eq!(q4_gather_grid(1, &s), Ok([4, 1, 1]));
assert_eq!(q8_step_grid(&s, true), Ok([2, 4, 2]));
assert_eq!(q8_step_grid(&s, false), Ok([2, 4, 1]));
// 5 ids * 2 heads * 64 float4 = 640 threads
assert_eq!(q8_gather_grid(5, &s), Ok([3, 1, 1]));
let odd = KvShape { head_dim: 192, ..s };
assert!(odd.check_q8().is_ok() && odd.check_q4().is_err() && odd.check_attn().is_err());
assert!(KvShape { head_dim: 100, ..s }.check_q8().is_err());
assert!(KvShape { kv_heads: 0, ..s }.check_q4().is_err());
assert!(KvShape { page_size: 0, ..s }.check_q8().is_err());
assert_eq!(copy_u4_grid(1), Ok([1, 1, 1]));
assert_eq!(copy_u4_grid(129), Ok([2, 1, 1]));
assert_eq!(copy_u4_grid(1 << 40), Ok([4096, 1, 1]));
assert_eq!(attn_chunk_grid(64, &s, 3), Ok([1, 2, 3]));
assert_eq!(attn_chunk_grid(65, &s, 1), Ok([2, 2, 1]));
assert_eq!(attn_merge_grid(&s, 4), Ok([24, 4, 1]));
assert!(attn_chunk_grid(0, &s, 1).is_err() && attn_chunk_grid(64, &s, 65_536).is_err());
assert_eq!(keyless_grid(3, 24), Ok([72, 1, 1]));
assert!(keyless_grid(0, 24).is_err());
assert_eq!(keyless_matrices_bytes(24), 24 * 65_536 * 4);
assert_eq!(cvec_grid(4, 3, 2560), Ok([4, 3, 1]));
assert!(
cvec_grid(4, 3, 4097).is_err()
&& cvec_grid(4, 3, 0).is_err()
&& cvec_grid(0, 3, 2560).is_err()
);
}
#[test]
fn byte_sizes_agree_with_the_reference_layouts() {
use leleka_experimental_ref::layout::{KvFormat, kv_pool_bytes, pool_arrays};
let s = KvShape::real();
let q = QsaShapes::real();
let pages = 11;
let arrays = pool_arrays(KvFormat::Q4_0, &q, pages);
assert_eq!(arrays[0].bytes, s.q4_bytes(pages));
assert_eq!(arrays[1].bytes, s.q4_bytes(pages));
let arrays = pool_arrays(KvFormat::Int8, &q, pages);
assert_eq!(arrays[0].bytes, s.q8_code_bytes(pages));
assert_eq!(arrays[2].bytes, s.q8_scale_bytes(pages));
let k8v4 = pool_arrays(KvFormat::K8V4, &q, pages);
assert_eq!(
(k8v4[0].bytes, k8v4[1].bytes, k8v4[2].bytes),
(
s.q8_code_bytes(pages),
s.q8_scale_bytes(pages),
s.q4_bytes(pages)
)
);
// 576 B per cell and layer for Q4_0, one page = 4 cells
assert_eq!(
kv_pool_bytes(KvFormat::Q4_0, &q, pages),
pages * 4 * 576 + 64
);
assert_eq!(s.q4_bytes(pages) * 2, pages * 4 * 576);
assert_eq!(s.gather_scratch_bytes(2048), 2048 * 2 * 256 * 2);
assert_eq!(attn_scratch_floats(2048, &s), 32 * 24 * 258 + 64);
assert_eq!(fwht_bytes(24), 24 * 1024);
assert_eq!(s.as_qsa(), q);
}
#[test]
fn stream_resolve_guards_are_the_originals() {
let s = KvShape::real();
assert_eq!(check_stream_resolve(&s, 5120, 1, 2048), Ok(()));
assert!(
matches!(check_stream_resolve(&s, 1023, 1, 8), Err(ExperimentalError::Invalid(m)) if m.contains("fewer slots"))
);
assert!(
matches!(check_stream_resolve(&s, 1024, 8, 4096), Err(ExperimentalError::Invalid(m)) if m.contains("distinct blocks"))
);
assert!(check_stream_resolve(&s, 5120, 0, 8).is_err());
let misaligned = KvShape {
kv_heads: 1,
page_size: 1,
..s
};
assert!(
matches!(check_stream_resolve(&misaligned, 5120, 1, 8), Err(ExperimentalError::Invalid(m)) if m.contains("16 bytes"))
);
}
}
@@ -0,0 +1,91 @@
// Offline compilation source; not a runtime/toolkit dependency.
// EXPERIMENTAL control vector on the residual stream (`--control-vector-scaled`, llama.cpp's cvec with the
// `--cvec-mode project` extension): after layer l's FFN write, every hyper-connection stream h of every token
// becomes `h - s (h . v) v` (project, v unit, s = |d|) or `h + d` (add). Steering changes model output by design:
// it is off by default, switched per request through a device flag, and the driver refuses the program without
// an explicit ExperimentalOptIn (experimental.rs). With the flag off and no pending write the kernel is a no-op;
// with a pending write it applies the fused hyper-connection read's own arithmetic.
//
// LITERAL PORT of engine/strata/src/kernels/cuda/cvec.cu: `cvec_kernel`'s BODY and `sigmoidf_` are
// byte-identical to the Original's (experimental_cvec.rs::literal_bodies_match_the_original). Edits:
// `__global__ cvec_kernel` became the `__device__ cvec_kernel_body` function called by the `extern "C" __global__`
// entry; the host tables (g_dev, cvec_upload, cvec_apply) are Rust. A null `bo`/`inj` is a 64-bit zero argument.
//
// Entry (grid / block): leleka_cvec_apply (hc, T) / 256
//
// STATUS: NOT COMPILED OR RUN (no nvcc here). PTX pin is zero until Root freezes it. Intended offline compile:
// nvcc 12.8.93 -ptx -O3 -arch=sm_120, precise math (the Original builds cvec.cu with default flags); note that
// `__expf` in `sigmoidf_` is the fast intrinsic, exactly as in the Original.
#include <cstdint>
namespace {
constexpr int THREADS = 256;
constexpr int MAXK = 16; // n_embd up to 4096, held in registers between the dot and the update
// the fused hyper-connection read's gate (fused_gr.cu), so a write done here is bitwise the one it would have folded
// the fused hyper-connection read's gate (fused_gr.cu), so a write done here is bitwise the one it would have folded
__device__ __forceinline__ float sigmoidf_(float x) { return 1.0f / (1.0f + __expf(-x)); }
// one block per (stream, token): the pending write, then h . v over the stream, then the update
// one block per (stream, token): the pending write, then h . v over the stream, then the update
__device__ __forceinline__ void cvec_kernel_body(float* __restrict__ R, const float* __restrict__ dir, const float* __restrict__ s_l,
const int* __restrict__ on, int mode, int64_t layer, int n, int hc, int64_t r_ld,
const float* __restrict__ bo, int64_t bo_ld, const float* __restrict__ inj,
int64_t inj_ld, int write) {
const int c = blockIdx.x;
const int64_t t = blockIdx.y;
float* r = R + t * r_ld + (int64_t) c * n;
const float s = s_l[layer];
const bool steer = *on != 0 && s != 0.0f; // uniform over the block
if (!steer && !write) return;
const float* v = dir + layer * n;
const float w = write ? 2.0f * sigmoidf_(inj[t * inj_ld + c] / (float) hc) : 0.0f;
const float* b = write ? bo + t * bo_ld : nullptr;
float x[MAXK];
float dot = 0.0f;
#pragma unroll
for (int k = 0; k < MAXK; ++k) {
const int d = threadIdx.x + k * THREADS;
if (d < n) {
float xv = r[d];
if (write) xv = fmaf(b[d], w, xv);
x[k] = xv;
if (steer && mode == 0) dot = fmaf(xv, v[d], dot);
}
}
if (steer && mode == 0) {
__shared__ float part[THREADS / 32];
#pragma unroll
for (int o = 16; o > 0; o >>= 1) dot += __shfl_xor_sync(0xffffffffu, dot, o);
if ((threadIdx.x & 31) == 0) part[threadIdx.x >> 5] = dot;
__syncthreads();
if (threadIdx.x < 32) {
float p = threadIdx.x < THREADS / 32 ? part[threadIdx.x] : 0.0f;
#pragma unroll
for (int o = 16; o > 0; o >>= 1) p += __shfl_xor_sync(0xffffffffu, p, o);
if (threadIdx.x == 0) part[0] = p;
}
__syncthreads();
dot = part[0] * s; // s (h . v)
}
#pragma unroll
for (int k = 0; k < MAXK; ++k) {
const int d = threadIdx.x + k * THREADS;
if (d < n) {
float xv = x[k];
if (steer) xv = mode == 0 ? fmaf(-dot, v[d], xv) : xv + v[d];
r[d] = xv;
}
}
}
} // namespace
extern "C" __global__ void __launch_bounds__(256) leleka_cvec_apply(
float* __restrict__ R, const float* __restrict__ dir, const float* __restrict__ s_l, const int* __restrict__ on,
int mode, long long layer, int n, int hc, long long r_ld, const float* __restrict__ bo, long long bo_ld,
const float* __restrict__ inj, long long inj_ld, int write) {
cvec_kernel_body(R, dir, s_l, on, mode, (int64_t) layer, n, hc, (int64_t) r_ld, bo, (int64_t) bo_ld, inj,
(int64_t) inj_ld, write);
}
@@ -0,0 +1,9 @@
//
// PLACEHOLDER - NOT GENERATED PTX.
// TODO-ROOT: compile experimental_cvec.cu offline with the pinned toolchain
// nvcc 12.8.93 -std=c++17 -O3 -ptx -arch=sm_120 experimental_cvec.cu -o experimental_cvec.ptx
// (precise math: no --use_fast_math; see docs/cuda-seal-plan-additions-experimental.json) then freeze the source
// and PTX SHA-256 values in the matching pin of experimental.rs after the Root GPU smoke passes.
// The driver refuses this asset while the pin is zero, and this text defines no kernel entry, so it can never be
// mistaken for a qualified executable. EXPERIMENTAL: the program is only reachable through an explicit opt-in.
//
+881
View File
@@ -0,0 +1,881 @@
//! Closed CUDA programs for the EXPERIMENTAL Strata modes (Q4_0 / hybrid K8V4 / rotated KV, keyless V-only KV,
//! KV streaming, control vectors). Linux 64-bit + `cuda-driver` only.
//!
//! Contract, in the style of the neighbouring closed programs:
//! - a program only opens when an enabled [`OptIn`] mode needs it AND its PTX matches a Root-frozen pin; with the
//! shipped zero pins the first use fails closed before any driver call;
//! - the module is loaded once per context and cached (`Context::close` unloads it);
//! - callers pass only admitted buffers (same context, whole-allocation extents of at least the size the
//! geometry implies, 16-byte aligned, no overlap with anything a launch writes) and validated shapes; entry
//! names, block sizes and argument layouts are the fixed tables of `experimental.rs`, cross-checked there
//! against the `.cu` text;
//! - every attempted launch sequence is drained with exactly ONE `cuCtxSynchronize`; an uncertain completion
//! poisons the context and leaks the raw-owned argument tables.
//!
//! The device index buffers (page tables, id lists, step records) are data the kernels trust exactly as the
//! Original's do; the facade bounds the pool/scratch arithmetic, not the contents of those index buffers.
//!
//! STATUS: compiled only by `cargo check --target x86_64-unknown-linux-gnu`. No PTX exists yet and no GPU run
//! has happened; the `#[ignore]`d smoke is `experimental_gpu_smoke.rs`.
use crate::{
Context, DeviceBuffer, Error, combine,
experimental::{
self, ATTN_CHUNK_M2, ATTN_CHUNK_M3, ATTN_CHUNK_M4, ATTN_MERGE, Arg, COPY_U4, CVEC_APPLY,
Entry, ExperimentalError, FWHT256, KEYLESS_ROUTE, KvShape, LoadedProgram, OptIn, Program,
Q4_APPEND_BATCH, Q4_APPEND_STEP, Q4_GATHER_STEP, Q8_APPEND_STEP, Q8_GATHER_STEP,
RING_TABLE, Result, STEP_BYTES, STREAM_COPY, STREAM_RESET, STREAM_RESOLVE, admit, invalid,
},
ffi,
};
use leleka_experimental_ref::{
attn,
kv_stream::CTL_INTS,
layout::{StreamFormat, stream_runs},
};
use std::rc::Rc;
type DriverResult<T> = std::result::Result<T, Error>;
impl Context<'_> {
/// Opt-in and pin gates, then load and cache the module once. Refuses without touching the driver while the
/// pin is zero or the mode is off.
pub(crate) fn experimental_program(
&self,
program: Program,
opt_in: &OptIn,
) -> Result<LoadedProgram> {
admit(program, opt_in)?;
if let Some(loaded) = self.experimental[program as usize].get() {
return Ok(loaded);
}
if self.poisoned.get() {
return Err(Error::ContextPoisoned.into());
}
let api = &self.driver.api;
let guard = self.enter()?;
let module = match api.load_kar_levels_module(program.ptx()) {
Ok(module) => module,
Err(error) => return Err(failure(error, guard.finish())),
};
let mut functions = [None; 5];
let mut resolved: DriverResult<()> = Ok(());
for (slot, entry) in functions.iter_mut().zip(program.entries()) {
match api.kar_levels_function(module, entry.name) {
Ok(function) => *slot = Some(function),
Err(error) => {
resolved = Err(error);
break;
}
}
}
match resolved {
Ok(()) => {
// Nothing is published until every entry resolves and the context restore succeeds.
guard.finish()?;
let loaded = LoadedProgram { module, functions };
self.experimental[program as usize].set(Some(loaded));
Ok(loaded)
}
Err(error) => {
let cleanup = api.unload(module);
if cleanup.is_err() {
self.poisoned.set(true);
std::mem::forget(Rc::clone(api));
}
let primary =
combine::<()>(Err(error), cleanup).expect_err("resolution failure is primary");
Err(failure(primary, guard.finish()))
}
}
}
}
/// A handle to one cached experimental program of a context.
pub struct Experimental<'c> {
context: &'c Context<'c>,
program: Program,
loaded: LoadedProgram,
}
#[derive(Clone, Copy)]
struct Admitted {
handle: ffi::BufferHandle,
bytes: usize,
writes: bool,
}
struct Launch {
function: ffi::FunctionHandle,
grid: [u32; 3],
block: [u32; 3],
args: ffi::KarLevelsArgs,
}
/// A paged KV pool's shape plus how many pages / page-table entries its buffers hold.
#[derive(Clone, Copy, Debug)]
pub struct Paged {
pub shape: KvShape,
/// Pages in the pool arrays (slots of a streamed cache).
pub pages: u64,
/// Entries (ints) in the page table.
pub table_entries: u64,
}
fn i32_of(value: u64) -> Result<i32> {
i32::try_from(value).or_else(|_| invalid("experimental launch scalar exceeds i32"))
}
fn i64_of(value: u64) -> Result<i64> {
i64::try_from(value).or_else(|_| invalid("experimental launch scalar exceeds i64"))
}
impl<'c> Experimental<'c> {
/// Load (once) and return the cached program. Fails closed with `NotEnabled` / `Unpinned`.
pub fn open(context: &'c Context<'c>, program: Program, opt_in: &OptIn) -> Result<Self> {
let loaded = context.experimental_program(program, opt_in)?;
Ok(Self {
context,
program,
loaded,
})
}
/// The module is owned by the context and unloaded by `Context::close`.
pub fn close(self) -> Result<()> {
Ok(())
}
fn expect(&self, program: Program) -> Result<()> {
if self.program != program {
return invalid("this facade call belongs to a different experimental program");
}
Ok(())
}
fn call(&self, entry: usize) -> Call<'_, 'c> {
Call {
gpu: self,
entry,
args: Vec::new(),
kinds: Vec::new(),
admitted: Vec::new(),
}
}
/// Launch every entry in order and drain with exactly one synchronize.
fn run(&self, mut launches: Vec<Launch>) -> Result<()> {
let context = self.context;
if context.poisoned.get() {
return Err(Error::ContextPoisoned.into());
}
let guard = context.enter()?;
let mut launch = Ok(());
for l in &mut launches {
launch = context
.driver
.api
.launch_kar_levels(l.function, l.grid, l.block, &mut l.args);
if launch.is_err() {
break;
}
}
context
.complete_launch(launch, launches, guard)
.map_err(Into::into)
}
// ------------------------------------------------------------------------------------- FWHT-256
/// `fwht256_cuda`: orthonormal Walsh-Hadamard transform of `rows` rows of 256 floats (scale 1/16; the
/// transform is its own inverse). `src` and `dst` must not overlap.
pub fn fwht256(
&self,
src: &DeviceBuffer<'_>,
dst: &mut DeviceBuffer<'_>,
rows: u64,
) -> Result<()> {
self.expect(Program::KvQ4)?;
let grid = experimental::fwht_grid(rows)?;
let bytes = experimental::fwht_bytes(rows);
let launch = self
.call(FWHT256)
.ro(src, bytes)?
.rw(dst, bytes)?
.i64(i64_of(rows)?)
.finish(grid)?;
self.run(vec![launch])
}
// ------------------------------------------------------------------------------------ Q4_0 pool
/// `kv_append_q4_step`: quantize one new cell (position and page table from the device `step` record) into
/// the Q4_0 pools. Host write-through is off (null mapped pointers).
#[allow(clippy::too_many_arguments)] // closed ABI operands
pub fn q4_append_step(
&self,
p: &Paged,
k_q4: &mut DeviceBuffer<'_>,
v_q4: &mut DeviceBuffer<'_>,
table: &DeviceBuffer<'_>,
step: &DeviceBuffer<'_>,
kcur: &DeviceBuffer<'_>,
vcur: &DeviceBuffer<'_>,
) -> Result<()> {
self.expect(Program::KvQ4)?;
let grid = experimental::q4_step_grid(&p.shape)?;
let cell = p.shape.kv_heads as u64 * p.shape.head_dim as u64 * 4;
let launch = self
.call(Q4_APPEND_STEP)
.rw(k_q4, p.shape.q4_bytes(p.pages))?
.rw(v_q4, p.shape.q4_bytes(p.pages))?
.ro(table, p.table_entries * 4)?
.ro(step, STEP_BYTES)?
.ro(kcur, cell)?
.ro(vcur, cell)?
.i32(p.shape.kv_heads as i32)
.i32(p.shape.head_dim as i32)
.i32(p.shape.page_size as i32)
.null()
.null()
.finish(grid)?;
self.run(vec![launch])
}
/// `kv_append_q4` (prefill): `tokens` cells starting at `pos0`; K and V are `[token][kv_head][head_dim]`.
/// Two launches (`is_v` 0 then 1) under one drain, as the Original does.
#[allow(clippy::too_many_arguments)] // closed ABI operands
pub fn q4_append_batch(
&self,
p: &Paged,
k_q4: &mut DeviceBuffer<'_>,
v_q4: &mut DeviceBuffer<'_>,
table: &DeviceBuffer<'_>,
pos0: i64,
tokens: u64,
k: &DeviceBuffer<'_>,
v: &DeviceBuffer<'_>,
) -> Result<()> {
self.expect(Program::KvQ4)?;
if pos0 < 0 {
return invalid("q4 append: negative start position");
}
let grid = experimental::q4_batch_grid(tokens, &p.shape)?;
let rows = tokens * p.shape.kv_heads as u64 * p.shape.head_dim as u64 * 4;
let mut launches = Vec::new();
for is_v in 0..2 {
launches.push(
self.call(Q4_APPEND_BATCH)
.rw(k_q4, p.shape.q4_bytes(p.pages))?
.rw(v_q4, p.shape.q4_bytes(p.pages))?
.ro(table, p.table_entries * 4)?
.i64(pos0)
.ro(k, rows)?
.ro(v, rows)?
.i32(p.shape.kv_heads as i32)
.i32(p.shape.head_dim as i32)
.i32(p.shape.page_size as i32)
.i32(is_v)
.null()
.null()
.null()
.null()
.finish(grid)?,
);
}
self.run(launches)
}
/// `kv_gather_q4_step`: dequantize the selected cells (device `ids`) into fp16 `[id][kv_head][head_dim]`.
#[allow(clippy::too_many_arguments)] // closed ABI operands
pub fn q4_gather_step(
&self,
p: &Paged,
k_q4: &DeviceBuffer<'_>,
v_q4: &DeviceBuffer<'_>,
table: &DeviceBuffer<'_>,
ids: &DeviceBuffer<'_>,
step: &DeviceBuffer<'_>,
max_ids: u64,
k_scratch: &mut DeviceBuffer<'_>,
v_scratch: &mut DeviceBuffer<'_>,
) -> Result<()> {
self.expect(Program::KvQ4)?;
let grid = experimental::q4_gather_grid(max_ids, &p.shape)?;
let scratch = p.shape.gather_scratch_bytes(max_ids);
let launch = self
.call(Q4_GATHER_STEP)
.ro(k_q4, p.shape.q4_bytes(p.pages))?
.ro(v_q4, p.shape.q4_bytes(p.pages))?
.ro(table, p.table_entries * 4)?
.ro(ids, max_ids * 4)?
.ro(step, STEP_BYTES)?
.i32(p.shape.kv_heads as i32)
.i32(p.shape.head_dim as i32)
.i32(p.shape.page_size as i32)
.rw(k_scratch, scratch)?
.rw(v_scratch, scratch)?
.finish(grid)?;
self.run(vec![launch])
}
// ------------------------------------------------------------------------------------ INT8 pool
/// `kv_append_q8_step`. With `keys == None` the cache is V-only (keyless): no K codes, scales or K input.
#[allow(clippy::too_many_arguments)] // closed ABI operands
pub fn q8_append_step(
&self,
p: &Paged,
keys: Option<(
&mut DeviceBuffer<'_>,
&mut DeviceBuffer<'_>,
&DeviceBuffer<'_>,
)>,
v_q: &mut DeviceBuffer<'_>,
v_scale: &mut DeviceBuffer<'_>,
table: &DeviceBuffer<'_>,
step: &DeviceBuffer<'_>,
vcur: &DeviceBuffer<'_>,
) -> Result<()> {
self.expect(Program::KvQ8)?;
let grid = experimental::q8_step_grid(&p.shape, keys.is_some())?;
let codes = p.shape.q8_code_bytes(p.pages);
let scales = p.shape.q8_scale_bytes(p.pages);
let cell = p.shape.kv_heads as u64 * p.shape.head_dim as u64 * 4;
let mut c = self.call(Q8_APPEND_STEP);
match keys {
Some((k_q, k_scale, kcur)) => {
c = c.rw(k_q, codes)?.rw(v_q, codes)?.rw(k_scale, scales)?;
c = c
.rw(v_scale, scales)?
.ro(table, p.table_entries * 4)?
.ro(step, STEP_BYTES)?;
c = c.ro(kcur, cell)?;
}
None => {
c = c.null().rw(v_q, codes)?.null().rw(v_scale, scales)?;
c = c
.ro(table, p.table_entries * 4)?
.ro(step, STEP_BYTES)?
.null();
}
}
let launch = c
.ro(vcur, cell)?
.i32(p.shape.kv_heads as i32)
.i32(p.shape.head_dim as i32)
.i32(p.shape.page_size as i32)
.null()
.null()
.null()
.null()
.finish(grid)?;
self.run(vec![launch])
}
/// `kv_gather_q8_step`: dequantize the selected cells into fp16 scratch (K and V of the same pool).
#[allow(clippy::too_many_arguments)] // closed ABI operands
pub fn q8_gather_step(
&self,
p: &Paged,
k_q: &DeviceBuffer<'_>,
v_q: &DeviceBuffer<'_>,
k_scale: &DeviceBuffer<'_>,
v_scale: &DeviceBuffer<'_>,
table: &DeviceBuffer<'_>,
ids: &DeviceBuffer<'_>,
step: &DeviceBuffer<'_>,
max_ids: u64,
k_scratch: &mut DeviceBuffer<'_>,
v_scratch: &mut DeviceBuffer<'_>,
) -> Result<()> {
self.expect(Program::KvQ8)?;
let grid = experimental::q8_gather_grid(max_ids, &p.shape)?;
let codes = p.shape.q8_code_bytes(p.pages);
let scales = p.shape.q8_scale_bytes(p.pages);
let scratch = p.shape.gather_scratch_bytes(max_ids);
let launch = self
.call(Q8_GATHER_STEP)
.ro(k_q, codes)?
.ro(v_q, codes)?
.ro(k_scale, scales)?
.ro(v_scale, scales)?
.ro(table, p.table_entries * 4)?
.ro(ids, max_ids * 4)?
.ro(step, STEP_BYTES)?
.i32(p.shape.kv_heads as i32)
.i32(p.shape.head_dim as i32)
.i32(p.shape.page_size as i32)
.rw(k_scratch, scratch)?
.rw(v_scratch, scratch)?
.finish(grid)?;
self.run(vec![launch])
}
// --------------------------------------------------------------------------------- KV streaming
/// `kv_stream_reset`: every block non-resident, every slot free, clock state zero.
pub fn stream_reset(
&self,
map: &mut StreamMap<'_, '_>,
n_blocks: u64,
n_slots: u64,
) -> Result<()> {
self.expect(Program::KvStream)?;
let launch = map
.bind(self.call(STREAM_RESET), n_blocks, n_slots, false)?
.i64(i64_of(n_blocks)?)
.i64(i64_of(n_slots)?)
.finish(experimental::STREAM_RESET_GRID)?;
self.run(vec![launch])
}
/// `kv_stream_resolve` followed by `copy_kernel`: map this call's block ids to slots (CLOCK), then copy the
/// missed blocks from the host-tier arrays into the slot arrays, under one drain. `host` and `slots` hold
/// the streamed format's arrays in the order of `stream_runs`.
#[allow(clippy::too_many_arguments)] // closed ABI operands
pub fn stream_resolve(
&self,
map: &mut StreamMap<'_, '_>,
format: StreamFormat,
shape: &KvShape,
n_blocks: u64,
n_slots: u64,
ids: &DeviceBuffer<'_>,
steps: &DeviceBuffer<'_>,
n_q: u64,
cap: u64,
host: &[&DeviceBuffer<'_>],
slots: &mut [&mut DeviceBuffer<'_>],
) -> Result<()> {
self.expect(Program::KvStream)?;
experimental::check_stream_resolve(shape, n_slots, n_q, cap)?;
let runs = stream_runs(&shape.as_qsa(), format);
if host.len() != runs.len() || slots.len() != runs.len() || runs.len() > 4 {
return invalid("kv_stream: host/slot array counts differ from the format's runs");
}
let resolve = map
.bind(self.call(STREAM_RESOLVE), n_blocks, n_slots, true)?
.i64(i64_of(n_slots)?)
.ro(ids, n_q * cap * 4)?
.ro(steps, n_q * STEP_BYTES)?
.i32(i32_of(n_q)?)
.i32(i32_of(cap)?)
.i32(shape.page_size as i32)
.finish(experimental::STREAM_RESOLVE_GRID)?;
let mut copy = self
.call(STREAM_COPY)
.rw(&*map.ctl, CTL_INTS as u64 * 4)?
.rw(&*map.miss_block, n_slots * 4)?
.rw(&*map.miss_slot, n_slots * 4)?;
for i in 0..4 {
copy = match (host.get(i), runs.get(i)) {
(Some(h), Some(run)) => copy.ro(h, n_blocks * run.1)?,
_ => copy.null(),
};
}
for i in 0..4 {
copy = match (slots.get(i), runs.get(i)) {
(Some(s), Some(run)) => copy.rw(s, n_slots * run.1)?,
_ => copy.null(),
};
}
for i in 0..4 {
copy = copy.i32(runs.get(i).map_or(0, |r| r.1 as i32));
}
let copy = copy
.i32(runs.len() as i32)
.finish(experimental::STREAM_COPY_GRID)?;
self.run(vec![resolve, copy])
}
/// `kv_ring_table`: the ring layout's fixed block -> slot table (`block % n_slots`).
pub fn ring_table(
&self,
table: &mut DeviceBuffer<'_>,
n_blocks: u64,
n_slots: u64,
) -> Result<()> {
self.expect(Program::KvStream)?;
if n_blocks == 0 || n_slots == 0 {
return invalid("kv ring: empty table");
}
let launch = self
.call(RING_TABLE)
.rw(table, n_blocks * 4)?
.i64(i64_of(n_blocks)?)
.i64(i64_of(n_slots)?)
.finish(experimental::RING_TABLE_GRID)?;
self.run(vec![launch])
}
/// `leleka_kv_copy_u4`: grid-stride copy of `n_u4` 16-byte units (stands in for `cudaMemcpyAsync` in
/// `kv_ring_restore` / `kv_stage_from_host`; `src` and `dst` must not overlap).
pub fn copy_u4(
&self,
src: &DeviceBuffer<'_>,
dst: &mut DeviceBuffer<'_>,
n_u4: u64,
) -> Result<()> {
self.expect(Program::KvStream)?;
let grid = experimental::copy_u4_grid(n_u4)?;
let launch = self
.call(COPY_U4)
.ro(src, n_u4 * 16)?
.rw(dst, n_u4 * 16)?
.i64(i64_of(n_u4)?)
.finish(grid)?;
self.run(vec![launch])
}
// ------------------------------------------------------------------------------------- keyless
/// `keyless_route_query`: rotate each head's query through its routing matrix (`[heads][256][256]` f32)
/// in place; `q` is `[token][head][256]`.
pub fn keyless_route_query(
&self,
q: &mut DeviceBuffer<'_>,
matrices: &DeviceBuffer<'_>,
tokens: u64,
heads: u64,
) -> Result<()> {
self.expect(Program::Keyless)?;
let grid = experimental::keyless_grid(tokens, heads)?;
let launch = self
.call(KEYLESS_ROUTE)
.rw(q, tokens * heads * 256 * 4)?
.ro(matrices, experimental::keyless_matrices_bytes(heads))?
.i32(i32_of(heads)?)
.finish(grid)?;
self.run(vec![launch])
}
// --------------------------------------------------------------------------------------- cvec
/// `cvec_apply` on `tokens` residual rows of `hc` streams of `n_embd`: `mode` 0 projects the direction out,
/// 1 adds it; an optional pending FFN write `(bo, bo_ld, inj, inj_ld)` is folded in first.
#[allow(clippy::too_many_arguments)] // closed ABI operands
pub fn cvec_apply(
&self,
r: &mut DeviceBuffer<'_>,
dir: &DeviceBuffer<'_>,
s_l: &DeviceBuffer<'_>,
on: &DeviceBuffer<'_>,
mode: leleka_experimental_ref::cvec::CvecMode,
layer: u64,
n_layers: u64,
n_embd: u64,
hc: u64,
tokens: u64,
r_ld: u64,
pending: Option<(&DeviceBuffer<'_>, u64, &DeviceBuffer<'_>, u64)>,
) -> Result<()> {
self.expect(Program::Cvec)?;
let grid = experimental::cvec_grid(hc, tokens, n_embd)?;
if layer >= n_layers || r_ld < hc * n_embd {
return invalid("control vector: layer or row stride out of range");
}
let rows = |ld: u64, width: u64| (tokens - 1) * ld + width;
let mut c = self
.call(CVEC_APPLY)
.rw(r, rows(r_ld, hc * n_embd) * 4)?
.ro(dir, n_layers * n_embd * 4)?
.ro(s_l, n_layers * 4)?
.ro(on, 4)?
.i32(mode as i32)
.i64(i64_of(layer)?)
.i32(i32_of(n_embd)?)
.i32(i32_of(hc)?)
.i64(i64_of(r_ld)?);
match pending {
Some((bo, bo_ld, inj, inj_ld)) => {
if bo_ld < n_embd || inj_ld < hc {
return invalid("control vector: pending-write strides are too small");
}
c = c.ro(bo, rows(bo_ld, n_embd) * 4)?.i64(i64_of(bo_ld)?);
c = c.ro(inj, rows(inj_ld, hc) * 4)?.i64(i64_of(inj_ld)?);
}
None => c = c.null().i64(0).null().i64(0),
}
let launch = c.i32(i32::from(pending.is_some())).finish(grid)?;
self.run(vec![launch])
}
// ------------------------------------------------------------------------------------ attention
/// `qsa_decode_attn_batch` for the experimental KV modes: the chunk kernel of `pools`' mode, then the merge,
/// under one drain. `scratch` holds `n_q * attn_scratch_floats(cap)` floats; the three partial buffers are
/// carved from it exactly as the Original's wrapper does.
#[allow(clippy::too_many_arguments)] // closed ABI operands
pub fn attend(
&self,
p: &Paged,
pools: &AttnPools<'_, '_>,
q: &DeviceBuffer<'_>,
table: &DeviceBuffer<'_>,
ids: &DeviceBuffer<'_>,
steps: &DeviceBuffer<'_>,
cap: u64,
n_q: u64,
scratch: &mut DeviceBuffer<'_>,
out: &mut DeviceBuffer<'_>,
) -> Result<()> {
self.expect(Program::QsaAttn)?;
let chunk_grid = experimental::attn_chunk_grid(cap, &p.shape, n_q)?;
let merge_grid = experimental::attn_merge_grid(&p.shape, n_q)?;
let n_chunks = chunk_grid[0] as u64;
let n_head = p.shape.n_head() as u64;
let stride = experimental::attn_scratch_floats(cap, &p.shape);
let m_offset = n_chunks * n_head * attn::HD as u64 * 4;
let l_offset = m_offset + n_chunks * n_head * 4;
let q_bytes = n_q * n_head * attn::HD as u64 * 4;
let (kv, ps) = (p.shape.kv_heads as i32, p.shape.page_size as i32);
let table_bytes = p.table_entries * 4;
let mut chunk = match pools {
AttnPools::Q4 { k_q4, v_q4 } => self
.call(ATTN_CHUNK_M2)
.ro(q, q_bytes)?
.ro(k_q4, p.shape.q4_bytes(p.pages))?
.ro(v_q4, p.shape.q4_bytes(p.pages))?
.ro(table, table_bytes)?
.ro(ids, n_q * cap * 4)?
.ro(steps, n_q * STEP_BYTES)?
.i32(kv)
.i32(ps),
AttnPools::K8V4 { k_q, k_scale, v_q4 } => self
.call(ATTN_CHUNK_M3)
.ro(q, q_bytes)?
.ro(k_q, p.shape.q8_code_bytes(p.pages))?
.ro(k_scale, p.shape.q8_scale_bytes(p.pages))?
.ro(v_q4, p.shape.q4_bytes(p.pages))?
.ro(table, table_bytes)?
.ro(ids, n_q * cap * 4)?
.ro(steps, n_q * STEP_BYTES)?
.i32(kv)
.i32(ps),
AttnPools::Keyless {
v_q,
v_scale,
cos,
sin,
mrope,
} => {
let n_rot = leleka_experimental_ref::keyless::N_ROT as u64;
let c = self
.call(ATTN_CHUNK_M4)
.ro(q, q_bytes)?
.ro(v_q, p.shape.q8_code_bytes(p.pages))?
.ro(v_scale, p.shape.q8_scale_bytes(p.pages))?
.ro(table, table_bytes)?
.ro(cos, 4)?
.ro(sin, 4)?;
let c = match mrope {
Some(m) => c.ro(m, 4)?,
None => c.null(),
};
c.i32(n_rot as i32)
.ro(ids, n_q * cap * 4)?
.ro(steps, n_q * STEP_BYTES)?
.i32(kv)
.i32(ps)
}
};
let scratch_bytes = n_q * stride * 4;
chunk = chunk
.rw_at(scratch, scratch_bytes, 0)?
.rw_at(scratch, scratch_bytes, m_offset)?
.rw_at(scratch, scratch_bytes, l_offset)?
.i32(i32_of(n_chunks)?)
.i32(i32_of(cap)?)
.i64(i64_of(stride)?);
let chunk = chunk.finish(chunk_grid)?;
let merge = self
.call(ATTN_MERGE)
.ro_at(scratch, scratch_bytes, 0)?
.ro_at(scratch, scratch_bytes, m_offset)?
.ro_at(scratch, scratch_bytes, l_offset)?
.i32(i32_of(n_chunks)?)
.rw(out, q_bytes)?
.i64(i64_of(stride)?)
.finish(merge_grid)?;
self.run(vec![chunk, merge])
}
}
/// The residency-map buffers of one streamed layer (`KvStreamMap`): all device ints.
pub struct StreamMap<'b, 'c> {
pub page_table: &'b mut DeviceBuffer<'c>,
pub slot_block: &'b mut DeviceBuffer<'c>,
pub slot_stamp: &'b mut DeviceBuffer<'c>,
pub slot_ref: &'b mut DeviceBuffer<'c>,
pub ctl: &'b mut DeviceBuffer<'c>,
pub miss_block: &'b mut DeviceBuffer<'c>,
pub miss_slot: &'b mut DeviceBuffer<'c>,
}
impl StreamMap<'_, '_> {
/// The first five (or seven, for resolve) pointer arguments of `reset` / `resolve`.
fn bind<'g, 'c>(
&self,
c: Call<'g, 'c>,
n_blocks: u64,
n_slots: u64,
with_miss: bool,
) -> Result<Call<'g, 'c>> {
let mut c = c
.rw(&*self.page_table, n_blocks * 4)?
.rw(&*self.slot_block, n_slots * 4)?
.rw(&*self.slot_stamp, n_slots * 4)?
.rw(&*self.slot_ref, n_slots * 4)?
.rw(&*self.ctl, CTL_INTS as u64 * 4)?;
if with_miss {
c = c
.rw(&*self.miss_block, n_slots * 4)?
.rw(&*self.miss_slot, n_slots * 4)?;
}
Ok(c)
}
}
/// The pool arrays an experimental attention mode reads.
pub enum AttnPools<'b, 'c> {
/// Mode 2: Q4_0 keys and values.
Q4 {
k_q4: &'b DeviceBuffer<'c>,
v_q4: &'b DeviceBuffer<'c>,
},
/// Mode 3: INT8 keys, Q4_0 values.
K8V4 {
k_q: &'b DeviceBuffer<'c>,
k_scale: &'b DeviceBuffer<'c>,
v_q4: &'b DeviceBuffer<'c>,
},
/// Mode 4: V-only INT8; keys rebuilt by RoPE from the value rows (cos/sin `[cell][32]`, optional M-RoPE
/// positions `[cell][3]`).
Keyless {
v_q: &'b DeviceBuffer<'c>,
v_scale: &'b DeviceBuffer<'c>,
cos: &'b DeviceBuffer<'c>,
sin: &'b DeviceBuffer<'c>,
mrope: Option<&'b DeviceBuffer<'c>>,
},
}
// ------------------------------------------------------------------------------------- launch builder
/// Builds one launch: every pointer is admitted as it is added, scalars are typed, and `finish` checks the
/// recorded kinds against the entry's fixed signature before anything can reach the driver.
struct Call<'g, 'c> {
gpu: &'g Experimental<'c>,
entry: usize,
args: Vec<ffi::KarArgument>,
kinds: Vec<Arg>,
admitted: Vec<Admitted>,
}
impl Call<'_, '_> {
fn pointer(
mut self,
buffer: &DeviceBuffer<'_>,
min: u64,
offset: u64,
writes: bool,
) -> Result<Self> {
let context = self.gpu.context;
if context.poisoned.get() {
return Err(Error::ContextPoisoned.into());
}
if !std::ptr::eq(context, buffer.context) {
return Err(Error::ContextMismatch.into());
}
let handle = buffer.handle.ok_or(Error::ContextPoisoned)?;
let min =
usize::try_from(min).or_else(|_| invalid("experimental buffer size exceeds usize"))?;
if min == 0 || buffer.bytes < min {
return invalid("experimental buffer is smaller than the geometry requires");
}
handle.validate_projection_extent(buffer.bytes, 16)?;
self.admitted.push(Admitted {
handle,
bytes: buffer.bytes,
writes,
});
let at = handle.experimental_offset(offset)?;
self.args
.push(ffi::KarArgument::Scalar64(at.qwen_address()));
self.kinds.push(Arg::Ptr);
Ok(self)
}
fn ro(self, buffer: &DeviceBuffer<'_>, min: u64) -> Result<Self> {
self.pointer(buffer, min, 0, false)
}
fn rw(self, buffer: &DeviceBuffer<'_>, min: u64) -> Result<Self> {
self.pointer(buffer, min, 0, true)
}
fn ro_at(self, buffer: &DeviceBuffer<'_>, min: u64, offset: u64) -> Result<Self> {
self.pointer(buffer, min, offset, false)
}
fn rw_at(self, buffer: &DeviceBuffer<'_>, min: u64, offset: u64) -> Result<Self> {
self.pointer(buffer, min, offset, true)
}
fn null(mut self) -> Self {
self.args.push(ffi::KarArgument::Scalar64(0));
self.kinds.push(Arg::PtrOpt);
self
}
fn i32(mut self, value: i32) -> Self {
// The bit pattern of a two's-complement i32 in the low four bytes of the slot.
self.args.push(ffi::KarArgument::Scalar(value as u32));
self.kinds.push(Arg::I32);
self
}
fn i64(mut self, value: i64) -> Self {
self.args.push(ffi::KarArgument::Scalar64(value as u64));
self.kinds.push(Arg::I64);
self
}
fn finish(self, grid: [u32; 3]) -> Result<Launch> {
let entry: &Entry = &self.gpu.program.entries()[self.entry];
let matches = entry.args.len() == self.kinds.len()
&& entry
.args
.iter()
.zip(&self.kinds)
.all(|(want, got)| match (want, got) {
(Arg::PtrOpt, Arg::Ptr | Arg::PtrOpt) => true,
(a, b) => a == b,
});
if !matches {
return invalid(
"experimental launch arguments differ from the entry's fixed signature",
);
}
for (i, a) in self.admitted.iter().enumerate() {
for b in &self.admitted[i + 1..] {
// The same allocation admitted twice (attention scratch) is one buffer, not an alias.
if (a.writes || b.writes)
&& !(a.handle == b.handle && a.bytes == b.bytes)
&& a.handle.overlaps(a.bytes, b.handle, b.bytes)
{
return Err(Error::OutputAliasesInput.into());
}
}
}
let function = self.gpu.loaded.functions[self.entry].ok_or(ExperimentalError::Invalid(
"experimental entry is not loaded",
))?;
Ok(Launch {
function,
grid,
block: entry.block,
args: ffi::KarLevelsArgs::new(&self.args)?,
})
}
}
/// A primary driver failure plus the outcome of the mandatory context restore.
fn failure(primary: Error, restore: DriverResult<()>) -> ExperimentalError {
combine::<()>(Err(primary), restore)
.expect_err("a primary failure always stays an error")
.into()
}
@@ -0,0 +1,324 @@
//! Root-only GPU smokes for the EXPERIMENTAL closed programs. Compiled only on Linux x86_64 with
//! `cuda-driver`; ignored by default because they need the compiled PTX, frozen pins and an RTX-class device.
//! Each compares the device with the CPU reference of `leleka-experimental-ref` (which is itself checked
//! bit-for-bit against the Original's host code and an emulation of the literal `.cu` text).
//!
//! Run (after TODO-ROOT: build the six PTX files and freeze `experimental::PINS`):
//! cargo test -p leleka-cuda-driver --features cuda-driver -- --ignored experimental_gpu
use super::experimental::{KvShape, Mode, OptIn, Program};
use super::experimental_gpu::{Experimental, Paged, StreamMap};
use super::{Context, DeviceBuffer, Driver};
use leleka_experimental_ref::{
cache::{PoolSet, append_cell, gather_q4},
fwht::fwht256,
keyless,
kv_stream::{CTL_INTS, StreamMap as CpuMap},
layout::{KvFormat, QsaShapes, StreamFormat, stream_runs},
q4_0::Contraction,
};
struct Rng(u64);
impl Rng {
fn next(&mut self) -> u32 {
self.0 = self
.0
.wrapping_mul(6364136223846793005)
.wrapping_add(1442695040888963407);
(self.0 >> 32) as u32
}
fn unit(&mut self) -> f32 {
((self.next() >> 8) as i32 - (1 << 23)) as f32 * (1.0 / 8_388_608.0)
}
}
fn f32_bytes(v: &[f32]) -> Vec<u8> {
v.iter().flat_map(|x| x.to_le_bytes()).collect()
}
fn i32_bytes(v: &[i32]) -> Vec<u8> {
v.iter().flat_map(|x| x.to_le_bytes()).collect()
}
fn upload<'c>(ctx: &'c Context<'c>, bytes: &[u8]) -> DeviceBuffer<'c> {
let mut b = ctx.allocate(bytes.len().max(16)).unwrap();
if bytes.len() >= 16 {
b.copy_from(bytes).unwrap();
} else {
let mut padded = bytes.to_vec();
padded.resize(16, 0);
b.copy_from(&padded).unwrap();
}
b
}
fn zeroed<'c>(ctx: &'c Context<'c>, bytes: usize) -> DeviceBuffer<'c> {
upload(ctx, &vec![0u8; bytes.max(16)])
}
fn download(b: &DeviceBuffer<'_>, len: usize) -> Vec<u8> {
let mut all = vec![0u8; b.len()];
b.copy_to(&mut all).unwrap();
all.truncate(len);
all
}
fn open<'c>(ctx: &'c Context<'c>, program: Program, mode: Mode) -> Experimental<'c> {
Experimental::open(ctx, program, &OptIn::default().with(mode)).unwrap_or_else(|error| {
panic!(
"{} open failed ({error}); TODO-ROOT: build PTX and freeze the pin",
program.name()
)
})
}
#[test]
#[ignore = "Root schedules the first experimental GPU gate after nvcc build and pin freeze"]
fn experimental_gpu_fwht256_matches_cpu() {
let driver = Driver::load().unwrap();
let ctx = driver.device(0).unwrap().create_context(256 << 20).unwrap();
{
let gpu = open(&ctx, Program::KvQ4, Mode::KvQ40);
let mut rng = Rng(0x57a7_0001);
let rows = 7usize;
let src: Vec<f32> = (0..rows * 256).map(|_| rng.unit()).collect();
let (src_b, mut dst_b) = (upload(&ctx, &f32_bytes(&src)), zeroed(&ctx, rows * 1024));
gpu.fwht256(&src_b, &mut dst_b, rows as u64).unwrap();
let got = download(&dst_b, rows * 1024);
let mut worst = 0f32;
for r in 0..rows {
let mut want = [0f32; 256];
fwht256(src[r * 256..(r + 1) * 256].try_into().unwrap(), &mut want);
for (i, w) in want.iter().enumerate() {
let g = f32::from_le_bytes(got[(r * 256 + i) * 4..][..4].try_into().unwrap());
worst = worst.max((g - w).abs());
}
}
assert!(worst <= 1e-6, "worst abs error {worst}");
println!("EXPERIMENTAL fwht256 rows={rows} worst_abs_error={worst}");
gpu.close().unwrap();
}
ctx.close().unwrap();
}
#[test]
#[ignore = "Root schedules the first experimental GPU gate after nvcc build and pin freeze"]
fn experimental_gpu_q4_append_and_gather_match_cpu() {
let driver = Driver::load().unwrap();
let ctx = driver.device(0).unwrap().create_context(256 << 20).unwrap();
{
let gpu = open(&ctx, Program::KvQ4, Mode::KvQ40);
let q = QsaShapes::real();
let p = Paged {
shape: KvShape::real(),
pages: 4,
table_entries: 4,
};
let table: Vec<i32> = vec![0, 1, 2, 3];
let mut rng = Rng(0x57a7_0002);
let n = 2 * 256;
let mut cpu = PoolSet::new(KvFormat::Q4_0, &q, p.shape.rows(p.pages)).unwrap();
let mut cells = Vec::new();
let (mut k_b, mut v_b) = (
zeroed(&ctx, p.shape.q4_bytes(4) as usize),
zeroed(&ctx, p.shape.q4_bytes(4) as usize),
);
let (table_b, ids_b) = (
upload(&ctx, &i32_bytes(&table)),
upload(&ctx, &i32_bytes(&[0, 3, 5, 7, 9, 12])),
);
for pos in 0..13i32 {
let kc: Vec<f32> = (0..n).map(|_| rng.unit()).collect();
let vc: Vec<f32> = (0..n).map(|_| rng.unit()).collect();
let step = upload(&ctx, &i32_bytes(&[pos, 0, 0, 0]));
let (kb, vb) = (upload(&ctx, &f32_bytes(&kc)), upload(&ctx, &f32_bytes(&vc)));
gpu.q4_append_step(&p, &mut k_b, &mut v_b, &table_b, &step, &kb, &vb)
.unwrap();
cells.push((pos, kc, vc));
}
let got_k = download(&k_b, p.shape.q4_bytes(4) as usize);
let got_v = download(&v_b, p.shape.q4_bytes(4) as usize);
// nvcc contracts a*b+c; the Fused model is the expectation, Separate the fallback we report.
let mut which = "none";
for (name, c) in [
("fused", Contraction::Fused),
("separate", Contraction::Separate),
] {
let mut m = PoolSet::new(KvFormat::Q4_0, &q, p.shape.rows(p.pages)).unwrap();
for (pos, kc, vc) in &cells {
append_cell(
KvFormat::Q4_0,
&mut m,
None,
&table,
i64::from(*pos),
kc,
vc,
&q,
c,
)
.unwrap();
}
if m.k_q4 == got_k && m.v_q4 == got_v {
which = name;
cpu = m;
break;
}
}
assert_ne!(
which, "none",
"device Q4_0 pools differ from both contraction models"
);
println!("EXPERIMENTAL q4_append cells=13 matches={which}");
// gather
let ids = [0, 3, 5, 7, 9, 12];
let step = upload(&ctx, &i32_bytes(&[0, 13, 0, 6]));
let scratch = p.shape.gather_scratch_bytes(6) as usize;
let (mut ks, mut vs) = (zeroed(&ctx, scratch), zeroed(&ctx, scratch));
gpu.q4_gather_step(&p, &k_b, &v_b, &table_b, &ids_b, &step, 6, &mut ks, &mut vs)
.unwrap();
let want_k = gather_q4(&cpu.k_q4, &table, &ids, &q).unwrap();
let got: Vec<u16> = download(&ks, scratch)
.chunks(2)
.map(|b| u16::from_le_bytes([b[0], b[1]]))
.collect();
assert_eq!(got, want_k, "gathered fp16 K bits");
gpu.close().unwrap();
}
ctx.close().unwrap();
}
#[test]
#[ignore = "Root schedules the first experimental GPU gate after nvcc build and pin freeze"]
fn experimental_gpu_keyless_route_matches_cpu() {
let driver = Driver::load().unwrap();
let ctx = driver.device(0).unwrap().create_context(256 << 20).unwrap();
{
let gpu = open(&ctx, Program::Keyless, Mode::KeylessVOnly);
let mut rng = Rng(0x57a7_0003);
let (tokens, heads) = (3usize, 4usize);
let q0: Vec<f32> = (0..tokens * heads * 256).map(|_| rng.unit()).collect();
let m: Vec<f32> = (0..heads * 256 * 256).map(|_| rng.unit() * 0.1).collect();
let (mut q_b, m_b) = (upload(&ctx, &f32_bytes(&q0)), upload(&ctx, &f32_bytes(&m)));
gpu.keyless_route_query(&mut q_b, &m_b, tokens as u64, heads as u64)
.unwrap();
let mut want = q0.clone();
keyless::route_query(&mut want, &m, tokens, heads).unwrap();
let got = download(&q_b, want.len() * 4);
let mismatches = want
.iter()
.enumerate()
.filter(|(i, w)| got[i * 4..i * 4 + 4] != w.to_le_bytes())
.count();
assert_eq!(mismatches, 0, "fmaf-ordered routing is bit-exact");
println!("EXPERIMENTAL keyless_route tokens={tokens} heads={heads} mismatches=0");
gpu.close().unwrap();
}
ctx.close().unwrap();
}
#[test]
#[ignore = "Root schedules the first experimental GPU gate after nvcc build and pin freeze"]
fn experimental_gpu_stream_resolve_copies_missed_blocks() {
let driver = Driver::load().unwrap();
let ctx = driver.device(0).unwrap().create_context(512 << 20).unwrap();
{
let gpu = open(&ctx, Program::KvStream, Mode::KvStreamed);
let shape = KvShape::real();
let q = QsaShapes::real();
let (n_blocks, n_slots, n_q, cap) = (4096u64, 1024u64, 2u64, 64u64);
let runs = stream_runs(&q, StreamFormat::F16);
let mut rng = Rng(0x57a7_0004);
let host_bytes: Vec<Vec<u8>> = runs
.iter()
.map(|(_, len)| (0..n_blocks * len).map(|_| rng.next() as u8).collect())
.collect();
let host: Vec<DeviceBuffer<'_>> = host_bytes.iter().map(|b| upload(&ctx, b)).collect();
let mut slots: Vec<DeviceBuffer<'_>> = runs
.iter()
.map(|(_, len)| zeroed(&ctx, (n_slots * len) as usize))
.collect();
let mut page_table = upload(&ctx, &i32_bytes(&vec![-1; n_blocks as usize]));
let mut slot_block = zeroed(&ctx, n_slots as usize * 4);
let mut slot_stamp = zeroed(&ctx, n_slots as usize * 4);
let mut slot_ref = zeroed(&ctx, n_slots as usize * 4);
let mut ctl = zeroed(&ctx, CTL_INTS * 4);
let mut miss_block = zeroed(&ctx, n_slots as usize * 4);
let mut miss_slot = zeroed(&ctx, n_slots as usize * 4);
let mut map = StreamMap {
page_table: &mut page_table,
slot_block: &mut slot_block,
slot_stamp: &mut slot_stamp,
slot_ref: &mut slot_ref,
ctl: &mut ctl,
miss_block: &mut miss_block,
miss_slot: &mut miss_slot,
};
gpu.stream_reset(&mut map, n_blocks, n_slots).unwrap();
// two queries, ascending cell ids; a cell is page_size = 4 per block
let width = cap as i32;
let mut ids = Vec::new();
let mut steps = Vec::new();
for qi in 0..n_q as i32 {
ids.extend((0..cap as i32).map(|i| i * 4 + qi * 8));
steps.extend([cap as i32 * 4, 0, 0, width]);
}
let (ids_b, steps_b) = (
upload(&ctx, &i32_bytes(&ids)),
upload(&ctx, &i32_bytes(&steps)),
);
let host_refs: Vec<&DeviceBuffer<'_>> = host.iter().collect();
let mut slot_refs: Vec<&mut DeviceBuffer<'_>> = slots.iter_mut().collect();
gpu.stream_resolve(
&mut map,
StreamFormat::F16,
&shape,
n_blocks,
n_slots,
&ids_b,
&steps_b,
n_q,
cap,
&host_refs,
&mut slot_refs,
)
.unwrap();
// CPU model: same distinct blocks, so the same miss count and a consistent residency map
let mut cpu = CpuMap::new(n_blocks as usize, n_slots as usize);
let report = cpu
.resolve(
&ids,
&steps,
n_q as usize,
cap as usize,
4,
&leleka_experimental_ref::kv_stream::MissOrder::Canonical,
)
.expect("cpu resolve");
let _ = report;
let table = download(&*map.page_table, n_blocks as usize * 4);
let table: Vec<i32> = table
.chunks(4)
.map(|b| i32::from_le_bytes(b.try_into().unwrap()))
.collect();
let resident: Vec<usize> = (0..n_blocks as usize).filter(|b| table[*b] >= 0).collect();
assert_eq!(
resident.len(),
cpu.resident_blocks(),
"same set of distinct blocks resident"
);
for b in resident {
let slot = table[b] as usize;
for (i, (_, len)) in runs.iter().enumerate() {
let len = *len as usize;
let got = download(&slots[i], (n_slots as usize) * len);
assert_eq!(
&got[slot * len..(slot + 1) * len],
&host_bytes[i][b * len..(b + 1) * len],
"block {b} array {i}"
);
}
}
println!(
"EXPERIMENTAL kv_stream resolve+copy resident={}",
cpu.resident_blocks()
);
gpu.close().unwrap();
}
ctx.close().unwrap();
}
@@ -0,0 +1,38 @@
// Offline compilation source; not a runtime/toolkit dependency.
// EXPERIMENTAL keyless query routing (`STRATA_KEYLESS_ROUTING`, charter G7 / STRA-11): each query head's 256-wide
// query is multiplied in place by that head's explicit 256x256 routing matrix (output-major rows), so attention
// scores can be taken against the rotated V cache and no K is stored. The pretrained-model retrofit FAILED its
// model-quality gate (docs/keyless-runtime.md): this is an unqualified experiment, off by default, and the driver
// refuses the program without an explicit ExperimentalOptIn (experimental.rs).
//
// LITERAL PORT of engine/strata/src/kernels/cuda/keyless.cu: the kernel BODY is byte-identical to the Original's
// (experimental_attn.rs::literal_bodies_match_the_original). Edits: `__global__ route_kernel` became the
// `__device__ route_kernel_body` function called by the `extern "C" __global__` entry; the host wrapper
// `keyless_route_query` (argument checks and launch geometry) is Rust.
//
// Entry (grid / block): leleka_keyless_route_query tokens * heads / 256
//
// STATUS: NOT COMPILED OR RUN (no nvcc here). PTX pin is zero until Root freezes it. Intended offline compile:
// nvcc 12.8.93 -ptx -O3 -arch=sm_120, precise math (the Original builds keyless.cu with default flags).
#include <cstddef>
#include <cstdint>
namespace {
__device__ __forceinline__ void route_kernel_body(float* q, const float* matrices, int heads) {
__shared__ float row[256];
const int d = threadIdx.x, h = blockIdx.x % heads;
float* query = q + (size_t)blockIdx.x * 256;
row[d] = query[d];
__syncthreads();
const float* weight = matrices + ((size_t)h * 256 + d) * 256;
float sum = 0;
for (int i = 0; i < 256; ++i) sum = fmaf(row[i], weight[i], sum);
query[d] = sum;
}
} // namespace
extern "C" __global__ void __launch_bounds__(256) leleka_keyless_route_query(float* q, const float* matrices, int heads) {
route_kernel_body(q, matrices, heads);
}
@@ -0,0 +1,9 @@
//
// PLACEHOLDER - NOT GENERATED PTX.
// TODO-ROOT: compile experimental_keyless.cu offline with the pinned toolchain
// nvcc 12.8.93 -std=c++17 -O3 -ptx -arch=sm_120 experimental_keyless.cu -o experimental_keyless.ptx
// (precise math: no --use_fast_math; see docs/cuda-seal-plan-additions-experimental.json) then freeze the source
// and PTX SHA-256 values in the matching pin of experimental.rs after the Root GPU smoke passes.
// The driver refuses this asset while the pin is zero, and this text defines no kernel entry, so it can never be
// mistaken for a qualified executable. EXPERIMENTAL: the program is only reachable through an explicit opt-in.
//
@@ -0,0 +1,325 @@
// Offline compilation source; not a runtime/toolkit dependency.
// EXPERIMENTAL, LOSSY: Q4_0 KV cache kernels (`--kv q4_0`, hybrid `--kv k8v4`'s V half) and the orthonormal
// 256-point Walsh-Hadamard transform they rely on. Off by default; the driver refuses to open this program
// without an explicit ExperimentalOptIn for a mode that needs it (experimental.rs).
//
// LITERAL PORT of engine/strata/src/kernels/cuda/kv_q4.cu (Original, PR #21). Every kernel BODY below is
// byte-identical to the Original's (experimental_kv.rs::literal_bodies_match_the_original compares them).
// The only edits:
// 1. each `__global__` kernel became a `__device__ ..._body` function with the same parameters, called by
// an `extern "C" __global__` entry with a flat pointer/integer ABI (`KvHostPools` is rebuilt from
// pointers inside the entry; fwht256's scale is the host wrapper's constant 1/16);
// 2. the host wrappers' launch geometry, `need_256` and `check` live in Rust (experimental_kv.rs);
// 3. KvHostPools, block_q4_0, f16_from_f32 and f32_from_f16 are copied from the Original headers.
//
// Entries (grid / block):
// leleka_fwht256_f32 ceil(rows / 4) / (32, 4)
// leleka_kv_append_q4_step (n_head_kv, head_dim / 32, 2) / 32
// leleka_kv_append_q4_batch (T, n_head_kv, head_dim / 32) twice, is_v = 0 then 1 / 32
// leleka_kv_gather_q4_step ceil(max_ids * n_head_kv * (head_dim / 32) / 4) / (32, 4)
//
// STATUS: NOT COMPILED OR RUN. There is no nvcc on the authoring host. The PTX pin in experimental.rs is zero
// until Root compiles this file with the pinned toolchain and freezes its digests. Intended offline compile
// (docs/cuda-seal-plan-additions-experimental.json): nvcc 12.8.93 -ptx -O3 -arch=sm_120, precise math (no
// --use_fast_math; the Original compiles kv_q4.cu with the default flags).
#include <cstdint>
#include <cstring>
#define STRATA_HD __host__ __device__
namespace strata {
namespace kernels {
enum QsaStep : int {
kStepPos = 0, // the new cell's sequence position
kStepNKv = 1,
kStepNBid = 2,
kStepWidth = 3, // how many cells the selection returns
kStepCount = 4,
};
struct KvHostPools {
uint16_t* k_pool = nullptr; ///< fp16 mode
uint16_t* v_pool = nullptr;
int8_t* k_q = nullptr; ///< int8 mode: codes
int8_t* v_q = nullptr;
uint16_t* k_scale = nullptr; ///< int8 mode: fp16 scale per 64 values
uint16_t* v_scale = nullptr;
uint8_t* k_q4 = nullptr; ///< q4_0 mode (kv_q4.hpp): block_q4_0 codes, 144 B per cell and head
uint8_t* v_q4 = nullptr;
bool present() const { return k_pool != nullptr || k_q != nullptr || k_q4 != nullptr || v_q != nullptr; }
};
inline constexpr int QK4_0 = 32;
#pragma pack(push, 1)
struct block_q4_0 {
uint16_t d; // scale (fp16 bits)
uint8_t qs[QK4_0 / 2]; // 32 4-bit codes: element j in the low nibble of qs[j], j + 16 in the high one
};
#pragma pack(pop)
static_assert(sizeof(block_q4_0) == 18, "block_q4_0 must be 18 bytes");
/// Round-to-nearest-even f32 -> fp16, returned as raw bits.
STRATA_HD inline uint16_t f16_from_f32(float f) {
uint32_t x;
#if defined(__HIP_DEVICE_COMPILE__)
__builtin_memcpy(&x, &f, 4);
#else
std::memcpy(&x, &f, 4);
#endif
const uint32_t sign = (x >> 16) & 0x8000u;
const uint32_t rawexp = (x >> 23) & 0xFFu;
int exp = (int) rawexp - 127 + 15;
uint32_t man = x & 0x7FFFFFu;
// TWO different things reach here and they must not be conflated: an f32 inf/NaN (raw exponent 255) stays
// an inf/NaN, and a FINITE value too large for fp16 (1e30) SATURATES TO INF. The version of this function
// in quantize_act.cu and shared_expert.cu tests `if (exp >= 31) return sign | 0x7C00 | (man ? 0x200 : 0)`
// and therefore returns a NaN for every overflowing finite value - which their own fixtures cannot see,
// because all of their values are O(1). Round 198's numpy oracle caught it here on the first run (1e30,
// 65536, 1e45: numpy says inf, the conflated test said NaN).
if (rawexp == 0xFFu) return (uint16_t) (sign | 0x7C00u | (man ? 0x200u : 0u)); // inf, or a quiet/NaN
if (exp >= 31) return (uint16_t) (sign | 0x7C00u); // finite overflow -> inf
if (exp <= 0) {
if (exp < -10) return (uint16_t) sign; // underflows to a signed zero
man |= 0x800000u; // restore the implicit 1
const uint32_t sh = (uint32_t) (14 - exp);
uint32_t h = (man >> sh) & 0x3FFu;
const uint32_t rem = man & ((1u << sh) - 1u);
if (rem > (1u << (sh - 1)) || (rem == (1u << (sh - 1)) && (h & 1u))) ++h;
return (uint16_t) (sign | h);
}
uint16_t h = (uint16_t) (sign | ((uint32_t) exp << 10) | (man >> 13));
const uint32_t rem = man & 0x1FFFu;
if (rem > 0x1000u || (rem == 0x1000u && (h & 1u))) ++h; // the carry may bump the exponent
return h;
}
/// Exact fp16 bits -> f32. No rounding, no exceptions: every one of the 65,536 inputs maps to a value f32
/// represents exactly, including the subnormals (which is why the `ex == 0` case cannot be skipped).
STRATA_HD inline float f32_from_f16(uint16_t h) {
const uint32_t sign = (uint32_t) (h & 0x8000u) << 16;
const uint32_t ex = (h >> 10) & 0x1Fu, man = h & 0x3FFu;
uint32_t out;
if (ex == 0) {
// Subnormal or zero. The value is `man * 2^-24`, so after `s` left shifts the leading 1 reaches bit
// 10 and the value is `(1 + frac) * 2^(-14-s)`: the f32 exponent field is 113 - s and `frac` is the low
// ten bits. Flushing these to zero - which the two private copies of this function in the tree do -
// maps 0x0001 to 0.0 instead of 2^-24, a 100% relative error on any KL-quant scale that lands here.
if (man == 0) {
out = sign;
} else {
uint32_t m = man;
int s = 0;
while ((m & 0x400u) == 0) { m <<= 1; ++s; }
out = sign | ((uint32_t) (113 - s) << 23) | ((m & 0x3FFu) << 13);
}
} else if (ex == 31) {
out = sign | 0x7F800000u | (man << 13);
} else {
out = sign | ((ex - 15 + 127) << 23) | (man << 13);
}
float f;
#if defined(__HIP_DEVICE_COMPILE__)
__builtin_memcpy(&f, &out, 4);
#else
std::memcpy(&f, &out, 4);
#endif
return f;
}
namespace {
// Fast Walsh-Hadamard Transform for N = 256: one warp per row, 8 values per lane in registers.
// Orthonormal (scale 1/sqrt(256) = 1/16), so it is its own inverse.
__device__ __forceinline__ void fwht256_kernel_body(const float* __restrict__ src, float* __restrict__ dst, int64_t n_rows, float scale) {
constexpr int warp_size = 32;
constexpr int N = 256;
constexpr int el_w = N / warp_size; // 8
const int64_t r = (int64_t) blockIdx.x * blockDim.y + threadIdx.y;
if (r >= n_rows) return;
const float* row_src = src + r * N;
float* row_dst = dst + r * N;
float reg[el_w];
const int lane = threadIdx.x;
#pragma unroll
for (int i = 0; i < el_w; ++i) reg[i] = row_src[i * warp_size + lane] * scale;
// the low 5 index bits live across lanes
#pragma unroll
for (int h = 1; h < warp_size; h *= 2) {
#pragma unroll
for (int j = 0; j < el_w; ++j) {
const float val = reg[j];
const float val2 = __shfl_xor_sync(0xffffffffu, val, h, warp_size);
reg[j] = (lane & h) == 0 ? val + val2 : val2 - val;
}
}
// the high 3 bits across each lane's registers
#pragma unroll
for (int h = warp_size; h < N; h *= 2) {
const int step = h / warp_size;
#pragma unroll
for (int j = 0; j < el_w; j += 2 * step) {
#pragma unroll
for (int k = 0; k < step; ++k) {
const float x = reg[j + k];
const float y = reg[j + k + step];
reg[j + k] = x + y;
reg[j + k + step] = x - y;
}
}
}
#pragma unroll
for (int i = 0; i < el_w; ++i) row_dst[i * warp_size + lane] = reg[i];
}
// One 32-value group in one warp (lane = element), ggml's q4_0: d = (the value of largest |x|) / -8,
// q = clamp(trunc(x / d + 8.5), 0, 15). Returns the scale bits; `byte` is lane t's packed byte for t < 16
// (element t in the low nibble, t + 16 in the high one). Ties in |x| resolve to the larger value in EVERY lane,
// so all lanes agree on d (a plain `a > amax` could leave lanes with opposite signs and one block two scales).
__device__ __forceinline__ uint16_t q4_group(float x, int lane, uint8_t& byte) {
float amax = fabsf(x), mval = x;
#pragma unroll
for (int o = 16; o > 0; o >>= 1) {
const float a = __shfl_xor_sync(0xffffffffu, amax, o);
const float v = __shfl_xor_sync(0xffffffffu, mval, o);
if (a > amax || (a == amax && v > mval)) { amax = a; mval = v; }
}
const float d = mval / -8.0f;
const float id = d != 0.0f ? 1.0f / d : 0.0f;
int q = __float2int_rz(x * id + 8.5f);
const uint8_t qc = (uint8_t) (q < 0 ? 0 : (q > 15 ? 15 : q));
const uint8_t qhi = __shfl_down_sync(0xffffffffu, qc, 16);
byte = (uint8_t) (qc | (qhi << 4));
(void) lane;
return f16_from_f32(d);
}
__device__ __forceinline__ void q4_store(uint8_t* pool, long long row, int b, int lane, uint16_t d, uint8_t byte) {
block_q4_0* blk = reinterpret_cast<block_q4_0*>(pool + row * (long long) sizeof(block_q4_0) * 8) + b;
if (lane == 0) blk->d = d;
if (lane < 16) blk->qs[lane] = byte;
}
// One block = one 32-value group of one KV head of K (blockIdx.z = 0) or V (1); 32 threads. KV streaming: the VRAM
// page only if the block is resident (table >= 0), the host copy always (identity layout) when there is one.
__device__ __forceinline__ void kv_append_q4_kernel_body(uint8_t* __restrict__ k_q4, uint8_t* __restrict__ v_q4,
const int32_t* __restrict__ table, const int32_t* __restrict__ step,
const float* __restrict__ kcur, const float* __restrict__ vcur,
int kv_heads, int head_dim, int page_size, KvHostPools host) {
const long long pos = (long long) __ldg(step + kStepPos);
const int h = blockIdx.x, b = blockIdx.y, t = threadIdx.x;
const bool is_v = blockIdx.z == 1;
const float x = (is_v ? vcur : kcur)[h * head_dim + b * QK4_0 + t];
uint8_t byte;
const uint16_t d = q4_group(x, t, byte);
const long long page = (long long) table[pos / page_size];
if (page >= 0) q4_store(is_v ? v_q4 : k_q4, (page * kv_heads + h) * page_size + (pos % page_size), b, t, d, byte);
if (host.k_q4 != nullptr)
q4_store(is_v ? host.v_q4 : host.k_q4, ((pos / page_size) * kv_heads + h) * page_size + (pos % page_size), b, t,
d, byte);
}
// The prompt path: grid (T, kv_heads, groups), K then V; also into the staging pool (identity layout) when given.
__device__ __forceinline__ void kv_append_q4_batch_kernel_body(uint8_t* __restrict__ k_q4, uint8_t* __restrict__ v_q4,
const int32_t* __restrict__ table, int64_t pos0,
const float* __restrict__ K, const float* __restrict__ V,
int kv_heads, int head_dim, int page_size, int is_v_grid, KvHostPools host,
KvHostPools stage) {
const long long t = blockIdx.x;
const long long pos = pos0 + t;
const int h = blockIdx.y, b = blockIdx.z, th = threadIdx.x;
const bool is_v = is_v_grid != 0;
const float x = (is_v ? V : K)[t * (kv_heads * head_dim) + h * head_dim + b * QK4_0 + th];
uint8_t byte;
const uint16_t d = q4_group(x, th, byte);
const long long page = (long long) table[pos / page_size];
const long long row_id = ((pos / page_size) * kv_heads + h) * page_size + (pos % page_size);
if (page >= 0) q4_store(is_v ? v_q4 : k_q4, (page * kv_heads + h) * page_size + (pos % page_size), b, th, d, byte);
if (host.k_q4 != nullptr) q4_store(is_v ? host.v_q4 : host.k_q4, row_id, b, th, d, byte);
if (stage.k_q4 != nullptr) q4_store(is_v ? stage.v_q4 : stage.k_q4, row_id, b, th, d, byte);
}
// Gather step[kStepWidth] cells into FP16 scratch (the non-fused attention paths)
__device__ __forceinline__ void kv_gather_q4_kernel_body(const uint8_t* __restrict__ k_q4, const uint8_t* __restrict__ v_q4,
const int32_t* __restrict__ table, const int32_t* __restrict__ ids,
const int32_t* __restrict__ step, int kv_heads, int head_dim, int page_size,
uint16_t* __restrict__ k_scratch, uint16_t* __restrict__ v_scratch) {
const long long n_ids = (long long) __ldg(step + kStepWidth);
const int blocks_per_head = head_dim / QK4_0; // 8
const int bytes_per_head = blocks_per_head * sizeof(block_q4_0); // 144
const long long total_blocks = n_ids * kv_heads * blocks_per_head;
const long long blk_idx = (long long) blockIdx.x * blockDim.y + threadIdx.y;
if (blk_idx >= total_blocks) return;
const int t = threadIdx.x;
const long long id = blk_idx / (kv_heads * blocks_per_head);
const int rem = (int) (blk_idx % (kv_heads * blocks_per_head));
const int h = rem / blocks_per_head;
const int b = rem % blocks_per_head;
const int cell = ids[id];
const long long page = (long long) table[cell / page_size];
const long long row = (page * kv_heads + h) * page_size + (cell % page_size);
const block_q4_0* k_blk = reinterpret_cast<const block_q4_0*>(k_q4 + row * bytes_per_head) + b;
const block_q4_0* v_blk = reinterpret_cast<const block_q4_0*>(v_q4 + row * bytes_per_head) + b;
const float kd = f32_from_f16(k_blk->d);
const float vd = f32_from_f16(v_blk->d);
const int j = t < 16 ? t : (t - 16);
const uint8_t k_byte = k_blk->qs[j];
const uint8_t v_byte = v_blk->qs[j];
const int kq = (t < 16) ? ((k_byte & 0x0F) - 8) : ((k_byte >> 4) - 8);
const int vq = (t < 16) ? ((v_byte & 0x0F) - 8) : ((v_byte >> 4) - 8);
const long long dst_offset = ((id * kv_heads + h) * head_dim) + (b * QK4_0 + t);
k_scratch[dst_offset] = f16_from_f32((float) kq * kd);
v_scratch[dst_offset] = f16_from_f32((float) vq * vd);
}
} // namespace
} // namespace kernels
} // namespace strata
using namespace strata::kernels;
extern "C" __global__ void __launch_bounds__(128) leleka_fwht256_f32(const float* __restrict__ src, float* __restrict__ dst,
long long n_rows) {
fwht256_kernel_body(src, dst, (int64_t) n_rows, 1.0f / 16.0f);
}
extern "C" __global__ void __launch_bounds__(32) leleka_kv_append_q4_step(
uint8_t* __restrict__ k_q4, uint8_t* __restrict__ v_q4, const int32_t* __restrict__ table,
const int32_t* __restrict__ step, const float* __restrict__ kcur, const float* __restrict__ vcur, int kv_heads,
int head_dim, int page_size, uint8_t* host_k_q4, uint8_t* host_v_q4) {
KvHostPools host{};
host.k_q4 = host_k_q4;
host.v_q4 = host_v_q4;
kv_append_q4_kernel_body(k_q4, v_q4, table, step, kcur, vcur, kv_heads, head_dim, page_size, host);
}
extern "C" __global__ void __launch_bounds__(32) leleka_kv_append_q4_batch(
uint8_t* __restrict__ k_q4, uint8_t* __restrict__ v_q4, const int32_t* __restrict__ table, long long pos0,
const float* __restrict__ K, const float* __restrict__ V, int kv_heads, int head_dim, int page_size, int is_v_grid,
uint8_t* host_k_q4, uint8_t* host_v_q4, uint8_t* stage_k_q4, uint8_t* stage_v_q4) {
KvHostPools host{}, stage{};
host.k_q4 = host_k_q4;
host.v_q4 = host_v_q4;
stage.k_q4 = stage_k_q4;
stage.v_q4 = stage_v_q4;
kv_append_q4_batch_kernel_body(k_q4, v_q4, table, (int64_t) pos0, K, V, kv_heads, head_dim, page_size, is_v_grid,
host, stage);
}
extern "C" __global__ void __launch_bounds__(128) leleka_kv_gather_q4_step(
const uint8_t* __restrict__ k_q4, const uint8_t* __restrict__ v_q4, const int32_t* __restrict__ table,
const int32_t* __restrict__ ids, const int32_t* __restrict__ step, int kv_heads, int head_dim, int page_size,
uint16_t* __restrict__ k_scratch, uint16_t* __restrict__ v_scratch) {
kv_gather_q4_kernel_body(k_q4, v_q4, table, ids, step, kv_heads, head_dim, page_size, k_scratch, v_scratch);
}
@@ -0,0 +1,9 @@
//
// PLACEHOLDER - NOT GENERATED PTX.
// TODO-ROOT: compile experimental_kv_q4.cu offline with the pinned toolchain
// nvcc 12.8.93 -std=c++17 -O3 -ptx -arch=sm_120 experimental_kv_q4.cu -o experimental_kv_q4.ptx
// (precise math: no --use_fast_math; see docs/cuda-seal-plan-additions-experimental.json) then freeze the source
// and PTX SHA-256 values in the matching pin of experimental.rs after the Root GPU smoke passes.
// The driver refuses this asset while the pin is zero, and this text defines no kernel entry, so it can never be
// mistaken for a qualified executable. EXPERIMENTAL: the program is only reachable through an explicit opt-in.
//
@@ -0,0 +1,221 @@
// Offline compilation source; not a runtime/toolkit dependency.
// INT8 KV cache append and gather kernels, in the forms the EXPERIMENTAL cache variants need:
// * V-only (keyless, `STRATA_KEYLESS_ROUTING`): `k_q == nullptr` writes only V (`is_v` is forced) and the
// launch uses z-extent 1;
// * K8V4 hybrid (`--kv k8v4`): the INT8 K half, with the unused half's pointers folded onto the used pool
// (`kv_append_q8_step(k_q, k_q, k_scale, k_scale, ..., kcur, kcur)`, layer.cpp), a bit-identical duplicate
// write, so no kernel variants exist.
// Both are lossy/unqualified and off by default; the driver refuses this program without an explicit
// ExperimentalOptIn (experimental.rs). The production INT8 path of the Rust runtime does not use this file.
//
// LITERAL PORT of engine/strata/src/kernels/cuda/kv_q8.cu. Kernel BODIES are byte-identical to the Original's
// (experimental_kv.rs::literal_bodies_match_the_original). Edits: each `__global__` kernel became a
// `__device__ ..._body` function with the same parameters called by an `extern "C" __global__` entry with a
// flat pointer/integer ABI (KvHostPools rebuilt from pointers; a null pointer argument is a 64-bit zero);
// launch geometry and validate() live in Rust; KvHostPools/f16 conversions are copied from the Original headers.
//
// Entries (grid / block):
// leleka_kv_append_q8_step (n_head_kv, head_dim / 64, k_q ? 2 : 1) / 64
// leleka_kv_gather_q8_step ceil(max_ids * n_head_kv * (head_dim / 4) / 256) / 256
//
// STATUS: NOT COMPILED OR RUN (no nvcc here). PTX pin is zero until Root freezes it. Intended offline compile:
// nvcc 12.8.93 -ptx -O3 -arch=sm_120, precise math (the Original builds kv_q8.cu with default flags).
#include <cstdint>
#include <cstring>
#define STRATA_HD __host__ __device__
namespace strata {
namespace kernels {
enum QsaStep : int {
kStepPos = 0, // the new cell's sequence position
kStepNKv = 1,
kStepNBid = 2,
kStepWidth = 3, // how many cells the selection returns
kStepCount = 4,
};
struct KvHostPools {
uint16_t* k_pool = nullptr; ///< fp16 mode
uint16_t* v_pool = nullptr;
int8_t* k_q = nullptr; ///< int8 mode: codes
int8_t* v_q = nullptr;
uint16_t* k_scale = nullptr; ///< int8 mode: fp16 scale per 64 values
uint16_t* v_scale = nullptr;
uint8_t* k_q4 = nullptr; ///< q4_0 mode (kv_q4.hpp): block_q4_0 codes, 144 B per cell and head
uint8_t* v_q4 = nullptr;
bool present() const { return k_pool != nullptr || k_q != nullptr || k_q4 != nullptr || v_q != nullptr; }
};
inline constexpr int KV_Q8_GROUP = 64;
/// Round-to-nearest-even f32 -> fp16, returned as raw bits.
STRATA_HD inline uint16_t f16_from_f32(float f) {
uint32_t x;
#if defined(__HIP_DEVICE_COMPILE__)
__builtin_memcpy(&x, &f, 4);
#else
std::memcpy(&x, &f, 4);
#endif
const uint32_t sign = (x >> 16) & 0x8000u;
const uint32_t rawexp = (x >> 23) & 0xFFu;
int exp = (int) rawexp - 127 + 15;
uint32_t man = x & 0x7FFFFFu;
// TWO different things reach here and they must not be conflated: an f32 inf/NaN (raw exponent 255) stays
// an inf/NaN, and a FINITE value too large for fp16 (1e30) SATURATES TO INF. The version of this function
// in quantize_act.cu and shared_expert.cu tests `if (exp >= 31) return sign | 0x7C00 | (man ? 0x200 : 0)`
// and therefore returns a NaN for every overflowing finite value - which their own fixtures cannot see,
// because all of their values are O(1). Round 198's numpy oracle caught it here on the first run (1e30,
// 65536, 1e45: numpy says inf, the conflated test said NaN).
if (rawexp == 0xFFu) return (uint16_t) (sign | 0x7C00u | (man ? 0x200u : 0u)); // inf, or a quiet/NaN
if (exp >= 31) return (uint16_t) (sign | 0x7C00u); // finite overflow -> inf
if (exp <= 0) {
if (exp < -10) return (uint16_t) sign; // underflows to a signed zero
man |= 0x800000u; // restore the implicit 1
const uint32_t sh = (uint32_t) (14 - exp);
uint32_t h = (man >> sh) & 0x3FFu;
const uint32_t rem = man & ((1u << sh) - 1u);
if (rem > (1u << (sh - 1)) || (rem == (1u << (sh - 1)) && (h & 1u))) ++h;
return (uint16_t) (sign | h);
}
uint16_t h = (uint16_t) (sign | ((uint32_t) exp << 10) | (man >> 13));
const uint32_t rem = man & 0x1FFFu;
if (rem > 0x1000u || (rem == 0x1000u && (h & 1u))) ++h; // the carry may bump the exponent
return h;
}
/// Exact fp16 bits -> f32. No rounding, no exceptions: every one of the 65,536 inputs maps to a value f32
/// represents exactly, including the subnormals (which is why the `ex == 0` case cannot be skipped).
STRATA_HD inline float f32_from_f16(uint16_t h) {
const uint32_t sign = (uint32_t) (h & 0x8000u) << 16;
const uint32_t ex = (h >> 10) & 0x1Fu, man = h & 0x3FFu;
uint32_t out;
if (ex == 0) {
// Subnormal or zero. The value is `man * 2^-24`, so after `s` left shifts the leading 1 reaches bit
// 10 and the value is `(1 + frac) * 2^(-14-s)`: the f32 exponent field is 113 - s and `frac` is the low
// ten bits. Flushing these to zero - which the two private copies of this function in the tree do -
// maps 0x0001 to 0.0 instead of 2^-24, a 100% relative error on any KL-quant scale that lands here.
if (man == 0) {
out = sign;
} else {
uint32_t m = man;
int s = 0;
while ((m & 0x400u) == 0) { m <<= 1; ++s; }
out = sign | ((uint32_t) (113 - s) << 23) | ((m & 0x3FFu) << 13);
}
} else if (ex == 31) {
out = sign | 0x7F800000u | (man << 13);
} else {
out = sign | ((ex - 15 + 127) << 23) | (man << 13);
}
float f;
#if defined(__HIP_DEVICE_COMPILE__)
__builtin_memcpy(&f, &out, 4);
#else
std::memcpy(&f, &out, 4);
#endif
return f;
}
namespace {
// One block = one 64-value group of one KV head of K (blockIdx.z = 0) or V (1); 64 threads, one value each.
__device__ __forceinline__ void kv_append_q8_kernel_body(int8_t* __restrict__ k_q, int8_t* __restrict__ v_q,
uint16_t* __restrict__ k_scale, uint16_t* __restrict__ v_scale,
const int32_t* __restrict__ table, const int32_t* __restrict__ step,
const float* __restrict__ kcur, const float* __restrict__ vcur, int kv_heads,
int head_dim, int page_size, KvHostPools host) {
const long long pos = (long long) __ldg(step + kStepPos);
const int h = blockIdx.x, g = blockIdx.y, t = threadIdx.x;
const bool is_v = k_q == nullptr || blockIdx.z == 1;
const int groups = head_dim / KV_Q8_GROUP;
const float x = (is_v ? vcur : kcur)[h * head_dim + g * KV_Q8_GROUP + t];
// max |x| over the 64 values: two warps, then combine through shared memory in a fixed order
float a = fabsf(x);
for (int o = 16; o > 0; o >>= 1) a = fmaxf(a, __shfl_xor_sync(0xffffffffu, a, o));
__shared__ float warp_max[2];
if ((t & 31) == 0) warp_max[t >> 5] = a;
__syncthreads();
const float amax = fmaxf(warp_max[0], warp_max[1]);
const uint16_t sbits = f16_from_f32(amax / 127.0f);
const float sf = f32_from_f16(sbits); // quantize against the STORED scale
int q = 0;
if (sf > 0.0f) {
q = __float2int_rn(x / sf);
q = q < -127 ? -127 : (q > 127 ? 127 : q);
}
// KV streaming: the host copy (identity layout) always, the VRAM page only if the block is resident
const long long page = (long long) table[pos / page_size];
if (page >= 0) {
const long long row = (page * kv_heads + h) * page_size + (pos % page_size);
(is_v ? v_q : k_q)[row * head_dim + g * KV_Q8_GROUP + t] = (int8_t) q;
if (t == 0) (is_v ? v_scale : k_scale)[row * groups + g] = sbits;
}
if ((is_v ? host.v_q : host.k_q) != nullptr) {
const long long row = ((pos / page_size) * kv_heads + h) * page_size + (pos % page_size);
(is_v ? host.v_q : host.k_q)[row * head_dim + g * KV_Q8_GROUP + t] = (int8_t) q;
if (t == 0) (is_v ? host.v_scale : host.k_scale)[row * groups + g] = sbits;
}
}
// One thread = 4 consecutive values of one cell and head (as the FP16 gather does with uint2).
__device__ __forceinline__ void kv_gather_q8_kernel_body(const int8_t* __restrict__ k_q, const int8_t* __restrict__ v_q,
const uint16_t* __restrict__ k_scale, const uint16_t* __restrict__ v_scale,
const int32_t* __restrict__ table, const int32_t* __restrict__ ids,
const int32_t* __restrict__ step, int kv_heads, int head_dim, int page_size,
uint16_t* __restrict__ k_scratch, uint16_t* __restrict__ v_scratch) {
const long long n_ids = (long long) __ldg(step + kStepWidth);
const int per = head_dim / 4;
const long long total = n_ids * kv_heads * per;
const long long i = blockIdx.x * (long long) blockDim.x + threadIdx.x;
if (i >= total) return;
const long long id = i / (kv_heads * (long long) per);
const int rem = (int) (i % (kv_heads * (long long) per));
const int h = rem / per, q4 = rem - h * per;
const int cell = ids[id];
const long long page = (long long) table[cell / page_size];
const long long row = (page * kv_heads + h) * page_size + (cell % page_size);
const int d = q4 * 4;
const int groups = head_dim / KV_Q8_GROUP;
const float ks = f32_from_f16(k_scale[row * groups + d / KV_Q8_GROUP]);
const float vs = f32_from_f16(v_scale[row * groups + d / KV_Q8_GROUP]);
const char4 kc = reinterpret_cast<const char4*>(k_q + row * head_dim)[q4];
const char4 vc = reinterpret_cast<const char4*>(v_q + row * head_dim)[q4];
ushort4 ko, vo;
ko.x = f16_from_f32((float) kc.x * ks); ko.y = f16_from_f32((float) kc.y * ks);
ko.z = f16_from_f32((float) kc.z * ks); ko.w = f16_from_f32((float) kc.w * ks);
vo.x = f16_from_f32((float) vc.x * vs); vo.y = f16_from_f32((float) vc.y * vs);
vo.z = f16_from_f32((float) vc.z * vs); vo.w = f16_from_f32((float) vc.w * vs);
const long long dst = (id * kv_heads + h) * (long long) per + q4;
reinterpret_cast<ushort4*>(k_scratch)[dst] = ko;
reinterpret_cast<ushort4*>(v_scratch)[dst] = vo;
}
} // namespace
} // namespace kernels
} // namespace strata
using namespace strata::kernels;
extern "C" __global__ void __launch_bounds__(64) leleka_kv_append_q8_step(
int8_t* __restrict__ k_q, int8_t* __restrict__ v_q, uint16_t* __restrict__ k_scale,
uint16_t* __restrict__ v_scale, const int32_t* __restrict__ table, const int32_t* __restrict__ step,
const float* __restrict__ kcur, const float* __restrict__ vcur, int kv_heads, int head_dim, int page_size,
int8_t* host_k_q, int8_t* host_v_q, uint16_t* host_k_scale, uint16_t* host_v_scale) {
KvHostPools host{};
host.k_q = host_k_q;
host.v_q = host_v_q;
host.k_scale = host_k_scale;
host.v_scale = host_v_scale;
kv_append_q8_kernel_body(k_q, v_q, k_scale, v_scale, table, step, kcur, vcur, kv_heads, head_dim, page_size, host);
}
extern "C" __global__ void __launch_bounds__(256) leleka_kv_gather_q8_step(
const int8_t* __restrict__ k_q, const int8_t* __restrict__ v_q, const uint16_t* __restrict__ k_scale,
const uint16_t* __restrict__ v_scale, const int32_t* __restrict__ table, const int32_t* __restrict__ ids,
const int32_t* __restrict__ step, int kv_heads, int head_dim, int page_size, uint16_t* __restrict__ k_scratch,
uint16_t* __restrict__ v_scratch) {
kv_gather_q8_kernel_body(k_q, v_q, k_scale, v_scale, table, ids, step, kv_heads, head_dim, page_size, k_scratch,
v_scratch);
}
@@ -0,0 +1,9 @@
//
// PLACEHOLDER - NOT GENERATED PTX.
// TODO-ROOT: compile experimental_kv_q8.cu offline with the pinned toolchain
// nvcc 12.8.93 -std=c++17 -O3 -ptx -arch=sm_120 experimental_kv_q8.cu -o experimental_kv_q8.ptx
// (precise math: no --use_fast_math; see docs/cuda-seal-plan-additions-experimental.json) then freeze the source
// and PTX SHA-256 values in the matching pin of experimental.rs after the Root GPU smoke passes.
// The driver refuses this asset while the pin is zero, and this text defines no kernel entry, so it can never be
// mistaken for a qualified executable. EXPERIMENTAL: the program is only reachable through an explicit opt-in.
//
@@ -0,0 +1,262 @@
// Offline compilation source; not a runtime/toolkit dependency.
// EXPERIMENTAL KV streaming (`--kv-resident N`): the in-graph CLOCK residency resolver, the copy of missed
// blocks from the pinned host copy into VRAM slots, the reset of the map and the static ring table of the MTP
// drafter. Streaming changes where the cache lives, not what it holds (the Original proves streamed attention
// bitwise equal to resident attention), but it is unqualified in this port and off by default; the driver
// refuses this program without an explicit ExperimentalOptIn (experimental.rs).
//
// LITERAL PORT of engine/strata/src/kernels/cuda/kv_stream.cu (resolve_kernel, copy_kernel, reset_kernel,
// ring_kernel, block_scan, Runs, RT). Bodies are byte-identical to the Original's
// (experimental_stream.rs::literal_bodies_match_the_original). Edits: `__global__` kernels became
// `__device__ ..._body` functions with the same parameters called by `extern "C" __global__` entries with a flat
// ABI (KvStreamMap / Runs rebuilt from pointers); the host wrappers (kv_stream_resolve's guards and launch
// geometry, runs_of, kv_block_bytes, kv_stream_counters) are Rust (experimental_stream.rs). Added: the one
// `leleka_kv_copy_u4` grid-stride copy that stands in for the Original's cudaMemcpyAsync in kv_ring_restore and
// kv_stage_from_host (same bytes over the same PCIe path; the closed program has no memcpy API).
//
// Entries (grid / block):
// leleka_kv_stream_reset 128 / 256
// leleka_kv_stream_resolve 1 / 1024 (n_slots >= 1024 is a host guard, see Rust)
// leleka_kv_stream_copy 96 / 128
// leleka_kv_ring_table 64 / 256
// leleka_kv_copy_u4 min(ceil(n_u4 / 128), 4096) / 128
//
// STATUS: NOT COMPILED OR RUN (no nvcc here). PTX pin is zero until Root freezes it. Intended offline compile:
// nvcc 12.8.93 -ptx -O3 -arch=sm_120, precise math (the Original builds kv_stream.cu with default flags).
#include <cstdint>
namespace strata {
namespace kernels {
enum QsaStep : int {
kStepPos = 0, // the new cell's sequence position
kStepNKv = 1,
kStepNBid = 2,
kStepWidth = 3, // how many cells the selection returns
kStepCount = 4,
};
struct KvStreamMap {
int32_t* page_table = nullptr; ///< (n_blocks,) block -> slot, or -1
int32_t* slot_block = nullptr; ///< (n_slots,) slot -> block, or -1
int32_t* slot_stamp = nullptr; ///< (n_slots,) the resolve epoch that last used the slot
int32_t* slot_ref = nullptr; ///< (n_slots,) clock reference bit
int32_t* ctl = nullptr; ///< kKvCtlInts: epoch, hand, misses of the last call, overflow, u64 counters
int32_t* miss_block = nullptr; ///< (n_slots,)
int32_t* miss_slot = nullptr; ///< (n_slots,)
int64_t n_blocks = 0;
int64_t n_slots = 0;
};
inline constexpr int kKvCtlInts = 16; ///< [0] epoch [1] hand [2] misses [3] overflow; u64 at [4] misses, [6] lookups, [8] calls
namespace {
constexpr int RT = 1024; // the resolve block
// The per-block byte runs of the (up to four) pool arrays: block b of array i is bytes [b * len, (b + 1) * len).
struct Runs {
const uint8_t* src[4];
uint8_t* dst[4];
int len[4];
int n;
};
// Block-wide exclusive prefix sum of one int per thread (RT threads); `total` is the sum over the block.
__device__ int block_scan(int v, int* warp_sums, int& total) {
const int lane = threadIdx.x & 31, w = threadIdx.x >> 5;
int x = v;
for (int o = 1; o < 32; o <<= 1) {
const int y = __shfl_up_sync(0xffffffffu, x, o);
if (lane >= o) x += y;
}
if (lane == 31) warp_sums[w] = x;
__syncthreads();
if (w == 0) {
int t = warp_sums[lane];
for (int o = 1; o < 32; o <<= 1) {
const int y = __shfl_up_sync(0xffffffffu, t, o);
if (lane >= o) t += y;
}
warp_sums[lane] = t;
}
__syncthreads();
total = warp_sums[31];
const int excl = x - v + (w > 0 ? warp_sums[w - 1] : 0);
__syncthreads();
return excl;
}
__device__ __forceinline__ void resolve_kernel_body(KvStreamMap m, const int32_t* __restrict__ ids,
const int32_t* __restrict__ steps, int n_q, int cap, int page_size) {
__shared__ int s_nmiss, s_lookups, s_cut;
__shared__ int warp_sums[32];
const int epoch = m.ctl[0] + 1;
if (threadIdx.x == 0) { s_nmiss = 0; s_lookups = 0; }
__syncthreads();
// 1. hits take this epoch and their reference bit; a missing block is claimed exactly once (-1 -> -2)
int lookups = 0;
for (int q = 0; q < n_q; ++q) {
const int width = steps[q * kStepCount + kStepWidth];
const int32_t* qi = ids + (long long) q * cap;
for (int i = threadIdx.x; i < width; i += RT) {
const int b = qi[i] / page_size;
if (i > 0 && qi[i - 1] / page_size == b) continue; // ids are ascending: one lookup per block
++lookups;
const int sl = m.page_table[b];
if (sl >= 0) {
m.slot_stamp[sl] = epoch;
m.slot_ref[sl] = 1;
} else if (sl == -1 && atomicCAS(&m.page_table[b], -1, -2) == -1) {
m.miss_block[atomicAdd(&s_nmiss, 1)] = b;
}
}
}
atomicAdd(&s_lookups, lookups);
__syncthreads();
// 2. one victim per miss: a clock sweep from the hand. A slot this call uses (stamp == epoch) is never taken;
// a referenced one loses its bit as the hand passes it and is taken on the next pass.
const int need = s_nmiss, n = (int) m.n_slots;
int hand = m.ctl[1], got = 0;
for (int scanned = 0; got < need && scanned < 3 * n; scanned += RT) {
const int j = (int) (((long long) hand + threadIdx.x) % n);
const bool mine = m.slot_stamp[j] == epoch;
const bool cand = !mine && (m.slot_block[j] < 0 || m.slot_ref[j] == 0);
int total = 0;
const int rank = block_scan(cand ? 1 : 0, warp_sums, total);
const int want = need - got;
if (threadIdx.x == 0) s_cut = RT;
__syncthreads();
if (cand && rank == want - 1) s_cut = threadIdx.x + 1; // the hand stops just past the last slot taken
__syncthreads();
const int cut = s_cut;
if (cand && rank < want) {
m.miss_slot[got + rank] = j;
m.slot_stamp[j] = epoch; // taken: a sweep that wraps around must not take it twice
} else if (threadIdx.x < cut && !mine) {
m.slot_ref[j] = 0;
}
got += total < want ? total : want;
hand = (int) (((long long) hand + cut) % n);
__syncthreads();
}
// 3. re-point the table; the copy kernel fills the slots
const int placed = got < need ? got : need;
for (int k = threadIdx.x; k < need; k += RT) {
const int b = m.miss_block[k];
if (k >= placed) { m.page_table[b] = -1; continue; } // overflow: never happens with a legal n_slots
const int sl = m.miss_slot[k];
const int old = m.slot_block[sl];
if (old >= 0) m.page_table[old] = -1;
m.slot_block[sl] = b;
m.slot_stamp[sl] = epoch;
m.slot_ref[sl] = 1;
m.page_table[b] = sl;
}
if (threadIdx.x == 0) {
m.ctl[0] = epoch;
m.ctl[1] = hand;
m.ctl[2] = placed;
if (placed < need) m.ctl[3] = 1;
unsigned long long* c = reinterpret_cast<unsigned long long*>(m.ctl + 4);
c[0] += (unsigned long long) placed;
c[1] += (unsigned long long) s_lookups;
c[2] += 1ull;
}
}
// One block per missed block (grid-stride): copy its runs from the host copy into its slot, 16 B per thread.
__device__ __forceinline__ void copy_kernel_body(KvStreamMap m, Runs r) {
const int need = m.ctl[2];
for (int k = blockIdx.x; k < need; k += gridDim.x) {
const long long b = m.miss_block[k], sl = m.miss_slot[k];
for (int a = 0; a < r.n; ++a) {
const uint4* src = reinterpret_cast<const uint4*>(r.src[a] + b * r.len[a]);
uint4* dst = reinterpret_cast<uint4*>(r.dst[a] + sl * r.len[a]);
for (int i = threadIdx.x; i < r.len[a] / 16; i += blockDim.x) dst[i] = src[i];
}
}
}
__device__ __forceinline__ void reset_kernel_body(KvStreamMap m) {
const long long i0 = (long long) blockIdx.x * blockDim.x + threadIdx.x, st = (long long) gridDim.x * blockDim.x;
for (long long i = i0; i < m.n_blocks; i += st) m.page_table[i] = -1;
for (long long i = i0; i < m.n_slots; i += st) {
m.slot_block[i] = -1;
m.slot_stamp[i] = -1;
m.slot_ref[i] = 0;
}
if (i0 < kKvCtlInts) m.ctl[i0] = 0;
}
__device__ __forceinline__ void ring_kernel_body(int32_t* table, long long n_blocks, long long n_slots) {
for (long long i = (long long) blockIdx.x * blockDim.x + threadIdx.x; i < n_blocks;
i += (long long) gridDim.x * blockDim.x)
table[i] = (int32_t) (i % n_slots);
}
} // namespace
} // namespace kernels
} // namespace strata
using namespace strata::kernels;
extern "C" __global__ void __launch_bounds__(256) leleka_kv_stream_reset(
int32_t* page_table, int32_t* slot_block, int32_t* slot_stamp, int32_t* slot_ref, int32_t* ctl,
long long n_blocks, long long n_slots) {
KvStreamMap m;
m.page_table = page_table;
m.slot_block = slot_block;
m.slot_stamp = slot_stamp;
m.slot_ref = slot_ref;
m.ctl = ctl;
m.n_blocks = n_blocks;
m.n_slots = n_slots;
reset_kernel_body(m);
}
extern "C" __global__ void __launch_bounds__(1024) leleka_kv_stream_resolve(
int32_t* page_table, int32_t* slot_block, int32_t* slot_stamp, int32_t* slot_ref, int32_t* ctl,
int32_t* miss_block, int32_t* miss_slot, long long n_slots, const int32_t* __restrict__ ids,
const int32_t* __restrict__ steps, int n_q, int cap, int page_size) {
KvStreamMap m;
m.page_table = page_table;
m.slot_block = slot_block;
m.slot_stamp = slot_stamp;
m.slot_ref = slot_ref;
m.ctl = ctl;
m.miss_block = miss_block;
m.miss_slot = miss_slot;
m.n_slots = n_slots;
resolve_kernel_body(m, ids, steps, n_q, cap, page_size);
}
extern "C" __global__ void __launch_bounds__(128) leleka_kv_stream_copy(
int32_t* ctl, int32_t* miss_block, int32_t* miss_slot, const uint8_t* src0, const uint8_t* src1,
const uint8_t* src2, const uint8_t* src3, uint8_t* dst0, uint8_t* dst1, uint8_t* dst2, uint8_t* dst3, int len0,
int len1, int len2, int len3, int n_runs) {
KvStreamMap m;
m.ctl = ctl;
m.miss_block = miss_block;
m.miss_slot = miss_slot;
Runs r{};
r.src[0] = src0; r.src[1] = src1; r.src[2] = src2; r.src[3] = src3;
r.dst[0] = dst0; r.dst[1] = dst1; r.dst[2] = dst2; r.dst[3] = dst3;
r.len[0] = len0; r.len[1] = len1; r.len[2] = len2; r.len[3] = len3;
r.n = n_runs;
copy_kernel_body(m, r);
}
extern "C" __global__ void __launch_bounds__(256) leleka_kv_ring_table(int32_t* table, long long n_blocks,
long long n_slots) {
ring_kernel_body(table, n_blocks, n_slots);
}
// Added (not in the Original): contiguous 16-byte grid-stride copy, the closed program's stand-in for
// cudaMemcpyAsync(cudaMemcpyDefault) in kv_ring_restore / kv_stage_from_host.
extern "C" __global__ void __launch_bounds__(128) leleka_kv_copy_u4(const uint4* __restrict__ src,
uint4* __restrict__ dst, long long n_u4) {
const long long i0 = (long long) blockIdx.x * blockDim.x + threadIdx.x;
const long long st = (long long) gridDim.x * blockDim.x;
for (long long i = i0; i < n_u4; i += st) dst[i] = src[i];
}
@@ -0,0 +1,9 @@
//
// PLACEHOLDER - NOT GENERATED PTX.
// TODO-ROOT: compile experimental_kv_stream.cu offline with the pinned toolchain
// nvcc 12.8.93 -std=c++17 -O3 -ptx -arch=sm_120 experimental_kv_stream.cu -o experimental_kv_stream.ptx
// (precise math: no --use_fast_math; see docs/cuda-seal-plan-additions-experimental.json) then freeze the source
// and PTX SHA-256 values in the matching pin of experimental.rs after the Root GPU smoke passes.
// The driver refuses this asset while the pin is zero, and this text defines no kernel entry, so it can never be
// mistaken for a qualified executable. EXPERIMENTAL: the program is only reachable through an explicit opt-in.
//
@@ -0,0 +1,342 @@
// Offline compilation source; not a runtime/toolkit dependency.
// EXPERIMENTAL fused split-K decode attention for the lossy / unqualified KV formats: KV_MODE 2 (Q4_0 K and V,
// rotated), 3 (hybrid K8V4: INT8 K, rotated Q4_0 V) and 4 (keyless: V-only INT8, positional key reconstruction
// from V with the rope tables, optionally M-RoPE positions). The caller rotates the query (mode 2) and rotates
// the output back (modes 2 and 3) with the FWHT kernel (experimental_kv_q4.cu); the Original does this in
// layer.cpp / verify.cpp / prefill.cpp. Off by default; the driver refuses this program without an explicit
// ExperimentalOptIn (experimental.rs). The fp16 and INT8 modes of the Original kernel are NOT instantiated here
// (INT8 is qsa_native_decode.cu; fp16 is not part of the Rust runtime).
//
// LITERAL PORT of engine/strata/src/kernels/cuda/qsa_decode_attn.cu: warp_sum, warp_max, load8_*, load8<>,
// attn_chunk_kernel<> and attn_merge_kernel BODIES are byte-identical to the Original's
// (experimental_attn.rs::literal_bodies_match_the_original), as are the constants and mrope_pos. Edits: the
// `__global__` kernels became `__device__ ..._body` functions with the same parameters, called by
// `extern "C" __global__` entries with a flat ABI that rebuilds QsaAttnPools from pointers (the unused pools
// stay null, exactly the Original's per-mode QsaAttnPools); the scale argument is the host wrapper's constant
// `1.0f / sqrtf((float) HD)`; geometry guards and scratch arithmetic (`qsa_decode_attn_batch`,
// `qsa_decode_attn_scratch_floats`) are Rust (experimental_attn.rs). A null pointer argument is a 64-bit zero.
//
// Entries (grid / block):
// leleka_qsa_attn_chunk_m2 / _m3 / _m4 (n_chunks, n_head_kv, n_q) / 256
// leleka_qsa_attn_merge (n_head, n_q) / 256
//
// STATUS: NOT COMPILED OR RUN (no nvcc here). PTX pin is zero until Root freezes it. Intended offline compile:
// nvcc 12.8.93 -ptx -O3 -arch=sm_120, precise math (the Original builds qsa_decode_attn.cu with default flags).
#include <cuda_fp16.h>
#include <cfloat>
#include <cstdint>
#include <cmath>
#include <cstring>
namespace strata {
namespace kernels {
enum QsaStep : int {
kStepPos = 0, // the new cell's sequence position
kStepNKv = 1,
kStepNBid = 2,
kStepWidth = 3, // how many cells the selection returns
kStepCount = 4,
};
inline constexpr int KV_Q8_GROUP = 64;
inline constexpr int QK4_0 = 32;
#pragma pack(push, 1)
struct block_q4_0 {
uint16_t d; // scale (fp16 bits)
uint8_t qs[QK4_0 / 2]; // 32 4-bit codes: element j in the low nibble of qs[j], j + 16 in the high one
};
#pragma pack(pop)
struct QsaAttnPools {
bool without_key = false;
const float* keyless_cos = nullptr;
const float* keyless_sin = nullptr;
int keyless_n_rot = 0;
const int32_t* keyless_mrope = nullptr; // optional per-cell time/height/width positions
const uint16_t* k_pool = nullptr; ///< fp16 [page][kv_head][page_size][head_dim], or null when int8
const uint16_t* v_pool = nullptr;
const int8_t* k_q = nullptr; ///< int8 codes, same layout
const int8_t* v_q = nullptr;
const uint16_t* k_scale = nullptr; ///< fp16 [page][kv_head][page_size][head_dim / 64]
const uint16_t* v_scale = nullptr;
const uint8_t* k_q4 = nullptr; ///< q4_0 block_q4_0 [page][kv_head][page_size][head_dim / 32 * 18]
const uint8_t* v_q4 = nullptr;
const int32_t* page_table = nullptr;
};
/// ggml rope_multi, is_imrope, sections {11, 11, 10, 0}: sector = pair % 32; sector % 3 == 1 -> h (sector < 33),
/// == 2 -> w (sector < 30), == 0 -> t (sector < 33). For pairs 0..31 all three bounds hold, so it is pair % 3.
__device__ __forceinline__ int mrope_pos(const int32_t* tab, int pos, int pair) {
return tab ? __ldg(tab + (size_t) pos * 3 + pair % 3) : pos;
}
namespace {
constexpr int HD = 256; // head_dim
constexpr int G = 12; // query heads per KV head (24 / 2)
constexpr int CHUNK = 64; // cells per block
constexpr int THREADS = 256;
constexpr int WARPS = THREADS / 32;
__device__ __forceinline__ float warp_sum(float v) {
#pragma unroll
for (int o = 16; o > 0; o >>= 1) v += __shfl_xor_sync(0xffffffffu, v, o);
return v;
}
__device__ __forceinline__ float warp_max(float v) {
#pragma unroll
for (int o = 16; o > 0; o >>= 1) v = fmaxf(v, __shfl_xor_sync(0xffffffffu, v, o));
return v;
}
// 8 consecutive values of one cell's key or value row for KV head `kvh`, dimensions [d0, d0+8).
// Per-format bodies; `load8` below is the KV_MODE dispatcher. value=false is the K side, true the V side.
__device__ __forceinline__ void load8_f16(const QsaAttnPools& p, bool value, long long row, int d0, float* out) {
const uint16_t* base = (value ? p.v_pool : p.k_pool) + row * HD + d0;
const uint4 raw = *reinterpret_cast<const uint4*>(base);
const __half2* h2 = reinterpret_cast<const __half2*>(&raw);
#pragma unroll
for (int j = 0; j < 4; ++j) {
const float2 f = __half22float2(h2[j]);
out[2 * j] = f.x;
out[2 * j + 1] = f.y;
}
}
__device__ __forceinline__ void load8_q8(const QsaAttnPools& p, bool value, long long row, int d0, float* out) {
const int8_t* codes = (value ? p.v_q : p.k_q) + row * HD + d0;
const uint16_t sbits = (value ? p.v_scale : p.k_scale)[row * (HD / KV_Q8_GROUP) + d0 / KV_Q8_GROUP];
const float sc = __half2float(__ushort_as_half(sbits));
const uint2 raw = *reinterpret_cast<const uint2*>(codes);
const int8_t* c = reinterpret_cast<const int8_t*>(&raw);
#pragma unroll
for (int j = 0; j < 8; ++j) out[j] = (float) c[j] * sc;
}
__device__ __forceinline__ void load8_q4(const QsaAttnPools& p, bool value, long long row, int d0, float* out) {
constexpr int bytes_per_head = (HD / QK4_0) * sizeof(block_q4_0);
const int b = d0 / QK4_0;
const int rem = d0 % QK4_0;
const block_q4_0* blk = reinterpret_cast<const block_q4_0*>((value ? p.v_q4 : p.k_q4) + row * bytes_per_head) + b;
const float d = __half2float(__ushort_as_half(blk->d));
const int j = (rem == 0 || rem == 16) ? 0 : 8;
const uint8_t* bytes = blk->qs + j;
if (rem < 16) {
#pragma unroll
for (int k = 0; k < 8; ++k) out[k] = (float) ((int)(bytes[k] & 0x0F) - 8) * d;
} else {
#pragma unroll
for (int k = 0; k < 8; ++k) out[k] = (float) ((int)(bytes[k] >> 4) - 8) * d;
}
}
template <int KV_MODE>
__device__ __forceinline__ void load8(const QsaAttnPools& p, bool value, long long row, int d0, float* out) {
if constexpr (KV_MODE == 0) load8_f16(p, value, row, d0, out);
else if constexpr (KV_MODE == 1 || KV_MODE == 4) load8_q8(p, value, row, d0, out);
else if constexpr (KV_MODE == 3) {
// hybrid K8V4: both sides are defined - K unrotated INT8, V rotated Q4_0 - so a value=true call
// reads the Q4_0 pool instead of dereferencing the null v_q (no call site does today; PR review)
if (value) load8_q4(p, value, row, d0, out);
else load8_q8(p, value, row, d0, out);
} else load8_q4(p, value, row, d0, out);
}
template <int KV_MODE>
__device__ __forceinline__ void attn_chunk_kernel_body(const float* __restrict__ q, QsaAttnPools p,
const int32_t* __restrict__ ids,
const int32_t* __restrict__ step, int n_kv_heads,
int page_size, float scale, float* __restrict__ part_acc,
float* __restrict__ part_m, float* __restrict__ part_l,
int n_chunks, int cap = 0, long long scratch_stride = 0) {
// batched form: query blockIdx.z, with its own q row, selection, step and scratch
q += (size_t) blockIdx.z * (size_t) (n_kv_heads * G) * HD;
ids += (size_t) blockIdx.z * (size_t) cap;
step += (size_t) blockIdx.z * kStepCount;
part_acc += (size_t) blockIdx.z * (size_t) scratch_stride;
part_m += (size_t) blockIdx.z * (size_t) scratch_stride;
part_l += (size_t) blockIdx.z * (size_t) scratch_stride;
__shared__ __align__(16) float sq[G][HD]; // 12 KB: this KV head's query heads
__shared__ float sp[G][CHUNK]; // scores, then probabilities
__shared__ long long srow[CHUNK]; // pool row of each cell (page, kv head, slot)
const int n_ids = __ldg(step + kStepWidth);
const int chunk = blockIdx.x, kvh = blockIdx.y;
const int t = threadIdx.x, lane = t & 31, warp = t >> 5;
const int c0 = chunk * CHUNK;
const int n_here = min(CHUNK, n_ids - c0);
const int slot = kvh * n_chunks + chunk;
if (n_here <= 0) {
if (t < G) { part_m[slot * G + t] = -FLT_MAX; part_l[slot * G + t] = 0.0f; }
return;
}
for (int i = t; i < G * HD; i += THREADS) sq[i / HD][i % HD] = q[(size_t) (kvh * G) * HD + i];
if (t < CHUNK) {
long long r = -1;
if (t < n_here) {
const int cell = ids[c0 + t];
const long long page = (long long) p.page_table[cell / page_size];
// a block the KV streaming could not make resident keeps page -1 (ctl[3]); its cells are masked
// (score -FLT_MAX, weight 0) instead of being read from before the pool.
if (page >= 0) r = (page * n_kv_heads + kvh) * page_size + (cell % page_size);
}
srow[t] = r;
}
__syncthreads();
// scores: each warp takes cells warp, warp+8, ...; each lane holds 8 of the 256 dimensions.
for (int c = warp; c < CHUNK; c += WARPS) {
if (c >= n_here || srow[c] < 0) {
if (lane < G) sp[lane][c] = -FLT_MAX;
continue;
}
float k8[8];
load8<KV_MODE>(p, KV_MODE == 4, srow[c], lane * 8, k8);
if constexpr (KV_MODE == 4) {
const int d0 = lane * 8, half = p.keyless_n_rot / 2;
if (d0 < p.keyless_n_rot) {
float paired[8];
load8_q8(p, true, srow[c], d0 < half ? d0 + half : d0 - half, paired);
const int cell = ids[c0 + c];
for (int d = 0; d < 8; ++d) {
const int pair = (d0 + d) % half;
const int rotary_pos = mrope_pos(p.keyless_mrope, cell, pair);
const float co = p.keyless_cos[(size_t)rotary_pos * half + pair];
const float si = p.keyless_sin[(size_t)rotary_pos * half + pair];
k8[d] = d0 < half ? k8[d]*co - paired[d]*si : k8[d]*co + paired[d]*si;
}
}
}
#pragma unroll
for (int h = 0; h < G; ++h) {
const float4 qa = *reinterpret_cast<const float4*>(&sq[h][lane * 8]);
const float4 qb = *reinterpret_cast<const float4*>(&sq[h][lane * 8 + 4]);
float s = k8[0] * qa.x + k8[1] * qa.y + k8[2] * qa.z + k8[3] * qa.w +
k8[4] * qb.x + k8[5] * qb.y + k8[6] * qb.z + k8[7] * qb.w;
s = warp_sum(s);
if (lane == 0) sp[h][c] = s * scale;
}
}
__syncthreads();
// per-head chunk max and exp-sum: warp w handles heads w and w+8.
for (int h = warp; h < G; h += WARPS) {
const float a = sp[h][lane], b = sp[h][lane + 32];
const float m = warp_max(fmaxf(a, b));
const float ea = (lane < n_here && srow[lane] >= 0) ? __expf(a - m) : 0.0f;
const float eb = (lane + 32 < n_here && srow[lane + 32] >= 0) ? __expf(b - m) : 0.0f;
sp[h][lane] = ea;
sp[h][lane + 32] = eb;
const float l = warp_sum(ea + eb);
if (lane == 0) { part_m[slot * G + h] = m; part_l[slot * G + h] = l; }
}
__syncthreads();
// values: thread t owns dimension t for all 12 heads.
float acc[G];
#pragma unroll
for (int h = 0; h < G; ++h) acc[h] = 0.0f;
for (int c = 0; c < n_here; ++c) {
if (srow[c] < 0) continue; // masked above, weight 0
float v;
if constexpr (KV_MODE == 0) {
v = __half2float(__ushort_as_half(p.v_pool[srow[c] * HD + t]));
} else if constexpr (KV_MODE == 1 || KV_MODE == 4) {
const float sc = __half2float(__ushort_as_half(p.v_scale[srow[c] * (HD / KV_Q8_GROUP) + t / KV_Q8_GROUP]));
v = (float) p.v_q[srow[c] * HD + t] * sc;
} else { // modes 2 and 3: V is rotated Q4_0 (kv_q4.hpp); the caller rotates the output back
constexpr int bytes_per_head = (HD / QK4_0) * sizeof(block_q4_0);
const int b = t / QK4_0;
const int rem = t % QK4_0;
const block_q4_0* blk = reinterpret_cast<const block_q4_0*>(p.v_q4 + srow[c] * bytes_per_head) + b;
const float d = __half2float(__ushort_as_half(blk->d));
const int j = rem < 16 ? rem : (rem - 16);
const uint8_t byte = blk->qs[j];
const int nibble = (rem < 16) ? ((byte & 0x0F) - 8) : ((byte >> 4) - 8);
v = (float) nibble * d;
}
#pragma unroll
for (int h = 0; h < G; ++h) acc[h] = fmaf(sp[h][c], v, acc[h]);
}
#pragma unroll
for (int h = 0; h < G; ++h) part_acc[((size_t) slot * G + h) * HD + t] = acc[h];
}
__device__ __forceinline__ void attn_merge_kernel_body(const float* __restrict__ part_acc,
const float* __restrict__ part_m,
const float* __restrict__ part_l, int n_chunks,
float* __restrict__ attn, long long scratch_stride = 0) {
part_acc += (size_t) blockIdx.y * (size_t) scratch_stride;
part_m += (size_t) blockIdx.y * (size_t) scratch_stride;
part_l += (size_t) blockIdx.y * (size_t) scratch_stride;
attn += (size_t) blockIdx.y * (size_t) gridDim.x * HD;
const int h = blockIdx.x; // global query head
const int kvh = h / G, hl = h % G;
const int d = threadIdx.x;
float M = -FLT_MAX;
for (int c = 0; c < n_chunks; ++c) M = fmaxf(M, part_m[(kvh * n_chunks + c) * G + hl]);
float L = 0.0f, acc = 0.0f;
for (int c = 0; c < n_chunks; ++c) {
const int slot = kvh * n_chunks + c;
const float m = part_m[slot * G + hl];
if (m == -FLT_MAX) continue;
const float w = __expf(m - M);
L = fmaf(part_l[slot * G + hl], w, L);
acc = fmaf(part_acc[((size_t) slot * G + hl) * HD + d], w, acc);
}
attn[(size_t) h * HD + d] = L > 0.0f ? acc / L : 0.0f;
}
} // namespace
} // namespace kernels
} // namespace strata
using namespace strata::kernels;
extern "C" __global__ void __launch_bounds__(256) leleka_qsa_attn_chunk_m2(
const float* __restrict__ q, const uint8_t* k_q4, const uint8_t* v_q4, const int32_t* page_table,
const int32_t* __restrict__ ids, const int32_t* __restrict__ step, int n_kv_heads, int page_size,
float* __restrict__ part_acc, float* __restrict__ part_m, float* __restrict__ part_l, int n_chunks, int cap,
long long scratch_stride) {
QsaAttnPools p;
p.k_q4 = k_q4;
p.v_q4 = v_q4;
p.page_table = page_table;
attn_chunk_kernel_body<2>(q, p, ids, step, n_kv_heads, page_size, 1.0f / sqrtf((float) HD), part_acc, part_m,
part_l, n_chunks, cap, scratch_stride);
}
extern "C" __global__ void __launch_bounds__(256) leleka_qsa_attn_chunk_m3(
const float* __restrict__ q, const int8_t* k_q, const uint16_t* k_scale, const uint8_t* v_q4,
const int32_t* page_table, const int32_t* __restrict__ ids, const int32_t* __restrict__ step, int n_kv_heads,
int page_size, float* __restrict__ part_acc, float* __restrict__ part_m, float* __restrict__ part_l,
int n_chunks, int cap, long long scratch_stride) {
QsaAttnPools p;
p.k_q = k_q;
p.k_scale = k_scale;
p.v_q4 = v_q4;
p.page_table = page_table;
attn_chunk_kernel_body<3>(q, p, ids, step, n_kv_heads, page_size, 1.0f / sqrtf((float) HD), part_acc, part_m,
part_l, n_chunks, cap, scratch_stride);
}
extern "C" __global__ void __launch_bounds__(256) leleka_qsa_attn_chunk_m4(
const float* __restrict__ q, const int8_t* v_q, const uint16_t* v_scale, const int32_t* page_table,
const float* keyless_cos, const float* keyless_sin, const int32_t* keyless_mrope, int keyless_n_rot,
const int32_t* __restrict__ ids, const int32_t* __restrict__ step, int n_kv_heads, int page_size,
float* __restrict__ part_acc, float* __restrict__ part_m, float* __restrict__ part_l, int n_chunks, int cap,
long long scratch_stride) {
QsaAttnPools p;
p.without_key = true;
p.v_q = v_q;
p.v_scale = v_scale;
p.page_table = page_table;
p.keyless_cos = keyless_cos;
p.keyless_sin = keyless_sin;
p.keyless_mrope = keyless_mrope;
p.keyless_n_rot = keyless_n_rot;
attn_chunk_kernel_body<4>(q, p, ids, step, n_kv_heads, page_size, 1.0f / sqrtf((float) HD), part_acc, part_m,
part_l, n_chunks, cap, scratch_stride);
}
extern "C" __global__ void __launch_bounds__(256) leleka_qsa_attn_merge(
const float* __restrict__ part_acc, const float* __restrict__ part_m, const float* __restrict__ part_l,
int n_chunks, float* __restrict__ attn, long long scratch_stride) {
attn_merge_kernel_body(part_acc, part_m, part_l, n_chunks, attn, scratch_stride);
}
@@ -0,0 +1,9 @@
//
// PLACEHOLDER - NOT GENERATED PTX.
// TODO-ROOT: compile experimental_qsa_attn.cu offline with the pinned toolchain
// nvcc 12.8.93 -std=c++17 -O3 -ptx -arch=sm_120 experimental_qsa_attn.cu -o experimental_qsa_attn.ptx
// (precise math: no --use_fast_math; see docs/cuda-seal-plan-additions-experimental.json) then freeze the source
// and PTX SHA-256 values in the matching pin of experimental.rs after the Root GPU smoke passes.
// The driver refuses this asset while the pin is zero, and this text defines no kernel entry, so it can never be
// mistaken for a qualified executable. EXPERIMENTAL: the program is only reachable through an explicit opt-in.
//
+9
View File
@@ -81,6 +81,15 @@ impl BufferHandle {
self.0 < other.0.saturating_add(other_bytes as u64)
&& other.0 < self.0.saturating_add(bytes as u64)
}
// A pointer `offset` bytes into an allocation the facade already admitted whole (experimental attention
// scratch: three partial buffers share one allocation). Overflow refuses.
pub(super) fn experimental_offset(self, offset: u64) -> Result<Self> {
Ok(Self(
self.0
.checked_add(offset)
.ok_or(Error::InvalidProjectionShape)?,
))
}
pub(super) fn moe_group_column(self, total: usize, index: usize) -> Result<Self> {
if !(1..=64).contains(&total) || index >= total {
return Err(Error::InvalidProjectionShape);
@@ -6,11 +6,14 @@
// scalars. No caller-selected symbol, executable or geometry reaches here.
const _: () = assert!(cfg!(target_endian = "little"));
pub(crate) const KAR_LEVELS_MAX_ARGUMENTS: usize = 16;
// 24 covers the widest closed experimental entry (18 parameters, experimental.rs); KAR's own entries use <= 8.
pub(crate) const KAR_LEVELS_MAX_ARGUMENTS: usize = 24;
pub(crate) enum KarArgument {
Pointer(BufferHandle),
Scalar(u32),
// A 64-bit integer parameter (`long long`); an optional pointer left null is `Scalar64(0)`.
Scalar64(u64),
}
struct KarLevelsStorage {
@@ -35,6 +38,7 @@ impl KarLevelsArgs {
*slot = match argument {
KarArgument::Pointer(handle) => handle.qwen_address(),
KarArgument::Scalar(value) => u64::from(*value),
KarArgument::Scalar64(value) => *value,
};
}
let storage = Box::into_raw(Box::new(KarLevelsStorage {
+19
View File
@@ -114,6 +114,21 @@ pub use qsa_selected_kv::{QsaSelectedKvProducts, QsaSelectedKvWorkspace};
#[allow(unsafe_code)]
mod qwen_ffi;
pub mod experimental;
#[cfg(all(
feature = "cuda-driver",
target_os = "linux",
target_pointer_width = "64"
))]
pub mod experimental_gpu;
#[cfg(all(
test,
feature = "cuda-driver",
target_os = "linux",
target_arch = "x86_64"
))]
#[path = "experimental_gpu_smoke.rs"]
mod experimental_gpu_smoke;
pub mod kar_decode_levels;
// Pure selection/geometry half of the Original QSA prompt-attention variants (any host).
pub mod qsa_prompt_attention_select;
@@ -366,6 +381,7 @@ impl<'driver> Device<'driver> {
projection_kernels: std::array::from_fn(|_| Cell::new(None)),
qwen_kernels: qwen_dispatch::Cache::new(),
kar_levels: Cell::new(None),
experimental: std::array::from_fn(|_| Cell::new(None)),
})
}
}
@@ -398,6 +414,7 @@ pub struct Context<'driver> {
projection_kernels: [Cell<Option<ProjectionKernels>>; 8],
qwen_kernels: qwen_dispatch::Cache,
kar_levels: Cell<Option<kar_decode_levels::KarLevelsKernels>>,
experimental: [Cell<Option<experimental::LoadedProgram>>; 6],
}
#[derive(Clone, Copy)]
struct FixedKernel {
@@ -2059,6 +2076,7 @@ impl Context<'_> {
),
);
let unload = combine(unload, self.unload_kar_levels());
let unload = combine(unload, self.unload_experimental());
if let Some(handle) = self.handle.take() {
// cuCtxDestroy accepts an owned non-current context. Pushing here
// would add a stack entry for a handle invalidated by destruction.
@@ -2518,6 +2536,7 @@ mod tests {
projection_kernels: std::array::from_fn(|_| Cell::new(None)),
qwen_kernels: qwen_dispatch::Cache::new(),
kar_levels: Cell::new(None),
experimental: std::array::from_fn(|_| Cell::new(None)),
};
let make = |handle| DeviceBuffer {
context: &context,
+13
View File
@@ -0,0 +1,13 @@
[package]
name = "leleka-experimental-ref"
version = "0.1.0"
description = "Pure Rust CPU references, cell layouts and planners of the experimental Strata modes (Q4_0/K8V4 KV, FWHT, keyless, control vectors, KV streaming, remote experts)"
edition.workspace = true
license.workspace = true
rust-version.workspace = true
[dev-dependencies]
serde_json = "1"
[lints]
workspace = true
@@ -0,0 +1,125 @@
// CPU emulation of the CUDA constructs the experimental KV / keyless / cvec kernels use, so the literal kernel
// TEXT of crates/cuda-driver/src/experimental_*.cu can be executed on a machine without nvcc or a GPU:
// one OS thread per CUDA thread, blocks run one after another, std::barrier for __syncthreads, a per-warp barrier
// plus a shared exchange array for the warp primitives. __shared__ becomes a function-level static (valid because
// blocks never overlap). It validates control flow, indexing and the arithmetic of the kernel text against the
// references; it says nothing about PTX code generation, FMA contraction chosen by nvcc, device libm accuracy
// (__expf is expf here) or performance.
#pragma once
#include <atomic>
#include <barrier>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <algorithm>
#include <functional>
#include <memory>
#include <thread>
#include <vector>
#define __device__
#define __host__
#define __global__
#define __forceinline__ inline
#define __launch_bounds__(...)
#define __shared__ static
#define __align__(n) __attribute__((aligned(n)))
struct dim3 {
unsigned x, y, z;
dim3(unsigned x_ = 1, unsigned y_ = 1, unsigned z_ = 1) : x(x_), y(y_), z(z_) {}
};
using uint3 = dim3;
inline thread_local dim3 threadIdx{0, 0, 0};
inline thread_local dim3 blockIdx{0, 0, 0};
inline thread_local dim3 blockDim{1, 1, 1};
inline thread_local dim3 gridDim{1, 1, 1};
inline std::barrier<>* emu_block = nullptr;
inline std::vector<std::unique_ptr<std::barrier<>>> emu_warp_barriers;
inline uint64_t emu_slots[64][32];
inline void __syncthreads() { emu_block->arrive_and_wait(); }
inline void __syncwarp() { emu_warp_barriers[(threadIdx.x + threadIdx.y * blockDim.x + threadIdx.z * blockDim.x * blockDim.y) >> 5]->arrive_and_wait(); }
inline int emu_lane() { return (int) ((threadIdx.x + threadIdx.y * blockDim.x + threadIdx.z * blockDim.x * blockDim.y) & 31); }
inline int emu_warp() { return (int) ((threadIdx.x + threadIdx.y * blockDim.x + threadIdx.z * blockDim.x * blockDim.y) >> 5); }
template <class T> inline T emu_get(int warp, int lane) { T v; std::memcpy(&v, &emu_slots[warp][lane], sizeof(T)); return v; }
template <class T, class F> inline T emu_exchange(T v, F partner) {
static_assert(sizeof(T) <= 8);
const int warp = emu_warp(), lane = emu_lane();
emu_slots[warp][lane] = 0;
std::memcpy(&emu_slots[warp][lane], &v, sizeof(T));
__syncwarp();
const T r = emu_get<T>(warp, partner(lane));
__syncwarp();
return r;
}
template <class T> inline T __shfl_xor_sync(unsigned, T v, int m, int = 32) { return emu_exchange(v, [m](int l) { return l ^ m; }); }
template <class T> inline T __shfl_up_sync(unsigned, T v, int d, int = 32) { return emu_exchange(v, [d](int l) { return l - d >= 0 ? l - d : l; }); }
template <class T> inline T __shfl_down_sync(unsigned, T v, int d, int = 32) { return emu_exchange(v, [d](int l) { return l + d < 32 ? l + d : l; }); }
template <class T> inline T __shfl_sync(unsigned, T v, int src, int = 32) { return emu_exchange(v, [src](int) { return src & 31; }); }
template <class T> inline T __ldg(const T* p) { return *p; }
inline float __expf(float x) { return std::exp(x); }
inline int __float2int_rn(float x) { return (int) std::nearbyint(x); }
inline int __float2int_rz(float x) {
if (x != x) return 0;
if (x >= 2147483648.0f) return INT32_MAX;
if (x <= -2147483648.0f) return INT32_MIN;
return (int) x;
}
inline int atomicAdd(int* a, int v) { return std::atomic_ref<int>(*a).fetch_add(v); }
inline int atomicCAS(int* a, int expected, int desired) {
std::atomic_ref<int>(*a).compare_exchange_strong(expected, desired);
return expected;
}
using std::max;
using std::min;
struct float2 { float x, y; };
struct float4 { float x, y, z, w; };
struct uint2 { unsigned x, y; };
struct uint4 { unsigned x, y, z, w; };
struct char4 { signed char x, y, z, w; };
struct ushort4 { unsigned short x, y, z, w; };
struct __half { unsigned short bits; };
struct __half2 { __half x, y; };
inline __half __ushort_as_half(unsigned short b) { return __half{b}; }
inline float __half2float(__half h) {
const uint32_t sign = (uint32_t) (h.bits & 0x8000u) << 16, ex = (h.bits >> 10) & 0x1Fu, man = h.bits & 0x3FFu;
uint32_t out;
if (ex == 0) {
if (man == 0) out = sign;
else { uint32_t m = man; int s = 0; while (!(m & 0x400u)) { m <<= 1; ++s; } out = sign | ((uint32_t) (113 - s) << 23) | ((m & 0x3FFu) << 13); }
} else if (ex == 31) out = sign | 0x7F800000u | (man << 13);
else out = sign | ((ex - 15 + 127) << 23) | (man << 13);
float f; std::memcpy(&f, &out, 4); return f;
}
inline float2 __half22float2(__half2 h) { return {__half2float(h.x), __half2float(h.y)}; }
// ---- launch: grid x block, blocks in order, one OS thread per CUDA thread
template <class F> inline void emu_launch(dim3 grid, dim3 block, F&& kernel) {
const unsigned n = block.x * block.y * block.z;
for (unsigned bz = 0; bz < grid.z; ++bz)
for (unsigned by = 0; by < grid.y; ++by)
for (unsigned bx = 0; bx < grid.x; ++bx) {
std::barrier<> bar((std::ptrdiff_t) n);
emu_block = &bar;
emu_warp_barriers.clear();
for (unsigned w = 0; w < (n + 31) / 32; ++w)
emu_warp_barriers.emplace_back(new std::barrier<>((std::ptrdiff_t) std::min(32u, n - w * 32)));
std::vector<std::thread> pool;
pool.reserve(n);
for (unsigned t = 0; t < n; ++t)
pool.emplace_back([&, t] {
threadIdx = dim3(t % block.x, (t / block.x) % block.y, t / (block.x * block.y));
blockIdx = dim3(bx, by, bz);
blockDim = block;
gridDim = grid;
kernel();
});
for (auto& th : pool) th.join();
}
}
@@ -0,0 +1,2 @@
#pragma once
#include "cuda_emu.h"
@@ -0,0 +1,2 @@
#pragma once
#include "cuda_emu.h"
@@ -0,0 +1,120 @@
// Shared pieces of the kernel-emulation harness: the deterministic integer generator (mirrored exactly by
// tests/common/mod.rs), JSON/hex writers, "device" buffers, and the C prototypes of the kernel entries.
#pragma once
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
// ---- the entries of crates/cuda-driver/src/experimental_*.cu (each compiled into its own object)
extern "C" {
void leleka_fwht256_f32(const float* src, float* dst, long long n_rows);
void leleka_kv_append_q4_step(uint8_t* k_q4, uint8_t* v_q4, const int32_t* table, const int32_t* step,
const float* kcur, const float* vcur, int kv_heads, int head_dim, int page_size,
uint8_t* host_k_q4, uint8_t* host_v_q4);
void leleka_kv_append_q4_batch(uint8_t* k_q4, uint8_t* v_q4, const int32_t* table, long long pos0, const float* K,
const float* V, int kv_heads, int head_dim, int page_size, int is_v_grid,
uint8_t* host_k_q4, uint8_t* host_v_q4, uint8_t* stage_k_q4, uint8_t* stage_v_q4);
void leleka_kv_gather_q4_step(const uint8_t* k_q4, const uint8_t* v_q4, const int32_t* table, const int32_t* ids,
const int32_t* step, int kv_heads, int head_dim, int page_size, uint16_t* k_scratch,
uint16_t* v_scratch);
void leleka_kv_append_q8_step(int8_t* k_q, int8_t* v_q, uint16_t* k_scale, uint16_t* v_scale, const int32_t* table,
const int32_t* step, const float* kcur, const float* vcur, int kv_heads, int head_dim,
int page_size, int8_t* host_k_q, int8_t* host_v_q, uint16_t* host_k_scale,
uint16_t* host_v_scale);
void leleka_kv_gather_q8_step(const int8_t* k_q, const int8_t* v_q, const uint16_t* k_scale, const uint16_t* v_scale,
const int32_t* table, const int32_t* ids, const int32_t* step, int kv_heads,
int head_dim, int page_size, uint16_t* k_scratch, uint16_t* v_scratch);
void leleka_keyless_route_query(float* q, const float* matrices, int heads);
void leleka_cvec_apply(float* R, const float* dir, const float* s_l, const int* on, int mode, long long layer, int n,
int hc, long long r_ld, const float* bo, long long bo_ld, const float* inj, long long inj_ld,
int write);
void leleka_qsa_attn_chunk_m2(const float* q, const uint8_t* k_q4, const uint8_t* v_q4, const int32_t* page_table,
const int32_t* ids, const int32_t* step, int n_kv_heads, int page_size, float* part_acc,
float* part_m, float* part_l, int n_chunks, int cap, long long scratch_stride);
void leleka_qsa_attn_chunk_m3(const float* q, const int8_t* k_q, const uint16_t* k_scale, const uint8_t* v_q4,
const int32_t* page_table, const int32_t* ids, const int32_t* step, int n_kv_heads,
int page_size, float* part_acc, float* part_m, float* part_l, int n_chunks, int cap,
long long scratch_stride);
void leleka_qsa_attn_chunk_m4(const float* q, const int8_t* v_q, const uint16_t* v_scale, const int32_t* page_table,
const float* keyless_cos, const float* keyless_sin, const int32_t* keyless_mrope,
int keyless_n_rot, const int32_t* ids, const int32_t* step, int n_kv_heads,
int page_size, float* part_acc, float* part_m, float* part_l, int n_chunks, int cap,
long long scratch_stride);
void leleka_qsa_attn_merge(const float* part_acc, const float* part_m, const float* part_l, int n_chunks,
float* attn, long long scratch_stride);
void leleka_kv_stream_reset(int32_t* page_table, int32_t* slot_block, int32_t* slot_stamp, int32_t* slot_ref,
int32_t* ctl, long long n_blocks, long long n_slots);
void leleka_kv_stream_resolve(int32_t* page_table, int32_t* slot_block, int32_t* slot_stamp, int32_t* slot_ref,
int32_t* ctl, int32_t* miss_block, int32_t* miss_slot, long long n_slots,
const int32_t* ids, const int32_t* steps, int n_q, int cap, int page_size);
void leleka_kv_stream_copy(int32_t* ctl, int32_t* miss_block, int32_t* miss_slot, const uint8_t* src0,
const uint8_t* src1, const uint8_t* src2, const uint8_t* src3, uint8_t* dst0, uint8_t* dst1,
uint8_t* dst2, uint8_t* dst3, int len0, int len1, int len2, int len3, int n_runs);
void leleka_kv_ring_table(int32_t* table, long long n_blocks, long long n_slots);
void leleka_kv_copy_u4(const void* src, void* dst, long long n_u4);
}
// ---- deterministic data: identical in tests/common/mod.rs
struct Lcg {
uint64_t s;
explicit Lcg(uint64_t seed) : s(seed) {}
uint32_t next() {
s = s * 6364136223846793005ull + 1442695040888963407ull;
return (uint32_t) (s >> 32);
}
// uniform in [-1, 1) on a 2^-23 grid: integer -> float and the scale are exact
float unit() { return (float) ((int32_t) (next() >> 8) - (1 << 23)) * (1.0f / 8388608.0f); }
// approximately normal: the sum of four units / 2 (variance 1/3 * 4 / 4)
float soft() { return (unit() + unit() + unit() + unit()) * 0.5f; }
uint32_t below(uint32_t n) { return next() % n; }
};
inline std::string hex_bytes(const void* p, size_t n) {
static const char* d = "0123456789abcdef";
std::string out;
out.reserve(n * 2);
const uint8_t* b = (const uint8_t*) p;
for (size_t i = 0; i < n; ++i) {
out += d[b[i] >> 4];
out += d[b[i] & 15];
}
return out;
}
template <class T>
std::string hex_vec(const std::vector<T>& v) {
return hex_bytes(v.data(), v.size() * sizeof(T));
}
inline uint64_t fnv1a(const void* p, size_t n) {
uint64_t h = 0xcbf29ce484222325ull;
for (size_t i = 0; i < n; ++i) h = (h ^ ((const uint8_t*) p)[i]) * 0x100000001b3ull;
return h;
}
template <class T>
uint64_t fnv_vec(const std::vector<T>& v) {
return fnv1a(v.data(), v.size() * sizeof(T));
}
// minimal JSON object writer (flat keys, values pre-rendered)
struct Json {
std::string out = "{";
bool first = true;
void raw(const std::string& key, const std::string& value) {
out += (first ? "\n\"" : ",\n\"") + key + "\":" + value;
first = false;
}
void str(const std::string& key, const std::string& s) { raw(key, "\"" + s + "\""); }
void num(const std::string& key, long long v) { raw(key, std::to_string(v)); }
template <class T>
void hex(const std::string& key, const std::vector<T>& v) { str(key, hex_vec(v)); }
template <class T>
void ints(const std::string& key, const std::vector<T>& v) {
std::string s = "[";
for (size_t i = 0; i < v.size(); ++i) s += (i ? "," : "") + std::to_string((long long) v[i]);
raw(key, s + "]");
}
void obj(const std::string& key, const Json& j) { raw(key, j.finish()); }
std::string finish() const { return out + "}"; }
};
@@ -0,0 +1,493 @@
// Executes the kernel TEXT of crates/cuda-driver/src/experimental_*.cu on the CPU (thread-per-CUDA-thread
// emulation, oracle/emu/cuda_emu.h) over deterministic scenarios and writes the results to
// tests/fixtures/emulated_kernels.json. tests/emulated_kernels.rs regenerates the same inputs with the Rust
// references (tests/common/mod.rs mirrors the generators below) and requires the kernel outputs to match.
// No GPU, no nvcc: this validates control flow, indexing and arithmetic of the literal kernel text; it does not
// validate PTX code generation, nvcc's FMA contraction, device libm or performance.
#include "cuda_runtime.h" // the emulation header (oracle/emu), NOT the CUDA toolkit
#include "emulate_common.h"
#include <set>
namespace {
constexpr int HEADS = 2, HD = 256, PAGE = 4, ROW_Q4 = 144;
std::vector<float> rotate(const std::vector<float>& x) { // leleka_fwht256_f32 over rows of 256
std::vector<float> out(x.size());
const long long rows = (long long) x.size() / 256;
emu_launch(dim3((unsigned) ((rows + 3) / 4)), dim3(32, 4), [&] { leleka_fwht256_f32(x.data(), out.data(), rows); });
return out;
}
// ---------------------------------------------------------------------------------------------- fwht
Json scenario_fwht() {
Lcg g(11);
const int rows = 9;
const float scale[3] = {1.0f, 20.0f, 0.02f};
std::vector<float> in((size_t) rows * 256);
for (int r = 0; r < rows; ++r)
for (int i = 0; i < 256; ++i) in[(size_t) r * 256 + i] = g.soft() * scale[r % 3];
const std::vector<float> out = rotate(in);
Json j;
j.num("rows", rows);
j.num("input_fnv", (long long) fnv_vec(in));
j.hex("out", out);
return j;
}
// ------------------------------------------------------------------------------------------- Q4_0 / Q8
struct Pools {
std::vector<uint8_t> k_q4, v_q4, ks, vs, kq, vq; // bytes
};
Json scenario_q4() {
const int pages = 3, cells = 12;
const std::vector<int32_t> table = {2, -1, 0};
const size_t pool_bytes = (size_t) pages * HEADS * PAGE * ROW_Q4;
std::vector<uint8_t> k(pool_bytes, 0), v(pool_bytes, 0), hk(pool_bytes, 0), hv(pool_bytes, 0);
Lcg g(21);
std::vector<float> all_k, all_v;
std::vector<int32_t> step(4);
for (int pos = 0; pos < cells; ++pos) {
std::vector<float> kraw(512), vraw(512);
for (auto& x : kraw) x = g.soft() * 3.0f;
for (auto& x : vraw) x = g.soft() * 3.0f;
all_k.insert(all_k.end(), kraw.begin(), kraw.end());
all_v.insert(all_v.end(), vraw.begin(), vraw.end());
const auto kc = rotate(kraw), vc = rotate(vraw);
step = {pos, pos + 1, (pos + 1) / 4, 0};
emu_launch(dim3(HEADS, HD / 32, 2), dim3(32), [&] {
leleka_kv_append_q4_step(k.data(), v.data(), table.data(), step.data(), kc.data(), vc.data(), HEADS, HD, PAGE,
hk.data(), hv.data());
});
}
Json j;
j.num("input_fnv", (long long) (fnv_vec(all_k) ^ (fnv_vec(all_v) * 31)));
j.hex("k", k); j.hex("v", v); j.hex("host_k", hk); j.hex("host_v", hv);
// prompt path: T cells from pos0 with a host copy and a staging pool, K then V grids
{
const int T = 6;
const long long pos0 = 3;
std::vector<uint8_t> bk(pool_bytes, 0), bv(pool_bytes, 0), bhk(pool_bytes, 0), bhv(pool_bytes, 0), bsk(pool_bytes, 0), bsv(pool_bytes, 0);
Lcg g2(31);
std::vector<float> K((size_t) T * 512), V((size_t) T * 512);
for (auto& x : K) x = g2.soft() * 3.0f;
for (auto& x : V) x = g2.soft() * 3.0f;
const auto Kr = rotate(K), Vr = rotate(V);
for (int is_v = 0; is_v < 2; ++is_v)
emu_launch(dim3(T, HEADS, HD / 32), dim3(32), [&] {
leleka_kv_append_q4_batch(bk.data(), bv.data(), table.data(), pos0, Kr.data(), Vr.data(), HEADS, HD, PAGE,
is_v, bhk.data(), bhv.data(), bsk.data(), bsv.data());
});
j.num("batch_input_fnv", (long long) (fnv_vec(K) ^ (fnv_vec(V) * 31)));
j.hex("batch_k", bk); j.hex("batch_v", bv); j.hex("batch_host_k", bhk); j.hex("batch_host_v", bhv);
j.hex("batch_stage_k", bsk); j.hex("batch_stage_v", bsv);
}
// gather the resident cells 0 1 3 8 10 11 from the sequential pools
const std::vector<int32_t> ids = {0, 1, 3, 8, 10, 11};
const std::vector<int32_t> gstep = {0, 0, 0, (int32_t) ids.size()};
std::vector<uint16_t> ks(ids.size() * HEADS * HD), vs(ids.size() * HEADS * HD);
const int total_blocks = (int) ids.size() * HEADS * (HD / 32);
emu_launch(dim3((total_blocks + 3) / 4), dim3(32, 4), [&] {
leleka_kv_gather_q4_step(k.data(), v.data(), table.data(), ids.data(), gstep.data(), HEADS, HD, PAGE, ks.data(), vs.data());
});
j.hex("gather_k", ks); j.hex("gather_v", vs);
return j;
}
Json scenario_q8() {
const int pages = 3, cells = 12;
const size_t rows = (size_t) pages * HEADS * PAGE;
const std::vector<int32_t> stream_table = {2, -1, 0}, table = {1, 2, 0};
Json j;
Lcg g(41);
std::vector<float> all_k, all_v;
std::vector<std::vector<float>> kc, vc;
for (int pos = 0; pos < cells; ++pos) {
std::vector<float> kraw(512), vraw(512);
for (auto& x : kraw) x = g.soft() * 2.0f;
for (auto& x : vraw) x = g.soft() * 2.0f;
all_k.insert(all_k.end(), kraw.begin(), kraw.end());
all_v.insert(all_v.end(), vraw.begin(), vraw.end());
kc.push_back(kraw);
vc.push_back(vraw);
}
j.num("input_fnv", (long long) (fnv_vec(all_k) ^ (fnv_vec(all_v) * 31)));
auto append = [&](int8_t* kq, int8_t* vq, uint16_t* ks, uint16_t* vs, const std::vector<int32_t>& tab, int pos,
const std::vector<float>& kk, const std::vector<float>& vv, int8_t* hkq, int8_t* hvq, uint16_t* hks, uint16_t* hvs) {
const std::vector<int32_t> step = {pos, pos + 1, (pos + 1) / 4, 0};
emu_launch(dim3(HEADS, HD / 64, kq ? 2 : 1), dim3(64), [&] {
leleka_kv_append_q8_step(kq, vq, ks, vs, tab.data(), step.data(), kk.data(), vv.data(), HEADS, HD, PAGE, hkq, hvq, hks, hvs);
});
};
// 1. INT8 K+V, resident (permuted table)
{
std::vector<int8_t> kq(rows * HD), vq(rows * HD);
std::vector<uint16_t> ks(rows * 4), vs(rows * 4);
for (int pos = 0; pos < cells; ++pos) append(kq.data(), vq.data(), ks.data(), vs.data(), table, pos, kc[pos], vc[pos], nullptr, nullptr, nullptr, nullptr);
j.hex("int8_kq", kq); j.hex("int8_vq", vq); j.hex("int8_ks", ks); j.hex("int8_vs", vs);
const std::vector<int32_t> ids = {0, 1, 3, 8, 10, 11}, gstep = {0, 0, 0, 6};
std::vector<uint16_t> ksc(6 * HEADS * HD), vsc(6 * HEADS * HD);
emu_launch(dim3((unsigned) ((6 * HEADS * (HD / 4) + 255) / 256)), dim3(256), [&] {
leleka_kv_gather_q8_step(kq.data(), vq.data(), ks.data(), vs.data(), table.data(), ids.data(), gstep.data(), HEADS, HD, PAGE, ksc.data(), vsc.data());
});
j.hex("int8_gather_k", ksc); j.hex("int8_gather_v", vsc);
}
// 2. INT8 with the streaming host copy (blocks 1 not resident)
{
std::vector<int8_t> kq(rows * HD), vq(rows * HD), hkq(rows * HD), hvq(rows * HD);
std::vector<uint16_t> ks(rows * 4), vs(rows * 4), hks(rows * 4), hvs(rows * 4);
for (int pos = 0; pos < cells; ++pos) append(kq.data(), vq.data(), ks.data(), vs.data(), stream_table, pos, kc[pos], vc[pos], hkq.data(), hvq.data(), hks.data(), hvs.data());
j.hex("stream_kq", kq); j.hex("stream_vq", vq); j.hex("stream_ks", ks); j.hex("stream_vs", vs);
j.hex("stream_host_kq", hkq); j.hex("stream_host_vq", hvq); j.hex("stream_host_ks", hks); j.hex("stream_host_vs", hvs);
}
// 3. V-only (keyless): k_q null, z extent 1
{
std::vector<int8_t> vq(rows * HD);
std::vector<uint16_t> vs(rows * 4);
for (int pos = 0; pos < cells; ++pos) append(nullptr, vq.data(), nullptr, vs.data(), table, pos, kc[pos], vc[pos], nullptr, nullptr, nullptr, nullptr);
j.hex("vonly_vq", vq); j.hex("vonly_vs", vs);
}
// 4. K8V4: rotate V; INT8 K-only with the pointers folded onto the K pool; Q4_0 V-only folded onto the V pool
{
std::vector<int8_t> kq(rows * HD);
std::vector<uint16_t> ks(rows * 4);
std::vector<uint8_t> v4(rows * ROW_Q4);
for (int pos = 0; pos < cells; ++pos) {
const auto vrot = rotate(vc[pos]);
const std::vector<int32_t> step = {pos, pos + 1, (pos + 1) / 4, 0};
append(kq.data(), kq.data(), ks.data(), ks.data(), table, pos, kc[pos], kc[pos], nullptr, nullptr, nullptr, nullptr);
emu_launch(dim3(HEADS, HD / 32, 2), dim3(32), [&] {
leleka_kv_append_q4_step(v4.data(), v4.data(), table.data(), step.data(), vrot.data(), vrot.data(), HEADS, HD, PAGE, nullptr, nullptr);
});
}
j.hex("k8v4_kq", kq); j.hex("k8v4_ks", ks); j.hex("k8v4_v4", v4);
const std::vector<int32_t> ids = {0, 1, 3, 8, 10, 11}, gstep = {0, 0, 0, 6};
std::vector<uint16_t> ksc(6 * HEADS * HD), vsc(6 * HEADS * HD);
emu_launch(dim3((unsigned) ((6 * HEADS * (HD / 4) + 255) / 256)), dim3(256), [&] {
leleka_kv_gather_q8_step(kq.data(), kq.data(), ks.data(), ks.data(), table.data(), ids.data(), gstep.data(), HEADS, HD, PAGE, ksc.data(), ksc.data());
});
const int total_blocks = 6 * HEADS * (HD / 32);
emu_launch(dim3((total_blocks + 3) / 4), dim3(32, 4), [&] {
leleka_kv_gather_q4_step(v4.data(), v4.data(), table.data(), ids.data(), gstep.data(), HEADS, HD, PAGE, vsc.data(), vsc.data());
});
j.hex("k8v4_gather_k", ksc); j.hex("k8v4_gather_v", vsc);
}
return j;
}
// ------------------------------------------------------------------------------------------- KV streaming
struct StreamState {
std::vector<int32_t> page_table, slot_block, slot_stamp, slot_ref, ctl, miss_block, miss_slot;
};
uint64_t state_hash(const StreamState& m, int placed) {
uint64_t h = 0xcbf29ce484222325ull;
auto add = [&](const std::vector<int32_t>& v, size_t n) {
for (size_t i = 0; i < n; ++i)
for (int b = 0; b < 4; ++b) h = (h ^ (uint8_t) ((uint32_t) v[i] >> (8 * b))) * 0x100000001b3ull;
};
add(m.page_table, m.page_table.size());
add(m.slot_block, m.slot_block.size());
add(m.slot_stamp, m.slot_stamp.size());
add(m.slot_ref, m.slot_ref.size());
add(m.miss_slot, (size_t) placed);
add(m.ctl, m.ctl.size());
return h;
}
// Host copy bytes: a pure function of (array, index), mirrored in tests/emulated_kernels.rs.
uint8_t host_byte(int array, size_t i) { return (uint8_t) (((uint32_t) (i + (size_t) array * 7919u) * 2654435761u) >> 24); }
Json scenario_stream() {
const int n_blocks = 1600, n_slots = 1030, cap = 76, n_q = 3, calls = 45;
const int runs_len[4] = {2048, 2048, 64, 64}; // Int8 runs of one block: k_q, v_q, k_scale, v_scale
StreamState m;
m.page_table.assign(n_blocks, 0); m.slot_block.assign(n_slots, 0); m.slot_stamp.assign(n_slots, 0);
m.slot_ref.assign(n_slots, 7); m.ctl.assign(16, 5); m.miss_block.assign(n_slots, 0); m.miss_slot.assign(n_slots, 0);
std::vector<std::vector<uint8_t>> host(4), slots(4);
for (int a = 0; a < 4; ++a) {
host[a].resize((size_t) n_blocks * runs_len[a]);
for (size_t i = 0; i < host[a].size(); ++i) host[a][i] = host_byte(a, i);
slots[a].assign((size_t) n_slots * runs_len[a], 0);
}
emu_launch(dim3(128), dim3(256), [&] {
leleka_kv_stream_reset(m.page_table.data(), m.slot_block.data(), m.slot_stamp.data(), m.slot_ref.data(), m.ctl.data(), n_blocks, n_slots);
});
Json j;
j.num("reset_state_fnv", (long long) state_hash(m, 0));
Lcg g(51);
std::string call_list = "[";
for (int call = 0; call < calls; ++call) {
std::vector<int32_t> ids((size_t) n_q * cap, 0), steps((size_t) n_q * 4, 0);
for (int q = 0; q < n_q; ++q) {
std::set<int> blocks;
while ((int) blocks.size() < cap / 4)
blocks.insert(g.below(2) ? (int) g.below(n_blocks) : (int) ((call * 7 + g.below(120)) % n_blocks));
int w = 0;
for (int b : blocks) for (int i = 0; i < 4; ++i) ids[(size_t) q * cap + w++] = b * 4 + i;
steps[q * 4 + 3] = w;
}
emu_launch(dim3(1), dim3(1024), [&] {
leleka_kv_stream_resolve(m.page_table.data(), m.slot_block.data(), m.slot_stamp.data(), m.slot_ref.data(), m.ctl.data(),
m.miss_block.data(), m.miss_slot.data(), n_slots, ids.data(), steps.data(), n_q, cap, PAGE);
});
emu_launch(dim3(96), dim3(128), [&] {
leleka_kv_stream_copy(m.ctl.data(), m.miss_block.data(), m.miss_slot.data(), host[0].data(), host[1].data(), host[2].data(), host[3].data(),
slots[0].data(), slots[1].data(), slots[2].data(), slots[3].data(), runs_len[0], runs_len[1], runs_len[2], runs_len[3], 4);
});
const int placed = m.ctl[2];
std::string order = "[";
for (int k = 0; k < placed; ++k) order += (k ? "," : "") + std::to_string(m.miss_block[k]);
std::string ctl = "[";
for (int k = 0; k < 16; ++k) ctl += (k ? "," : "") + std::to_string(m.ctl[k]);
call_list += std::string(call ? ",\n" : "") + "{\"order\":" + order + "],\"ctl\":" + ctl + "],\"state_fnv\":" +
std::to_string((long long) state_hash(m, placed)) + "}";
}
j.raw("calls", call_list + "]");
j.num("slots_fnv_k_q", (long long) fnv_vec(slots[0])); j.num("slots_fnv_v_q", (long long) fnv_vec(slots[1]));
j.num("slots_fnv_k_scale", (long long) fnv_vec(slots[2])); j.num("slots_fnv_v_scale", (long long) fnv_vec(slots[3]));
// the static ring of the MTP drafter and the plain u4 copy that stands in for cudaMemcpyAsync
std::vector<int32_t> ring(37, 0);
emu_launch(dim3(64), dim3(256), [&] { leleka_kv_ring_table(ring.data(), 37, 8); });
j.ints("ring_table", ring);
std::vector<uint8_t> src(100 * 16), dst(100 * 16, 0);
for (size_t i = 0; i < src.size(); ++i) src[i] = host_byte(5, i);
emu_launch(dim3(2), dim3(128), [&] { leleka_kv_copy_u4(src.data(), dst.data(), 100); });
j.num("copy_u4_equal", src == dst);
// reset again: everything evicted, counters zero
emu_launch(dim3(128), dim3(256), [&] {
leleka_kv_stream_reset(m.page_table.data(), m.slot_block.data(), m.slot_stamp.data(), m.slot_ref.data(), m.ctl.data(), n_blocks, n_slots);
});
j.num("final_reset_state_fnv", (long long) state_hash(m, 0));
return j;
}
// ------------------------------------------------------------------------------------ keyless routing
// matrices[(h*256+d)*256+j] = (d==j ? .8f : 0.f) + (float)(((h*19+d*3+j*11)%17)-8) * .001f (mirrored in Rust)
std::vector<float> routing_matrices(int heads) {
std::vector<float> m((size_t) heads * 256 * 256);
for (int h = 0; h < heads; ++h)
for (int d = 0; d < 256; ++d)
for (int j = 0; j < 256; ++j)
m[((size_t) h * 256 + d) * 256 + j] = (d == j ? .8f : 0.f) + (float) (((h * 19 + d * 3 + j * 11) % 17) - 8) * .001f;
return m;
}
Json scenario_route() {
const int tokens = 3, heads = 3;
const auto m = routing_matrices(heads);
Lcg g(61);
std::vector<float> q((size_t) tokens * heads * 256);
for (auto& x : q) x = g.soft();
std::vector<float> out = q;
emu_launch(dim3(tokens * heads), dim3(256), [&] { leleka_keyless_route_query(out.data(), m.data(), heads); });
Json j;
j.num("tokens", tokens); j.num("heads", heads);
j.hex("routed", out);
return j;
}
// ---------------------------------------------------------------------------------------- control vector
Json scenario_cvec() {
const int n = 300, hc = 3, T = 2, L = 4, layer = 2;
Lcg g(71);
std::vector<float> v(n);
for (auto& x : v) x = g.soft();
double nrm = 0;
for (float x : v) nrm += (double) x * x;
nrm = std::sqrt(nrm);
std::vector<float> unit(n);
for (int j = 0; j < n; ++j) unit[j] = (float) (v[j] / nrm);
const size_t r_ld = (size_t) hc * n;
std::vector<float> R0((size_t) T * r_ld), bo((size_t) T * n), inj((size_t) T * hc);
for (auto& x : R0) x = g.soft() * 3.0f;
for (auto& x : bo) x = g.soft();
for (auto& x : inj) x = g.soft();
Json j;
j.num("n", n); j.num("hc", hc); j.num("T", T); j.num("layer", layer); j.num("L", L);
j.hex("unit", unit); j.hex("add_dir", v); j.hex("r0", R0); j.hex("bo", bo); j.hex("inj", inj);
auto run = [&](const char* name, int mode, const std::vector<float>& dirv, float s_val, int layer_used, bool on, bool write) {
std::vector<float> dir((size_t) L * n, 0.0f), s(L, 0.0f);
std::copy(dirv.begin(), dirv.end(), dir.begin() + (size_t) layer * n);
s[layer] = s_val;
int on_flag = on ? 1 : 0;
std::vector<float> R = R0;
emu_launch(dim3(hc, T), dim3(256), [&] {
leleka_cvec_apply(R.data(), dir.data(), s.data(), &on_flag, mode, layer_used, n, hc, (long long) r_ld,
write ? bo.data() : nullptr, n, write ? inj.data() : nullptr, hc, write ? 1 : 0);
});
j.hex(name, R);
};
run("project_s1", 0, unit, 1.0f, layer, true, false);
run("project_s2", 0, unit, 2.0f, layer, true, false);
run("add", 1, v, 1.0f, layer, true, false);
run("off", 0, unit, 1.0f, layer, false, false);
run("off_write", 0, unit, 1.0f, layer, false, true);
run("project_write", 0, unit, 1.0f, layer, true, true);
run("add_write", 1, v, 1.0f, layer, true, true);
run("no_direction_layer", 0, unit, 1.0f, 1, true, false);
return j;
}
// ------------------------------------------------------------------------------------------ attention
constexpr int ATT_CELLS = 70, ATT_CAP = 70, ATT_NCHUNKS = 2, ATT_NQ = 2, NH = 24;
uint64_t scratch_floats() { return (uint64_t) ATT_NCHUNKS * NH * (HD + 2) + 64; }
struct AttnRun { std::vector<float> out; };
// chunk kernel then merge, for ATT_NQ queries with per-query selections
template <class ChunkFn>
std::vector<float> run_attention(const std::vector<int32_t>& ids, const std::vector<int32_t>& steps, int n_q, ChunkFn chunk) {
const long long stride = (long long) scratch_floats();
std::vector<float> scratch((size_t) stride * n_q, 0.0f), out((size_t) n_q * NH * HD, 0.0f);
float* part_acc = scratch.data();
float* part_m = part_acc + (size_t) ATT_NCHUNKS * NH * HD;
float* part_l = part_m + (size_t) ATT_NCHUNKS * NH;
emu_launch(dim3(ATT_NCHUNKS, HEADS, n_q), dim3(256), [&] { chunk(part_acc, part_m, part_l, stride); });
emu_launch(dim3(NH, n_q), dim3(256), [&] { leleka_qsa_attn_merge(part_acc, part_m, part_l, ATT_NCHUNKS, out.data(), stride); });
return out;
}
std::vector<int32_t> att_table() { // permutation of the 18 pages
std::vector<int32_t> t(18);
for (int i = 0; i < 18; ++i) t[i] = (i * 5 + 3) % 18;
return t;
}
Json scenario_attention() {
Json root;
const auto table = att_table();
const int pages = 18;
const size_t rows = (size_t) pages * HEADS * PAGE;
Lcg g(81);
std::vector<std::vector<float>> kc, vc;
for (int c = 0; c < ATT_CELLS; ++c) {
std::vector<float> k(512), v(512);
for (auto& x : k) x = g.soft() * 1.5f;
for (auto& x : v) x = g.soft() * 1.5f;
kc.push_back(k); vc.push_back(v);
}
std::vector<float> q((size_t) ATT_NQ * NH * HD);
for (auto& x : q) x = g.soft();
root.num("input_fnv", (long long) (fnv_vec(q) ^ (fnv_vec(kc[0]) * 3) ^ (fnv_vec(vc[ATT_CELLS - 1]) * 5)));
// selections: query 0 attends cells 0..69, query 1 cells 0..65
std::vector<int32_t> ids((size_t) ATT_NQ * ATT_CAP, 0), steps((size_t) ATT_NQ * 4, 0);
for (int i = 0; i < ATT_CELLS; ++i) ids[i] = i;
for (int i = 0; i < 66; ++i) ids[ATT_CAP + i] = i;
steps[3] = ATT_CELLS; steps[4 + 3] = 66;
auto append_q4 = [&](std::vector<uint8_t>& kp, std::vector<uint8_t>& vp, const std::vector<float>& k, const std::vector<float>& v, int pos) {
const std::vector<int32_t> step = {pos, pos + 1, (pos + 1) / 4, 0};
emu_launch(dim3(HEADS, HD / 32, 2), dim3(32), [&] {
leleka_kv_append_q4_step(kp.data(), vp.data(), table.data(), step.data(), k.data(), v.data(), HEADS, HD, PAGE, nullptr, nullptr);
});
};
// ---- mode 2: Q4_0 K and V (rotated), rotated query, output in the rotated domain
{
std::vector<uint8_t> kp(rows * ROW_Q4), vp(rows * ROW_Q4);
for (int c = 0; c < ATT_CELLS; ++c) append_q4(kp, vp, rotate(kc[c]), rotate(vc[c]), c);
const auto qr = rotate(q);
const auto out = run_attention(ids, steps, ATT_NQ, [&](float* pa, float* pm, float* pl, long long stride) {
leleka_qsa_attn_chunk_m2(qr.data(), kp.data(), vp.data(), table.data(), ids.data(), steps.data(), HEADS, PAGE, pa, pm, pl, ATT_NCHUNKS, ATT_CAP, stride);
});
Json j; j.hex("out", out);
root.obj("m2", j);
}
// ---- mode 3: INT8 K (unrotated), Q4_0 V (rotated), unrotated query, rotated output
{
std::vector<int8_t> kq(rows * HD);
std::vector<uint16_t> ks(rows * 4);
std::vector<uint8_t> v4(rows * ROW_Q4);
for (int c = 0; c < ATT_CELLS; ++c) {
const std::vector<int32_t> step = {c, c + 1, (c + 1) / 4, 0};
emu_launch(dim3(HEADS, HD / 64, 2), dim3(64), [&] {
leleka_kv_append_q8_step(kq.data(), kq.data(), ks.data(), ks.data(), table.data(), step.data(), kc[c].data(), kc[c].data(), HEADS, HD, PAGE, nullptr, nullptr, nullptr, nullptr);
});
const auto vr = rotate(vc[c]);
emu_launch(dim3(HEADS, HD / 32, 2), dim3(32), [&] {
leleka_kv_append_q4_step(v4.data(), v4.data(), table.data(), step.data(), vr.data(), vr.data(), HEADS, HD, PAGE, nullptr, nullptr);
});
}
const auto out = run_attention(ids, steps, ATT_NQ, [&](float* pa, float* pm, float* pl, long long stride) {
leleka_qsa_attn_chunk_m3(q.data(), kq.data(), ks.data(), v4.data(), table.data(), ids.data(), steps.data(), HEADS, PAGE, pa, pm, pl, ATT_NCHUNKS, ATT_CAP, stride);
});
Json j; j.hex("out", out);
root.obj("m3", j);
}
// ---- mode 4: V-only INT8, routed + position-encoded queries, keys rebuilt from V by position
{
std::vector<int8_t> vq(rows * HD);
std::vector<uint16_t> vs(rows * 4);
for (int c = 0; c < ATT_CELLS; ++c) {
const std::vector<int32_t> step = {c, c + 1, (c + 1) / 4, 0};
emu_launch(dim3(HEADS, HD / 64, 1), dim3(64), [&] {
leleka_kv_append_q8_step(nullptr, vq.data(), nullptr, vs.data(), table.data(), step.data(), kc[c].data(), vc[c].data(), HEADS, HD, PAGE, nullptr, nullptr, nullptr, nullptr);
});
}
// rope tables [position][32] from double math
std::vector<float> co((size_t) ATT_CELLS * 32), si((size_t) ATT_CELLS * 32);
for (int p = 0; p < ATT_CELLS; ++p)
for (int d = 0; d < 32; ++d) {
const double angle = p * std::pow(1e7, -2.0 * d / 64);
co[(size_t) p * 32 + d] = (float) std::cos(angle);
si[(size_t) p * 32 + d] = (float) std::sin(angle);
}
std::vector<int32_t> mpos((size_t) ATT_CELLS * 3);
for (int cell = 0; cell < ATT_CELLS; ++cell) for (int sector = 0; sector < 3; ++sector) mpos[cell * 3 + sector] = cell / (sector + 2);
root.hex("cos", co); root.hex("sin", si);
const auto matrices = routing_matrices(NH);
// per-query positions and selections (cells with cell % 3 != 1 up to the position)
const int qpos[ATT_NQ] = {ATT_CELLS - 1, 51};
std::vector<int32_t> kids((size_t) ATT_NQ * ATT_CAP, 0), ksteps((size_t) ATT_NQ * 4, 0);
for (int b = 0; b < ATT_NQ; ++b) {
int w = 0;
for (int cell = 0; cell <= qpos[b]; ++cell) if (cell % 3 != 1) kids[(size_t) b * ATT_CAP + w++] = cell;
ksteps[b * 4 + 3] = w;
}
for (int vision = 0; vision < 2; ++vision) {
std::vector<float> routed = q;
emu_launch(dim3(ATT_NQ * NH), dim3(256), [&] { leleka_keyless_route_query(routed.data(), matrices.data(), NH); });
std::vector<float> roped = routed;
for (int b = 0; b < ATT_NQ; ++b) for (int h = 0; h < NH; ++h) for (int d = 0; d < 32; ++d) {
const int i = (b * NH + h) * HD + d;
const int rp = vision ? mpos[qpos[b] * 3 + d % 3] : qpos[b];
const float a = roped[i], vv = roped[i + 32], c = co[(size_t) rp * 32 + d], s2 = si[(size_t) rp * 32 + d];
roped[i] = a * c - vv * s2; roped[i + 32] = a * s2 + vv * c;
}
const auto out = run_attention(kids, ksteps, ATT_NQ, [&](float* pa, float* pm, float* pl, long long stride) {
leleka_qsa_attn_chunk_m4(roped.data(), vq.data(), vs.data(), table.data(), co.data(), si.data(), vision ? mpos.data() : nullptr, 64,
kids.data(), ksteps.data(), HEADS, PAGE, pa, pm, pl, ATT_NCHUNKS, ATT_CAP, stride);
});
Json j; j.hex("out", out);
root.obj(vision ? "m4_mrope" : "m4", j);
}
}
return root;
}
} // namespace
int main(int argc, char** argv) {
Json root;
root.obj("fwht", scenario_fwht());
root.obj("q4", scenario_q4());
root.obj("q8", scenario_q8());
root.obj("stream", scenario_stream());
root.obj("route", scenario_route());
root.obj("cvec", scenario_cvec());
root.obj("attn", scenario_attention());
#ifdef HAVE_SCENARIOS_2
scenarios_2(root);
#endif
const std::string text = root.finish() + "\n";
if (argc > 1) {
FILE* f = std::fopen(argv[1], "w");
std::fwrite(text.data(), 1, text.size(), f);
std::fclose(f);
} else {
std::fwrite(text.data(), 1, text.size(), stdout);
}
return 0;
}
@@ -0,0 +1,161 @@
// Golden fixtures for control-vector loading: `load_control_vectors` of engine/strata/src/program/generate.cpp,
// included VERBATIM (extracted by gen_cvec_golden.sh with awk) and run on synthetic control-vector GGUF files
// written by this harness. `cvec_upload` (CUDA) is replaced by a recorder; the function is otherwise unmodified.
#include "strata/artifact/gguf_reader.hpp"
#include "strata/core/layout.hpp"
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <string>
#include <utility>
#include <vector>
// ---- stand-ins for what the extracted function touches
struct Options {
std::vector<std::pair<std::string, float>> cvec_files;
int cvec_first = -1, cvec_last = -1;
int cvec_mode = 1;
int cvec_single = -1;
};
namespace strata::kernels {
struct Recorded { std::vector<float> dir, s; int mode = -1, first = 0, last = 0; int64_t n_embd = 0, hc = 0; bool called = false; };
inline Recorded g_recorded;
inline bool cvec_upload(const std::vector<float>& dir, const std::vector<float>& s, int mode, int first, int last,
int64_t n_embd, int64_t hc, std::string&) {
g_recorded = {dir, s, mode, first, last, n_embd, hc, true};
return true;
}
} // namespace strata::kernels
#include "fragment_load_control_vectors.inc"
namespace {
uint64_t lcg_state = 77;
uint32_t next32() { lcg_state = lcg_state * 6364136223846793005ull + 1442695040888963407ull; return (uint32_t) (lcg_state >> 32); }
float value() { return (float) ((int32_t) (next32() >> 8) - (1 << 23)) / 8388608.0f * 2.0f; }
uint32_t bits(float f) { uint32_t u; std::memcpy(&u, &f, 4); return u; }
void put_u32(std::string& b, uint32_t v) { b.append((const char*) &v, 4); }
void put_u64(std::string& b, uint64_t v) { b.append((const char*) &v, 8); }
void put_str(std::string& b, const std::string& s) { put_u64(b, s.size()); b += s; }
struct T { std::string name; std::vector<float> data; uint32_t type = 0; };
std::string gguf(const std::string& arch, const std::vector<T>& ts, bool hint = false) {
std::string b;
put_u32(b, 0x46554747u); put_u32(b, 3); put_u64(b, ts.size()); put_u64(b, 1 + (hint ? 1 : 0));
put_str(b, "general.architecture"); put_u32(b, 8); put_str(b, arch);
if (hint) { put_str(b, "controlvector.model_hint"); put_u32(b, 8); put_str(b, "qwen4exp"); }
uint64_t off = 0;
for (const T& t : ts) {
put_str(b, t.name); put_u32(b, 1); put_u64(b, t.data.size()); put_u32(b, t.type); put_u64(b, off);
off += (t.data.size() * 4 + 31) / 32 * 32;
}
while (b.size() % 32) b.push_back(0);
for (const T& t : ts) {
b.append((const char*) t.data.data(), t.data.size() * 4);
while (b.size() % 32) b.push_back(0);
}
return b;
}
std::string hex(const std::string& s) {
static const char* d = "0123456789abcdef";
std::string o;
for (unsigned char c : s) { o += d[c >> 4]; o += d[c & 15]; }
return o;
}
std::vector<float> vec(int n) { std::vector<float> v(n); for (auto& x : v) x = value(); return v; }
struct Case { std::string name; std::vector<std::pair<std::string, float>> files; std::vector<std::string> contents; Options o; };
} // namespace
int main() {
const int L = 6, N = 40, HC = 4;
strata::core::ModelGeometry g;
g.n_layers = L; g.n_embd = N; g.hc = HC;
const std::string dir = std::string(getenv("TMPDIR") ? getenv("TMPDIR") : "/tmp") + "/leleka_cvec_golden";
std::system(("mkdir -p " + dir).c_str());
std::vector<std::string> A = {gguf("controlvector", {{"direction.0", vec(N)}, {"direction.2", vec(N)}, {"direction.3", vec(N)}, {"direction.9", vec(N)}}, true),
gguf("controlvector", {{"direction.2", vec(N)}, {"direction.4", vec(N)}})};
const std::string wrong_arch = gguf("llama", {{"direction.2", vec(N)}});
const std::string wrong_shape = gguf("controlvector", {{"direction.2", vec(N + 1)}});
const std::string wrong_type = gguf("controlvector", {{"direction.2", vec(N), 1}});
const std::string no_dirs = gguf("controlvector", {{"other.2", vec(N)}});
const std::string only_layer0 = gguf("controlvector", {{"direction.0", vec(N)}});
const std::string zero_dir = gguf("controlvector", {{"direction.2", std::vector<float>(N, 0.0f)}});
const std::string truncated = A[0].substr(0, 60);
std::string bad_magic = A[0]; bad_magic[0] = 'X';
std::string v2 = A[0]; v2[4] = 2;
std::vector<Case> cases;
auto mk = [&](const std::string& name, std::vector<std::pair<std::string, float>> files, std::vector<std::string> contents, Options o) {
cases.push_back({name, std::move(files), std::move(contents), o});
};
Options add; add.cvec_mode = 1;
Options proj; proj.cvec_mode = 0;
Options range = add; range.cvec_first = 2; range.cvec_last = 4;
Options proj_range = proj; proj_range.cvec_first = 2; proj_range.cvec_last = 5;
Options single = proj; single.cvec_single = 3;
Options single_missing = proj; single_missing.cvec_single = 5;
Options single_ignored_in_add = add; single_ignored_in_add.cvec_single = 5;
Options out_of_range = add; out_of_range.cvec_first = 5; out_of_range.cvec_last = 5;
Options wide = add; wide.cvec_last = 100;
mk("add_two_files", {{"a.gguf", 1.5f}, {"b.gguf", -0.5f}}, {A[0], A[1]}, add);
mk("add_range", {{"a.gguf", 1.0f}, {"b.gguf", 2.0f}}, {A[0], A[1]}, range);
mk("add_last_beyond_model", {{"a.gguf", 0.25f}}, {A[0]}, wide);
mk("project_two_files", {{"a.gguf", 1.0f}, {"b.gguf", 1.0f}}, {A[0], A[1]}, proj);
mk("project_range", {{"a.gguf", 0.75f}, {"b.gguf", 0.5f}}, {A[0], A[1]}, proj_range);
mk("project_single_layer", {{"a.gguf", 1.0f}}, {A[0]}, single);
mk("project_single_missing", {{"a.gguf", 1.0f}}, {A[0]}, single_missing);
mk("add_ignores_single", {{"a.gguf", 1.0f}}, {A[0]}, single_ignored_in_add);
mk("nothing_in_range", {{"a.gguf", 1.0f}}, {A[0]}, out_of_range);
mk("zero_scale_project", {{"a.gguf", 0.0f}}, {A[0]}, proj);
mk("zero_direction_project", {{"z.gguf", 1.0f}}, {zero_dir}, proj);
mk("wrong_architecture", {{"w.gguf", 1.0f}}, {wrong_arch}, add);
mk("wrong_shape", {{"s.gguf", 1.0f}}, {wrong_shape}, add);
mk("wrong_type", {{"t.gguf", 1.0f}}, {wrong_type}, add);
mk("no_direction_tensors", {{"n.gguf", 1.0f}}, {no_dirs}, add);
mk("only_layer_zero", {{"o.gguf", 1.0f}}, {only_layer0}, add);
mk("truncated", {{"x.gguf", 1.0f}}, {truncated}, add);
mk("bad_magic", {{"m.gguf", 1.0f}}, {bad_magic}, add);
mk("version_2", {{"v.gguf", 1.0f}}, {v2}, add);
std::printf("{\"n_layers\":%d,\"n_embd\":%d,\"hc\":%d,\"cases\":[", L, N, HC);
for (size_t ci = 0; ci < cases.size(); ++ci) {
Case& c = cases[ci];
Options o = c.o;
for (size_t i = 0; i < c.files.size(); ++i) {
const std::string path = dir + "/" + std::to_string(ci) + "_" + c.files[i].first;
std::ofstream(path, std::ios::binary).write(c.contents[i].data(), (std::streamsize) c.contents[i].size());
o.cvec_files.push_back({path, c.files[i].second});
}
strata::kernels::g_recorded = {};
std::string summary, err;
const bool ok = load_control_vectors(o, g, summary, err);
// the error text names the temp path; record it with that prefix replaced by the file label
for (size_t i = 0; i < c.files.size(); ++i) {
const std::string path = dir + "/" + std::to_string(ci) + "_" + c.files[i].first;
for (size_t at; (at = err.find(path)) != std::string::npos;) err.replace(at, path.size(), c.files[i].first);
}
std::printf("%s\n{\"name\":\"%s\",\"options\":{\"first\":%d,\"last\":%d,\"mode\":%d,\"single\":%d},\"files\":[", ci ? "," : "", c.name.c_str(),
o.cvec_first, o.cvec_last, o.cvec_mode, o.cvec_single);
for (size_t i = 0; i < c.files.size(); ++i)
std::printf("%s{\"label\":\"%s\",\"scale\":%u,\"bytes\":\"%s\"}", i ? "," : "", c.files[i].first.c_str(), bits(c.files[i].second), hex(c.contents[i]).c_str());
std::printf("],\"ok\":%d,\"error\":\"%s\"", ok ? 1 : 0, ok ? "" : err.c_str());
if (ok) {
const auto& r = strata::kernels::g_recorded;
std::printf(",\"summary\":\"%s\",\"mode\":%d,\"first\":%d,\"last\":%d,\"dir\":[", summary.c_str(), r.mode, r.first, r.last);
for (size_t i = 0; i < r.dir.size(); ++i) std::printf("%s%u", i ? "," : "", bits(r.dir[i]));
std::printf("],\"s\":[");
for (size_t i = 0; i < r.s.size(); ++i) std::printf("%s%u", i ? "," : "", bits(r.s[i]));
std::printf("]");
}
std::printf("}");
}
std::printf("]}\n");
std::system(("rm -rf " + dir).c_str());
return 0;
}
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
# Regenerates tests/fixtures/cvec_golden.json from generate.cpp's own load_control_vectors (extracted verbatim)
# running on synthetic control-vector GGUF files. Host-only; `cvec_upload` is a recorder.
# crates/experimental-ref/oracle/gen_cvec_golden.sh
set -eu
here=$(cd "$(dirname "$0")" && pwd)
strata="$here/../../../engine/strata"
out="$here/../tests/fixtures"
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
awk '/^bool load_control_vectors\(const Options& o, const strata::core::ModelGeometry& g, std::string& summary, std::string& err\) \{/ {on=1} on {print} on && /^}/ {exit}' \
"$strata/src/program/generate.cpp" > "$work/fragment_load_control_vectors.inc"
test -s "$work/fragment_load_control_vectors.inc"
# -ffp-contract=off: the Original's host build has no FMA, `data += scale * src` is a multiply then an add
${CXX:-clang++} -std=c++17 -O1 -ffp-contract=off -Wno-unused-function -Wno-unused-variable -I"$strata/include" -I"$work" \
"$here/gen_cvec_golden.cpp" -o "$work/gen_cvec"
mkdir -p "$out"
"$work/gen_cvec" > "$out/cvec_golden.json"
echo "wrote $out/cvec_golden.json"
@@ -0,0 +1,166 @@
// Golden fixtures for the Q4_0 / INT8 / FWHT arithmetic and the KV layout sizes, produced by the Original's own
// host code: the functions below are included VERBATIM (extracted by gen_kv_golden.sh with awk, never retyped)
// from engine/strata/src/kernels/kv_q4_parity.cpp (fwht256_host_reference, quantize_block_q4_0_host),
// kv_hybrid_parity.cpp (the INT8 K host reference) and the layer.cpp / kv_stream.cu size functions.
// usage: gen_kv_golden <separate|fused> (the script builds it twice: -ffp-contract=off and =fast)
#include "strata/kernels/f16_bits.hpp"
#include "strata/kernels/kv_q4.hpp"
#include "strata/kernels/kv_q8.hpp"
#include "strata/kernels/kv_stream.hpp"
#include "strata/kernels/qsa.hpp"
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
namespace k = strata::kernels;
using namespace strata::kernels;
namespace {
bool g_without_key = false, g_kv_q4 = false;
#include "fragment_fwht_q4.inc"
#include "fragment_pool_bytes.inc"
} // namespace
namespace strata::kernels {
#include "fragment_block_bytes.inc"
}
namespace {
uint64_t lcg_state = 0x9e3779b97f4a7c15ull;
uint32_t next32() {
lcg_state = lcg_state * 6364136223846793005ull + 1442695040888963407ull;
return (uint32_t) (lcg_state >> 32);
}
float uniform() { return (float) (next32() >> 8) / 16777216.0f; } // [0, 1)
float gauss() { // sum of 12 uniforms - 6
float s = 0.0f;
for (int i = 0; i < 12; ++i) s += uniform();
return s - 6.0f;
}
uint32_t bits(float f) { uint32_t u; std::memcpy(&u, &f, 4); return u; }
void print_u32(FILE* o, const float* v, int n) {
std::fprintf(o, "[");
for (int i = 0; i < n; ++i) std::fprintf(o, "%s%u", i ? "," : "", bits(v[i]));
std::fprintf(o, "]");
}
} // namespace
int main(int argc, char** argv) {
const std::string mode = argc > 1 ? argv[1] : "separate";
// The fused build only needs the Q4_0 section (the one place a fused multiply-add changes a result); the
// other sections are generated identically in both builds so the LCG sequence stays aligned.
const bool full = mode == "separate";
FILE* null_out = std::fopen("/dev/null", "w");
FILE* o = full ? stdout : null_out;
std::fprintf(o, "{\"mode\":\"%s\",\n", mode.c_str());
// ---- FWHT rows (the Original's host reference, butterflies then 1/16)
std::fprintf(o, "\"fwht\":[");
for (int r = 0; r < 24; ++r) {
float in[256], out[256];
const float scale = r < 8 ? 1.0f : (r < 16 ? 37.5f : 0.003f);
for (int i = 0; i < 256; ++i) in[i] = (r == 23 ? (i == 5 ? 1.0f : 0.0f) : gauss() * scale);
std::memcpy(out, in, sizeof in);
fwht256_host_reference(out);
std::fprintf(o, "%s{\"in\":", r ? ",\n" : "\n");
print_u32(o, in, 256);
std::fprintf(o, ",\"out\":");
print_u32(o, out, 256);
std::fprintf(o, "}");
}
std::fprintf(o, "],\n");
// ---- Q4_0 groups (quantize_block_q4_0_host on separate or fused arithmetic, whatever this build does)
o = stdout;
if (!full) std::fprintf(o, "{\"mode\":\"%s\",\n", mode.c_str());
std::fprintf(o, "\"q4\":[");
const int groups = 480 + 96; // the last 96 sit on the code boundaries where fused and separate evaluation differ
for (int g = 0; g < groups; ++g) {
float x[32];
const int cls = g >= 480 ? 8 : g % 8;
const float M = 0.05f + uniform() * 9.0f;
for (int i = 0; i < 32; ++i) {
float v = gauss();
switch (cls) {
case 1: v *= 0.01f; break;
case 2: v *= 300.0f; break;
case 3: v = (i % 2 ? 1.0f : -1.0f) * (float) (i / 2) * 0.25f; break; // exact multiples
case 4: v = (float) ((int) (next32() % 17) - 8) * 0.5f; break; // ties and boundaries
case 5: v = i == 7 ? 1e4f : v * 1e-3f; break; // one outlier
case 6: v = 0.0f; break;
case 7: v = v * 1e-8f; break; // fp16 subnormal scales
case 8: { // x on the half-multiples of d, +-1 ulp
v = i == 0 ? M : (float) ((double) M * ((double) (i % 8) + 0.5) / 8.0);
if (i > 0 && (next32() & 1)) v = nextafterf(v, 0.0f);
if (i > 0 && (next32() & 2)) v = nextafterf(v, 100.0f);
break;
}
default: break;
}
x[i] = v;
}
if (cls == 0 && g % 16 == 0) { x[3] = 2.0f; x[20] = -2.0f; } // tied magnitudes, opposite sign
k::block_q4_0 blk;
quantize_block_q4_0_host(x, blk);
unsigned char raw[18];
std::memcpy(raw, &blk, 18);
std::fprintf(o, "%s{\"x\":", g ? ",\n" : "\n");
print_u32(o, x, 32);
std::fprintf(o, ",\"block\":\"");
for (int i = 0; i < 18; ++i) std::fprintf(o, "%02x", raw[i]);
std::fprintf(o, "\"}");
}
std::fprintf(o, "]");
// ---- INT8 K groups (kv_hybrid_parity.cpp's host reference for K)
if (!full) { std::fprintf(o, "}\n"); return 0; }
std::fprintf(o, ",\n");
std::fprintf(o, "\"q8\":[");
{
const int cells = 12, H = 2, D = 256, G = D / k::KV_Q8_GROUP;
std::vector<float> K((size_t) cells * H * D);
for (size_t i = 0; i < K.size(); ++i) K[i] = gauss() * ((i / 64) % 5 == 0 ? 0.0f : ((i / 64) % 5) * 0.4f);
std::vector<int8_t> rk((size_t) cells * H * D);
std::vector<uint16_t> rk_s((size_t) cells * H * G);
#include "fragment_q8_k.inc"
for (int c = 0; c < cells; ++c)
for (int h = 0; h < H; ++h)
for (int g = 0; g < G; ++g) {
const size_t base = ((size_t) c * H + h) * D + (size_t) g * k::KV_Q8_GROUP;
std::fprintf(o, "%s{\"x\":", (c || h || g) ? ",\n" : "\n");
print_u32(o, &K[base], 64);
std::fprintf(o, ",\"scale\":%u,\"codes\":[", (unsigned) rk_s[((size_t) c * H + h) * G + g]);
for (int t = 0; t < 64; ++t) std::fprintf(o, "%s%d", t ? "," : "", (int) rk[base + t]);
std::fprintf(o, "]}");
}
}
std::fprintf(o, "],\n");
// ---- layout sizes: the Original's own functions
const k::QsaShapes s = k::qsa_real_shapes();
std::fprintf(o, "\"per_cell\":{\"q8\":%llu,\"q4\":%llu},\n", (unsigned long long) k::kv_q8_bytes_per_cell(s),
(unsigned long long) k::kv_q4_bytes_per_cell(s));
std::fprintf(o, "\"block_bytes\":{\"f16\":%llu,\"int8\":%llu,\"q4\":%llu,\"value_int8\":%llu},\n",
(unsigned long long) k::kv_block_bytes(s, k::kKvF16), (unsigned long long) k::kv_block_bytes(s, k::kKvInt8),
(unsigned long long) k::kv_block_bytes(s, k::kKvQ4), (unsigned long long) k::kv_block_bytes(s, k::kKvValueInt8));
std::fprintf(o, "\"pool_bytes\":[");
bool first = true;
for (int64_t pages : {1, 5, 64, 5120, 131072}) {
struct Case { const char* name; bool without_key, q4, hybrid, int8; } cases[] = {
{"fp16", false, false, false, false}, {"int8", false, false, false, true}, {"q4_0", false, true, false, true},
{"k8v4", false, false, true, true}, {"int8-keyless", true, false, false, true}};
for (const Case& c : cases) {
g_without_key = c.without_key;
g_kv_q4 = c.q4;
std::fprintf(o, "%s{\"format\":\"%s\",\"pages\":%lld,\"bytes\":%llu}", first ? "\n" : ",\n", c.name, (long long) pages,
(unsigned long long) kv_pool_bytes(s, pages, c.hybrid, c.int8));
first = false;
}
}
std::fprintf(o, "]}\n");
return 0;
}
+35
View File
@@ -0,0 +1,35 @@
#!/bin/sh
# Regenerates tests/fixtures/kv_golden_{separate,fused}.json from the Original's host code (macOS or Linux, any
# C++17 compiler, no CUDA). The reference functions are extracted verbatim from engine/strata with awk.
# crates/experimental-ref/oracle/gen_kv_golden.sh
# `separate` is compiled with -ffp-contract=off (every x * id + 8.5f is a multiply then an add), `fused` with
# -ffp-contract=fast (-mfma on x86; arm64 fuses natively), which is how nvcc compiles the same expression.
set -eu
here=$(cd "$(dirname "$0")" && pwd)
strata="$here/../../../engine/strata"
out="$here/../tests/fixtures"
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
# 1. fwht256_host_reference + quantize_block_q4_0_host, up to the end of the anonymous namespace
awk '/^void fwht256_host_reference\(float\* x\) \{/ {on=1} on && /^} \/\/ namespace/ {exit} on {print}' \
"$strata/src/kernels/kv_q4_parity.cpp" > "$work/fragment_fwht_q4.inc"
# 2. kv_pool_bytes of layer.cpp
awk '/^uint64_t kv_pool_bytes\(const QsaShapes& s, int64_t pages, bool hybrid, bool int8\) \{/ {on=1} on {print} on && /^}/ {exit}' \
"$strata/src/core/layer.cpp" > "$work/fragment_pool_bytes.inc"
# 3. kv_block_bytes of kv_stream.cu
awk '/^uint64_t kv_block_bytes\(const QsaShapes& s, int fmt\) \{/ {on=1} on {print} on && /^}/ {exit}' \
"$strata/src/kernels/cuda/kv_stream.cu" > "$work/fragment_block_bytes.inc"
# 4. the INT8 K host reference loop of kv_hybrid_parity.cpp (from after the rk_s declaration to Vrot's)
awk '/std::vector<uint16_t> rk_s\(/ {skip=1; next} skip && /std::vector<float> Vrot/ {exit} skip {print}' \
"$strata/src/kernels/kv_hybrid_parity.cpp" > "$work/fragment_q8_k.inc"
for f in fragment_fwht_q4 fragment_pool_bytes fragment_block_bytes fragment_q8_k; do test -s "$work/$f.inc"; done
CXX=${CXX:-clang++}
FMA=""
case $(uname -m) in x86_64|amd64) FMA="-mfma" ;; esac
common="-std=c++17 -O1 -Wno-unused-function -I$strata/include -I$here/stub -I$work"
$CXX $common -ffp-contract=off -o "$work/gen_separate" "$here/gen_kv_golden.cpp"
$CXX $common -ffp-contract=fast $FMA -o "$work/gen_fused" "$here/gen_kv_golden.cpp"
mkdir -p "$out"
"$work/gen_separate" separate > "$out/kv_golden_separate.json"
"$work/gen_fused" fused > "$out/kv_golden_fused.json"
echo "wrote $out/kv_golden_separate.json and kv_golden_fused.json"
@@ -0,0 +1,200 @@
// Golden fixtures for the second-GPU expert tier. The decision code of engine/strata/src/core/remote_experts.cpp
// (selection, slot sizing, claim bookkeeping, window guard + grouping, RemoteMeta packing, the result scatter) is
// included VERBATIM through the fragments extracted by gen_remote_golden.sh; the harness provides the members and
// recorder stand-ins for the cache and layout they touch.
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <string>
#include <utility>
#include <vector>
namespace strata::kernels::cpu { constexpr int64_t MAXT = 8; }
namespace {
constexpr int64_t H = 2560;
constexpr int64_t CAP = 8 * 10;
#include "f_struct.inc"
struct Layout {
bool native = false;
uint64_t max_blob = 1382400;
std::vector<uint64_t> blobs;
uint64_t blob_bytes(int64_t layer) const { return blobs[(size_t) layer]; }
};
struct Cache {
std::vector<std::pair<int32_t, int32_t>> sel;
int32_t slot_of(int64_t layer, int64_t expert) const {
for (size_t i = 0; i < sel.size(); ++i) if (sel[i].first == layer && sel[i].second == expert) return (int32_t) i;
return -1;
}
uint64_t device_slot(int32_t slot) const { return 0x100000000ull + (uint64_t) slot * 0x200000ull; }
};
struct Primary {
std::vector<uint8_t> has; // layers * experts
int64_t experts = 0;
int32_t slot_of(int64_t layer, int64_t expert) const { return has[(size_t) (layer * experts + expert)] ? 3 : -1; }
};
struct Tier {
int device = 1;
int64_t n_expert_ = 0;
int device_ = 1;
Layout lay;
Cache cache_;
std::vector<uint8_t> owned_ = std::vector<uint8_t>(CAP, 0), layers_present_;
std::vector<int32_t> group_of_ = std::vector<int32_t>(CAP, -1), group_id_;
std::vector<unsigned long long> ptr_;
std::vector<int32_t> start_, dst_, tok_, original_row_;
uint64_t computed_ = 0;
unsigned char h_meta_[sizeof(RemoteMeta)] = {};
const float* h_out_ = nullptr;
std::string err;
void close() {}
// open() up to the memory check; returns selected.empty() == false
bool select(int slots, int64_t layers, int64_t experts, const std::vector<std::pair<int32_t, int32_t>>& ranked,
const Primary& primary, std::vector<uint8_t>& claimed, std::vector<std::pair<int32_t, int32_t>>& selected_out,
uint64_t& needed_out) {
n_expert_ = experts;
#include "f_select.inc"
uint64_t needed_total = 0;
{
#include "f_needed.inc"
needed_total = needed;
}
layers_present_.assign((size_t) layers, 0);
#include "f_mark.inc"
selected_out = selected;
cache_.sel = selected;
needed_out = needed_total;
return true;
}
bool begin(int64_t layer, const int32_t* ids, int64_t n_tok, int64_t k, const int32_t* kind, const int32_t* primary_res) {
const int64_t n = n_tok * k;
#include "f_begin.inc"
return true;
}
void pack(int64_t) {
#include "f_meta.inc"
}
void finish(float* out) {
#include "f_finish.inc"
}
};
uint64_t lcg_state = 4242;
uint32_t next32() { lcg_state = lcg_state * 6364136223846793005ull + 1442695040888963407ull; return (uint32_t) (lcg_state >> 32); }
uint32_t below(uint32_t n) { return next32() % n; }
template <class T> void arr(const char* name, const std::vector<T>& v, bool comma = true) {
std::printf("\"%s\":[", name);
for (size_t i = 0; i < v.size(); ++i) std::printf("%s%lld", i ? "," : "", (long long) v[i]);
std::printf("]%s", comma ? "," : "");
}
} // namespace
int main() {
std::printf("{\"open\":[");
const int L = 6, E = 24;
std::vector<Tier> tiers;
std::vector<Primary> primaries;
for (int c = 0; c < 40; ++c) {
Tier t;
Primary p;
p.experts = E;
p.has.assign((size_t) L * E, 0);
for (auto& h : p.has) h = below(5) == 0;
std::vector<uint8_t> claimed((size_t) L * E, 0);
for (auto& v : claimed) v = below(6) == 0;
std::vector<std::pair<int32_t, int32_t>> ranked;
const int rn = 5 + (int) below(60);
for (int i = 0; i < rn; ++i) ranked.push_back({(int32_t) below(L + 2) - 1, (int32_t) below(E + 3) - 1});
if (c % 5 == 3) ranked.insert(ranked.begin() + 1, ranked[0]);
t.lay.native = c % 2 == 1;
for (int l = 0; l < L; ++l) t.lay.blobs.push_back(100000 + below(900000));
const int slots = 1 + (int) below(30);
const std::vector<uint8_t> claimed_in = claimed;
std::vector<std::pair<int32_t, int32_t>> sel;
uint64_t needed = 0;
t.select(slots, L, E, ranked, p, claimed, sel, needed);
std::printf("%s{\"slots\":%d,\"native\":%d,", c ? "," : "", slots, t.lay.native ? 1 : 0);
arr("blobs", t.lay.blobs);
std::printf("\"max_blob\":%llu,", (unsigned long long) t.lay.max_blob);
arr("primary", p.has);
arr("claimed_in", claimed_in);
std::printf("\"ranked\":[");
for (size_t i = 0; i < ranked.size(); ++i) std::printf("%s[%d,%d]", i ? "," : "", ranked[i].first, ranked[i].second);
std::printf("],\"selected\":[");
for (size_t i = 0; i < sel.size(); ++i) std::printf("%s[%d,%d]", i ? "," : "", sel[i].first, sel[i].second);
std::printf("],\"needed\":%llu,", (unsigned long long) needed);
arr("layers_present", t.layers_present_);
arr("claimed_out", claimed, false);
std::printf("}");
tiers.push_back(t);
primaries.push_back(p);
}
std::printf("],\"begin\":[");
int emitted = 0;
for (int c = 0; c < 200; ++c) {
Tier& t = tiers[(size_t) (c % tiers.size())];
if (t.cache_.sel.empty()) continue;
const Primary& p = primaries[(size_t) (c % tiers.size())];
const int64_t n_tok = c % 23 == 0 ? 9 : 1 + below(8);
int64_t k = c % 31 == 0 ? 9 : 10;
int64_t layer = c % 29 == 0 ? L : (int64_t) below(L);
// bias ids toward held experts so groups form
std::vector<int32_t> ids((size_t) (n_tok * k) + 1);
for (auto& id : ids) {
const uint32_t r = below(10);
if (r < 6) id = t.cache_.sel[below((uint32_t) t.cache_.sel.size())].second;
else if (r == 9) id = (int32_t) below(4) - 2 + (r == 9 ? E : 0);
else id = (int32_t) below(E);
}
const bool use_kind = c % 3 == 1, use_primary = c % 4 == 2;
std::vector<int32_t> kind(ids.size()), pres((size_t) L * E);
for (auto& v : kind) v = below(4) == 0 ? 2 : -1;
for (size_t i = 0; i < pres.size(); ++i) pres[i] = p.has[i] ? 1 : -1;
t.start_.clear(); t.dst_.clear(); t.tok_.clear(); t.original_row_.clear(); t.group_id_.clear(); t.ptr_.clear();
t.computed_ = 0;
t.owned_.assign(CAP, 0);
const bool ok = t.begin(layer, ids.data(), n_tok, k, use_kind ? kind.data() : nullptr, use_primary ? pres.data() : nullptr);
std::printf("%s{\"layer\":%lld,\"n_tok\":%lld,\"k\":%lld,\"tier\":%d,", emitted++ ? "," : "", (long long) layer, (long long) n_tok, (long long) k, (int) (c % tiers.size()));
arr("ids", std::vector<int32_t>(ids.begin(), ids.begin() + (size_t) (n_tok * k)));
std::printf("\"use_kind\":%d,\"use_primary\":%d,", use_kind, use_primary);
arr("kind", std::vector<int32_t>(kind.begin(), kind.begin() + (size_t) (n_tok * k)));
std::printf("\"ok\":%d,", ok ? 1 : 0);
if (ok) {
arr("owned", t.owned_);
arr("group_id", t.group_id_);
arr("ptr", t.ptr_);
arr("start", t.start_);
arr("dst", t.dst_);
arr("tok", t.tok_);
arr("original_row", t.original_row_);
std::printf("\"computed\":%llu,", (unsigned long long) t.computed_);
if (!t.group_id_.empty()) {
std::memset(t.h_meta_, 0, sizeof t.h_meta_);
t.pack(n_tok);
std::printf("\"meta\":[");
for (size_t i = 0; i < sizeof t.h_meta_; ++i) std::printf("%s%u", i ? "," : "", t.h_meta_[i]);
std::printf("],");
// finish: rows of 4 floats stand in for H (the verbatim loop uses H; use the real width on a sparse check)
std::vector<float> compact(t.dst_.size() * H);
for (size_t i = 0; i < compact.size(); ++i) compact[i] = (float) (i / H) + 1.0f + (float) (i % H) * 0.0001f;
std::vector<float> out((size_t) (n_tok * k) * H, -1.0f);
// run the verbatim scatter with the real width
t.h_out_ = compact.data();
t.finish(out.data());
std::printf("\"scatter_rows\":[");
for (size_t r = 0; r < (size_t) (n_tok * k); ++r) {
// row signature: first, middle, last element
std::printf("%s[%.7g,%.7g,%.7g]", r ? "," : "", out[r * H], out[r * H + H / 2], out[r * H + H - 1]);
}
std::printf("],");
}
}
std::printf("\"end\":0}");
}
std::printf("]}\n");
}
+31
View File
@@ -0,0 +1,31 @@
#!/bin/sh
# Regenerates tests/fixtures/remote_golden.json from the Original's remote_experts.cpp: the expert selection of
# `open`, the grouping of `begin`, the RemoteMeta packing and `finish`'s scatter are extracted VERBATIM (awk) and
# compiled on the host against recorder stand-ins for the cache / layout. No CUDA involved.
# crates/experimental-ref/oracle/gen_remote_golden.sh
set -eu
here=$(cd "$(dirname "$0")" && pwd)
strata="$here/../../../engine/strata"
src="$strata/src/core/remote_experts.cpp"
out="$here/../tests/fixtures"
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
# open(): rank filter ... "no unclaimed experts" check
awk '/^ std::vector<std::pair<int32_t, int32_t>> selected;$/ {on=1} on {print} on && /selected\.empty\(\)/ {exit}' "$src" > "$work/f_select.inc"
# open(): device bytes of the chosen slots
awk '/^ uint64_t needed = 0;$/ {on=1} on {print; n++} on && n==3 {exit}' "$src" > "$work/f_needed.inc"
# open(): claim bookkeeping
awk '{ if (hold != "" && index($0, "layers_present_[(size_t) pair.first] = 1;")) { print hold; on=1 } hold=$0 } on {print} on && /^ }$/ {exit}' "$src" > "$work/f_mark.inc"
# begin(): window guard ... group/start/dst/tok construction
awk '/^ if \(n <= 0 \|\| n > CAP/ {on=1} on {print} on && /^ start_\.push_back\(\(int32_t\) dst_\.size\(\)\);$/ {exit}' "$src" > "$work/f_begin.inc"
# begin(): metadata packing
awk '/auto\* meta = \(RemoteMeta\*\) h_meta_;/ {on=1} on {print} on && /meta->count = / {exit}' "$src" > "$work/f_meta.inc"
# finish(): scatter
awk '/^ for \(size_t i = 0; i < original_row_\.size\(\); \+\+i\)$/ {on=1} on {print; n++} on && n==2 {exit}' "$src" > "$work/f_finish.inc"
# struct RemoteMeta
awk '/^struct RemoteMeta \{/ {on=1} on {print} on && /^};/ {exit}' "$src" > "$work/f_struct.inc"
for f in select needed mark begin meta finish struct; do test -s "$work/f_$f.inc" || { echo "empty fragment $f" >&2; exit 1; }; done
${CXX:-clang++} -std=c++17 -O1 -ffp-contract=off -I"$work" "$here/gen_remote_golden.cpp" -o "$work/gen_remote"
mkdir -p "$out"
"$work/gen_remote" > "$out/remote_golden.json"
echo "wrote $out/remote_golden.json"
@@ -0,0 +1,45 @@
#!/usr/bin/env python3
"""Regenerates docs/cuda-seal-plan-additions-experimental.json (sha256 + bytes of the six experimental .cu assets
and their Rust consumers). Run from the repository root after any edit to those files:
python3 crates/experimental-ref/oracle/gen_seal_additions.py
Flags follow engine/strata/CMakeLists.txt: none of the six Original TUs is in the --use_fast_math list and the
target sets only CUDA_STANDARD 17, so the build is precise, default -fmad."""
import hashlib, json
def sha(path):
data = open(path, "rb").read()
return {"sha256": hashlib.sha256(data).hexdigest(), "bytes": len(data)}
PROGRAMS = [
("kv_q4", "kv_q4.cu", "FWHT-256 + Q4_0 append (step/batched) + gather; Original kv_q4.cu precise (default flags, not in the fast-math list); K8V4's Q4_0 V half and rotated INT8's FWHT"),
("kv_q8", "kv_q8.cu", "INT8 append (K+V, K8V4 K half, V-only) + gather; Original kv_q8.cu precise"),
("kv_stream", "kv_stream.cu", "CLOCK residency resolver, block copy, ring table, u4 copy; Original kv_stream.cu precise; integer only"),
("keyless", "keyless.cu", "per-head query routing (fmaf-ordered 256x256); Original keyless.cu precise"),
("qsa_attn", "qsa_decode_attn.cu", "experimental attention modes 2/3/4 + merge; Original qsa_decode_attn.cu precise (expf/exp2f exact, not in the fast-math list)"),
("cvec", "cvec.cu", "control-vector apply; Original cvec.cu default flags (its own __expf in sigmoidf_ is explicit in the source)"),
]
src = "crates/cuda-driver/src/"
assets = []
for i, (name, original, policy) in enumerate(PROGRAMS):
assets.append({
"cu": f"{src}experimental_{name}.cu",
"cu_pin": sha(f"{src}experimental_{name}.cu"),
"ptx": f"{src}experimental_{name}.ptx",
"flags": ["-ptx", "-O3", "-arch=sm_120", "-std=c++17"],
"policy": "EXPERIMENTAL, off by default (OptIn). " + policy,
"direct_original_headers": [],
"original": f"engine/strata/src/kernels/cuda/{original}",
"rust_consumers": {"experimental.rs": sha(src + "experimental.rs"), "experimental_gpu.rs": sha(src + "experimental_gpu.rs")},
"rust_fields_to_fill": {"experimental.rs": [f"PINS[{i}].source_sha256", f"PINS[{i}].ptx_sha256"]},
"encoding": "concat_include_str",
"seal_sha256": None,
"seal_length": None,
})
doc = {
"schema": 1,
"note": "Additions for the experimental Strata modes. None of these six .cu files has been compiled; PINS in experimental.rs are all zero and admit_ptx refuses every asset until Root builds the PTX and freezes the digests. Flags follow engine/strata/CMakeLists.txt: none of the six Original TUs is in the --use_fast_math list (native_* only) and the strata_kernels target adds no other CUDA flag besides CUDA_STANDARD 17, so the build is precise (no --use_fast_math) with default -fmad contraction.",
"assets": assets,
}
with open("docs/cuda-seal-plan-additions-experimental.json", "w") as f:
json.dump(doc, f, indent=2)
f.write("\n")
@@ -0,0 +1,63 @@
// Golden fixtures for the KV streaming planner: `kv_plan`, `kv_pool_bytes`, `qsa_state_bytes`, `qsa_shapes`,
// `align_up16` and `qsa_kv_resident_min` of engine/strata/src/core/layer.cpp, included VERBATIM (extracted by
// gen_stream_golden.sh with awk, never retyped) and driven over a grid of formats, contexts, rings and
// --kv-resident values. Host-only: no CUDA symbol is needed.
#include "strata/core/layout.hpp"
#include "strata/kernels/kv_q4.hpp"
#include "strata/kernels/kv_q8.hpp"
#include "strata/kernels/kv_stream.hpp"
#include "strata/kernels/qsa.hpp"
#include <algorithm>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <vector>
namespace strata::core {
using strata::kernels::QsaShapes;
int64_t qsa_kv_resident_min();
#include "fragment_flags.inc"
namespace {
#include "fragment_shapes.inc"
#include "fragment_streaming.inc"
} // namespace
#include "fragment_state_bytes.inc"
#include "fragment_resident_min.inc"
void emit() {
const ModelGeometry g;
struct Fmt { const char* name; bool without_key, int8, q4, hybrid; } fmts[] = {
{"fp16", false, false, false, false}, {"int8", false, true, false, false}, {"q4_0", false, false, true, false},
{"k8v4", false, false, false, true}, {"int8-keyless", true, true, false, false}};
std::printf("{\"cases\":[");
bool first = true;
for (const Fmt& f : fmts)
for (int64_t max_cells : {4096ll, 32768ll, 262144ll, 524288ll})
for (int64_t ring : {0ll, 256ll, -1ll})
for (int64_t resident : {0ll, 1000ll, 20480ll, 65536ll})
for (int rope = 0; rope < 2; ++rope) {
g_without_key = f.without_key;
g_kv_int8 = f.int8;
g_kv_q4 = f.q4;
g_kv_hybrid = f.hybrid;
g_kv_resident = resident;
const QsaShapes s = qsa_shapes(g);
const KvPlan p = kv_plan(s, max_cells, ring);
const uint64_t bytes = qsa_state_bytes(g, max_cells, rope != 0, ring);
std::printf("%s\n{\"format\":\"%s\",\"max_cells\":%lld,\"ring\":%lld,\"resident\":%lld,\"rope\":%d,"
"\"mode\":%d,\"pages\":%lld,\"slots\":%lld,\"pooled_rows\":%lld,\"state_bytes\":%llu}",
first ? "" : ",", f.name, (long long) max_cells, (long long) ring, (long long) resident, rope,
p.mode, (long long) p.pages, (long long) p.slots, (long long) p.pooled_rows,
(unsigned long long) bytes);
first = false;
}
std::printf("],\"resident_min\":%lld,\"map_bytes_5120\":%llu}\n", (long long) qsa_kv_resident_min(),
(unsigned long long) strata::kernels::kv_stream_map_bytes(5120));
}
} // namespace strata::core
int main() {
strata::core::emit();
return 0;
}
+24
View File
@@ -0,0 +1,24 @@
#!/bin/sh
# Regenerates tests/fixtures/stream_plan_golden.json from layer.cpp's own planner functions (extracted verbatim).
# crates/experimental-ref/oracle/gen_stream_golden.sh
set -eu
here=$(cd "$(dirname "$0")" && pwd)
strata="$here/../../../engine/strata"
out="$here/../tests/fixtures"
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
layer="$strata/src/core/layer.cpp"
grep -m1 '^namespace { bool g_without_key' "$layer" | sed 's/^namespace {//; s/}$//' > "$work/fragment_flags.inc"
grep -m1 '^QsaShapes qsa_shapes(const ModelGeometry& g) {' "$layer" > "$work/fragment_shapes.inc"
grep -m1 '^uint64_t align_up16(uint64_t n) {' "$layer" >> "$work/fragment_shapes.inc"
# the streaming chunk: from the globals to the end of kv_pool_bytes (the anonymous namespace closes after it)
awk '/^int64_t g_kv_resident = 0;/ {on=1} on && /^} \/\/ namespace/ {exit} on {print}' "$layer" > "$work/fragment_streaming.inc"
awk '/^uint64_t qsa_state_bytes\(const ModelGeometry& g, int64_t max_cells, bool with_rope, int64_t ring_cells\) \{/ {on=1} on {print} on && /^}/ {exit}' \
"$layer" > "$work/fragment_state_bytes.inc"
grep -m1 '^int64_t qsa_kv_resident_min()' "$layer" > "$work/fragment_resident_min.inc"
for f in fragment_flags fragment_shapes fragment_streaming fragment_state_bytes fragment_resident_min; do test -s "$work/$f.inc"; done
${CXX:-clang++} -std=c++17 -O1 -ffp-contract=off -Wno-unused-function -Wno-unused-variable -I"$strata/include" -I"$here/stub" -I"$work" \
"$here/gen_stream_golden.cpp" -o "$work/gen_stream"
mkdir -p "$out"
"$work/gen_stream" > "$out/stream_plan_golden.json"
echo "wrote $out/stream_plan_golden.json"
+23
View File
@@ -0,0 +1,23 @@
#!/bin/sh
# Executes the kernel text of crates/cuda-driver/src/experimental_*.cu on the CPU (thread emulation, no GPU, no
# nvcc) and writes tests/fixtures/emulated_kernels.json for tests/emulated_kernels.rs.
# crates/experimental-ref/oracle/run_emulated_kernels.sh [output.json]
# -ffp-contract=off pins the host float evaluation to separate IEEE operations; explicit fmaf calls in the kernels
# stay fused. nvcc's own contraction of `a * b + c` is NOT modelled (see Contraction in src/q4_0.rs).
set -eu
here=$(cd "$(dirname "$0")" && pwd)
src="$here/../../cuda-driver/src"
out=${1:-"$here/../tests/fixtures/emulated_kernels.json"}
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
CXX=${CXX:-clang++}
flags="-std=c++20 -O1 -ffp-contract=off -pthread -Wno-unused-function -Wno-unknown-pragmas -Wno-unused-variable -I$here/emu"
objs=""
for f in kv_q4 kv_q8 kv_stream keyless qsa_attn cvec; do
$CXX $flags -x c++ -include "$here/emu/cuda_runtime.h" -c "$src/experimental_$f.cu" -o "$work/$f.o"
objs="$objs $work/$f.o"
done
$CXX $flags -I"$here" -c "$here/emulate_kernels.cpp" -o "$work/harness.o"
$CXX $flags -pthread $objs "$work/harness.o" -o "$work/emulate"
"$work/emulate" "$out"
echo "wrote $out"
@@ -0,0 +1,3 @@
// Host-only stand-in: the Original headers pulled in by the oracle harnesses need no CUDA symbol, only the
// include to resolve. Nothing here is ever linked or executed on a device.
#pragma once
+116
View File
@@ -0,0 +1,116 @@
//! Decode attention over the experimental KV formats: scratch arithmetic of `qsa_decode_attn.cu` and a
//! double-precision reference of what the split-K kernel computes (softmax GQA over the selected cells).
//!
//! The device kernel accumulates in f32 in a split-K order and uses `__expf`; this reference is the exact
//! mathematical result over the *same dequantized* K/V, so agreement is a relative tolerance (the Original's own
//! parity tests use `5e-3` absolute against a host f32 reference). The attention kernels are:
//! KV_MODE 2 (Q4_0 K and V, rotated), 3 (K8V4: INT8 K, rotated Q4_0 V), 4 (keyless: V-only INT8, K rebuilt from
//! V by position). Modes 2 and 3 return the output in the *rotated* domain; the caller applies the FWHT.
use crate::layout::QsaShapes;
pub const HD: usize = 256;
/// Query heads per KV head (24 / 2).
pub const G: usize = 12;
/// Cells per block.
pub const CHUNK: usize = 64;
pub const THREADS: usize = 256;
/// `qsa_decode_attn_scratch_floats`: partial accumulators, maxima and sums for `cap` selected cells.
pub fn scratch_floats(cap: i64, s: &QsaShapes) -> u64 {
let chunks = (cap + CHUNK as i64 - 1) / CHUNK as i64;
chunks as u64 * s.n_head as u64 * (HD as u64 + 2) + 64
}
pub fn n_chunks(cap: i64) -> i64 {
(cap + CHUNK as i64 - 1) / CHUNK as i64
}
/// The score scale of the Original (`1.0f / sqrtf((float) HD)`), exactly 1/16.
pub const SCALE: f32 = 0.0625;
/// Softmax GQA attention in f64. `q` is `[n_head][256]`; `k` and `v` are `[n_ids][n_head_kv][256]`
/// (dequantized, already in the domain the kernel sees); `n_ids` cells are attended. Returns `[n_head][256]`.
pub fn reference(q: &[f32], k: &[f32], v: &[f32], n_head: usize, n_head_kv: usize, n_ids: usize) -> Vec<f64> {
assert_eq!(n_head % n_head_kv, 0);
assert_eq!(q.len(), n_head * HD);
assert_eq!(k.len(), n_ids * n_head_kv * HD);
assert_eq!(v.len(), k.len());
let group = n_head / n_head_kv;
let mut out = vec![0f64; n_head * HD];
if n_ids == 0 {
return out;
}
for h in 0..n_head {
let kvh = h / group;
let mut scores = vec![0f64; n_ids];
for (j, sc) in scores.iter_mut().enumerate() {
let kr = &k[(j * n_head_kv + kvh) * HD..][..HD];
let qr = &q[h * HD..][..HD];
*sc = qr.iter().zip(kr).map(|(a, b)| f64::from(*a) * f64::from(*b)).sum::<f64>() * f64::from(SCALE);
}
let max = scores.iter().cloned().fold(f64::NEG_INFINITY, f64::max);
let weights: Vec<f64> = scores.iter().map(|s| (s - max).exp()).collect();
let total: f64 = weights.iter().sum();
for (j, w) in weights.iter().enumerate() {
let vr = &v[(j * n_head_kv + kvh) * HD..][..HD];
for d in 0..HD {
out[h * HD + d] += w / total * f64::from(vr[d]);
}
}
}
out
}
/// Relative L2 and max absolute error between a kernel output and a reference.
pub fn errors(got: &[f32], want: &[f64]) -> (f64, f64) {
let (mut e2, mut r2, mut emax) = (0f64, 0f64, 0f64);
for (g, w) in got.iter().zip(want) {
let e = f64::from(*g) - w;
e2 += e * e;
r2 += w * w;
emax = emax.max(e.abs());
}
((e2 / r2.max(1e-300)).sqrt(), emax)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn scratch_size_matches_the_original_formula() {
let s = QsaShapes::real();
assert_eq!(scratch_floats(70, &s), 2 * 24 * 258 + 64);
assert_eq!(scratch_floats(2051, &s), 33 * 24 * 258 + 64);
assert_eq!(n_chunks(64), 1);
assert_eq!(n_chunks(65), 2);
}
#[test]
fn uniform_scores_average_the_values() {
let (nh, nkv, n) = (2, 1, 3);
let q = vec![0.0f32; nh * HD];
let k = vec![1.0f32; n * nkv * HD];
let mut v = vec![0.0f32; n * nkv * HD];
for j in 0..n {
v[j * HD] = (j + 1) as f32; // 1, 2, 3
}
let out = reference(&q, &k, &v, nh, nkv, n);
assert!((out[0] - 2.0).abs() < 1e-12 && (out[HD] - 2.0).abs() < 1e-12);
}
#[test]
fn a_dominant_key_selects_its_value() {
let (nh, nkv, n) = (1, 1, 2);
let mut q = vec![0.0f32; HD];
q[0] = 160.0;
let mut k = vec![0.0f32; n * HD];
k[0] = 1.0; // cell 0 aligned with q: score 10
let mut v = vec![0.0f32; n * HD];
v[0] = 5.0;
v[HD] = -7.0;
let out = reference(&q, &k, &v, nh, nkv, n);
assert!((out[0] - 5.0).abs() < 1e-3);
}
}
+429
View File
@@ -0,0 +1,429 @@
//! CPU twin of the experimental KV programs' *data movement*: paged pools with the Original's row layout,
//! the append kernels (`kv_append_q4_*`, `kv_append_q8_*`) and the gathers (`kv_gather_q4_*`,
//! `kv_gather_q8_*`) of `kv_q4.cu` / `kv_q8.cu`, including the KV-streaming write rule (the host copy always,
//! the VRAM page only when the block is resident, i.e. `table[block] >= 0`) and the K8V4 / V-only call
//! compositions of `layer.cpp`.
//!
//! The pools are plain byte vectors in exactly the device layout, so a pool dumped from a (emulated or real)
//! kernel run compares byte-for-byte. Nothing here is a performance model.
use crate::f16::f16_from_f32;
use crate::kv_q8::{self, KV_Q8_GROUP};
use crate::layout::{KvFormat, QsaShapes, physical_row};
use crate::q4_0::{self, BLOCK_BYTES, Contraction, QK4_0};
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CacheError {
/// fp16 pools are not part of the experimental programs.
UnsupportedFormat,
/// `head_dim` must be 256 for the Hadamard formats and a multiple of 64 for INT8.
Geometry,
/// A cell position or selection id is outside the page table.
OutOfRange,
}
/// One bundle of pool arrays (a VRAM pool, a streaming host copy or a prompt staging pool).
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct PoolSet {
pub k_q: Vec<u8>,
pub v_q: Vec<u8>,
pub k_scale: Vec<u8>,
pub v_scale: Vec<u8>,
pub k_q4: Vec<u8>,
pub v_q4: Vec<u8>,
}
impl PoolSet {
/// A pool array by the names of `layout::pool_arrays` / `layout::stream_runs`.
pub fn array(&self, name: &str) -> Option<&Vec<u8>> {
Some(match name {
"k_q" => &self.k_q,
"v_q" => &self.v_q,
"k_scale" => &self.k_scale,
"v_scale" => &self.v_scale,
"k_q4" => &self.k_q4,
"v_q4" => &self.v_q4,
_ => return None,
})
}
pub fn array_mut(&mut self, name: &str) -> Option<&mut Vec<u8>> {
Some(match name {
"k_q" => &mut self.k_q,
"v_q" => &mut self.v_q,
"k_scale" => &mut self.k_scale,
"v_scale" => &mut self.v_scale,
"k_q4" => &mut self.k_q4,
"v_q4" => &mut self.v_q4,
_ => return None,
})
}
/// Zeroed pools of `rows` physical rows for `format` (rows = pages x n_head_kv x page_size).
pub fn new(format: KvFormat, shapes: &QsaShapes, rows: u64) -> Result<Self, CacheError> {
let hd = shapes.head_dim as u64;
if format == KvFormat::Fp16 {
return Err(CacheError::UnsupportedFormat);
}
let q4 = (rows * q4_0::bytes_per_head(hd as usize)) as usize;
let codes = (rows * hd) as usize;
let scales = (rows * (hd / KV_Q8_GROUP as u64) * 2) as usize;
let mut p = Self::default();
match format {
KvFormat::Q4_0 => {
p.k_q4 = vec![0; q4];
p.v_q4 = vec![0; q4];
}
KvFormat::K8V4 => {
p.k_q = vec![0; codes];
p.k_scale = vec![0; scales];
p.v_q4 = vec![0; q4];
}
KvFormat::Int8 | KvFormat::Int8Rotated => {
p.k_q = vec![0; codes];
p.v_q = vec![0; codes];
p.k_scale = vec![0; scales];
p.v_scale = vec![0; scales];
}
KvFormat::Int8Keyless => {
p.v_q = vec![0; codes];
p.v_scale = vec![0; scales];
}
KvFormat::Fp16 => unreachable!(),
}
Ok(p)
}
}
fn check_geometry(format: KvFormat, s: &QsaShapes) -> Result<(), CacheError> {
let hd = s.head_dim;
let ok = match format {
KvFormat::Q4_0 | KvFormat::K8V4 => hd == 256,
KvFormat::Fp16 => false,
_ => hd > 0 && hd % KV_Q8_GROUP as i64 == 0,
};
if ok && s.n_head_kv > 0 && s.page_size > 0 { Ok(()) } else { Err(CacheError::Geometry) }
}
fn write_q4(pool: &mut [u8], row: u64, b: usize, blk: &q4_0::BlockQ4_0, blocks_per_head: usize) {
let at = (row as usize * blocks_per_head + b) * BLOCK_BYTES;
pool[at..at + BLOCK_BYTES].copy_from_slice(&blk.to_bytes());
}
fn write_q8(codes: &mut [u8], scales: &mut [u8], row: u64, g: usize, group: &[i8; KV_Q8_GROUP], sbits: u16, hd: usize) {
let at = row as usize * hd + g * KV_Q8_GROUP;
for (i, c) in group.iter().enumerate() {
codes[at + i] = *c as u8;
}
let sat = (row as usize * (hd / KV_Q8_GROUP) + g) * 2;
scales[sat..sat + 2].copy_from_slice(&sbits.to_le_bytes());
}
/// Which half a Q4_0 / INT8 append writes (the Original launches z = 0 for K and z = 1 for V; the K8V4 and
/// V-only compositions fold the unused half onto the used pool).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Half {
K,
V,
}
/// `kv_append_q4_kernel` for one cell and one half: `x` is `[n_head_kv][head_dim]`, already rotated.
#[allow(clippy::too_many_arguments)]
pub fn append_q4_half(
pool: &mut [u8],
host: Option<&mut [u8]>,
table: &[i32],
pos: i64,
x: &[f32],
s: &QsaShapes,
c: Contraction,
) -> Result<(), CacheError> {
let (hd, kvh, ps) = (s.head_dim as usize, s.n_head_kv as u64, s.page_size);
if hd != 256 || x.len() != kvh as usize * hd {
return Err(CacheError::Geometry);
}
let blk_page = (pos / ps) as usize;
let page = *table.get(blk_page).ok_or(CacheError::OutOfRange)?;
let slot = (pos % ps) as u64;
let bph = hd / QK4_0;
let mut host = host;
for h in 0..kvh {
for b in 0..bph {
let g: &[f32; 32] = x[h as usize * hd + b * QK4_0..][..QK4_0].try_into().expect("group");
let blk = q4_0::quantize_group(g, c);
if page >= 0 {
write_q4(pool, physical_row(s, page as u64, h, slot), b, &blk, bph);
}
if let Some(hp) = host.as_deref_mut() {
write_q4(hp, physical_row(s, blk_page as u64, h, slot), b, &blk, bph);
}
}
}
Ok(())
}
/// `kv_append_q8_kernel` for one cell and one half. `k_q`/`k_scale` of a value-only cache are simply never
/// passed (the Original passes null pointers and launches z = 1 only).
#[allow(clippy::too_many_arguments)]
pub fn append_q8_half(
codes: &mut [u8],
scales: &mut [u8],
host: Option<(&mut [u8], &mut [u8])>,
table: &[i32],
pos: i64,
x: &[f32],
s: &QsaShapes,
) -> Result<(), CacheError> {
let (hd, kvh, ps) = (s.head_dim as usize, s.n_head_kv as u64, s.page_size);
if hd % KV_Q8_GROUP != 0 || x.len() != kvh as usize * hd {
return Err(CacheError::Geometry);
}
let blk_page = (pos / ps) as usize;
let page = *table.get(blk_page).ok_or(CacheError::OutOfRange)?;
let slot = (pos % ps) as u64;
let mut host = host;
for h in 0..kvh {
for g in 0..hd / KV_Q8_GROUP {
let grp: &[f32; KV_Q8_GROUP] =
x[h as usize * hd + g * KV_Q8_GROUP..][..KV_Q8_GROUP].try_into().expect("group");
let (q, sbits) = kv_q8::quantize_group(grp);
if page >= 0 {
write_q8(codes, scales, physical_row(s, page as u64, h, slot), g, &q, sbits, hd);
}
if let Some((hc, hs)) = host.as_mut() {
write_q8(hc, hs, physical_row(s, blk_page as u64, h, slot), g, &q, sbits, hd);
}
}
}
Ok(())
}
/// The whole cell append of `layer.cpp` for `format`: rotation is the caller's (`fwht256` of K and/or V as
/// [`KvFormat::rotates_k`] / [`KvFormat::rotates_v`] say); this writes the already-rotated `k` and `v`.
/// K8V4 is the composed call (INT8 K, Q4_0 V); a value-only cache ignores `k`.
#[allow(clippy::too_many_arguments)]
pub fn append_cell(
format: KvFormat,
pools: &mut PoolSet,
mut host: Option<&mut PoolSet>,
table: &[i32],
pos: i64,
k: &[f32],
v: &[f32],
s: &QsaShapes,
c: Contraction,
) -> Result<(), CacheError> {
check_geometry(format, s)?;
match format {
KvFormat::Q4_0 => {
append_q4_half(&mut pools.k_q4, host.as_deref_mut().map(|h| &mut h.k_q4[..]), table, pos, k, s, c)?;
append_q4_half(&mut pools.v_q4, host.as_deref_mut().map(|h| &mut h.v_q4[..]), table, pos, v, s, c)
}
KvFormat::Int8 | KvFormat::Int8Rotated => {
let h = host.as_deref_mut();
let (hk, hv) = match h {
Some(h) => {
let PoolSet { k_q, v_q, k_scale, v_scale, .. } = h;
(Some((&mut k_q[..], &mut k_scale[..])), Some((&mut v_q[..], &mut v_scale[..])))
}
None => (None, None),
};
append_q8_half(&mut pools.k_q, &mut pools.k_scale, hk, table, pos, k, s)?;
append_q8_half(&mut pools.v_q, &mut pools.v_scale, hv, table, pos, v, s)
}
KvFormat::Int8Keyless => {
let hv = host.as_deref_mut().map(|h| (&mut h.v_q[..], &mut h.v_scale[..]));
append_q8_half(&mut pools.v_q, &mut pools.v_scale, hv, table, pos, v, s)
}
KvFormat::K8V4 => {
// layer.cpp: fwht256(vcur); kv_append_q8_step(k_q, k_q, ..., kcur, kcur); kv_append_q4_step(v_q4, v_q4, ..., vcur, vcur)
// mode 0 only: no host mirror ("K8V4 does not support streaming")
append_q8_half(&mut pools.k_q, &mut pools.k_scale, None, table, pos, k, s)?;
append_q4_half(&mut pools.v_q4, None, table, pos, v, s, c)
}
KvFormat::Fp16 => Err(CacheError::UnsupportedFormat),
}
}
/// `kv_gather_q4_kernel`: for each selected cell, head and element, `fp16(code * d)` (rotated domain), as
/// `[id][head][head_dim]` fp16 bits.
pub fn gather_q4(pool: &[u8], table: &[i32], ids: &[i32], s: &QsaShapes) -> Result<Vec<u16>, CacheError> {
let (hd, kvh, ps) = (s.head_dim as usize, s.n_head_kv as u64, s.page_size);
let bph = hd / QK4_0;
let mut out = vec![0u16; ids.len() * kvh as usize * hd];
for (i, &cell) in ids.iter().enumerate() {
let page = *table.get((cell as i64 / ps) as usize).ok_or(CacheError::OutOfRange)?;
for h in 0..kvh {
let row = physical_row(s, page as u64, h, (cell as i64 % ps) as u64);
for b in 0..bph {
let at = (row as usize * bph + b) * BLOCK_BYTES;
let blk = q4_0::BlockQ4_0::from_bytes(&pool[at..at + BLOCK_BYTES]);
for t in 0..QK4_0 {
out[(i * kvh as usize + h as usize) * hd + b * QK4_0 + t] = blk.gather_bits(t);
}
}
}
}
Ok(out)
}
/// `kv_gather_q8_kernel` for one half.
pub fn gather_q8(codes: &[u8], scales: &[u8], table: &[i32], ids: &[i32], s: &QsaShapes) -> Result<Vec<u16>, CacheError> {
let (hd, kvh, ps) = (s.head_dim as usize, s.n_head_kv as u64, s.page_size);
let groups = hd / KV_Q8_GROUP;
let mut out = vec![0u16; ids.len() * kvh as usize * hd];
for (i, &cell) in ids.iter().enumerate() {
let page = *table.get((cell as i64 / ps) as usize).ok_or(CacheError::OutOfRange)?;
for h in 0..kvh {
let row = physical_row(s, page as u64, h, (cell as i64 % ps) as u64) as usize;
for d in 0..hd {
let sat = (row * groups + d / KV_Q8_GROUP) * 2;
let sbits = u16::from_le_bytes([scales[sat], scales[sat + 1]]);
out[(i * kvh as usize + h as usize) * hd + d] = kv_q8::gather_bits(codes[row * hd + d] as i8, sbits);
}
}
}
Ok(out)
}
/// The dequantized values the fused attention reads (`load8_*`), `[id][head][head_dim]` f32, unrounded.
pub fn dequant_q4(pool: &[u8], table: &[i32], ids: &[i32], s: &QsaShapes) -> Result<Vec<f32>, CacheError> {
let (hd, kvh, ps) = (s.head_dim as usize, s.n_head_kv as u64, s.page_size);
let bph = hd / QK4_0;
let mut out = vec![0f32; ids.len() * kvh as usize * hd];
for (i, &cell) in ids.iter().enumerate() {
let page = *table.get((cell as i64 / ps) as usize).ok_or(CacheError::OutOfRange)?;
for h in 0..kvh {
let row = physical_row(s, page as u64, h, (cell as i64 % ps) as u64);
for b in 0..bph {
let at = (row as usize * bph + b) * BLOCK_BYTES;
let blk = q4_0::BlockQ4_0::from_bytes(&pool[at..at + BLOCK_BYTES]);
for t in 0..QK4_0 {
out[(i * kvh as usize + h as usize) * hd + b * QK4_0 + t] = blk.dequant(t);
}
}
}
}
Ok(out)
}
pub fn dequant_q8(codes: &[u8], scales: &[u8], table: &[i32], ids: &[i32], s: &QsaShapes) -> Result<Vec<f32>, CacheError> {
let (hd, kvh, ps) = (s.head_dim as usize, s.n_head_kv as u64, s.page_size);
let groups = hd / KV_Q8_GROUP;
let mut out = vec![0f32; ids.len() * kvh as usize * hd];
for (i, &cell) in ids.iter().enumerate() {
let page = *table.get((cell as i64 / ps) as usize).ok_or(CacheError::OutOfRange)?;
for h in 0..kvh {
let row = physical_row(s, page as u64, h, (cell as i64 % ps) as u64) as usize;
for d in 0..hd {
let sat = (row * groups + d / KV_Q8_GROUP) * 2;
let sbits = u16::from_le_bytes([scales[sat], scales[sat + 1]]);
out[(i * kvh as usize + h as usize) * hd + d] = kv_q8::dequant(codes[row * hd + d] as i8, sbits);
}
}
}
Ok(out)
}
/// fp16 bits of a float, for fixtures that compare rounded scratch.
pub fn half_bits(v: &[f32]) -> Vec<u16> {
v.iter().map(|x| f16_from_f32(*x)).collect()
}
#[cfg(test)]
mod tests {
use super::*;
use crate::fwht;
const S: QsaShapes = QsaShapes::real();
fn cell(seed: u64, scale: f32) -> Vec<f32> {
let mut s = seed | 1;
(0..512)
.map(|_| {
s ^= s << 13;
s ^= s >> 7;
s ^= s << 17;
((s >> 40) as f32 / (1u64 << 24) as f32 - 0.5) * scale
})
.collect()
}
fn identity_table(pages: usize) -> Vec<i32> {
(0..pages as i32).collect()
}
#[test]
fn q4_round_trip_stays_within_half_a_step_in_the_rotated_domain() {
let pages = 4;
let rows = pages as u64 * S.rows_per_page();
let mut pools = PoolSet::new(KvFormat::Q4_0, &S, rows).unwrap();
let table = identity_table(pages);
let mut k = cell(1, 4.0);
let mut v = cell(2, 4.0);
fwht::fwht256_rows_in_place(&mut k);
fwht::fwht256_rows_in_place(&mut v);
append_cell(KvFormat::Q4_0, &mut pools, None, &table, 5, &k, &v, &S, Contraction::Separate).unwrap();
let back = dequant_q4(&pools.k_q4, &table, &[5], &S).unwrap();
for (i, (a, b)) in back.iter().zip(&k).enumerate() {
let blk = i / 32;
let amax = k[blk * 32..blk * 32 + 32].iter().fold(0f32, |m, x| m.max(x.abs()));
assert!((a - b).abs() <= amax / 8.0 * 1.01 + 1e-6, "{i}: {a} {b}");
}
// nothing else was written
let gather = gather_q4(&pools.k_q4, &table, &[5], &S).unwrap();
assert_eq!(gather.len(), 512);
let zero_cell = dequant_q4(&pools.k_q4, &table, &[0], &S).unwrap();
assert!(zero_cell.iter().all(|x| *x == 0.0));
}
#[test]
fn streaming_write_rule_host_always_vram_only_when_resident() {
let pages = 4;
let rows = pages as u64 * S.rows_per_page();
let mut pools = PoolSet::new(KvFormat::Int8, &S, rows).unwrap();
let mut host = PoolSet::new(KvFormat::Int8, &S, rows).unwrap();
let table = vec![-1, 0, -1, 1]; // blocks 0 and 2 not resident
let k = cell(3, 2.0);
let v = cell(4, 2.0);
for pos in 0..16 {
append_cell(KvFormat::Int8, &mut pools, Some(&mut host), &table, pos, &k, &v, &S, Contraction::Fused).unwrap();
}
assert!(host.k_q.iter().any(|b| *b != 0));
// resident slots (pages 0 and 1 of the VRAM pool) hold blocks 1 and 3, the rest is untouched
let row_bytes = 256;
let slot_rows = |p: usize| (p as u64 * S.rows_per_page()) as usize * row_bytes;
let per_page = S.rows_per_page() as usize * row_bytes;
assert_eq!(pools.k_q[slot_rows(0)..slot_rows(0) + per_page], host.k_q[slot_rows(1)..slot_rows(1) + per_page]);
assert_eq!(pools.k_q[slot_rows(1)..slot_rows(1) + per_page], host.k_q[slot_rows(3)..slot_rows(3) + per_page]);
assert!(pools.k_q[slot_rows(2)..].iter().all(|b| *b == 0));
}
#[test]
fn k8v4_composition_writes_int8_k_and_q4_v_only() {
let rows = 2 * S.rows_per_page();
let mut pools = PoolSet::new(KvFormat::K8V4, &S, rows).unwrap();
let table = identity_table(2);
let k = cell(5, 3.0);
let mut v = cell(6, 3.0);
fwht::fwht256_rows_in_place(&mut v);
append_cell(KvFormat::K8V4, &mut pools, None, &table, 0, &k, &v, &S, Contraction::Fused).unwrap();
assert!(pools.k_q.iter().any(|b| *b != 0) && pools.v_q4.iter().any(|b| *b != 0));
assert!(pools.v_q.is_empty() && pools.k_q4.is_empty());
let kd = dequant_q8(&pools.k_q, &pools.k_scale, &table, &[0], &S).unwrap();
for (a, b) in kd.iter().zip(&k) {
assert!((a - b).abs() < 0.05, "{a} {b}");
}
}
#[test]
fn fp16_is_refused_and_geometry_is_checked() {
assert_eq!(PoolSet::new(KvFormat::Fp16, &S, 4), Err(CacheError::UnsupportedFormat));
let mut bad = S;
bad.head_dim = 128;
let mut p = PoolSet::new(KvFormat::Q4_0, &S, 8).unwrap();
assert_eq!(
append_cell(KvFormat::Q4_0, &mut p, None, &[0, 1], 0, &[0.0; 256], &[0.0; 256], &bad, Contraction::Fused),
Err(CacheError::Geometry)
);
}
}
+682
View File
@@ -0,0 +1,682 @@
//! Control vectors (`--control-vector[-scaled]`, `--cvec-mode`, `--cvec-dir`; `kernels/cvec.{hpp,cu}`,
//! `load_control_vectors` in `generate.cpp`): GGUF parsing, the per-layer direction/scale tables, and the
//! kernel's application to the hyper-connection residual streams.
//!
//! After layer `l`'s FFN write, every one of the `hc` residual streams `h` of every token becomes
//! * project: `h <- h - s_l (h . v_l) v_l` with `v_l = d / |d|`, `s_l = |d|` (the steered component is removed
//! or, for `s != 1`, scaled);
//! * add: `h <- h + d` (llama.cpp's stock additive vector)
//! for `l` in `[first, last]`; `d` is the sum over files of `scale * direction.<src>` with `src = l` or one fixed
//! layer (`single:L`, project mode). Layer 0 has no direction.
//!
//! EXPERIMENTAL: steering changes model output by design. Off unless a vector is loaded; a loaded one is
//! switched per request (`on`); with the switch off and no pending write the kernel does nothing.
/// Threads of the kernel block and the register capacity of one stream (`n_embd <= 256 * 16`).
pub const THREADS: usize = 256;
pub const MAXK: usize = 16;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum CvecError {
/// GGUF structure: bad magic, version, truncated header, duplicate tensor, bad dims, array too long, ...
Gguf(String),
/// `general.architecture` is not `controlvector`.
NotAControlVector(String),
/// A `direction.<l>` tensor is not `n_embd` f32.
BadTensor { file: String, tensor: String, n_embd: i64 },
NoDirections(String),
/// `--cvec-dir single:L` names a layer the vector has no direction for.
NoSingleDirection(i64),
/// No layer in `[first, last]` is steered.
NothingSteered { first: i64, last: i64 },
UnsupportedEmbd,
BadTables,
}
impl std::fmt::Display for CvecError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Gguf(m) => write!(f, "{m}"),
Self::NotAControlVector(p) => {
write!(f, "{p}: not a control vector GGUF (general.architecture is not 'controlvector')")
}
Self::BadTensor { file, tensor, n_embd } => write!(f, "{file}: {tensor} must be {n_embd} f32"),
Self::NoDirections(p) => write!(f, "{p}: no direction.<layer> tensors"),
Self::NoSingleDirection(l) => write!(f, "--cvec-dir single:{l}: the vector has no direction for that layer"),
Self::NothingSteered { first, last } => {
write!(f, "the control vector has no direction in layers {first}..{last}")
}
Self::UnsupportedEmbd => f.write_str("control vector: unsupported n_embd"),
Self::BadTables => f.write_str("control vector: bad table sizes"),
}
}
}
impl std::error::Error for CvecError {}
// ------------------------------------------------------------------------------------------------ GGUF
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct GgufTensor {
pub name: String,
pub shape: Vec<u64>,
pub ggml_type: u32,
/// Byte range of the tensor data in the file (checked to lie inside it).
pub data: std::ops::Range<usize>,
}
impl GgufTensor {
pub fn elements(&self) -> u64 {
self.shape.iter().product()
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct GgufFile {
pub architecture: Option<String>,
pub model_hint: Option<String>,
pub tensors: Vec<GgufTensor>,
}
struct Cursor<'a> {
b: &'a [u8],
at: usize,
}
impl Cursor<'_> {
fn need(&self, n: usize) -> Result<(), CvecError> {
if self.at.checked_add(n).is_none_or(|e| e > self.b.len()) {
return Err(CvecError::Gguf("GGUF: unexpected end of file in header".into()));
}
Ok(())
}
fn take(&mut self, n: usize) -> Result<&[u8], CvecError> {
self.need(n)?;
let s = &self.b[self.at..self.at + n];
self.at += n;
Ok(s)
}
fn u32(&mut self) -> Result<u32, CvecError> {
Ok(u32::from_le_bytes(self.take(4)?.try_into().expect("4")))
}
fn u64(&mut self) -> Result<u64, CvecError> {
Ok(u64::from_le_bytes(self.take(8)?.try_into().expect("8")))
}
fn string(&mut self) -> Result<String, CvecError> {
let n = self.u64()?;
let n = usize::try_from(n).map_err(|_| CvecError::Gguf("GGUF: unexpected end of file in header".into()))?;
Ok(String::from_utf8_lossy(self.take(n)?).into_owned())
}
}
enum Meta {
Str(String),
Uint(u64),
Other,
}
fn read_value(c: &mut Cursor<'_>, t: u32, depth: u32) -> Result<Meta, CvecError> {
if depth > 2 {
return Err(CvecError::Gguf("GGUF: array nesting too deep".into()));
}
Ok(match t {
0 | 1 | 7 => Meta::Uint(u64::from(c.take(1)?[0])),
2 | 3 => Meta::Uint(u64::from(u16::from_le_bytes(c.take(2)?.try_into().expect("2")))),
4 | 5 => Meta::Uint(u64::from(c.u32()?)),
6 => {
c.take(4)?;
Meta::Other
}
8 => Meta::Str(c.string()?),
10 | 11 => Meta::Uint(c.u64()?),
12 => {
c.take(8)?;
Meta::Other
}
9 => {
let elem = c.u32()?;
let count = c.u64()?;
if count > (1 << 24) {
return Err(CvecError::Gguf("GGUF: implausible array length".into()));
}
for _ in 0..count {
read_value(c, elem, depth + 1)?;
}
Meta::Other
}
_ => return Err(CvecError::Gguf("GGUF: unknown metadata value type".into())),
})
}
/// Parse a GGUF v3 file's header (`GgufFile::parse` of `gguf_reader.hpp`), plus a check the Original lacks:
/// every tensor's data range must lie inside the file.
pub fn parse_gguf(bytes: &[u8]) -> Result<GgufFile, CvecError> {
let mut c = Cursor { b: bytes, at: 0 };
if c.u32()? != 0x4655_4747 {
return Err(CvecError::Gguf("not a GGUF file (bad magic)".into()));
}
let version = c.u32()?;
if version != 3 {
return Err(CvecError::Gguf(format!("GGUF v{version}, this reader handles v3")));
}
let n_tensors = c.u64()?;
let n_kv = c.u64()?;
let (mut architecture, mut model_hint, mut alignment) = (None, None, 32u64);
let mut seen_keys = std::collections::BTreeSet::new();
for _ in 0..n_kv {
let key = c.string()?;
let t = c.u32()?;
let v = read_value(&mut c, t, 0)?;
if !seen_keys.insert(key.clone()) {
continue; // emplace keeps the first
}
match (key.as_str(), v) {
("general.architecture", Meta::Str(s)) => architecture = Some(s),
("general.architecture", _) => architecture = Some(String::new()),
("controlvector.model_hint", Meta::Str(s)) => model_hint = Some(s),
("controlvector.model_hint", _) => model_hint = Some(String::new()),
("general.alignment", Meta::Uint(a)) if a != 0 => alignment = a,
_ => {}
}
}
let mut names = std::collections::BTreeSet::new();
let mut infos = Vec::new();
for _ in 0..n_tensors {
let name = c.string()?;
if !names.insert(name.clone()) {
return Err(CvecError::Gguf(format!("GGUF: duplicate tensor name '{name}'")));
}
let nd = c.u32()?;
if nd == 0 || nd > 4 {
return Err(CvecError::Gguf(format!("GGUF: bad n_dims for {name}")));
}
let mut shape = Vec::new();
for _ in 0..nd {
shape.push(c.u64()?);
}
let ggml_type = c.u32()?;
let offset = c.u64()?;
infos.push((name, shape, ggml_type, offset));
}
let data_start = (c.at as u64).div_ceil(alignment) * alignment;
if data_start > bytes.len() as u64 {
return Err(CvecError::Gguf("GGUF: data section starts past EOF".into()));
}
let mut tensors = Vec::new();
for (name, shape, ggml_type, offset) in infos {
let elements = shape.iter().try_fold(1u64, |a, d| a.checked_mul(*d));
// only F32 tensors are read; their extent is checked, others keep an empty range
let range = match (ggml_type, elements) {
(0, Some(n)) => {
let start = data_start.checked_add(offset);
let end = start.and_then(|s| n.checked_mul(4).and_then(|b| s.checked_add(b)));
match (start, end) {
(Some(s), Some(e)) if e <= bytes.len() as u64 => s as usize..e as usize,
_ => return Err(CvecError::Gguf(format!("GGUF: tensor {name} lies outside the file"))),
}
}
_ => 0..0,
};
tensors.push(GgufTensor { name, shape, ggml_type, data: range });
}
Ok(GgufFile { architecture, model_hint, tensors })
}
// ---------------------------------------------------------------------------------------------- tables
/// `--cvec-mode`: 0 project, 1 add (llama.cpp's default).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CvecMode {
Project = 0,
Add = 1,
}
/// The loader's options (`Options::cvec_*`): `first`/`last` of `<= 0` mean the defaults `1` / last layer.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct CvecOptions {
pub first: i64,
pub last: i64,
pub mode: CvecMode,
/// `--cvec-dir single:L` (project mode only); `-1` = per-layer.
pub single: i64,
}
impl Default for CvecOptions {
fn default() -> Self {
Self { first: -1, last: -1, mode: CvecMode::Add, single: -1 }
}
}
/// The tables `cvec_upload` takes plus the description the engine keeps (`Cvec`).
#[derive(Clone, Debug, PartialEq)]
pub struct CvecTables {
/// `n_layers * n_embd`: project = the unit `v_l`, add = `d_l`; zero rows elsewhere.
pub dir: Vec<f32>,
/// `n_layers`: project = `s_l`, add = 1; 0 = the layer is not steered.
pub s: Vec<f32>,
pub mode: CvecMode,
pub first: i64,
pub last: i64,
pub n_embd: i64,
pub hc: i64,
pub steered: Vec<bool>,
/// What `INFO` reports.
pub summary: String,
}
impl CvecTables {
/// `Cvec::covers`: layer `l`'s FFN write is followed by the vector (decided at load time).
pub fn covers(&self, l: i64) -> bool {
l >= self.first && l <= self.last && (l as usize) < self.steered.len() && l >= 0 && self.steered[l as usize]
}
}
/// `load_control_vectors`: every file's `direction.<l>` times its scale, summed (f32 multiply then add), then the
/// project/add tables. `files` are `(label, bytes, scale)`. A `direction.<l>` with `l < 1` or `l >= n_layers` is
/// ignored (layer 0 has no vector; past the model is ignored, as in llama.cpp).
pub fn load_control_vectors(
files: &[(String, Vec<u8>, f32)],
n_layers: i64,
n_embd: i64,
hc: i64,
o: &CvecOptions,
) -> Result<CvecTables, CvecError> {
let (l_n, n) = (n_layers as usize, n_embd as usize);
let mut data = vec![0.0f32; l_n * n];
let mut have = vec![false; l_n];
for (label, bytes, scale) in files {
let f = parse_gguf(bytes)?;
if f.architecture.as_deref() != Some("controlvector") {
return Err(CvecError::NotAControlVector(label.clone()));
}
let mut found = 0;
for t in &f.tensors {
let Some(rest) = t.name.strip_prefix("direction.") else { continue };
// std::strtol: an optional sign and leading digits, anything else stops the parse (0 if none)
let digits: String = rest.chars().take_while(|c| c.is_ascii_digit()).collect();
let l: i64 = digits.parse().unwrap_or(0);
if l < 1 || l >= n_layers {
continue;
}
if t.ggml_type != 0 || t.elements() != n as u64 {
return Err(CvecError::BadTensor { file: label.clone(), tensor: t.name.clone(), n_embd });
}
let src = &bytes[t.data.clone()];
for j in 0..n {
let v = f32::from_le_bytes(src[j * 4..j * 4 + 4].try_into().expect("4"));
data[l as usize * n + j] += *scale * v;
}
have[l as usize] = true;
found += 1;
}
if found == 0 {
return Err(CvecError::NoDirections(label.clone()));
}
}
let first = if o.first <= 0 { 1 } else { o.first };
let last = if o.last <= 0 || o.last >= n_layers { n_layers - 1 } else { o.last };
let single = if o.mode == CvecMode::Project { o.single } else { -1 };
if single >= 0 && (single >= n_layers || !have[single as usize]) {
return Err(CvecError::NoSingleDirection(single));
}
let mut dir = vec![0.0f32; l_n * n];
let mut s = vec![0.0f32; l_n];
let mut steered = 0;
for l in first..=last {
let src = if single >= 0 { single } else { l };
if src < 0 || src >= n_layers || !have[src as usize] {
continue;
}
let d = &data[src as usize * n..(src as usize + 1) * n];
match o.mode {
CvecMode::Project => {
let mut nrm = 0.0f64;
for v in d {
nrm += f64::from(*v) * f64::from(*v);
}
let nrm = nrm.sqrt();
if nrm <= 0.0 {
continue;
}
s[l as usize] = nrm as f32;
for j in 0..n {
dir[l as usize * n + j] = (f64::from(d[j]) / nrm) as f32;
}
}
CvecMode::Add => {
s[l as usize] = 1.0;
dir[l as usize * n..(l as usize + 1) * n].copy_from_slice(d);
}
}
steered += 1;
}
if steered == 0 {
return Err(CvecError::NothingSteered { first, last });
}
check_tables(&dir, &s, n_embd)?;
let summary = format!(
"{}:{}-{}{}",
if o.mode == CvecMode::Project { "project" } else { "add" },
first,
last,
if single >= 0 { format!(":single{single}") } else { String::new() }
);
let steered_flags = s.iter().map(|v| *v != 0.0).collect();
Ok(CvecTables { dir, s, mode: o.mode, first, last, n_embd, hc, steered: steered_flags, summary })
}
/// The admission of `cvec_upload`.
pub fn check_tables(dir: &[f32], s: &[f32], n_embd: i64) -> Result<(), CvecError> {
if n_embd < 1 || n_embd > (THREADS * MAXK) as i64 {
return Err(CvecError::UnsupportedEmbd);
}
if s.is_empty() || dir.len() != s.len() * n_embd as usize {
return Err(CvecError::BadTables);
}
Ok(())
}
// ---------------------------------------------------------------------------------------------- kernel
/// The fused hyper-connection read's gate (`sigmoidf_`, `1 / (1 + __expf(-x))`). The device uses the fast
/// intrinsic; this is the libm result, so a pending write is exact only up to that intrinsic's error.
pub fn sigmoid(x: f32) -> f32 {
1.0 / (1.0 + (-x).exp())
}
/// Butterfly sum over 32 lanes with `__shfl_xor_sync` offsets 16, 8, 4, 2, 1 (every lane ends with the same
/// value; lane 0's is returned).
pub fn warp_xor_sum(mut lanes: [f32; 32]) -> f32 {
let mut o = 16;
while o > 0 {
let prev = lanes;
for l in 0..32 {
lanes[l] = prev[l] + prev[l ^ o];
}
o >>= 1;
}
lanes[0]
}
/// One `cvec_apply` over a batch: `R` is `T` rows of `r_ld` floats, each holding `hc` streams of `n`. With
/// `write`, the pending FFN write `R += bo * 2 sigmoid(inj / hc)` is applied first (`bo` rows of `bo_ld`,
/// `inj` rows of `inj_ld`). Literal twin of `cvec_kernel`'s per-thread dataflow, including the reduction tree.
#[allow(clippy::too_many_arguments, clippy::needless_range_loop)] // thread/k indices mirror the CUDA text
pub fn apply(
r: &mut [f32],
tables: &CvecTables,
on: bool,
layer: usize,
t_count: usize,
r_ld: usize,
pending: Option<(&[f32], usize, &[f32], usize)>,
) {
let (n, hc) = (tables.n_embd as usize, tables.hc as usize);
let write = pending.is_some();
let s = tables.s[layer];
let steer = on && s != 0.0;
if !steer && !write {
return;
}
let v = &tables.dir[layer * n..(layer + 1) * n];
for t in 0..t_count {
for c in 0..hc {
let base = t * r_ld + c * n;
let (w, b) = match pending {
Some((bo, bo_ld, inj, inj_ld)) => (2.0 * sigmoid(inj[t * inj_ld + c] / hc as f32), Some(&bo[t * bo_ld..][..n])),
None => (0.0, None),
};
// per-thread registers
let mut x = vec![[0.0f32; MAXK]; THREADS];
let mut dots = [0.0f32; THREADS];
for tid in 0..THREADS {
let mut dot = 0.0f32;
for k in 0..MAXK {
let d = tid + k * THREADS;
if d < n {
let mut xv = r[base + d];
if let Some(b) = b {
xv = b[d].mul_add(w, xv);
}
x[tid][k] = xv;
if steer && tables.mode == CvecMode::Project {
dot = xv.mul_add(v[d], dot);
}
}
}
dots[tid] = dot;
}
let mut dot = 0.0f32;
if steer && tables.mode == CvecMode::Project {
let mut part = [0.0f32; THREADS / 32];
for (w_i, p) in part.iter_mut().enumerate() {
let mut lanes = [0.0f32; 32];
lanes.copy_from_slice(&dots[w_i * 32..w_i * 32 + 32]);
*p = warp_xor_sum(lanes);
}
let mut lanes = [0.0f32; 32];
lanes[..THREADS / 32].copy_from_slice(&part);
dot = warp_xor_sum(lanes) * s; // s (h . v)
}
for tid in 0..THREADS {
for k in 0..MAXK {
let d = tid + k * THREADS;
if d < n {
let mut xv = x[tid][k];
if steer {
xv = if tables.mode == CvecMode::Project { (-dot).mul_add(v[d], xv) } else { xv + v[d] };
}
r[base + d] = xv;
}
}
}
}
}
}
#[cfg(test)]
mod tests {
use super::*;
// ---- a tiny GGUF writer for the tests (v3, F32 tensors)
fn gguf(arch: &str, hint: Option<&str>, tensors: &[(&str, Vec<f32>)]) -> Vec<u8> {
let mut b = Vec::new();
let s = |b: &mut Vec<u8>, t: &str| {
b.extend_from_slice(&(t.len() as u64).to_le_bytes());
b.extend_from_slice(t.as_bytes());
};
b.extend_from_slice(&0x4655_4747u32.to_le_bytes());
b.extend_from_slice(&3u32.to_le_bytes());
b.extend_from_slice(&(tensors.len() as u64).to_le_bytes());
b.extend_from_slice(&(1 + u64::from(hint.is_some())).to_le_bytes());
s(&mut b, "general.architecture");
b.extend_from_slice(&8u32.to_le_bytes());
s(&mut b, arch);
if let Some(h) = hint {
s(&mut b, "controlvector.model_hint");
b.extend_from_slice(&8u32.to_le_bytes());
s(&mut b, h);
}
let mut off = 0u64;
for (name, v) in tensors {
s(&mut b, name);
b.extend_from_slice(&1u32.to_le_bytes());
b.extend_from_slice(&(v.len() as u64).to_le_bytes());
b.extend_from_slice(&0u32.to_le_bytes());
b.extend_from_slice(&off.to_le_bytes());
off += (v.len() * 4).div_ceil(32) as u64 * 32;
}
while b.len() % 32 != 0 {
b.push(0);
}
for (_, v) in tensors {
for x in v {
b.extend_from_slice(&x.to_le_bytes());
}
while b.len() % 32 != 0 {
b.push(0);
}
}
b
}
fn vec_of(n: usize, seed: f32) -> Vec<f32> {
(0..n).map(|i| ((i as f32 + seed) * 0.37).sin()).collect()
}
#[test]
fn parses_and_ignores_layer_zero_and_past_the_model() {
let n = 8;
let bytes = gguf("controlvector", Some("qwen4exp"), &[("direction.0", vec_of(n, 0.0)), ("direction.2", vec_of(n, 2.0)), ("direction.9", vec_of(n, 9.0))]);
let f = parse_gguf(&bytes).unwrap();
assert_eq!(f.architecture.as_deref(), Some("controlvector"));
assert_eq!(f.model_hint.as_deref(), Some("qwen4exp"));
assert_eq!(f.tensors.len(), 3);
let t = load_control_vectors(&[("a.gguf".into(), bytes, 1.5)], 4, n as i64, 2, &CvecOptions::default()).unwrap();
assert_eq!(t.summary, "add:1-3");
assert!(t.covers(2) && !t.covers(1) && !t.covers(3) && !t.covers(0));
let want = 1.5 * vec_of(n, 2.0)[3];
assert_eq!(t.dir[2 * n + 3], want + 0.0);
}
#[test]
fn project_mode_normalizes_and_scale_is_the_norm() {
let n = 16;
let d = vec_of(n, 1.0);
let bytes = gguf("controlvector", None, &[("direction.1", d.clone())]);
let o = CvecOptions { mode: CvecMode::Project, first: 1, last: 3, single: -1 };
let t = load_control_vectors(&[("a".into(), bytes, 2.0)], 4, n as i64, 4, &o).unwrap();
let nrm: f64 = d.iter().map(|v| f64::from(2.0 * v).powi(2)).sum::<f64>().sqrt();
assert!((f64::from(t.s[1]) - nrm).abs() < 1e-5);
let unit: f64 = (0..n).map(|j| f64::from(t.dir[n + j]).powi(2)).sum();
assert!((unit - 1.0).abs() < 1e-6);
assert_eq!(t.s[2], 0.0); // layer 2 has no direction
assert_eq!(t.summary, "project:1-3");
}
#[test]
fn single_layer_direction_steers_every_layer() {
let n = 8;
let bytes = gguf("controlvector", None, &[("direction.2", vec_of(n, 2.0))]);
let o = CvecOptions { mode: CvecMode::Project, first: 1, last: 3, single: 2 };
let t = load_control_vectors(&[("a".into(), bytes.clone(), 1.0)], 4, n as i64, 2, &o).unwrap();
assert!(t.covers(1) && t.covers(2) && t.covers(3));
assert_eq!(t.summary, "project:1-3:single2");
let o = CvecOptions { single: 3, ..o };
assert_eq!(
load_control_vectors(&[("a".into(), bytes, 1.0)], 4, n as i64, 2, &o),
Err(CvecError::NoSingleDirection(3))
);
}
#[test]
fn rejections() {
let n = 8;
let ok = gguf("controlvector", None, &[("direction.1", vec_of(n, 1.0))]);
let load = |bytes: Vec<u8>, o: CvecOptions| load_control_vectors(&[("f".into(), bytes, 1.0)], 4, n as i64, 2, &o);
let d = CvecOptions::default();
assert!(matches!(load(gguf("llama", None, &[("direction.1", vec_of(n, 1.0))]), d), Err(CvecError::NotAControlVector(_))));
assert!(matches!(load(gguf("controlvector", None, &[("direction.1", vec_of(n + 1, 1.0))]), d), Err(CvecError::BadTensor { .. })));
assert!(matches!(load(gguf("controlvector", None, &[("foo", vec_of(n, 1.0))]), d), Err(CvecError::NoDirections(_))));
assert!(matches!(load(ok[..20].to_vec(), d), Err(CvecError::Gguf(_))));
let mut bad_magic = ok.clone();
bad_magic[0] = 0;
assert!(matches!(load(bad_magic, d), Err(CvecError::Gguf(_))));
// steered layers outside the requested range
let o = CvecOptions { first: 2, last: 3, ..d };
assert_eq!(load(ok, o), Err(CvecError::NothingSteered { first: 2, last: 3 }));
// a zero direction in project mode is skipped
let zero = gguf("controlvector", None, &[("direction.1", vec![0.0; n])]);
assert!(matches!(load(zero, CvecOptions { mode: CvecMode::Project, ..d }), Err(CvecError::NothingSteered { .. })));
assert_eq!(check_tables(&[0.0; 10], &[0.0; 2], 5), Ok(()));
assert_eq!(check_tables(&[0.0; 10], &[0.0; 2], 6), Err(CvecError::BadTables));
assert_eq!(check_tables(&[], &[], 5), Err(CvecError::BadTables));
assert_eq!(check_tables(&[0.0; 4097 * 2], &[0.0; 2], 4097), Err(CvecError::UnsupportedEmbd));
}
fn tables(mode: CvecMode, n: usize, hc: usize, layer: usize, l: usize, scale: f32) -> CvecTables {
let mut dir = vec![0.0f32; l * n];
let mut s = vec![0.0f32; l];
let v = vec_of(n, 3.0);
let nrm = v.iter().map(|x| f64::from(*x).powi(2)).sum::<f64>().sqrt();
match mode {
CvecMode::Project => {
for j in 0..n {
dir[layer * n + j] = (f64::from(v[j]) / nrm) as f32;
}
s[layer] = scale; // s = 1 projects the direction out, s = 2 reflects the component
}
CvecMode::Add => {
dir[layer * n..(layer + 1) * n].copy_from_slice(&v);
s[layer] = 1.0;
}
}
let steered = s.iter().map(|x| *x != 0.0).collect();
CvecTables { dir, s, mode, first: 1, last: l as i64 - 1, n_embd: n as i64, hc: hc as i64, steered, summary: String::new() }
}
#[test]
fn project_removes_the_component_and_add_adds() {
let (n, hc, t_count) = (600usize, 3usize, 2usize);
let r_ld = hc * n;
let r0: Vec<f32> = (0..t_count * r_ld).map(|i| ((i * 7 % 13) as f32 - 6.0) * 0.3).collect();
let tp = tables(CvecMode::Project, n, hc, 2, 4, 1.0);
let mut r = r0.clone();
apply(&mut r, &tp, true, 2, t_count, r_ld, None);
for t in 0..t_count {
for c in 0..hc {
let after: f64 = (0..n).map(|j| f64::from(r[t * r_ld + c * n + j]) * f64::from(tp.dir[2 * n + j])).sum();
assert!(after.abs() < 1e-3, "{after}");
}
}
// off: unchanged
let mut r = r0.clone();
apply(&mut r, &tp, false, 2, t_count, r_ld, None);
assert_eq!(r, r0);
// a layer without a direction is untouched
apply(&mut r, &tp, true, 1, t_count, r_ld, None);
assert_eq!(r, r0);
// add
let ta = tables(CvecMode::Add, n, hc, 2, 4, 1.0);
let mut r = r0.clone();
apply(&mut r, &ta, true, 2, t_count, r_ld, None);
for t in 0..t_count {
for c in 0..hc {
for j in 0..n {
assert_eq!(r[t * r_ld + c * n + j], r0[t * r_ld + c * n + j] + ta.dir[2 * n + j]);
}
}
}
}
#[test]
fn pending_write_is_applied_even_when_the_vector_is_off() {
let (n, hc) = (300usize, 2usize);
let r0: Vec<f32> = (0..hc * n).map(|i| (i % 11) as f32 * 0.1).collect();
let bo: Vec<f32> = (0..n).map(|i| (i % 5) as f32 - 2.0).collect();
let inj = vec![0.5f32, -1.0];
let tp = tables(CvecMode::Project, n, hc, 2, 4, 1.0);
let mut r = r0.clone();
apply(&mut r, &tp, false, 2, 1, hc * n, Some((&bo, n, &inj, hc)));
for c in 0..hc {
let w = 2.0 * sigmoid(inj[c] / hc as f32);
for j in 0..n {
assert_eq!(r[c * n + j], bo[j].mul_add(w, r0[c * n + j]));
}
}
}
#[test]
fn warp_sum_is_a_butterfly_tree() {
let mut lanes = [0.0f32; 32];
for (i, l) in lanes.iter_mut().enumerate() {
*l = (i + 1) as f32;
}
assert_eq!(warp_xor_sum(lanes), 528.0);
// lanes >= 8 zero: the final reduction of 8 warp partials
let mut p = [0.0f32; 32];
for (i, l) in p.iter_mut().take(8).enumerate() {
*l = 1.0 / (i as f32 + 3.0);
}
let want = ((p[0] + p[4]) + (p[2] + p[6])) + ((p[1] + p[5]) + (p[3] + p[7]));
assert_eq!(warp_xor_sum(p), want);
}
}
+97
View File
@@ -0,0 +1,97 @@
//! The fp16 conversions of `include/strata/kernels/f16_bits.hpp`, written out as bits (literal port).
//!
//! Round-to-nearest-even f32 -> fp16 with explicit subnormal and overflow regimes; the reverse conversion
//! is exact. The Original uses these instead of `__float2half` in every KV kernel.
/// Round-to-nearest-even f32 -> fp16, returned as raw bits.
pub fn f16_from_f32(f: f32) -> u16 {
let x = f.to_bits();
let sign = (x >> 16) & 0x8000;
let rawexp = (x >> 23) & 0xFF;
let exp = rawexp as i32 - 127 + 15;
let mut man = x & 0x7F_FFFF;
// inf / NaN stay inf / NaN; a finite value too large for fp16 saturates to inf
if rawexp == 0xFF {
return (sign | 0x7C00 | if man != 0 { 0x200 } else { 0 }) as u16;
}
if exp >= 31 {
return (sign | 0x7C00) as u16;
}
if exp <= 0 {
if exp < -10 {
return sign as u16;
}
man |= 0x80_0000;
let sh = (14 - exp) as u32;
let mut h = (man >> sh) & 0x3FF;
let rem = man & ((1u32 << sh) - 1);
if rem > (1u32 << (sh - 1)) || (rem == (1u32 << (sh - 1)) && (h & 1) != 0) {
h += 1;
}
return (sign | h) as u16;
}
let mut h = (sign | ((exp as u32) << 10) | (man >> 13)) as u16;
let rem = man & 0x1FFF;
if rem > 0x1000 || (rem == 0x1000 && (h & 1) != 0) {
h = h.wrapping_add(1); // the carry may bump the exponent
}
h
}
/// Exact fp16 bits -> f32 (every one of the 65,536 inputs maps to an exactly representable value).
pub fn f32_from_f16(h: u16) -> f32 {
let sign = (u32::from(h) & 0x8000) << 16;
let ex = (u32::from(h) >> 10) & 0x1F;
let man = u32::from(h) & 0x3FF;
let out = if ex == 0 {
if man == 0 {
sign
} else {
let mut m = man;
let mut s = 0u32;
while (m & 0x400) == 0 {
m <<= 1;
s += 1;
}
sign | ((113 - s) << 23) | ((m & 0x3FF) << 13)
}
} else if ex == 31 {
sign | 0x7F80_0000 | (man << 13)
} else {
sign | ((ex + 112) << 23) | (man << 13)
};
f32::from_bits(out)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn exact_round_trip_for_every_finite_half() {
for h in 0..=u16::MAX {
let f = f32_from_f16(h);
if f.is_nan() {
assert_eq!(h & 0x7C00, 0x7C00);
continue;
}
assert_eq!(f16_from_f32(f), h, "{h:#06x}");
}
}
#[test]
fn documented_regimes() {
assert_eq!(f16_from_f32(1.0), 0x3C00);
assert_eq!(f16_from_f32(1e30), 0x7C00); // finite overflow saturates to inf, not NaN
assert_eq!(f16_from_f32(-1e30), 0xFC00);
assert_eq!(f16_from_f32(f32::INFINITY), 0x7C00);
assert_eq!(f16_from_f32(f32::NAN) & 0x7C00, 0x7C00);
assert_ne!(f16_from_f32(f32::NAN) & 0x3FF, 0);
assert_eq!(f32_from_f16(0x0001), 2.0f32.powi(-24)); // subnormals are not flushed
assert_eq!(f16_from_f32(2.0f32.powi(-26)), 0); // underflow to zero
assert_eq!(f16_from_f32(-0.0), 0x8000);
// ties to even at the subnormal boundary and in the normal range
assert_eq!(f16_from_f32(f32::from_bits(0x3F80_1000)), 0x3C00); // 1 + 2^-11 -> tie, even
assert_eq!(f16_from_f32(f32::from_bits(0x3F80_3000)), 0x3C02); // 1 + 3*2^-11 -> tie, odd up
}
}
+202
View File
@@ -0,0 +1,202 @@
//! Orthonormal 256-point Fast Walsh-Hadamard Transform (`fwht256_kernel` in `kv_q4.cu`).
//!
//! H is symmetric and orthonormal with scale 1/16, so it is its own inverse: the query is rotated with it,
//! the cache holds rotated K/V, the attention output (a mix of rotated values) is rotated back.
//!
//! Two forms are provided and are bit-identical for finite inputs without underflow:
//! * [`fwht256`] - the kernel's operation order (scale first, then log2(256) butterfly stages, low index
//! bit first);
//! * [`fwht256_host_reference`] - the Original's host reference (`fwht256_host_reference` in
//! `kv_q4_parity.cpp`): butterflies first, scale last.
//! Multiplying by 2^-4 is exact, so the two orders agree unless a partial sum underflows.
//! [`fwht256_warp_model`] re-derives the kernel's one-warp register/lane split literally; a test pins it
//! to the stage loop.
pub const N: usize = 256;
pub const SCALE: f32 = 1.0 / 16.0;
/// Kernel order: scale, then Sylvester butterflies `(u + v, u - v)` for strides 1, 2, 4, ..., 128.
pub fn fwht256(src: &[f32; N], dst: &mut [f32; N]) {
for i in 0..N {
dst[i] = src[i] * SCALE;
}
let mut s = 1;
while s < N {
let mut i = 0;
while i < N {
for j in 0..s {
let u = dst[i + j];
let v = dst[i + j + s];
dst[i + j] = u + v;
dst[i + j + s] = u - v;
}
i += 2 * s;
}
s *= 2;
}
}
/// The Original's host reference: butterflies, then the 1/16 scale.
pub fn fwht256_host_reference(x: &mut [f32; N]) {
let mut s = 1;
while s < N {
let mut i = 0;
while i < N {
for j in 0..s {
let u = x[i + j];
let v = x[i + j + s];
x[i + j] = u + v;
x[i + j + s] = u - v;
}
i += 2 * s;
}
s *= 2;
}
for v in x.iter_mut() {
*v *= SCALE;
}
}
/// `n_rows` consecutive rows, in place (`fwht256_inplace_cuda`).
pub fn fwht256_rows_in_place(data: &mut [f32]) {
assert!(data.len().is_multiple_of(N), "rows of 256 floats");
for row in data.chunks_exact_mut(N) {
let src: [f32; N] = row.try_into().expect("row");
let mut dst = [0.0; N];
fwht256(&src, &mut dst);
row.copy_from_slice(&dst);
}
}
/// One warp of the kernel: lane `l` holds elements `i * 32 + l` in register `i` (8 registers). The five
/// low index bits are butterflied across lanes with `__shfl_xor_sync`, the three high bits across each
/// lane's registers. Literal transcription of the CUDA control flow.
pub fn fwht256_warp_model(src: &[f32; N]) -> [f32; N] {
const WARP: usize = 32;
const EL_W: usize = N / WARP;
let mut reg = [[0.0f32; EL_W]; WARP];
for (lane, regs) in reg.iter_mut().enumerate() {
for (i, r) in regs.iter_mut().enumerate() {
*r = src[i * WARP + lane] * SCALE;
}
}
let mut h = 1;
while h < WARP {
let before = reg;
for lane in 0..WARP {
for j in 0..EL_W {
let val = before[lane][j];
let val2 = before[lane ^ h][j];
reg[lane][j] = if (lane & h) == 0 { val + val2 } else { val2 - val };
}
}
h *= 2;
}
let mut h = WARP;
while h < N {
let step = h / WARP;
for regs in reg.iter_mut() {
let mut j = 0;
while j < EL_W {
for k in 0..step {
let x = regs[j + k];
let y = regs[j + k + step];
regs[j + k] = x + y;
regs[j + k + step] = x - y;
}
j += 2 * step;
}
}
h *= 2;
}
let mut out = [0.0; N];
for (lane, regs) in reg.iter().enumerate() {
for (i, r) in regs.iter().enumerate() {
out[i * WARP + lane] = *r;
}
}
out
}
#[cfg(test)]
mod tests {
use super::*;
fn rng(seed: &mut u64) -> f32 {
*seed ^= *seed << 13;
*seed ^= *seed >> 7;
*seed ^= *seed << 17;
((*seed >> 40) as f32 / (1u64 << 24) as f32 - 0.5) * 6.0
}
fn sample(seed: &mut u64) -> [f32; N] {
let mut x = [0.0; N];
for v in x.iter_mut() {
*v = rng(seed);
}
x
}
#[test]
fn warp_model_equals_stage_loop_bitwise() {
let mut seed = 0x9e37_79b9_7f4a_7c15;
for _ in 0..64 {
let x = sample(&mut seed);
let mut a = [0.0; N];
fwht256(&x, &mut a);
assert_eq!(
a.map(f32::to_bits),
fwht256_warp_model(&x).map(f32::to_bits)
);
}
}
#[test]
fn kernel_order_equals_host_reference_bitwise() {
let mut seed = 1234567;
for _ in 0..64 {
let x = sample(&mut seed);
let mut a = [0.0; N];
fwht256(&x, &mut a);
let mut b = x;
fwht256_host_reference(&mut b);
assert_eq!(a.map(f32::to_bits), b.map(f32::to_bits));
}
}
#[test]
fn is_its_own_inverse_and_preserves_dot_products() {
let mut seed = 42;
let x = sample(&mut seed);
let y = sample(&mut seed);
let (mut hx, mut hy) = ([0.0; N], [0.0; N]);
fwht256(&x, &mut hx);
fwht256(&y, &mut hy);
let dot = |a: &[f32; N], b: &[f32; N]| -> f64 {
a.iter().zip(b).map(|(p, q)| f64::from(*p) * f64::from(*q)).sum()
};
assert!((dot(&x, &y) - dot(&hx, &hy)).abs() < 1e-3);
let mut back = [0.0; N];
fwht256(&hx, &mut back);
for (a, b) in back.iter().zip(&x) {
assert!((a - b).abs() < 1e-5);
}
}
#[test]
fn basis_vector_maps_to_a_signed_flat_row() {
// H e0 = 1/16 in every position (all +).
let mut e = [0.0; N];
e[0] = 1.0;
let mut out = [0.0; N];
fwht256(&e, &mut out);
assert!(out.iter().all(|v| *v == SCALE));
// H e1: signs alternate with the lowest index bit.
let mut e = [0.0; N];
e[1] = 1.0;
fwht256(&e, &mut out);
for (i, v) in out.iter().enumerate() {
assert_eq!(*v, if i & 1 == 0 { SCALE } else { -SCALE });
}
}
}
+493
View File
@@ -0,0 +1,493 @@
//! Keyless / V-only QSA (`STRATA_KEYLESS_ROUTING`, charter G7, `docs/keyless-runtime.md`): the routing-matrix
//! artifact (`SKLROUT1`, `src/core/keyless.cpp`), the in-place query routing kernel (`keyless.cu`) and the
//! positional key reconstruction the V-only attention performs (`attn_chunk_kernel<4>`).
//!
//! The cache stores only INT8 V (codes + one fp16 scale per 64 values; 528 B per cell and layer). The query is
//! routed by an explicit per-head 256x256 matrix, then position-encoded; scores are taken against RoPE(V) at
//! each cell's position and the value sum retrieves the raw, unrotated V.
//!
//! EXPERIMENTAL with a FAILED model-quality gate (`docs/experiments/2026-10-04-keyless-runtime.md`): off by
//! default, never silently enabled; initial support requires INT8, no Hadamard rotation, one GPU stage and zero
//! position base.
use std::collections::BTreeSet;
pub const MAGIC: &[u8; 8] = b"SKLROUT1";
pub const VERSION: u32 = 1;
pub const DIM: usize = 256;
/// Rotated dimensions of the V-only keys (`keyless_n_rot`, the kernel requires exactly 64).
pub const N_ROT: usize = 64;
/// `__ldg`-free `mrope_pos`: with a `[cell][3]` (t, h, w) table the pair rotates by `tab[cell * 3 + pair % 3]`,
/// without one the position is the cell index (`mrope.hpp`).
pub fn mrope_pos(tab: Option<&[i32]>, pos: i32, pair: i32) -> i32 {
tab.map_or(pos, |t| t[pos as usize * 3 + (pair % 3) as usize])
}
/// `route_kernel`, host twin: `tokens x heads` queries of 256 floats are replaced by `matrix[head] * q`,
/// `sum = fmaf(row[i], weight[i], sum)` over i = 0..255 in order, where row `d` of head `h`'s matrix is
/// `matrices[(h * 256 + d) * 256 ..]` ("output-major"). Block `b = token * heads + head` reads head `b % heads`.
pub fn route_query(q: &mut [f32], matrices: &[f32], tokens: usize, heads: usize) -> Result<(), KeylessError> {
if q.len() != tokens * heads * DIM || matrices.len() != heads * DIM * DIM || tokens < 1 || heads < 1 {
return Err(KeylessError::Geometry);
}
if tokens > i32::MAX as usize / heads {
return Err(KeylessError::Geometry);
}
for block in 0..tokens * heads {
let h = block % heads;
let query = &mut q[block * DIM..(block + 1) * DIM];
let row: [f32; DIM] = (*query).try_into().expect("row");
for d in 0..DIM {
let weight = &matrices[(h * DIM + d) * DIM..][..DIM];
let mut sum = 0.0f32;
for i in 0..DIM {
sum = row[i].mul_add(weight[i], sum);
}
query[d] = sum;
}
}
Ok(())
}
/// Launch-argument admission of `keyless_route_query` (the host wrapper's check).
pub fn check_route_geometry(tokens: i64, heads: i64, dim: i64) -> Result<(), KeylessError> {
if tokens < 1 || heads < 1 || dim != DIM as i64 || tokens > i64::from(i32::MAX) / heads {
return Err(KeylessError::Geometry);
}
Ok(())
}
/// The key of a V-only cell: RoPE applied to the first 64 dimensions of the dequantized V row (`v` is 256
/// values), pairs `(d, d +- 32)`; `cos`/`sin` are `[position][32]` tables (`build_rope_table`).
pub fn key_from_value(v: &[f32], cell: i32, cos: &[f32], sin: &[f32], mrope: Option<&[i32]>) -> Vec<f32> {
assert_eq!(v.len(), DIM);
let half = N_ROT / 2;
let mut k = v.to_vec();
for d in 0..N_ROT {
let pair = d % half;
let rotary_pos = mrope_pos(mrope, cell, pair as i32) as usize;
let co = cos[rotary_pos * half + pair];
let si = sin[rotary_pos * half + pair];
let other = if d < half { d + half } else { d - half };
k[d] = if d < half { v[d] * co - v[other] * si } else { v[d] * co + v[other] * si };
}
k
}
// -------------------------------------------------------------------------------------------- artifact
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum KeylessError {
Geometry,
/// Header, version or geometry differs from the model (`invalid keyless artifact header/geometry`).
Header,
Truncated,
/// A layer id is out of range, not a QSA layer, or repeated.
InvalidLayer(u32),
/// A source projection is missing or its type, size or encoding differs.
SourceMismatch { layer: u32, role: &'static str },
/// The FNV-1a 64 of the source projection bytes differs from the artifact's record.
Fingerprint { layer: u32, role: &'static str },
NonFinite(u32),
Trailing,
}
impl std::fmt::Display for KeylessError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Geometry => f.write_str("invalid keyless query routing geometry or artifact"),
Self::Header => f.write_str("invalid keyless artifact header/geometry"),
Self::Truncated => f.write_str("truncated keyless artifact"),
Self::InvalidLayer(l) => write!(f, "keyless artifact has invalid/duplicate layer {l}"),
Self::SourceMismatch { layer, role } => {
write!(f, "keyless artifact source projection geometry/type mismatch (layer {layer}, {role})")
}
Self::Fingerprint { layer, role } => {
write!(f, "keyless artifact source projection fingerprint mismatch (layer {layer}, {role})")
}
Self::NonFinite(l) => write!(f, "truncated/nonfinite keyless query matrix (layer {l})"),
Self::Trailing => f.write_str("keyless artifact has trailing data"),
}
}
}
impl std::error::Error for KeylessError {}
/// The model's side of the admission: `ModelGeometry` and its QSA layer set.
#[derive(Clone, Debug)]
pub struct KeylessGeometry {
pub n_layers: u32,
pub qsa_layers: BTreeSet<u32>,
pub n_head: u32,
pub n_head_kv: u32,
pub head_dim: u32,
pub n_embd: u32,
}
impl KeylessGeometry {
/// `layer % 4 == 3` is a QSA layer (`is_qsa_layer`).
pub fn real() -> Self {
Self {
n_layers: 48,
qsa_layers: (0..48).filter(|l| l % 4 == 3).collect(),
n_head: 24,
n_head_kv: 2,
head_dim: 256,
n_embd: 2560,
}
}
}
/// One source projection of the loaded model (`WeightTable::find("blk.<l>.attn_<role>.weight")`).
#[derive(Clone, Copy, Debug)]
pub struct SourceTensor<'a> {
pub native_type: i32,
pub elements: u64,
/// The native (quantized) bytes; at least the artifact's recorded length.
pub data: &'a [u8],
}
#[derive(Clone, Debug, PartialEq)]
pub struct RoutingLayer {
pub layer: u32,
/// `[heads][256][256]` output-major matrices.
pub matrices: Vec<f32>,
}
#[derive(Clone, Debug, PartialEq)]
pub struct Routing {
pub layers: Vec<RoutingLayer>,
}
impl Routing {
/// `keyless_routing(layer)`.
pub fn layer(&self, layer: u32) -> Option<&[f32]> {
self.layers.iter().find(|l| l.layer == layer).map(|l| &l.matrices[..])
}
}
/// FNV-1a 64 (the artifact's fingerprint of the source bytes).
pub fn fnv1a64(bytes: &[u8]) -> u64 {
let mut h = 0xcbf2_9ce4_8422_2325u64;
for b in bytes {
h = (h ^ u64::from(*b)).wrapping_mul(0x0000_0100_0000_01b3);
}
h
}
/// `(block_elements, block_bytes)` of the native projection encodings the artifact records
/// (`kind`: 42 Q2_0, 8 Q8_0, 11 Q3_K, 12 Q4_K, 13 Q5_K, 14 Q6_K, 23 IQ4_XS).
pub fn block_geometry(kind: u32) -> Option<(u64, u64)> {
let elements = match kind {
42 => 64,
8 => 32,
_ => 256,
};
let bytes = match kind {
42 => 18,
11 => 110,
12 => 144,
13 => 176,
14 => 210,
23 => 136,
8 => 34,
_ => return None,
};
Some((elements, bytes))
}
struct Reader<'a> {
b: &'a [u8],
at: usize,
}
impl Reader<'_> {
fn take(&mut self, n: usize) -> Result<&[u8], KeylessError> {
let end = self.at.checked_add(n).ok_or(KeylessError::Truncated)?;
let s = self.b.get(self.at..end).ok_or(KeylessError::Truncated)?;
self.at = end;
Ok(s)
}
fn u32(&mut self) -> Result<u32, KeylessError> {
Ok(u32::from_le_bytes(self.take(4)?.try_into().expect("4")))
}
fn u64(&mut self) -> Result<u64, KeylessError> {
Ok(u64::from_le_bytes(self.take(8)?.try_into().expect("8")))
}
}
/// `keyless_load` minus the CUDA allocations: parse and fully admit a `SKLROUT1` artifact against the model's
/// geometry and its source projections. Every check happens before any matrix would reach a device.
pub fn parse_artifact<'a>(
bytes: &[u8],
g: &KeylessGeometry,
source: &dyn Fn(u32, &str) -> Option<SourceTensor<'a>>,
) -> Result<Routing, KeylessError> {
let mut r = Reader { b: bytes, at: 0 };
let magic = r.take(8)?;
if magic != MAGIC {
return Err(KeylessError::Header);
}
let (version, layers, heads, dim) = (r.u32()?, r.u32()?, r.u32()?, r.u32()?);
if version != VERSION
|| layers as usize != g.qsa_layers.len()
|| heads != g.n_head
|| dim != g.head_dim
|| dim as usize != DIM
{
return Err(KeylessError::Header);
}
let mut seen = BTreeSet::new();
let mut out = Vec::new();
for _ in 0..layers {
let layer = r.u32()?;
if layer >= g.n_layers || !g.qsa_layers.contains(&layer) || !seen.insert(layer) {
return Err(KeylessError::InvalidLayer(layer));
}
for role in ["q", "k", "v"] {
let kind = r.u32()?;
let nbytes = r.u64()?;
let wanted = r.u64()?;
let role_static: &'static str = match role {
"q" => "q",
"k" => "k",
_ => "v",
};
let mismatch = KeylessError::SourceMismatch { layer, role: role_static };
let w = source(layer, role).ok_or_else(|| mismatch.clone())?;
let expected_elements =
u64::from(g.n_embd) * u64::from(g.head_dim) * if role == "q" { u64::from(g.n_head) * 2 } else { u64::from(g.n_head_kv) };
if w.native_type as i64 != i64::from(kind)
|| nbytes == 0
|| nbytes > expected_elements * 4
|| expected_elements != w.elements
{
return Err(mismatch);
}
let (block_elements, block_bytes) = block_geometry(kind).ok_or_else(|| mismatch.clone())?;
if expected_elements % block_elements != 0 || nbytes != expected_elements / block_elements * block_bytes {
return Err(mismatch);
}
let data = w.data.get(..nbytes as usize).ok_or_else(|| mismatch.clone())?;
if fnv1a64(data) != wanted {
return Err(KeylessError::Fingerprint { layer, role: role_static });
}
}
let n = heads as usize * DIM * DIM;
let raw = r.take(n * 4)?;
let matrices: Vec<f32> = raw.chunks_exact(4).map(|c| f32::from_le_bytes(c.try_into().expect("4"))).collect();
if matrices.iter().any(|v| !v.is_finite()) {
return Err(KeylessError::NonFinite(layer));
}
out.push(RoutingLayer { layer, matrices });
}
if r.at != bytes.len() {
return Err(KeylessError::Trailing);
}
Ok(Routing { layers: out })
}
#[cfg(test)]
mod tests {
use super::*;
fn identity_scaled(heads: usize, scale: f32) -> Vec<f32> {
let mut m = vec![0.0f32; heads * DIM * DIM];
for h in 0..heads {
for d in 0..DIM {
m[(h * DIM + d) * DIM + d] = scale;
}
}
m
}
#[test]
fn routing_by_identity_scales_the_query_and_heads_wrap_by_block() {
let (tokens, heads) = (2, 3);
let mut m = identity_scaled(heads, 1.0);
for d in 0..DIM {
m[(2 * DIM + d) * DIM + d] = 2.0; // head 2 doubles
}
let mut q: Vec<f32> = (0..tokens * heads * DIM).map(|i| (i % 7) as f32 - 3.0).collect();
let orig = q.clone();
route_query(&mut q, &m, tokens, heads).unwrap();
for block in 0..tokens * heads {
let k = if block % heads == 2 { 2.0 } else { 1.0 };
for d in 0..DIM {
assert_eq!(q[block * DIM + d], k * orig[block * DIM + d]);
}
}
}
#[test]
fn routing_matrix_is_output_major() {
// matrix row 0 sums the first two inputs: out[0] = q0 + q1
let mut m = vec![0.0f32; DIM * DIM];
m[0] = 1.0;
m[1] = 1.0;
let mut q = vec![0.0f32; DIM];
q[0] = 3.0;
q[1] = 4.0;
route_query(&mut q, &m, 1, 1).unwrap();
assert_eq!(q[0], 7.0);
assert!(q[1..].iter().all(|v| *v == 0.0));
assert_eq!(route_query(&mut [0.0; 10], &m, 1, 1), Err(KeylessError::Geometry));
assert!(check_route_geometry(8, 24, 256).is_ok());
assert!(check_route_geometry(8, 24, 128).is_err());
assert!(check_route_geometry(i64::from(i32::MAX), 24, 256).is_err());
}
#[test]
fn mrope_is_the_cell_index_without_a_table() {
assert_eq!(mrope_pos(None, 17, 5), 17);
let tab = [10, 11, 12, 20, 21, 22];
assert_eq!(mrope_pos(Some(&tab), 1, 0), 20);
assert_eq!(mrope_pos(Some(&tab), 1, 4), 21); // pair % 3 == 1: h
assert_eq!(mrope_pos(Some(&tab), 0, 5), 12); // pair % 3 == 2: w
}
#[test]
fn key_reconstruction_rotates_the_first_64_dims_only() {
let v: Vec<f32> = (0..DIM).map(|i| i as f32 * 0.01).collect();
// position 0: cos 1, sin 0 -> identity
let (mut cos, mut sin) = (vec![0.0f32; 4 * 32], vec![0.0f32; 4 * 32]);
for p in 0..4 {
for d in 0..32 {
let a = p as f32 * (d as f32 + 1.0) * 0.1;
cos[p * 32 + d] = a.cos();
sin[p * 32 + d] = a.sin();
}
}
assert_eq!(key_from_value(&v, 0, &cos, &sin, None), v);
let k = key_from_value(&v, 2, &cos, &sin, None);
assert_eq!(k[64..], v[64..]);
assert_ne!(k[..64], v[..64]);
// rotation preserves the norm of each (d, d + 32) pair
for d in 0..32 {
let n0 = v[d] * v[d] + v[d + 32] * v[d + 32];
let n1 = k[d] * k[d] + k[d + 32] * k[d + 32];
assert!((n0 - n1).abs() < 1e-5);
}
}
// ------------------------------------------------------------------ artifact
struct Model {
g: KeylessGeometry,
// (layer, role) -> (kind, elements, data)
tensors: Vec<(u32, &'static str, i32, u64, Vec<u8>)>,
}
fn small_model() -> Model {
let mut g = KeylessGeometry::real();
g.qsa_layers = [3u32, 7].into_iter().collect();
g.n_head = 2;
g.n_head_kv = 1;
g.n_embd = 256;
let mut tensors = Vec::new();
for layer in [3u32, 7] {
for (role, mul) in [("q", 2 * 2u64), ("k", 1), ("v", 1)] {
let elements = 256 * 256 * mul;
// Q4_K: 256-element blocks of 144 bytes
let nbytes = (elements / 256 * 144) as usize;
let data: Vec<u8> = (0..nbytes).map(|i| ((i * 31 + layer as usize * 7 + role.len()) % 251) as u8).collect();
tensors.push((layer, role, 12, elements, data));
}
}
Model { g, tensors }
}
fn write_artifact(m: &Model, matrix_value: f32) -> Vec<u8> {
let mut out = Vec::new();
out.extend_from_slice(MAGIC);
for v in [1u32, m.g.qsa_layers.len() as u32, m.g.n_head, m.g.head_dim] {
out.extend_from_slice(&v.to_le_bytes());
}
// layout of scripts/prepare-keyless-routing.py: "<8s4I", then per layer "<I", 3 x "<IQQ", f32 matrices
for layer in &m.g.qsa_layers {
out.extend_from_slice(&layer.to_le_bytes());
for role in ["q", "k", "v"] {
let t = m.tensors.iter().find(|t| t.0 == *layer && t.1 == role).unwrap();
out.extend_from_slice(&(t.2 as u32).to_le_bytes());
out.extend_from_slice(&(t.4.len() as u64).to_le_bytes());
out.extend_from_slice(&fnv1a64(&t.4).to_le_bytes());
}
for _ in 0..m.g.n_head as usize * DIM * DIM {
out.extend_from_slice(&matrix_value.to_le_bytes());
}
}
out
}
fn lookup<'m>(m: &'m Model) -> impl Fn(u32, &str) -> Option<SourceTensor<'m>> + 'm {
move |layer, role| {
m.tensors
.iter()
.find(|t| t.0 == layer && t.1 == role)
.map(|t| SourceTensor { native_type: t.2, elements: t.3, data: &t.4 })
}
}
#[test]
fn artifact_round_trip_and_each_admission_failure() {
let m = small_model();
let good = write_artifact(&m, 0.5);
let routing = parse_artifact(&good, &m.g, &lookup(&m)).unwrap();
assert_eq!(routing.layers.len(), 2);
assert_eq!(routing.layer(7).unwrap().len(), 2 * DIM * DIM);
assert!(routing.layer(5).is_none());
let err = |bytes: &[u8]| parse_artifact(bytes, &m.g, &lookup(&m)).unwrap_err();
let mut bad = good.clone();
bad[0] = b'X';
assert_eq!(err(&bad), KeylessError::Header);
let mut bad = good.clone();
bad[8] = 2; // version
assert_eq!(err(&bad), KeylessError::Header);
let mut bad = good.clone();
bad[12] = 3; // layers
assert_eq!(err(&bad), KeylessError::Header);
let mut bad = good.clone();
bad[20] = 128; // head_dim
assert_eq!(err(&bad), KeylessError::Header);
let mut bad = good.clone();
bad[24] = 5; // first layer id is not a QSA layer
assert_eq!(err(&bad), KeylessError::InvalidLayer(5));
assert_eq!(err(&good[..good.len() - 1]), KeylessError::Truncated);
let mut bad = good.clone();
bad.push(0);
assert_eq!(err(&bad), KeylessError::Trailing);
// matrix NaN
let mut bad = good.clone();
let at = 24 + 4 + 3 * 20 + 16;
bad[at..at + 4].copy_from_slice(&f32::NAN.to_le_bytes());
assert_eq!(err(&bad), KeylessError::NonFinite(3));
// a different source tensor: fingerprint
let mut other = small_model();
other.tensors[0].4[3] ^= 0xFF;
assert_eq!(
parse_artifact(&good, &m.g, &lookup(&other)).unwrap_err(),
KeylessError::Fingerprint { layer: 3, role: "q" }
);
// a different encoding
let mut other = small_model();
other.tensors[1].2 = 14;
assert_eq!(
parse_artifact(&good, &m.g, &lookup(&other)).unwrap_err(),
KeylessError::SourceMismatch { layer: 3, role: "k" }
);
// duplicate layer
let mut dup = good.clone();
let layer_len = 4 + 60 + m.g.n_head as usize * DIM * DIM * 4;
let first = dup[24..24 + 4].to_vec();
dup[24 + layer_len..24 + layer_len + 4].copy_from_slice(&first);
assert_eq!(err(&dup), KeylessError::InvalidLayer(3));
}
#[test]
fn block_geometry_table() {
assert_eq!(block_geometry(42), Some((64, 18)));
assert_eq!(block_geometry(8), Some((32, 34)));
assert_eq!(block_geometry(12), Some((256, 144)));
assert_eq!(block_geometry(14), Some((256, 210)));
assert_eq!(block_geometry(1), None);
}
}
+102
View File
@@ -0,0 +1,102 @@
//! INT8 KV storage (`include/strata/kernels/kv_q8.hpp`, `src/kernels/cuda/kv_q8.cu`): the Original's
//! production format and the building block of the experimental K8V4 hybrid and keyless (V-only) caches.
//!
//! One fp16 scale per 64 values: `scale = fp16(max|x| / 127)`, `code = clamp(rint(x / scale), -127, 127)`
//! (round-half-even), quantized against the *stored* (fp16-rounded) scale. A gather dequantizes to
//! `fp16(code * scale)`; the fused decode attention reads `code * scale` unrounded.
use crate::f16::{f16_from_f32, f32_from_f16};
pub const KV_Q8_GROUP: usize = 64;
/// One 64-value group: `(codes, scale bits)`.
pub fn quantize_group(x: &[f32; KV_Q8_GROUP]) -> ([i8; KV_Q8_GROUP], u16) {
// fmaxf ignores a NaN operand, as Rust's f32::max does.
let amax = x.iter().fold(0.0f32, |m, v| m.max(v.abs()));
let sbits = f16_from_f32(amax / 127.0);
let sf = f32_from_f16(sbits);
let mut codes = [0i8; KV_Q8_GROUP];
if sf > 0.0 {
for (c, v) in codes.iter_mut().zip(x) {
// __float2int_rn: round to nearest even, saturating, NaN -> 0.
let q = (*v / sf).round_ties_even() as i32;
*c = q.clamp(-127, 127) as i8;
}
}
(codes, sbits)
}
/// One KV head (`head_dim` a multiple of 64): codes and `head_dim / 64` scale bit patterns.
pub fn quantize_head(x: &[f32]) -> (Vec<i8>, Vec<u16>) {
assert!(x.len().is_multiple_of(KV_Q8_GROUP));
let mut codes = Vec::with_capacity(x.len());
let mut scales = Vec::with_capacity(x.len() / KV_Q8_GROUP);
for g in x.chunks_exact(KV_Q8_GROUP) {
let (c, s) = quantize_group(g.try_into().expect("group"));
codes.extend_from_slice(&c);
scales.push(s);
}
(codes, scales)
}
/// `kv_gather_q8_kernel` output element: `fp16(code * scale)` as bits.
pub fn gather_bits(code: i8, scale_bits: u16) -> u16 {
f16_from_f32(f32::from(code) * f32_from_f16(scale_bits))
}
/// `load8_q8` of the fused decode attention: `code * scale`, not rounded to fp16.
pub fn dequant(code: i8, scale_bits: u16) -> f32 {
f32::from(code) * f32_from_f16(scale_bits)
}
/// Bytes per cell (one token, one layer): K and V codes plus their scales (`kv_q8_bytes_per_cell`).
pub const fn bytes_per_cell(n_head_kv: usize, head_dim: usize) -> u64 {
(n_head_kv * head_dim * 2 + n_head_kv * (head_dim / KV_Q8_GROUP) * 2 * 2) as u64
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn real_geometry_is_1056_bytes_per_cell() {
assert_eq!(bytes_per_cell(2, 256), 1056);
}
#[test]
fn codes_are_symmetric_and_the_extreme_is_127() {
let mut x = [0.0f32; 64];
for (i, v) in x.iter_mut().enumerate() {
*v = (i as f32 - 31.5) * 0.37;
}
let (codes, sbits) = quantize_group(&x);
let amax = x.iter().fold(0.0f32, |m, v| m.max(v.abs()));
let peak = x.iter().position(|v| v.abs() == amax).unwrap();
assert_eq!(codes[peak].unsigned_abs(), 127);
assert!(codes.iter().all(|c| *c != i8::MIN));
let sf = f32_from_f16(sbits);
for (c, v) in codes.iter().zip(&x) {
assert!((f32::from(*c) * sf - v).abs() <= sf * 0.5 + 1e-6);
}
}
#[test]
fn zero_group_stays_zero_with_a_zero_scale() {
let (codes, s) = quantize_group(&[0.0; 64]);
assert_eq!(s, 0);
assert!(codes.iter().all(|c| *c == 0));
}
#[test]
fn ties_round_to_even() {
// scale = fp16(127 / 127) = 1.0: 2.5 -> 2, 3.5 -> 4, -2.5 -> -2
let mut x = [0.0f32; 64];
x[0] = 127.0;
x[1] = 2.5;
x[2] = 3.5;
x[3] = -2.5;
let (codes, s) = quantize_group(&x);
assert_eq!(f32_from_f16(s), 1.0);
assert_eq!((codes[1], codes[2], codes[3]), (2, 4, -2));
}
}
+627
View File
@@ -0,0 +1,627 @@
//! KV streaming (`--kv-resident N`): the planner arithmetic of `layer.cpp` (`kv_plan`, `qsa_state_bytes`,
//! the pinned host-copy size) and the in-graph CLOCK residency resolver of `kv_stream.cu`, as a CPU oracle.
//!
//! A streamed QSA layer keeps its authoritative K/V in pinned host memory in the identity layout; VRAM holds
//! `n_slots` pages (one page = one indexer block = 4 cells) and the page table becomes a residency map:
//! `page_table[block]` = the slot holding it, `-1` = not resident, `-2` = claimed by the current resolve call.
//! `resolve` makes every block a batch of selections names resident: hits take the call's epoch and their
//! reference bit, misses are claimed once and given a victim slot by a second-chance sweep that never takes a
//! slot the call uses. [`StreamMap::resolve`] is a faithful sequential model of the kernel's three phases.
//!
//! What is *not* deterministic on the device: the order in which threads append to the miss list (phase 1).
//! The model takes it as input ([`MissOrder`]); every other effect (victim choice, hand movement, table
//! updates, counters) is a function of that order. The emulated-kernel test feeds the order the device-text run
//! actually produced.
//!
//! EXPERIMENTAL: streaming is off by default (`kv_resident == 0` keeps every cell in VRAM) and unqualified in
//! this port.
use crate::cache::PoolSet;
use crate::layout::{KvFormat, QsaShapes, StreamFormat, kv_block_bytes, kv_pool_bytes, stream_runs};
/// Threads of the resolve block: the sweep looks at `RT` consecutive slots per iteration.
pub const RT: usize = 1024;
/// `kKvCtlInts`: `[0]` epoch `[1]` hand `[2]` misses of the last call `[3]` overflow; u64 at `[4]` misses,
/// `[6]` lookups, `[8]` calls.
pub const CTL_INTS: usize = 16;
/// `qsa_kv_resident_min()`: one verify window's selections must fit at once.
pub const KV_RESIDENT_MIN: i64 = 20480;
/// `qsa_step_bytes()`: four int32.
pub const STEP_BYTES: u64 = 16;
/// `kv_stream_map_bytes`: five per-slot int arrays plus the control block.
pub const fn map_bytes(n_slots: u64) -> u64 {
n_slots * 4 * 5 + CTL_INTS as u64 * 4
}
// ------------------------------------------------------------------------------------------ planner
/// `QsaState::kv_mode`.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum StreamMode {
/// Every page in VRAM, identity page table, no host copy.
Resident = 0,
/// Streamed: authoritative K/V in the host copy, `slots` pages in VRAM, a residency map.
Streamed = 1,
/// A ring (the MTP drafter's window): pages at `block % slots`, host copy for a resume.
Ring = 2,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct KvPlan {
pub mode: StreamMode,
pub pages: i64,
pub slots: i64,
pub pooled_rows: i64,
}
/// `STRATA_KV_RING_OFF` / `STRATA_KV_MAIN_OFF`: A/B switches that keep a state fully resident.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct PlanSwitches {
pub ring_off: bool,
pub main_off: bool,
}
/// `kv_plan` of `layer.cpp`. `ring_cells < 0` forces a fully resident state, `> 0` is the drafter's ring.
pub fn kv_plan(s: &QsaShapes, max_cells: i64, ring_cells: i64, kv_resident: i64, sw: PlanSwitches) -> KvPlan {
let ps = s.page_size;
let pages = (max_cells + ps - 1) / ps;
let mut p = KvPlan { mode: StreamMode::Resident, pages, slots: pages, pooled_rows: max_cells / s.idx_block + 2 };
if kv_resident <= 0 || ring_cells < 0 {
return p;
}
if if ring_cells > 0 { sw.ring_off } else { sw.main_off } {
return p;
}
if ring_cells > 0 {
let r = (ring_cells + ps - 1) / ps;
if r < pages {
p.mode = StreamMode::Ring;
p.slots = r;
p.pooled_rows = 2; // the drafter has no indexer
}
} else {
let r = (kv_resident.max(KV_RESIDENT_MIN) + ps - 1) / ps;
if r < pages {
p.mode = StreamMode::Streamed;
p.slots = r;
}
}
p
}
fn align16(n: u64) -> u64 {
(n + 15) & !15
}
/// `qsa_state_bytes(g, max_cells, with_rope, ring_cells)` of one QSA layer for `format`. `ring` selects the
/// drafter's state (`ring_cells > 0`): K8V4 does not apply to it (the drafter is plain INT8), the other globals do.
pub fn qsa_state_bytes(
s: &QsaShapes,
format: KvFormat,
max_cells: i64,
with_rope: bool,
ring_cells: i64,
kv_resident: i64,
sw: PlanSwitches,
) -> u64 {
let p = kv_plan(s, max_cells, ring_cells, kv_resident, sw);
// g_kv_hybrid && ring_cells <= 0 selects the hybrid pool; a ring state under k8v4 is INT8 (mtp.cpp)
let pool_format = if format == KvFormat::K8V4 && ring_cells > 0 { KvFormat::Int8 } else { format };
let mut n = kv_pool_bytes(pool_format, s, p.slots as u64) + 4 * 16;
n += p.pages as u64 * 4; // page_table
if p.mode == StreamMode::Streamed {
n += map_bytes(p.slots as u64) + 6 * 16; // the residency map
}
n += (s.idx_block as u64 - 1) * s.idx_dim as u64 * 4; // tail
n += s.idx_dim as u64 * 4; // dead
n += p.pooled_rows as u64 * s.idx_dim as u64 * 4; // pooled
n += 16; // block_pos
if with_rope {
n += max_cells as u64 * (s.n_rot as u64 / 2) * 4 * 2; // cos + sin tables
}
n += STEP_BYTES + 16; // counts and aligned attention status
n += s.n_head as u64 * 4; // pos_dev
align16(n) + 256
}
/// Pinned host bytes of one streamed or ring state's copy (`pages * kv_block_bytes + 4 * 256`).
pub fn host_copy_bytes(s: &QsaShapes, format: KvFormat, pages: i64) -> Option<u64> {
let sf = StreamFormat::of(format)?;
Some(pages as u64 * kv_block_bytes(s, sf) + 4 * 256)
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum StreamError {
/// Fewer slots than the resolve block: the sweep would take one slot twice (`kv_stream_resolve` guard).
TooFewSlots,
/// More distinct blocks in one call than slots (the `n_q x (cap / page_size + 2)` bound).
CallTooLarge,
/// A block's scale run must be a multiple of 16 bytes (`kv_stream_resolve` guard).
ScaleRunAlignment,
/// A supplied miss order is not a permutation of the blocks the call misses.
BadMissOrder,
/// An id names a block outside the page table.
BlockOutOfRange,
/// The format cannot stream (hybrid K8V4).
NotStreamable,
}
/// The host guards of `kv_stream_resolve`.
pub fn check_resolve(s: &QsaShapes, n_slots: i64, n_q: i64, cap: i64) -> Result<(), StreamError> {
if s.n_head_kv * s.page_size * (s.head_dim / crate::kv_q8::KV_Q8_GROUP as i64) * 2 % 16 != 0 {
return Err(StreamError::ScaleRunAlignment);
}
if n_slots < RT as i64 {
return Err(StreamError::TooFewSlots);
}
// n_slots "must hold the distinct blocks of one call (n_q x (cap / page_size + 2))"
if n_slots < n_q * (cap / s.page_size + 2) {
return Err(StreamError::CallTooLarge);
}
Ok(())
}
// ------------------------------------------------------------------------------------ the resolver
/// Order in which the device threads appended the missed blocks of phase 1.
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum MissOrder {
/// Sequential walk: query-major, ascending id (what a single thread would append).
Canonical,
/// The order observed on a device (or emulated) run; must be a permutation of the missed blocks.
Observed(Vec<i32>),
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct ResolveReport {
pub epoch: i32,
pub hand: i32,
/// Distinct blocks that were not resident when the call began.
pub misses: usize,
/// Misses that received a slot (== `misses` unless the call overflowed).
pub placed: usize,
/// Block lookups of the call (consecutive ids of one block count once).
pub lookups: usize,
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct Counters {
pub misses: u64,
pub lookups: u64,
pub calls: u64,
pub overflow: bool,
}
/// `KvStreamMap`: the residency state, all int32 arrays of the device.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct StreamMap {
pub page_table: Vec<i32>,
pub slot_block: Vec<i32>,
pub slot_stamp: Vec<i32>,
pub slot_ref: Vec<i32>,
pub ctl: [i32; CTL_INTS],
pub miss_block: Vec<i32>,
pub miss_slot: Vec<i32>,
}
impl StreamMap {
/// `kv_stream_reset`: every block evicted, every slot free, counters zero.
pub fn new(n_blocks: usize, n_slots: usize) -> Self {
Self {
page_table: vec![-1; n_blocks],
slot_block: vec![-1; n_slots],
slot_stamp: vec![-1; n_slots],
slot_ref: vec![0; n_slots],
ctl: [0; CTL_INTS],
miss_block: vec![0; n_slots],
miss_slot: vec![0; n_slots],
}
}
pub fn n_slots(&self) -> usize {
self.slot_block.len()
}
pub fn reset(&mut self) {
*self = Self::new(self.page_table.len(), self.n_slots());
}
/// `kv_stream_counters` (the u64 counters sit at ctl[4..10]).
pub fn counters(&self) -> Counters {
let u = |i: usize| u64::from(self.ctl[i] as u32) | (u64::from(self.ctl[i + 1] as u32) << 32);
Counters { misses: u(4), lookups: u(6), calls: u(8), overflow: self.ctl[3] != 0 }
}
fn add_u64(&mut self, i: usize, v: u64) {
let cur = u64::from(self.ctl[i] as u32) | (u64::from(self.ctl[i + 1] as u32) << 32);
let n = cur.wrapping_add(v);
self.ctl[i] = n as u32 as i32;
self.ctl[i + 1] = (n >> 32) as u32 as i32;
}
/// One `resolve_kernel` call. `ids` is `[n_q][cap]` ascending cell ids, the width of query `q` is
/// `steps[q * 4 + 3]`.
pub fn resolve(
&mut self,
ids: &[i32],
steps: &[i32],
n_q: usize,
cap: usize,
page_size: i32,
order: &MissOrder,
) -> Result<ResolveReport, StreamError> {
let n = self.n_slots();
if n < RT {
return Err(StreamError::TooFewSlots);
}
let epoch = self.ctl[0] + 1;
// 1. hits take this epoch and their reference bit; a missing block is claimed exactly once (-1 -> -2)
let mut lookups = 0usize;
let mut misses: Vec<i32> = Vec::new();
for q in 0..n_q {
let width = steps[q * 4 + 3] as usize;
let qi = &ids[q * cap..q * cap + cap];
for i in 0..width {
let b = qi[i] / page_size;
if i > 0 && qi[i - 1] / page_size == b {
continue; // ids are ascending: one lookup per block
}
lookups += 1;
let bu = usize::try_from(b).map_err(|_| StreamError::BlockOutOfRange)?;
let sl = *self.page_table.get(bu).ok_or(StreamError::BlockOutOfRange)?;
if sl >= 0 {
self.slot_stamp[sl as usize] = epoch;
self.slot_ref[sl as usize] = 1;
} else if sl == -1 {
self.page_table[bu] = -2;
misses.push(b);
}
}
}
if misses.len() > n {
return Err(StreamError::CallTooLarge);
}
if let MissOrder::Observed(o) = order {
let mut a = o.clone();
let mut b = misses.clone();
a.sort_unstable();
b.sort_unstable();
if a != b {
return Err(StreamError::BadMissOrder);
}
misses = o.clone();
}
for (k, b) in misses.iter().enumerate() {
self.miss_block[k] = *b;
}
// 2. one victim per miss: a clock sweep from the hand. A slot this call uses (stamp == epoch) is never
// taken; a referenced one loses its bit as the hand passes it and is taken on the next pass.
let need = misses.len();
let mut hand = self.ctl[1] as usize;
let mut got = 0usize;
let mut scanned = 0usize;
while got < need && scanned < 3 * n {
// the RT threads read the pre-iteration state, then write
let mut cand = [false; RT];
let mut mine = [false; RT];
for t in 0..RT {
let j = (hand + t) % n;
mine[t] = self.slot_stamp[j] == epoch;
cand[t] = !mine[t] && (self.slot_block[j] < 0 || self.slot_ref[j] == 0);
}
let want = need - got;
let mut rank = [0usize; RT];
let mut total = 0usize;
for t in 0..RT {
rank[t] = total;
total += usize::from(cand[t]);
}
let mut cut = RT;
for t in 0..RT {
if cand[t] && rank[t] + 1 == want {
cut = t + 1; // the hand stops just past the last slot taken
}
}
for t in 0..RT {
let j = (hand + t) % n;
if cand[t] && rank[t] < want {
self.miss_slot[got + rank[t]] = j as i32;
self.slot_stamp[j] = epoch; // taken: a sweep that wraps around must not take it twice
} else if t < cut && !mine[t] {
self.slot_ref[j] = 0;
}
}
got += total.min(want);
hand = (hand + cut) % n;
scanned += RT;
}
// 3. re-point the table; the copy kernel fills the slots
let placed = got.min(need);
for k in 0..need {
let b = self.miss_block[k] as usize;
if k >= placed {
self.page_table[b] = -1; // overflow: never happens with a legal n_slots
continue;
}
let sl = self.miss_slot[k] as usize;
let old = self.slot_block[sl];
if old >= 0 {
self.page_table[old as usize] = -1;
}
self.slot_block[sl] = b as i32;
self.slot_stamp[sl] = epoch;
self.slot_ref[sl] = 1;
self.page_table[b] = sl as i32;
}
self.ctl[0] = epoch;
self.ctl[1] = hand as i32;
self.ctl[2] = placed as i32;
if placed < need {
self.ctl[3] = 1;
}
self.add_u64(4, placed as u64);
self.add_u64(6, lookups as u64);
self.add_u64(8, 1);
Ok(ResolveReport { epoch, hand: hand as i32, misses: need, placed, lookups })
}
/// The map inverts itself: every resident block names a slot that names it back, and every occupied slot is
/// in the table (the invariant `kv_stream_parity.cpp` checks after every call).
pub fn is_consistent(&self) -> bool {
let n = self.n_slots() as i32;
for (b, &sl) in self.page_table.iter().enumerate() {
if sl < -1 || sl >= n || (sl >= 0 && self.slot_block[sl as usize] != b as i32) {
return false;
}
}
self.slot_block
.iter()
.enumerate()
.all(|(sl, &b)| b < 0 || self.page_table.get(b as usize) == Some(&(sl as i32)))
}
pub fn resident_blocks(&self) -> usize {
self.page_table.iter().filter(|s| **s >= 0).count()
}
/// `copy_kernel`: the first `ctl[2]` missed blocks are copied from the host copy into their slots, run by
/// run. `slots` is the VRAM pool bundle, `host` the identity-layout copy.
pub fn copy_missed(&self, slots: &mut PoolSet, host: &PoolSet, s: &QsaShapes, fmt: StreamFormat) {
let need = self.ctl[2] as usize;
for (name, len) in stream_runs(s, fmt) {
let len = len as usize;
let src = host.array(name).expect("host array");
let dst = slots.array_mut(name).expect("slot array");
for k in 0..need {
let (b, sl) = (self.miss_block[k] as usize, self.miss_slot[k] as usize);
dst[sl * len..(sl + 1) * len].copy_from_slice(&src[b * len..(b + 1) * len]);
}
}
}
}
/// `kv_ring_table`: the static ring `block -> block % n_slots`.
pub fn ring_table(n_blocks: usize, n_slots: usize) -> Vec<i32> {
(0..n_blocks).map(|i| (i % n_slots) as i32).collect()
}
/// `kv_ring_restore`: blocks `[b0, b1)` of the host copy into the ring slots `b % n_slots`, in runs up to the
/// ring's end (the Original issues one copy per run per array).
pub fn ring_restore(slots: &mut PoolSet, host: &PoolSet, s: &QsaShapes, fmt: StreamFormat, b0: usize, b1: usize, n_slots: usize) {
for (name, len) in stream_runs(s, fmt) {
let len = len as usize;
let src = host.array(name).expect("host array");
let dst = slots.array_mut(name).expect("slot array");
let mut b = b0;
while b < b1 {
let sl = b % n_slots;
let run = (b1 - b).min(n_slots - sl);
dst[sl * len..(sl + run) * len].copy_from_slice(&src[b * len..(b + run) * len]);
b += run;
}
}
}
/// `kv_stage_from_host`: the first `n_blocks` blocks of the host copy into an identity-layout staging pool.
pub fn stage_from_host(stage: &mut PoolSet, host: &PoolSet, s: &QsaShapes, fmt: StreamFormat, n_blocks: usize) {
for (name, len) in stream_runs(s, fmt) {
let len = len as usize;
let src = host.array(name).expect("host array");
let dst = stage.array_mut(name).expect("stage array");
dst[..n_blocks * len].copy_from_slice(&src[..n_blocks * len]);
}
}
#[cfg(test)]
mod tests {
use super::*;
const S: QsaShapes = QsaShapes::real();
#[test]
fn plan_matches_the_documented_modes() {
let sw = PlanSwitches::default();
// not streaming: all pages resident
let p = kv_plan(&S, 262_144, 0, 0, sw);
assert_eq!((p.mode, p.pages, p.slots, p.pooled_rows), (StreamMode::Resident, 65_536, 65_536, 65_538));
// streaming 32768 cells of a 262144 context: 8192 slots
let p = kv_plan(&S, 262_144, 0, 32_768, sw);
assert_eq!((p.mode, p.slots), (StreamMode::Streamed, 8192));
// below the minimum the minimum applies (20480 cells = 5120 slots)
let p = kv_plan(&S, 262_144, 0, 1000, sw);
assert_eq!((p.mode, p.slots), (StreamMode::Streamed, 5120));
// a context that fits is not streamed
let p = kv_plan(&S, 16_384, 0, 20_480, sw);
assert_eq!(p.mode, StreamMode::Resident);
// the drafter's ring
let p = kv_plan(&S, 262_144, 256, 20_480, sw);
assert_eq!((p.mode, p.slots, p.pooled_rows), (StreamMode::Ring, 64, 2));
// forced fully resident
assert_eq!(kv_plan(&S, 262_144, -1, 20_480, sw).mode, StreamMode::Resident);
// A/B switches
assert_eq!(kv_plan(&S, 262_144, 256, 20_480, PlanSwitches { ring_off: true, main_off: false }).mode, StreamMode::Resident);
assert_eq!(kv_plan(&S, 262_144, 0, 20_480, PlanSwitches { ring_off: false, main_off: true }).mode, StreamMode::Resident);
}
#[test]
fn resolve_guards() {
assert_eq!(check_resolve(&S, 5120, 8, 2051), Ok(()));
assert_eq!(check_resolve(&S, 1000, 1, 70), Err(StreamError::TooFewSlots));
assert_eq!(check_resolve(&S, 1024, 8, 2051), Err(StreamError::CallTooLarge));
let mut odd = S;
odd.n_head_kv = 1;
odd.page_size = 1; // 1 x 1 x 4 groups x 2 B = 8 B per block run
assert_eq!(check_resolve(&odd, 5120, 1, 70), Err(StreamError::ScaleRunAlignment));
}
fn lcg(s: &mut u64) -> u32 {
*s = s.wrapping_mul(6364136223846793005).wrapping_add(1442695040888963407);
(*s >> 32) as u32
}
/// Selections shaped like the indexer's: ascending, whole 4-cell blocks.
fn selection(seed: &mut u64, n_blocks: u32, nb: usize) -> Vec<i32> {
let mut blocks = std::collections::BTreeSet::new();
while blocks.len() < nb {
blocks.insert((lcg(seed) % n_blocks) as i32);
}
blocks.into_iter().flat_map(|b| (0..4).map(move |i| b * 4 + i)).collect()
}
fn run_calls(map: &mut StreamMap, calls: usize, nb: usize, n_q: usize) {
let cap = nb * 4;
let mut seed = 99u64;
for _ in 0..calls {
let mut ids = Vec::new();
let mut steps = Vec::new();
for _ in 0..n_q {
let sel = selection(&mut seed, map.page_table.len() as u32, nb);
steps.extend_from_slice(&[0, 0, 0, sel.len() as i32]);
ids.extend_from_slice(&sel);
}
let report = map.resolve(&ids, &steps, n_q, cap, 4, &MissOrder::Canonical).unwrap();
assert_eq!(report.placed, report.misses);
assert!(map.is_consistent());
// every selected block is resident after the call
for q in 0..n_q {
for i in 0..steps[q * 4 + 3] as usize {
assert!(map.page_table[(ids[q * cap + i] / 4) as usize] >= 0);
}
}
}
}
#[test]
fn eviction_keeps_the_map_consistent_and_counters_add_up() {
let mut map = StreamMap::new(2000, 1100);
run_calls(&mut map, 60, 20, 3);
let c = map.counters();
assert!(!c.overflow);
assert_eq!(c.calls, 60);
assert!(c.misses > 0 && c.misses < c.lookups, "{c:?}");
assert_eq!(map.resident_blocks(), 1100.min(map.resident_blocks()));
assert!(map.resident_blocks() <= 1100);
// a repeated call is all hits
let ids: Vec<i32> = (0..40).collect();
let steps = [0, 0, 0, 40];
map.resolve(&ids, &steps, 1, 40, 4, &MissOrder::Canonical).unwrap();
let before = map.counters().misses;
let r = map.resolve(&ids, &steps, 1, 40, 4, &MissOrder::Canonical).unwrap();
assert_eq!(r.misses, 0);
assert_eq!(map.counters().misses, before);
}
#[test]
fn a_slot_used_by_the_call_is_never_a_victim() {
let mut map = StreamMap::new(3000, 1030);
// fill every slot with blocks 0..1030
for chunk in 0..(1030 / 40 + 1) {
let first = chunk * 40;
let ids: Vec<i32> = (first * 4..(first + 40) * 4).collect();
let steps = [0, 0, 0, ids.len() as i32];
map.resolve(&ids, &steps, 1, ids.len(), 4, &MissOrder::Canonical).unwrap();
}
assert_eq!(map.resident_blocks(), 1030);
// one call that hits 40 resident blocks and misses 40 new ones: no hit block may be evicted
let mut ids: Vec<i32> = (100..140).flat_map(|b| (0..4).map(move |i| b * 4 + i)).collect();
ids.extend((2000..2040).flat_map(|b| (0..4).map(move |i| b * 4 + i)));
let steps = [0, 0, 0, ids.len() as i32];
map.resolve(&ids, &steps, 1, ids.len(), 4, &MissOrder::Canonical).unwrap();
for b in 100..140 {
assert!(map.page_table[b] >= 0, "hit block {b} was evicted");
}
for b in 2000..2040 {
assert!(map.page_table[b] >= 0);
}
}
#[test]
fn observed_miss_order_changes_only_the_pairing_not_the_victim_set() {
let ids: Vec<i32> = [7, 3, 500, 9].iter().flat_map(|b: &i32| (0..4).map(move |i| b * 4 + i)).collect();
// ids must be ascending for the dedupe; resolve a sorted selection
let mut sorted = ids.clone();
sorted.sort_unstable();
let steps = [0, 0, 0, sorted.len() as i32];
let mut a = StreamMap::new(600, 1030);
let mut b = a.clone();
a.resolve(&sorted, &steps, 1, sorted.len(), 4, &MissOrder::Canonical).unwrap();
b.resolve(&sorted, &steps, 1, sorted.len(), 4, &MissOrder::Observed(vec![500, 9, 3, 7])).unwrap();
let mut sa = a.miss_slot[..4].to_vec();
let mut sb = b.miss_slot[..4].to_vec();
sa.sort_unstable();
sb.sort_unstable();
assert_eq!(sa, sb);
assert_ne!(a.page_table, b.page_table);
assert!(a.is_consistent() && b.is_consistent());
assert_eq!(
a.resolve(&sorted, &steps, 1, sorted.len(), 4, &MissOrder::Observed(vec![1, 2, 3, 4])),
Err(StreamError::BadMissOrder)
);
}
#[test]
fn too_many_distinct_blocks_for_the_slots_is_refused() {
let mut map = StreamMap::new(5000, 1024);
let ids: Vec<i32> = (0..1025 * 4).collect();
let steps = [0, 0, 0, ids.len() as i32];
assert_eq!(
map.resolve(&ids, &steps, 1, ids.len(), 4, &MissOrder::Canonical),
Err(StreamError::CallTooLarge)
);
}
#[test]
fn ring_table_and_restore() {
let t = ring_table(10, 4);
assert_eq!(t, [0, 1, 2, 3, 0, 1, 2, 3, 0, 1]);
let rows = 10 * S.rows_per_page();
let mut host = PoolSet::new(KvFormat::Int8, &S, rows).unwrap();
for (i, b) in host.k_q.iter_mut().enumerate() {
*b = (i % 251) as u8;
}
for (i, b) in host.k_scale.iter_mut().enumerate() {
*b = (i % 13) as u8;
}
let mut ring = PoolSet::new(KvFormat::Int8, &S, 4 * S.rows_per_page()).unwrap();
ring_restore(&mut ring, &host, &S, StreamFormat::Int8, 6, 10, 4);
let len = 2048; // k_q bytes of a block
for b in 6..10 {
let sl = b % 4;
assert_eq!(ring.k_q[sl * len..(sl + 1) * len], host.k_q[b * len..(b + 1) * len]);
}
}
#[test]
fn state_bytes_grow_with_resident_slots_only() {
let sw = PlanSwitches::default();
let full = qsa_state_bytes(&S, KvFormat::Int8, 262_144, true, 0, 0, sw);
let streamed = qsa_state_bytes(&S, KvFormat::Int8, 262_144, true, 0, 20_480, sw);
assert!(streamed < full);
// the streamed state is the resident one minus the evicted pages' KV, plus the map
let removed = kv_pool_bytes(KvFormat::Int8, &S, 65_536) - kv_pool_bytes(KvFormat::Int8, &S, 5120);
assert_eq!(full - streamed, removed - map_bytes(5120) - 6 * 16);
assert_eq!(host_copy_bytes(&S, KvFormat::Int8, 65_536), Some(65_536 * 4224 + 1024));
assert_eq!(host_copy_bytes(&S, KvFormat::K8V4, 10), None);
}
}
+464
View File
@@ -0,0 +1,464 @@
//! KV cache cell layouts and byte sizes of every KV format of the Original (`src/core/layer.cpp`
//! `kv_pool_bytes` / `qsa_state_init`, `kernels/kv_q8.hpp`, `kernels/kv_q4.hpp`, `kernels/kv_stream.cu`
//! `kv_block_bytes`), plus the format-selection rules of `generate.cpp`.
//!
//! This is the *layout* half only. `crates/context` (`memory_plan.rs`, branch `claude/port-rope`) owns the
//! `strata-plan` admission arithmetic and carries its own golden tests of `kv_pool_bytes`; the per-cell
//! figures below (fp16 2048, INT8 1056, Q4_0 576, K8V4 816, keyless 528 bytes per cell and layer) are
//! asserted identical in the tests so the two stay consistent when the branches meet. Nothing is
//! re-derived from the plan; this module is what the CUDA programs index with.
//!
//! Pools are paged: `[page][kv_head][slot][...]` with one physical *row* per (page, head, slot):
//! `row = (page * n_head_kv + head) * page_size + slot`. A KV streaming host copy uses the identity page
//! table with the same row formula.
use crate::{kv_q8, q4_0};
/// Geometry of one QSA layer (`QsaShapes`).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct QsaShapes {
pub n_head: i64,
pub n_head_kv: i64,
pub head_dim: i64,
pub n_rot: i64,
pub idx_n_head: i64,
pub idx_dim: i64,
pub idx_block: i64,
pub idx_top_k: i64,
pub page_size: i64,
}
impl QsaShapes {
/// `qsa_real_shapes()`: 24 query heads, 2 KV heads, head_dim 256, page = one indexer block of 4 cells.
pub const fn real() -> Self {
Self {
n_head: 24,
n_head_kv: 2,
head_dim: 256,
n_rot: 64,
idx_n_head: 4,
idx_dim: 128,
idx_block: 4,
idx_top_k: 2048,
page_size: 4,
}
}
/// Rows of one page (all KV heads x page cells).
pub const fn rows_per_page(&self) -> u64 {
(self.n_head_kv * self.page_size) as u64
}
}
/// The KV storage format of the QSA layers.
///
/// Only [`KvFormat::Fp16`] and [`KvFormat::Int8`] are the Original's non-experimental formats; the rest are
/// lossy or unqualified and are never a default: [`KvFormat::is_experimental`].
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum KvFormat {
Fp16,
Int8,
/// INT8 K/V through the Hadamard rotation (`STRATA_KV_ROT=1`): the layout of INT8, rotated contents.
Int8Rotated,
/// `--kv q4_0`: rotated Q4_0 K and V, 576 B per cell.
Q4_0,
/// `--kv k8v4`: INT8 K (unrotated, exact scores) + rotated Q4_0 V, 816 B per cell. No KV streaming.
K8V4,
/// `STRATA_KEYLESS_ROUTING`: V-only INT8, no K store, 528 B per cell. Failed its model-quality gate.
Int8Keyless,
}
impl KvFormat {
pub const ALL: [KvFormat; 6] = [
Self::Fp16,
Self::Int8,
Self::Int8Rotated,
Self::Q4_0,
Self::K8V4,
Self::Int8Keyless,
];
pub const fn name(self) -> &'static str {
match self {
Self::Fp16 => "fp16",
Self::Int8 => "int8",
Self::Int8Rotated => "int8-rotated",
Self::Q4_0 => "q4_0",
Self::K8V4 => "k8v4",
Self::Int8Keyless => "int8-keyless",
}
}
/// Lossy or unqualified: must be named explicitly by the operator.
pub const fn is_experimental(self) -> bool {
!matches!(self, Self::Fp16 | Self::Int8)
}
/// K and V are written through the Hadamard rotation (`kv_rot`); K8V4 rotates only V.
pub const fn rotates_k(self) -> bool {
matches!(self, Self::Q4_0 | Self::Int8Rotated)
}
pub const fn rotates_v(self) -> bool {
matches!(self, Self::Q4_0 | Self::Int8Rotated | Self::K8V4)
}
/// The queries are rotated too (`kv_rot`), and the attention output rotated back.
pub const fn rotates_query(self) -> bool {
self.rotates_k()
}
pub const fn rotates_output(self) -> bool {
self.rotates_v()
}
pub const fn has_k_store(self) -> bool {
!matches!(self, Self::Int8Keyless)
}
/// The fused decode attention's `KV_MODE`: 0 fp16, 1 INT8, 2 Q4_0, 3 K8V4, 4 V-only.
pub const fn attention_mode(self) -> u32 {
match self {
Self::Fp16 => 0,
Self::Int8 | Self::Int8Rotated => 1,
Self::Q4_0 => 2,
Self::K8V4 => 3,
Self::Int8Keyless => 4,
}
}
/// Bytes per cell (one token, one layer, K and V of every KV head).
pub fn bytes_per_cell(self, s: &QsaShapes) -> u64 {
let (h, d) = (s.n_head_kv as usize, s.head_dim as usize);
match self {
Self::Fp16 => (h * d * 2 * 2) as u64,
Self::Int8 | Self::Int8Rotated => kv_q8::bytes_per_cell(h, d),
Self::Q4_0 => q4_0::bytes_per_cell(h, d),
Self::K8V4 => {
(h as u64) * (d as u64 + (d / kv_q8::KV_Q8_GROUP * 2) as u64 + q4_0::bytes_per_head(d))
}
Self::Int8Keyless => kv_q8::bytes_per_cell(h, d) / 2,
}
}
}
/// `--kv` plus the environment switches, as `generate.cpp` validates them. `keyless_routing` stands for a
/// set `STRATA_KEYLESS_ROUTING`; `kv_rot` for `STRATA_KV_ROT=1`.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct KvRequest<'a> {
pub kv: &'a str,
pub kv_rot: bool,
pub keyless_routing: bool,
pub kv_resident: i64,
pub gpu_stages: bool,
pub diagnostic_dumps: bool,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum KvSelectionError {
UnknownFormat,
KeylessRequiresPlainInt8,
NegativeResident,
K8V4NotStreamable,
}
impl std::fmt::Display for KvSelectionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(match self {
Self::UnknownFormat => "--kv must be fp16, int8, q4_0 or k8v4",
Self::KeylessRequiresPlainInt8 => {
"keyless requires INT8, no Hadamard rotation, one GPU stage and no diagnostic dumps"
}
Self::NegativeResident => "--kv-resident must be >= 0",
Self::K8V4NotStreamable => "--kv k8v4 does not support --kv-resident streaming (yet)",
})
}
}
impl std::error::Error for KvSelectionError {}
/// The Original's selection (`generate.cpp:1504-1531`). `q4` is accepted as `q4_0`.
pub fn select_format(r: &KvRequest<'_>) -> Result<KvFormat, KvSelectionError> {
let kv = if r.kv == "q4" { "q4_0" } else { r.kv };
if !matches!(kv, "fp16" | "int8" | "q4_0" | "k8v4") {
return Err(KvSelectionError::UnknownFormat);
}
if r.keyless_routing && (kv != "int8" || r.gpu_stages || r.diagnostic_dumps || r.kv_rot) {
return Err(KvSelectionError::KeylessRequiresPlainInt8);
}
if r.kv_resident < 0 {
return Err(KvSelectionError::NegativeResident);
}
if kv == "k8v4" && r.kv_resident > 0 {
return Err(KvSelectionError::K8V4NotStreamable);
}
Ok(match kv {
_ if r.keyless_routing => KvFormat::Int8Keyless,
"fp16" => KvFormat::Fp16,
"int8" if r.kv_rot => KvFormat::Int8Rotated,
"int8" => KvFormat::Int8,
"q4_0" => KvFormat::Q4_0,
_ => KvFormat::K8V4,
})
}
/// One array of a pool bundle and its place in the 16-byte-aligned arena (`Cursor::take`).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct PoolArray {
pub name: &'static str,
pub offset: u64,
pub bytes: u64,
}
fn align16(n: u64) -> u64 {
(n + 15) & !15
}
/// The arrays `qsa_state_init` takes for `slots` resident pages, in order, with the Original's
/// 16-byte cursor alignment. Total = last offset + bytes aligned up.
pub fn pool_arrays(fmt: KvFormat, s: &QsaShapes, slots: u64) -> Vec<PoolArray> {
let rows = slots * s.rows_per_page();
let hd = s.head_dim as u64;
let groups = hd / kv_q8::KV_Q8_GROUP as u64;
let q4_row = q4_0::bytes_per_head(hd as usize);
let spec: &[(&'static str, u64)] = &match fmt {
KvFormat::K8V4 => [
("k_q", rows * hd),
("k_scale", rows * groups * 2),
("v_q4", rows * q4_row),
("", 0),
],
KvFormat::Q4_0 => [("k_q4", rows * q4_row), ("v_q4", rows * q4_row), ("", 0), ("", 0)],
KvFormat::Int8 | KvFormat::Int8Rotated => [
("k_q", rows * hd),
("v_q", rows * hd),
("k_scale", rows * groups * 2),
("v_scale", rows * groups * 2),
],
KvFormat::Int8Keyless => [
("v_q", rows * hd),
("v_scale", rows * groups * 2),
("", 0),
("", 0),
],
KvFormat::Fp16 => [("k_pool", rows * hd * 2), ("v_pool", rows * hd * 2), ("", 0), ("", 0)],
};
let mut used = 0;
let mut out = Vec::new();
for (name, bytes) in spec.iter().filter(|(n, _)| !n.is_empty()) {
out.push(PoolArray { name, offset: used, bytes: *bytes });
used = align16(used + bytes);
}
out
}
/// Total aligned arena bytes of [`pool_arrays`].
pub fn pool_arena_bytes(fmt: KvFormat, s: &QsaShapes, slots: u64) -> u64 {
pool_arrays(fmt, s, slots)
.last()
.map_or(0, |a| align16(a.offset + a.bytes))
}
/// `kv_pool_bytes` of `layer.cpp` verbatim (including its `+ 64` slack on every format but fp16).
pub fn kv_pool_bytes(fmt: KvFormat, s: &QsaShapes, pages: u64) -> u64 {
let cell = |per_cell: u64| pages * s.page_size as u64 * per_cell + 64;
match fmt {
KvFormat::Int8Keyless => pages * s.page_size as u64 * kv_q8::bytes_per_cell(s.n_head_kv as usize, s.head_dim as usize) / 2 + 64,
KvFormat::K8V4 => {
let rows = pages * s.rows_per_page();
let hd = s.head_dim as u64;
rows * hd
+ rows * (hd / kv_q8::KV_Q8_GROUP as u64) * 2
+ rows * q4_0::bytes_per_head(hd as usize)
+ 64
}
KvFormat::Q4_0 => cell(q4_0::bytes_per_cell(s.n_head_kv as usize, s.head_dim as usize)),
KvFormat::Int8 | KvFormat::Int8Rotated => cell(kv_q8::bytes_per_cell(s.n_head_kv as usize, s.head_dim as usize)),
KvFormat::Fp16 => pages * s.n_head_kv as u64 * s.page_size as u64 * s.head_dim as u64 * 2 * 2,
}
}
/// The formats that kernels of `kv_stream.cu` can move, by their `KvFormat` enum values
/// (`kKvF16 = 0, kKvInt8 = 1, kKvQ4 = 2, kKvValueInt8 = 4`). Hybrid K8V4 has no streaming id.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum StreamFormat {
F16 = 0,
Int8 = 1,
Q4 = 2,
ValueInt8 = 4,
}
impl StreamFormat {
pub fn of(fmt: KvFormat) -> Option<Self> {
match fmt {
KvFormat::Fp16 => Some(Self::F16),
KvFormat::Int8 | KvFormat::Int8Rotated => Some(Self::Int8),
KvFormat::Q4_0 => Some(Self::Q4),
KvFormat::Int8Keyless => Some(Self::ValueInt8),
KvFormat::K8V4 => None,
}
}
}
/// Bytes of one block (page) of K and V together (`kv_block_bytes` in `kv_stream.cu`).
pub fn kv_block_bytes(s: &QsaShapes, fmt: StreamFormat) -> u64 {
let rows = s.rows_per_page();
let hd = s.head_dim as u64;
let group = kv_q8::KV_Q8_GROUP as u64;
match fmt {
StreamFormat::ValueInt8 => rows * (hd + hd / group * 2),
StreamFormat::Q4 => rows * q4_0::bytes_per_head(hd as usize) * 2,
StreamFormat::Int8 => rows * hd * 2 + rows * (hd / group) * 2 * 2,
StreamFormat::F16 => rows * hd * 2 * 2,
}
}
/// Byte runs of a block, per pool array (`runs_of` in `kv_stream.cu`): block `b` of array `i` is bytes
/// `[b * len, (b + 1) * len)`. Array names are those of [`pool_arrays`].
pub fn stream_runs(s: &QsaShapes, fmt: StreamFormat) -> Vec<(&'static str, u64)> {
let rows = s.rows_per_page();
let hd = s.head_dim as u64;
let groups = hd / kv_q8::KV_Q8_GROUP as u64;
match fmt {
StreamFormat::ValueInt8 => vec![("v_q", rows * hd), ("v_scale", rows * groups * 2)],
StreamFormat::Q4 => {
let b = rows * q4_0::bytes_per_head(hd as usize);
vec![("k_q4", b), ("v_q4", b)]
}
StreamFormat::Int8 => {
let (codes, scales) = (rows * hd, rows * groups * 2);
vec![("k_q", codes), ("v_q", codes), ("k_scale", scales), ("v_scale", scales)]
}
StreamFormat::F16 => {
let b = rows * hd * 2;
vec![("k_pool", b), ("v_pool", b)]
}
}
}
/// The physical row of (page, head, slot) in a pool or an identity-layout host copy.
pub const fn physical_row(s: &QsaShapes, page: u64, head: u64, slot: u64) -> u64 {
(page * s.n_head_kv as u64 + head) * s.page_size as u64 + slot
}
#[cfg(test)]
mod tests {
use super::*;
const S: QsaShapes = QsaShapes::real();
#[test]
fn per_cell_bytes_are_the_documented_figures() {
// Identical to crates/context memory_plan.rs (branch claude/port-rope) golden `kv_pool_bytes` rows.
assert_eq!(KvFormat::Fp16.bytes_per_cell(&S), 2048);
assert_eq!(KvFormat::Int8.bytes_per_cell(&S), 1056);
assert_eq!(KvFormat::Int8Rotated.bytes_per_cell(&S), 1056);
assert_eq!(KvFormat::Q4_0.bytes_per_cell(&S), 576);
assert_eq!(KvFormat::K8V4.bytes_per_cell(&S), 816);
assert_eq!(KvFormat::Int8Keyless.bytes_per_cell(&S), 528);
}
#[test]
fn pool_arrays_sum_to_the_per_cell_cost() {
for fmt in KvFormat::ALL {
for slots in [1u64, 7, 5120] {
let cells = slots * S.page_size as u64;
let sum: u64 = pool_arrays(fmt, &S, slots).iter().map(|a| a.bytes).sum();
assert_eq!(sum, cells * fmt.bytes_per_cell(&S), "{fmt:?} {slots}");
// the Original's closed form stays within its `+ 64` slack plus the 4 x 16 cursor slack
let closed = kv_pool_bytes(fmt, &S, slots);
let arena = pool_arena_bytes(fmt, &S, slots);
assert!(arena <= closed + 4 * 16 && arena >= sum, "{fmt:?} {slots} {arena} {closed}");
}
}
}
#[test]
fn arrays_are_16_byte_aligned_and_disjoint() {
for fmt in KvFormat::ALL {
let a = pool_arrays(fmt, &S, 3);
for w in a.windows(2) {
assert!(w[0].offset + w[0].bytes <= w[1].offset);
}
assert!(a.iter().all(|x| x.offset % 16 == 0));
}
}
#[test]
fn array_order_matches_qsa_state_init() {
let names = |f| pool_arrays(f, &S, 1).iter().map(|a| a.name).collect::<Vec<_>>();
assert_eq!(names(KvFormat::K8V4), ["k_q", "k_scale", "v_q4"]);
assert_eq!(names(KvFormat::Q4_0), ["k_q4", "v_q4"]);
assert_eq!(names(KvFormat::Int8), ["k_q", "v_q", "k_scale", "v_scale"]);
assert_eq!(names(KvFormat::Int8Keyless), ["v_q", "v_scale"]);
assert_eq!(names(KvFormat::Fp16), ["k_pool", "v_pool"]);
}
#[test]
fn block_bytes_follow_kv_stream_cu() {
// a block is one page (4 cells): cells x per-cell bytes for the formats that stream
for fmt in [KvFormat::Fp16, KvFormat::Int8, KvFormat::Q4_0, KvFormat::Int8Keyless] {
let sf = StreamFormat::of(fmt).unwrap();
assert_eq!(kv_block_bytes(&S, sf), 4 * fmt.bytes_per_cell(&S), "{fmt:?}");
assert_eq!(
stream_runs(&S, sf).iter().map(|r| r.1).sum::<u64>(),
kv_block_bytes(&S, sf)
);
}
assert_eq!(kv_block_bytes(&S, StreamFormat::Int8), 4224); // the "4,224 B in int8" of kv_stream.hpp
assert!(StreamFormat::of(KvFormat::K8V4).is_none());
}
#[test]
fn stream_run_lengths_are_multiples_of_16_for_the_uint4_copy() {
for fmt in [StreamFormat::F16, StreamFormat::Int8, StreamFormat::Q4, StreamFormat::ValueInt8] {
assert!(stream_runs(&S, fmt).iter().all(|r| r.1 % 16 == 0), "{fmt:?}");
}
}
#[test]
fn selection_rules_are_those_of_generate_cpp() {
let req = |kv| KvRequest {
kv,
kv_rot: false,
keyless_routing: false,
kv_resident: 0,
gpu_stages: false,
diagnostic_dumps: false,
};
assert_eq!(select_format(&req("fp16")), Ok(KvFormat::Fp16));
assert_eq!(select_format(&req("q4")), Ok(KvFormat::Q4_0));
assert_eq!(select_format(&req("q4_0")), Ok(KvFormat::Q4_0));
assert_eq!(select_format(&req("k8v4")), Ok(KvFormat::K8V4));
assert_eq!(select_format(&req("bf16")), Err(KvSelectionError::UnknownFormat));
assert_eq!(
select_format(&KvRequest { kv_rot: true, ..req("int8") }),
Ok(KvFormat::Int8Rotated)
);
let keyless = KvRequest { keyless_routing: true, ..req("int8") };
assert_eq!(select_format(&keyless), Ok(KvFormat::Int8Keyless));
for bad in [
KvRequest { kv: "fp16", ..keyless },
KvRequest { kv: "q4_0", ..keyless },
KvRequest { gpu_stages: true, ..keyless },
KvRequest { diagnostic_dumps: true, ..keyless },
KvRequest { kv_rot: true, ..keyless },
] {
assert_eq!(select_format(&bad), Err(KvSelectionError::KeylessRequiresPlainInt8));
}
assert_eq!(
select_format(&KvRequest { kv_resident: -1, ..req("int8") }),
Err(KvSelectionError::NegativeResident)
);
assert_eq!(
select_format(&KvRequest { kv_resident: 20480, ..req("k8v4") }),
Err(KvSelectionError::K8V4NotStreamable)
);
assert_eq!(
select_format(&KvRequest { kv_resident: 20480, ..req("q4_0") }),
Ok(KvFormat::Q4_0)
);
}
#[test]
fn experimental_flags() {
assert!(!KvFormat::Fp16.is_experimental() && !KvFormat::Int8.is_experimental());
for f in [KvFormat::Int8Rotated, KvFormat::Q4_0, KvFormat::K8V4, KvFormat::Int8Keyless] {
assert!(f.is_experimental(), "{f:?}");
}
assert!(KvFormat::K8V4.rotates_v() && !KvFormat::K8V4.rotates_k());
assert!(KvFormat::K8V4.rotates_output() && !KvFormat::K8V4.rotates_query());
assert!(KvFormat::Q4_0.rotates_query() && KvFormat::Q4_0.rotates_output());
assert!(!KvFormat::Int8Keyless.has_k_store());
assert_eq!(KvFormat::ALL.map(KvFormat::attention_mode), [0, 1, 1, 2, 3, 4]);
}
}
+28
View File
@@ -0,0 +1,28 @@
//! CPU references, cell layouts and planners for the *experimental* modes of the Original Strata engine
//! (`engine/strata`), in safe Rust. Every mode here is lossy or otherwise unqualified and is therefore OFF by
//! default; callers must name the mode explicitly (see `leleka-cuda-driver::experimental`).
//!
//! * [`f16`], [`fwht`], [`q4_0`], [`kv_q8`] - the arithmetic of `f16_bits.hpp`, `kv_q4.cu`, `kv_q8.cu`.
//! * [`layout`] - KV cache cell layouts and byte sizes of every KV format (fp16, INT8, rotated INT8, Q4_0,
//! K8V4, INT8 keyless / V-only).
//! * [`keyless`] - query-routing matrices, the `SKLROUT1` artifact, positional V-only attention.
//! * [`cvec`] - control-vector GGUF parsing and application (project / add).
//! * [`kv_stream`] - the KV streaming planner and the CLOCK residency resolver.
//! * [`remote_experts`] - the second-GPU expert tier's planner, dispatcher and result scatter.
//!
//! Nothing here claims a speed or model-quality result.
// Literal ports keep the Original's loop and reborrow shapes (host-pool reborrows, exact chunking by constant sizes).
#![allow(clippy::needless_option_as_deref, clippy::chunks_exact_to_as_chunks)]
pub mod attn;
pub mod cache;
pub mod cvec;
pub mod f16;
pub mod fwht;
pub mod keyless;
pub mod kv_q8;
pub mod kv_stream;
pub mod layout;
pub mod q4_0;
pub mod remote_experts;
+278
View File
@@ -0,0 +1,278 @@
//! Q4_0 KV storage (`include/strata/kernels/kv_q4.hpp`, `src/kernels/cuda/kv_q4.cu`, PR #21 of the Original).
//!
//! ggml's q4_0: 32 values per block = an fp16 scale + 16 bytes of 4-bit codes (18 bytes). Element `j`
//! (j < 16) sits in the low nibble of `qs[j]`, element `j + 16` in the high one. A KV head of 256 values is
//! 8 blocks = 144 bytes; a cell (K and V of 2 heads) is 576 bytes, against 1,056 in INT8.
//!
//! LOSSY: the 4-bit rounding is the only loss (the FWHT rotation is exact). Experimental, never a default.
//!
//! The quantizer here follows the CUDA kernel (`q4_group`): the scale is `value of largest |x| / -8`, ties in
//! `|x|` resolve to the *larger value* (the Original's "deterministic group maximum added on merge"), the code
//! is `clamp(trunc(x * (1/d) + 8.5), 0, 15)`. The Original's host reference in `kv_q4_parity.cpp`
//! ([`quantize_group_host_reference`]) resolves a tie to the first element instead; the two differ only when two
//! elements of one group have equal magnitude and opposite sign.
//!
//! `nvcc` contracts `x * id + 8.5f` into a fused multiply-add by default (`--fmad=true`); [`Contraction`]
//! names both evaluations so the choice is explicit. [`Contraction::Fused`] models the device,
//! [`Contraction::Separate`] models a host compiled with `-ffp-contract=off`. They differ only when `x * id`
//! lies within one rounding error of an integer boundary of the code.
use crate::f16::{f16_from_f32, f32_from_f16};
pub const QK4_0: usize = 32;
/// `sizeof(block_q4_0)` (`#pragma pack(1)`): fp16 scale + 16 code bytes.
pub const BLOCK_BYTES: usize = 18;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct BlockQ4_0 {
/// fp16 bits of the scale.
pub d: u16,
pub qs: [u8; QK4_0 / 2],
}
impl BlockQ4_0 {
pub fn to_bytes(self) -> [u8; BLOCK_BYTES] {
let mut out = [0; BLOCK_BYTES];
out[..2].copy_from_slice(&self.d.to_le_bytes());
out[2..].copy_from_slice(&self.qs);
out
}
pub fn from_bytes(bytes: &[u8]) -> Self {
assert!(bytes.len() >= BLOCK_BYTES);
let mut qs = [0; 16];
qs.copy_from_slice(&bytes[2..BLOCK_BYTES]);
Self { d: u16::from_le_bytes([bytes[0], bytes[1]]), qs }
}
/// The signed 4-bit code of element `t` (0..32), `(nibble) - 8`.
pub fn code(&self, t: usize) -> i32 {
let byte = self.qs[t % 16];
if t < 16 { i32::from(byte & 0x0F) - 8 } else { i32::from(byte >> 4) - 8 }
}
/// Gather output (`kv_gather_q4_kernel`): `f16(code * d)` as fp16 bits.
pub fn gather_bits(&self, t: usize) -> u16 {
f16_from_f32(self.code(t) as f32 * f32_from_f16(self.d))
}
/// The dequantized value the attention kernels read (`load8_q4`): `code * d`, unrounded to fp16.
pub fn dequant(&self, t: usize) -> f32 {
self.code(t) as f32 * f32_from_f16(self.d)
}
}
/// How `x * id + 8.5f` is evaluated.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Contraction {
/// One multiplication and one addition, each rounded (host with `-ffp-contract=off`).
Separate,
/// A single fused multiply-add (what `nvcc --fmad=true` emits for the kernel).
Fused,
}
fn code_of(x: f32, id: f32, c: Contraction) -> u8 {
let y = match c {
Contraction::Separate => x * id + 8.5,
Contraction::Fused => x.mul_add(id, 8.5),
};
// __float2int_rz: truncation toward zero, saturating, NaN -> 0 (identical to Rust `as`).
let q = y as i32;
q.clamp(0, 15) as u8
}
/// The largest-magnitude element per the kernel's warp reduction: lexicographic `(|x|, x)` maximum via
/// xor-butterflies over 32 lanes (`a > amax || (a == amax && v > mval)`), evaluated lane by lane so a NaN
/// input behaves as on the device.
fn group_max(x: &[f32; QK4_0]) -> [f32; QK4_0] {
let mut amax = x.map(f32::abs);
let mut mval = *x;
let mut o = 16;
while o > 0 {
let (a0, v0) = (amax, mval);
for lane in 0..QK4_0 {
let a = a0[lane ^ o];
let v = v0[lane ^ o];
if a > amax[lane] || (a == amax[lane] && v > mval[lane]) {
amax[lane] = a;
mval[lane] = v;
}
}
o >>= 1;
}
mval
}
/// Quantize 32 values like `q4_group` + `q4_store` of the kernel.
pub fn quantize_group(x: &[f32; QK4_0], c: Contraction) -> BlockQ4_0 {
let mval = group_max(x)[0]; // every lane agrees
let d = mval / -8.0;
let id = if d != 0.0 { 1.0 / d } else { 0.0 };
let mut codes = [0u8; QK4_0];
for (code, v) in codes.iter_mut().zip(x) {
*code = code_of(*v, id, c);
}
let mut qs = [0u8; 16];
for t in 0..16 {
qs[t] = codes[t] | (codes[t + 16] << 4);
}
BlockQ4_0 { d: f16_from_f32(d), qs }
}
/// The Original's host reference (`quantize_block_q4_0_host` in `kv_q4_parity.cpp`), separate operations.
pub fn quantize_group_host_reference(x: &[f32; QK4_0]) -> BlockQ4_0 {
quantize_group_host_reference_with(x, Contraction::Separate)
}
/// The same host reference with the contraction of the compiler that built it (`-ffp-contract=fast` on a
/// machine with FMA fuses `x[i] * id + 8.5f`).
pub fn quantize_group_host_reference_with(x: &[f32; QK4_0], c: Contraction) -> BlockQ4_0 {
let mut amax = 0.0f32;
let mut max_val = 0.0f32;
for v in x {
if amax < v.abs() {
amax = v.abs();
max_val = *v;
}
}
let d = max_val / -8.0;
let id = if d != 0.0 { 1.0 / d } else { 0.0 };
let mut qs = [0u8; 16];
for i in 0..16 {
qs[i] = code_of(x[i], id, c) | (code_of(x[i + 16], id, c) << 4);
}
BlockQ4_0 { d: f16_from_f32(d), qs }
}
/// One KV head of `head_dim` (a multiple of 32) values -> `head_dim / 32` blocks.
pub fn quantize_head(x: &[f32], c: Contraction) -> Vec<BlockQ4_0> {
assert!(x.len().is_multiple_of(QK4_0));
x.chunks_exact(QK4_0)
.map(|g| quantize_group(g.try_into().expect("group"), c))
.collect()
}
/// Bytes per cell and KV head (`kv_q4_bytes_per_head`): 8 blocks of 32 for head_dim 256 -> 144.
pub const fn bytes_per_head(head_dim: usize) -> u64 {
(head_dim / QK4_0 * BLOCK_BYTES) as u64
}
/// Bytes per cell (one token, one layer): K and V of every KV head (`kv_q4_bytes_per_cell`).
pub const fn bytes_per_cell(n_head_kv: usize, head_dim: usize) -> u64 {
n_head_kv as u64 * bytes_per_head(head_dim) * 2
}
#[cfg(test)]
mod tests {
use super::*;
fn xorshift(s: &mut u64) -> u64 {
*s ^= *s << 13;
*s ^= *s >> 7;
*s ^= *s << 17;
*s
}
fn group(seed: &mut u64, scale: f32) -> [f32; 32] {
let mut g = [0.0; 32];
for v in g.iter_mut() {
*v = ((xorshift(seed) >> 40) as f32 / (1u64 << 24) as f32 - 0.5) * scale;
}
g
}
#[test]
fn sizes_match_the_documented_layout() {
assert_eq!(std::mem::size_of::<[u8; BLOCK_BYTES]>(), 18);
assert_eq!(bytes_per_head(256), 144);
assert_eq!(bytes_per_cell(2, 256), 576);
}
#[test]
fn byte_round_trip() {
let mut seed = 5;
let b = quantize_group(&group(&mut seed, 4.0), Contraction::Separate);
assert_eq!(BlockQ4_0::from_bytes(&b.to_bytes()), b);
}
#[test]
fn host_reference_equals_kernel_without_ties() {
let mut seed = 99;
for i in 0..2000 {
let g = group(&mut seed, 1.0 + i as f32 * 0.01);
assert_eq!(
quantize_group(&g, Contraction::Separate),
quantize_group_host_reference(&g),
"{i}"
);
}
}
#[test]
fn fused_and_separate_differ_only_in_rare_boundary_codes() {
let mut seed = 7;
let (mut total, mut diff) = (0, 0);
for i in 0..4000 {
let g = group(&mut seed, 0.5 + i as f32 * 0.003);
let a = quantize_group(&g, Contraction::Separate);
let b = quantize_group(&g, Contraction::Fused);
assert_eq!(a.d, b.d);
total += 1;
diff += usize::from(a != b);
}
// a code flips only when x * id + 8.5 lands within one ULP of an integer
assert!(diff * 20 < total, "{diff} of {total}");
}
#[test]
fn tie_in_magnitude_resolves_to_the_larger_value_in_the_kernel_only() {
let mut g = [0.25; 32];
g[3] = -2.0;
g[20] = 2.0;
let kernel = quantize_group(&g, Contraction::Separate);
let host = quantize_group_host_reference(&g);
// kernel: mval = +2, d = -0.25; host: first max is g[3] = -2, d = +0.25
assert_eq!(f32_from_f16(kernel.d), -0.25);
assert_eq!(f32_from_f16(host.d), 0.25);
assert_ne!(kernel, host);
}
#[test]
fn the_largest_element_always_reaches_a_boundary_code() {
let mut seed = 31;
for _ in 0..500 {
let g = group(&mut seed, 10.0);
let b = quantize_group(&g, Contraction::Separate);
let imax = (0..32)
.max_by(|&i, &j| g[i].abs().partial_cmp(&g[j].abs()).unwrap())
.unwrap();
// d = max / -8, so x / d = -8 -> code 0 (the extreme negative nibble)
assert_eq!(b.code(imax) + 8, 0, "{:?}", g[imax]);
}
}
#[test]
fn all_zero_group_has_zero_scale_and_mid_codes() {
let b = quantize_group(&[0.0; 32], Contraction::Fused);
// d = (+0) / -8 = -0.0: the stored scale is a negative zero, as in the kernel
assert_eq!(b.d, 0x8000);
assert_eq!(f32_from_f16(b.d), 0.0);
// x * 0 + 8.5 truncates to 8
assert!(b.qs.iter().all(|q| *q == 0x88));
assert_eq!(b.gather_bits(5), 0x8000); // 0 * -0.0
assert_eq!(quantize_group_host_reference(&[0.0; 32]), b);
}
#[test]
fn nibble_placement_and_gather() {
let mut g = [0.0f32; 32];
for (i, v) in g.iter_mut().enumerate() {
*v = (i as f32 - 15.5) / 4.0;
}
let b = quantize_group(&g, Contraction::Separate);
for t in 0..32 {
let want = b.code(t);
let nib = if t < 16 { b.qs[t] & 0xF } else { b.qs[t - 16] >> 4 };
assert_eq!(i32::from(nib) - 8, want);
assert_eq!(
b.gather_bits(t),
f16_from_f32(want as f32 * f32_from_f16(b.d))
);
}
}
}
@@ -0,0 +1,536 @@
//! The second-GPU expert tier (`core/remote_experts.{hpp,cpp}`, `--expert-cache-device<N>`): "a static,
//! profile-filled expert tier on another CUDA device. CUDA0 keeps all dense weights and state; results return
//! through the existing pinned CPU rows."
//!
//! What a single process can test, and is ported here with the Original's arithmetic:
//! * [`plan_open`] - which ranked experts the helper device takes (not already resident on the primary, not
//! claimed by another tier), the device-memory admission (`needed + 512 MiB <= free`), the slot order the
//! cache hands out, which layers the helper serves, and the fixed device buffers' sizes ([`device_buffer_bytes`]);
//! * [`dispatch`] - `begin`'s per-layer ownership decision and expert grouping (the CSR-like `start/dst/tok`
//! arrays the grouped expert kernels read, the compact result row of every entry), and
//! [`RemoteMeta::to_bytes`], the 1,608-byte device image of those arrays;
//! * [`scatter`] - `finish`'s copy of the compact rows back to the routed rows.
//! What is *not* here: the second CUDA context, the zero-copy mapped staging and the launches of the existing
//! grouped expert kernels (`moe_grouped_s2` / `native_expert_grouped`) - they need two devices and a GPU.
//!
//! EXPERIMENTAL and off by default (charter deferred multi-GPU, AMD/HIP out of scope): the tier only exists when
//! an operator names a second device and a slot count.
/// `cpu::H` (n_embd) and `cpu::FF` (expert intermediate width), `cpu::MAXT` (window tokens).
pub const H: usize = 2560;
pub const FF: usize = 640;
pub const MAXT: usize = 8;
/// Routed experts per token (`k != 10` is refused).
pub const ROUTES: usize = 10;
/// `CAP = MAXT * 10` entries per call.
pub const CAP: usize = MAXT * ROUTES;
/// Memory the helper must keep free for the CUDA context, staging and later driver allocations.
pub const RESERVE_BYTES: u64 = 512 << 20;
pub const SLOT_ALIGN: u64 = 256;
/// `sizeof(block_q8_1)` as used for the activation buffer.
pub const Q8_1_BLOCK_BYTES: u64 = 36;
/// `struct RemoteMeta`: device pointers, group starts, destinations, token indices and the group count in one
/// block, uploaded once per layer. 8-byte aligned (`unsigned long long` first).
pub const META_PTR_OFFSET: usize = 0;
pub const META_START_OFFSET: usize = CAP * 8;
pub const META_DST_OFFSET: usize = META_START_OFFSET + (CAP + 1) * 4;
pub const META_TOK_OFFSET: usize = META_DST_OFFSET + CAP * 4;
pub const META_COUNT_OFFSET: usize = META_TOK_OFFSET + CAP * 4;
pub const META_BYTES: usize = (META_COUNT_OFFSET + 4).div_ceil(8) * 8;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RemoteError {
/// `device < 1 || device >= count`, no ranked experts, non-positive slots/layers/experts, or a `claimed`
/// table of the wrong size.
BadArguments,
DeviceNotVisible,
/// Every ranked expert is already resident on the primary or claimed.
NoUnclaimedExperts,
/// The slots (plus the 512 MiB reserve) exceed the helper's free memory.
SlotsLeaveLessThanReserve { needed: u64, free: u64 },
/// `begin` was handed an invalid layer, routing width or window size.
InvalidDispatch,
}
impl RemoteError {
/// The Original's message for `device`.
pub fn message(&self, device: i32) -> String {
match self {
Self::BadArguments => format!("CUDA{device} experts: need the device, ranked experts and positive slot count"),
Self::DeviceNotVisible => format!("CUDA{device} experts: CUDA device is not visible"),
Self::NoUnclaimedExperts => format!("CUDA{device} experts: no unclaimed experts remain"),
Self::SlotsLeaveLessThanReserve { .. } => {
format!("CUDA{device} experts: slots leave less than 512 MiB free; reduce --expert-cache-device{device}")
}
Self::InvalidDispatch => format!("CUDA{device} experts: invalid layer, routing width or window size"),
}
}
}
impl std::fmt::Display for RemoteError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&self.message(1))
}
}
impl std::error::Error for RemoteError {}
/// The parts of `ExpertLayout` the helper tier needs.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ExpertSizes {
/// A native pack: per-layer blob sizes differ. Otherwise the canonical Q2_0 layout (`max_blob` everywhere).
pub native: bool,
pub max_blob: u64,
/// Per layer (native packs only).
pub blob_bytes: Vec<u64>,
}
impl ExpertSizes {
pub fn blob(&self, layer: usize) -> u64 {
if self.native { self.blob_bytes[layer] } else { self.max_blob }
}
/// What one slot of `layer` costs on the helper: native blobs are rounded up to 256 bytes, canonical ones use
/// the maximum blob.
pub fn slot_cost(&self, layer: usize) -> u64 {
if self.native { self.blob(layer).div_ceil(SLOT_ALIGN) * SLOT_ALIGN } else { self.max_blob }
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RemotePlan {
pub device: i32,
pub n_expert: i64,
/// Experts the helper holds, in admission order: slot `i` holds `selected[i]`.
pub selected: Vec<(i32, i32)>,
/// Slot sizes (native packs; empty for the uniform cache).
pub slot_sizes: Vec<u64>,
pub layers_present: Vec<u8>,
pub needed_bytes: u64,
}
impl RemotePlan {
/// `cache_.slot_of(layer, expert)`: the helper's slot or -1.
pub fn slot_of(&self, layer: i64, expert: i64) -> i32 {
if layer < 0 || expert < 0 {
return -1;
}
self.selected
.iter()
.position(|&(l, e)| i64::from(l) == layer && i64::from(e) == expert)
.map_or(-1, |s| s as i32)
}
}
/// Everything `RemoteExperts::open` decides before it touches the helper device (`preflight` and the checks of
/// `open`). `primary_has(layer, expert)` is `primary.slot_of(..) >= 0`. On success `claimed` marks the helper's
/// experts (only then: a failed open leaves it untouched).
#[allow(clippy::too_many_arguments)]
pub fn plan_open(
device: i32,
device_count: i32,
free_bytes: u64,
slots: i32,
layers: i64,
experts: i64,
ranked: &[(i32, i32)],
primary_has: &dyn Fn(i32, i32) -> bool,
claimed: &mut [u8],
sizes: &ExpertSizes,
) -> Result<RemotePlan, RemoteError> {
if device < 1 || device >= device_count || slots <= 0 || ranked.is_empty() || layers <= 0 || experts <= 0 || claimed.len() != layers as usize * experts as usize {
return Err(RemoteError::BadArguments);
}
let mut selected: Vec<(i32, i32)> = Vec::with_capacity(slots as usize);
let mut picked = vec![0u8; claimed.len()];
for &(layer, expert) in ranked {
if layer < 0 || i64::from(layer) >= layers || expert < 0 || i64::from(expert) >= experts {
continue;
}
let index = layer as usize * experts as usize + expert as usize;
if !primary_has(layer, expert) && claimed[index] == 0 && picked[index] == 0 {
selected.push((layer, expert));
picked[index] = 1;
if selected.len() as i32 >= slots {
break;
}
}
}
if selected.is_empty() {
return Err(RemoteError::NoUnclaimedExperts);
}
let slot_sizes: Vec<u64> = if sizes.native { selected.iter().map(|&(l, _)| sizes.blob(l as usize)).collect() } else { Vec::new() };
let needed: u64 = selected.iter().map(|&(l, _)| sizes.slot_cost(l as usize)).sum();
// Leave room for the CUDA context, staging and later driver allocations, especially under WDDM.
if needed + RESERVE_BYTES > free_bytes {
return Err(RemoteError::SlotsLeaveLessThanReserve { needed, free: free_bytes });
}
let mut layers_present = vec![0u8; layers as usize];
for &(l, e) in &selected {
layers_present[l as usize] = 1;
claimed[l as usize * experts as usize + e as usize] = 1;
}
Ok(RemotePlan { device, n_expert: experts, selected, slot_sizes, layers_present, needed_bytes: needed })
}
fn align16(n: u64) -> u64 {
(n + 15) & !15
}
/// `moe_hit_grouped_scratch_bytes(n_hits, n_embd, n_ff)` of `s2_expert_grouped.cu`.
pub fn moe_hit_grouped_scratch_bytes(n_hits: u64, n_embd: u64, n_ff: u64) -> u64 {
if n_hits == 0 {
return 0;
}
let gu = n_hits * (2 * n_ff) * 4;
let q8 = n_hits * (n_ff / 32) * 34;
let hs = n_hits * (n_ff / 32) * 4;
let xh = (n_embd / 32) * 4;
align16(gu) + align16(q8) + 2 * align16(hs) + align16(xh)
}
/// `native_expert_scratch_bytes(cap, n_ff)` of `iq_kernels.cu`.
pub fn native_expert_scratch_bytes(cap: u64, n_ff: u64) -> u64 {
let a256 = |n: u64| (n + 255) & !255;
let f = cap * n_ff * 4;
3 * a256(f) + a256(cap * (n_ff / 32) * Q8_1_BLOCK_BYTES)
}
/// The helper's fixed device buffers of `open` (input, result, Q8_1 activation, scales, scratch, group
/// metadata), excluding the expert slots.
pub fn device_buffer_bytes() -> u64 {
let cap = CAP as u64;
let scratch = moe_hit_grouped_scratch_bytes(cap, H as u64, FF as u64).max(native_expert_scratch_bytes(cap, FF as u64));
cap * H as u64 * 4 // d_x_
+ cap * H as u64 * 4 // d_out_
+ cap * (H as u64 / 32) * Q8_1_BLOCK_BYTES // d_q8_
+ cap * (H as u64 / 32) * 4 // d_scales_
+ scratch
+ META_BYTES as u64
}
// ------------------------------------------------------------------------------------------------ dispatch
/// One expert group of a layer: the helper slot and where its entries sit.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Group {
pub expert: i32,
pub slot: i32,
}
/// The outcome of `begin` for one layer.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Dispatch {
/// `owned[i] = 1` when routed entry `i` is computed on the helper.
pub owned: Vec<u8>,
pub groups: Vec<Group>,
/// Group boundaries into the entry arrays (`groups + 1` entries when non-empty).
pub start: Vec<i32>,
/// Compact output row of each entry (== its position).
pub dst: Vec<i32>,
/// Source token of each entry (`routed row / k`).
pub tok: Vec<i32>,
/// The routed row each compact row returns to (`finish` scatters through this).
pub original_row: Vec<i32>,
/// Entries newly owned (`computed_ += ...`).
pub computed: u64,
}
impl Dispatch {
pub fn is_empty(&self) -> bool {
self.groups.is_empty()
}
/// Compact result bytes returned over the link (`dst.size() * H * 4`).
pub fn returned_bytes(&self) -> u64 {
self.dst.len() as u64 * H as u64 * 4
}
/// The bytes a full-row return would have cost (`n * H * 4`).
pub fn full_row_bytes(&self) -> u64 {
self.owned.len() as u64 * H as u64 * 4
}
}
/// `RemoteExperts::begin` minus staging and launches. `ids` is `[n_tok][k]`, `kind` the primary verifier's
/// classification (-1 = CPU candidate, null on the one-token path), `primary_res` the primary's
/// `layer x expert -> slot` table.
#[allow(clippy::needless_range_loop)] // the loop indices are begin()'s entry numbers
pub fn dispatch(
plan: &RemotePlan,
layer: i64,
ids: &[i32],
n_tok: i64,
k: i64,
kind: Option<&[i32]>,
primary_res: Option<&[i32]>,
) -> Result<Dispatch, RemoteError> {
let n = n_tok * k;
if n <= 0 || n > CAP as i64 || n_tok > MAXT as i64 || k != ROUTES as i64 || layer < 0 || layer as usize >= plan.layers_present.len() {
return Err(RemoteError::InvalidDispatch);
}
let n = n as usize;
let mut d = Dispatch { owned: vec![0; n], groups: Vec::new(), start: Vec::new(), dst: Vec::new(), tok: Vec::new(), original_row: Vec::new(), computed: 0 };
if plan.layers_present[layer as usize] == 0 {
return Ok(d);
}
let mut group_of = vec![-1i32; n];
for i in 0..n {
let e = ids[i];
let skip = kind.is_some_and(|kd| kd[i] != -1)
|| e < 0
|| i64::from(e) >= plan.n_expert
|| primary_res.is_some_and(|pr| pr[layer as usize * plan.n_expert as usize + e as usize] >= 0);
if skip {
continue;
}
let slot = plan.slot_of(layer, i64::from(e));
if slot < 0 {
continue;
}
d.owned[i] = 1;
let mut group = -1i32;
for (g, grp) in d.groups.iter().enumerate() {
if grp.expert == e {
group = g as i32;
break;
}
}
if group < 0 {
group = d.groups.len() as i32;
d.groups.push(Group { expert: e, slot });
}
group_of[i] = group;
d.computed += 1;
}
if d.groups.is_empty() {
return Ok(d);
}
for g in 0..d.groups.len() {
d.start.push(d.dst.len() as i32);
for i in 0..n {
if group_of[i] == g as i32 {
// The grouped kernels read the activation from `tok`, so their output row can instead be
// packed densely for the link back.
d.original_row.push(i as i32);
d.dst.push(d.dst.len() as i32);
d.tok.push((i as i64 / k) as i32);
}
}
}
d.start.push(d.dst.len() as i32);
Ok(d)
}
/// The device image of a dispatch (`struct RemoteMeta`): group device pointers (`device_slot(slot)`, supplied
/// by the cache), starts, destinations, token indices and the group count. Unused tails are zero.
pub struct RemoteMeta;
impl RemoteMeta {
pub fn to_bytes(d: &Dispatch, device_slot: &dyn Fn(i32) -> u64) -> [u8; META_BYTES] {
let mut b = [0u8; META_BYTES];
for (g, grp) in d.groups.iter().enumerate() {
b[META_PTR_OFFSET + g * 8..][..8].copy_from_slice(&device_slot(grp.slot).to_le_bytes());
}
for (i, s) in d.start.iter().enumerate() {
b[META_START_OFFSET + i * 4..][..4].copy_from_slice(&s.to_le_bytes());
}
for (i, v) in d.dst.iter().enumerate() {
b[META_DST_OFFSET + i * 4..][..4].copy_from_slice(&v.to_le_bytes());
}
for (i, v) in d.tok.iter().enumerate() {
b[META_TOK_OFFSET + i * 4..][..4].copy_from_slice(&v.to_le_bytes());
}
b[META_COUNT_OFFSET..][..4].copy_from_slice(&(d.groups.len() as i32).to_le_bytes());
b
}
}
/// `RemoteExperts::finish`'s copy: compact row `i` of `h_out` returns to routed row `original_row[i]` of `out`
/// (`row_len` floats each; `H` in the engine).
pub fn scatter(out: &mut [f32], h_out: &[f32], original_row: &[i32], row_len: usize) {
for (i, &r) in original_row.iter().enumerate() {
out[r as usize * row_len..][..row_len].copy_from_slice(&h_out[i * row_len..][..row_len]);
}
}
/// Counters the engine reports per request.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct Totals {
pub computed: u64,
pub launched_layers: u64,
pub returned_bytes: u64,
pub full_row_bytes: u64,
}
impl Totals {
/// After a `begin` that launched (`groups` non-empty).
pub fn record(&mut self, d: &Dispatch) {
self.computed += d.computed;
if !d.is_empty() {
self.launched_layers += 1;
self.returned_bytes += d.returned_bytes();
self.full_row_bytes += d.full_row_bytes();
}
}
}
#[cfg(test)]
mod tests {
use super::*;
fn canonical() -> ExpertSizes {
ExpertSizes { native: false, max_blob: 1_382_400, blob_bytes: Vec::new() }
}
#[test]
fn meta_layout_is_the_c_struct() {
assert_eq!(META_START_OFFSET, 640);
assert_eq!(META_DST_OFFSET, 964);
assert_eq!(META_TOK_OFFSET, 1284);
assert_eq!(META_COUNT_OFFSET, 1604);
assert_eq!(META_BYTES, 1608);
assert_eq!(CAP, 80);
}
#[test]
fn selection_skips_primary_claimed_duplicates_and_out_of_range() {
let ranked = [(0, 1), (0, 1), (9, 0), (0, 99), (-1, 0), (1, 2), (2, 3), (1, 5), (3, 3)];
let mut claimed = vec![0u8; 4 * 8];
claimed[2 * 8 + 3] = 1; // (2,3) taken by another tier
let primary = |l: i32, e: i32| (l, e) == (1, 2);
let plan = plan_open(1, 2, 24 << 30, 3, 4, 8, &ranked, &primary, &mut claimed, &canonical()).unwrap();
assert_eq!(plan.selected, [(0, 1), (1, 5), (3, 3)]);
assert_eq!(plan.slot_of(1, 5), 1);
assert_eq!(plan.slot_of(1, 2), -1);
assert_eq!(plan.layers_present, [1, 1, 0, 1]);
// claimed now marks the helper's experts, and nothing else new
let marked: Vec<usize> = claimed.iter().enumerate().filter(|(_, v)| **v == 1).map(|(i, _)| i).collect();
assert_eq!(marked, [1, 2 * 8 + 3, 8 + 5, 3 * 8 + 3].iter().copied().collect::<std::collections::BTreeSet<_>>().into_iter().collect::<Vec<_>>());
assert_eq!(plan.needed_bytes, 3 * 1_382_400);
}
#[test]
fn open_failures_leave_claimed_untouched() {
let mut claimed = vec![0u8; 32];
let none = |_: i32, _: i32| false;
let before = claimed.clone();
let sizes = canonical();
assert_eq!(plan_open(0, 2, 1 << 40, 2, 4, 8, &[(0, 0)], &none, &mut claimed, &sizes), Err(RemoteError::BadArguments));
assert_eq!(plan_open(2, 2, 1 << 40, 2, 4, 8, &[(0, 0)], &none, &mut claimed, &sizes), Err(RemoteError::BadArguments));
assert_eq!(plan_open(1, 2, 1 << 40, 0, 4, 8, &[(0, 0)], &none, &mut claimed, &sizes), Err(RemoteError::BadArguments));
assert_eq!(plan_open(1, 2, 1 << 40, 2, 4, 8, &[], &none, &mut claimed, &sizes), Err(RemoteError::BadArguments));
assert_eq!(plan_open(1, 2, 1 << 40, 2, 4, 7, &[(0, 0)], &none, &mut claimed, &sizes), Err(RemoteError::BadArguments));
let all = |_: i32, _: i32| true;
assert_eq!(plan_open(1, 2, 1 << 40, 2, 4, 8, &[(0, 0)], &all, &mut claimed, &sizes), Err(RemoteError::NoUnclaimedExperts));
// 2 slots of 1.38 MB plus 512 MiB do not fit in 512 MiB
let e = plan_open(1, 2, 512 << 20, 2, 4, 8, &[(0, 0), (0, 1)], &none, &mut claimed, &sizes).unwrap_err();
assert!(matches!(e, RemoteError::SlotsLeaveLessThanReserve { .. }));
assert_eq!(e.message(1), "CUDA1 experts: slots leave less than 512 MiB free; reduce --expert-cache-device1");
assert_eq!(claimed, before);
// the boundary is inclusive
let need = 2 * 1_382_400 + RESERVE_BYTES;
assert!(plan_open(1, 2, need, 2, 4, 8, &[(0, 0), (0, 1)], &none, &mut claimed, &sizes).is_ok());
}
#[test]
fn native_packs_round_slots_up_to_256_and_keep_each_layers_size() {
let sizes = ExpertSizes { native: true, max_blob: 2000, blob_bytes: vec![1000, 1025, 2000, 513] };
assert_eq!(sizes.slot_cost(0), 1024);
assert_eq!(sizes.slot_cost(1), 1280);
let mut claimed = vec![0u8; 4 * 2];
let none = |_: i32, _: i32| false;
let plan = plan_open(1, 2, 1 << 30, 3, 4, 2, &[(1, 0), (3, 1), (0, 0)], &none, &mut claimed, &sizes).unwrap();
assert_eq!(plan.slot_sizes, [1025, 513, 1000]);
assert_eq!(plan.needed_bytes, 1280 + 768 + 1024);
}
fn plan_for_dispatch() -> RemotePlan {
let mut claimed = vec![0u8; 3 * 16];
let none = |_: i32, _: i32| false;
// layer 1 holds experts 4, 9, 2 (slots 0, 1, 2); layer 0 holds expert 7 (slot 3)
plan_open(1, 2, 1 << 40, 4, 3, 16, &[(1, 4), (1, 9), (1, 2), (0, 7)], &none, &mut claimed, &canonical()).unwrap()
}
#[test]
fn dispatch_groups_by_expert_in_first_appearance_order() {
let plan = plan_for_dispatch();
// 2 tokens x 10 routes; layer 1
let mut ids = vec![0i32; 20];
ids[..10].copy_from_slice(&[4, 3, 9, 5, 6, 8, 10, 11, 12, 13]);
ids[10..].copy_from_slice(&[9, 4, 1, 2, 0, 3, 5, 6, 7, 8]);
let d = dispatch(&plan, 1, &ids, 2, 10, None, None).unwrap();
assert_eq!(d.groups, [Group { expert: 4, slot: 0 }, Group { expert: 9, slot: 1 }, Group { expert: 2, slot: 2 }]);
assert_eq!(d.start, [0, 2, 4, 5]);
assert_eq!(d.original_row, [0, 11, 2, 10, 13]);
assert_eq!(d.tok, [0, 1, 0, 1, 1]);
assert_eq!(d.dst, [0, 1, 2, 3, 4]);
assert_eq!(d.computed, 5);
assert_eq!(d.owned.iter().filter(|o| **o == 1).count(), 5);
assert_eq!(d.returned_bytes(), 5 * 2560 * 4);
assert_eq!(d.full_row_bytes(), 20 * 2560 * 4);
}
#[test]
fn dispatch_respects_kind_primary_residency_and_missing_layers() {
let plan = plan_for_dispatch();
let ids: Vec<i32> = vec![4, 9, 2, 0, 1, 3, 5, 6, 8, 10];
let mut kind = vec![-1i32; 10];
kind[1] = 2; // expert 9 was already served on the primary
let d = dispatch(&plan, 1, &ids, 1, 10, Some(&kind), None).unwrap();
assert_eq!(d.original_row, [0, 2]);
// the primary holds expert 4 of layer 1
let mut res = vec![-1i32; 3 * 16];
res[16 + 4] = 5;
let d = dispatch(&plan, 1, &ids, 1, 10, None, Some(&res)).unwrap();
assert_eq!(d.original_row, [1, 2]);
// a layer the helper holds nothing of
let d = dispatch(&plan, 2, &ids, 1, 10, None, None).unwrap();
assert!(d.is_empty() && d.owned.iter().all(|o| *o == 0));
assert!(d.start.is_empty());
// out-of-range experts are ignored
let d = dispatch(&plan, 1, &[-3, 99, 4, 4, 4, 4, 4, 4, 4, 4], 1, 10, None, None).unwrap();
assert_eq!(d.groups.len(), 1);
assert_eq!(d.original_row.len(), 8);
}
#[test]
fn dispatch_validation() {
let plan = plan_for_dispatch();
let ids = vec![0i32; 100];
for (layer, n_tok, k) in [(1, 0, 10), (1, 9, 10), (1, 1, 9), (-1, 1, 10), (3, 1, 10)] {
assert_eq!(dispatch(&plan, layer, &ids, n_tok, k, None, None), Err(RemoteError::InvalidDispatch), "{layer} {n_tok} {k}");
}
assert!(dispatch(&plan, 1, &ids, 8, 10, None, None).is_ok());
}
#[test]
fn meta_image_and_scatter() {
let plan = plan_for_dispatch();
let ids: Vec<i32> = vec![4, 9, 4, 0, 1, 3, 5, 6, 8, 10];
let d = dispatch(&plan, 1, &ids, 1, 10, None, None).unwrap();
let img = RemoteMeta::to_bytes(&d, &|slot| 0x1000_0000 + slot as u64 * 0x10_0000);
assert_eq!(u64::from_le_bytes(img[0..8].try_into().unwrap()), 0x1000_0000);
assert_eq!(u64::from_le_bytes(img[8..16].try_into().unwrap()), 0x1010_0000);
assert_eq!(i32::from_le_bytes(img[META_START_OFFSET + 4..][..4].try_into().unwrap()), 2);
assert_eq!(i32::from_le_bytes(img[META_START_OFFSET + 8..][..4].try_into().unwrap()), 3);
assert_eq!(i32::from_le_bytes(img[META_COUNT_OFFSET..][..4].try_into().unwrap()), 2);
// scatter: compact rows of width 3 return to their routed rows
let h_out = [1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0];
let mut out = vec![0.0f32; 10 * 3];
scatter(&mut out, &h_out, &d.original_row, 3);
assert_eq!(&out[0..3], [1.0; 3]);
assert_eq!(&out[2 * 3..2 * 3 + 3], [2.0; 3]);
assert_eq!(&out[3..6], [3.0; 3]); // routed row 1 (expert 9) is the group after expert 4's
assert_eq!(out.iter().filter(|v| **v != 0.0).count(), 9);
}
#[test]
fn device_buffers_fit_a_small_budget() {
// 80 entries x 2560 floats x 2, activation, scales, scratch, meta
let b = device_buffer_bytes();
assert!(b > 2_000_000 && b < 8_000_000, "{b}");
assert_eq!(moe_hit_grouped_scratch_bytes(0, 2560, 640), 0);
assert_eq!(native_expert_scratch_bytes(80, 640), 3 * 204_800 + ((80 * 20 * 36 + 255) & !255));
let mut t = Totals::default();
let d = dispatch(&plan_for_dispatch(), 1, &[4; 10], 1, 10, None, None).unwrap();
t.record(&d);
assert_eq!((t.computed, t.launched_layers), (10, 1));
}
}
@@ -0,0 +1,72 @@
#![allow(clippy::chunks_exact_to_as_chunks)]
//! Shared test helpers: the deterministic generator mirrored from `oracle/emulate_common.h` and hex codecs.
#![allow(dead_code)]
use serde_json::Value;
/// `Lcg` of `oracle/emulate_common.h`: 64-bit LCG, values taken from the high 32 bits.
pub struct Lcg(u64);
impl Lcg {
pub fn new(seed: u64) -> Self {
Self(seed)
}
pub fn next(&mut self) -> u32 {
self.0 = self.0.wrapping_mul(6364136223846793005).wrapping_add(1442695040888963407);
(self.0 >> 32) as u32
}
/// Uniform in [-1, 1) on a 2^-23 grid (integer -> float and the scale are exact).
pub fn unit(&mut self) -> f32 {
((self.next() >> 8) as i32 - (1 << 23)) as f32 * (1.0 / 8388608.0)
}
/// Approximately normal: the sum of four units, halved (left-to-right additions).
pub fn soft(&mut self) -> f32 {
let (a, b, c, d) = (self.unit(), self.unit(), self.unit(), self.unit());
(((a + b) + c) + d) * 0.5
}
pub fn below(&mut self, n: u32) -> u32 {
self.next() % n
}
}
pub fn fnv1a(bytes: &[u8]) -> u64 {
let mut h = 0xcbf2_9ce4_8422_2325u64;
for b in bytes {
h = (h ^ u64::from(*b)).wrapping_mul(0x0100_0000_01b3);
}
h
}
pub fn f32_bytes(v: &[f32]) -> Vec<u8> {
v.iter().flat_map(|x| x.to_le_bytes()).collect()
}
pub fn unhex(s: &str) -> Vec<u8> {
(0..s.len()).step_by(2).map(|i| u8::from_str_radix(&s[i..i + 2], 16).expect("hex")).collect()
}
pub fn hex_f32(s: &str) -> Vec<f32> {
unhex(s).chunks_exact(4).map(|c| f32::from_le_bytes(c.try_into().unwrap())).collect()
}
pub fn hex_u16(s: &str) -> Vec<u16> {
unhex(s).chunks_exact(2).map(|c| u16::from_le_bytes(c.try_into().unwrap())).collect()
}
pub fn u16_bytes(v: &[u16]) -> Vec<u8> {
v.iter().flat_map(|x| x.to_le_bytes()).collect()
}
pub fn fixture(name: &str) -> Value {
let path = format!("{}/tests/fixtures/{name}", env!("CARGO_MANIFEST_DIR"));
serde_json::from_str(&std::fs::read_to_string(path).expect("fixture")).expect("json")
}
/// Compare a byte array with a fixture hex string, reporting the first difference.
pub fn assert_hex_eq(what: &str, got: &[u8], want_hex: &Value) {
let want = unhex(want_hex.as_str().unwrap_or_else(|| panic!("{what}: not a string")));
assert_eq!(got.len(), want.len(), "{what}: length");
if let Some(i) = got.iter().zip(&want).position(|(a, b)| a != b) {
panic!("{what}: first difference at byte {i}: got {:#04x}, kernel wrote {:#04x}", got[i], want[i]);
}
}
@@ -0,0 +1,53 @@
//! Control-vector loading against `load_control_vectors` of `generate.cpp` (extracted verbatim, run on synthetic
//! control-vector GGUF files by `oracle/gen_cvec_golden.sh`).
mod common;
use common::{fixture, unhex};
use leleka_experimental_ref::cvec::{CvecMode, CvecOptions, load_control_vectors};
#[test]
fn tables_and_errors_match_the_original_loader() {
let g = fixture("cvec_golden.json");
let (layers, n, hc) = (g["n_layers"].as_i64().unwrap(), g["n_embd"].as_i64().unwrap(), g["hc"].as_i64().unwrap());
let mut ok_cases = 0;
let mut err_cases = 0;
for c in g["cases"].as_array().unwrap() {
let name = c["name"].as_str().unwrap();
let o = &c["options"];
let opts = CvecOptions {
first: o["first"].as_i64().unwrap(),
last: o["last"].as_i64().unwrap(),
mode: if o["mode"].as_i64() == Some(0) { CvecMode::Project } else { CvecMode::Add },
single: o["single"].as_i64().unwrap(),
};
let files: Vec<(String, Vec<u8>, f32)> = c["files"]
.as_array()
.unwrap()
.iter()
.map(|f| {
(
f["label"].as_str().unwrap().to_string(),
unhex(f["bytes"].as_str().unwrap()),
f32::from_bits(f["scale"].as_u64().unwrap() as u32),
)
})
.collect();
let got = load_control_vectors(&files, layers, n, hc, &opts);
if c["ok"].as_i64() == Some(1) {
let t = got.unwrap_or_else(|e| panic!("{name}: {e}"));
let bits = |k: &str| -> Vec<u32> { c[k].as_array().unwrap().iter().map(|x| x.as_u64().unwrap() as u32).collect() };
assert_eq!(t.dir.iter().map(|x| x.to_bits()).collect::<Vec<_>>(), bits("dir"), "{name}: dir");
assert_eq!(t.s.iter().map(|x| x.to_bits()).collect::<Vec<_>>(), bits("s"), "{name}: s");
assert_eq!(t.mode as i64, c["mode"].as_i64().unwrap(), "{name}");
assert_eq!((t.first, t.last), (c["first"].as_i64().unwrap(), c["last"].as_i64().unwrap()), "{name}");
assert_eq!(t.summary, c["summary"].as_str().unwrap(), "{name}");
ok_cases += 1;
} else {
let e = got.expect_err(name);
assert_eq!(e.to_string(), c["error"].as_str().unwrap(), "{name}");
err_cases += 1;
}
}
assert_eq!((ok_cases, err_cases), (7, 12));
}
@@ -0,0 +1,467 @@
//! The literal experimental kernel text (`crates/cuda-driver/src/experimental_*.cu`), executed on the CPU by
//! `oracle/run_emulated_kernels.sh`, against the Rust references. The scenarios' inputs are regenerated here with
//! the mirrored generator, so a fixture/generator mismatch is caught by the input checksum first.
mod common;
use common::*;
use leleka_experimental_ref::{
cache::{self, PoolSet},
fwht,
layout::{KvFormat, QsaShapes},
q4_0::Contraction,
};
const S: QsaShapes = QsaShapes::real();
// the harness compiles with -ffp-contract=off: separate multiply and add
const C: Contraction = Contraction::Separate;
fn rotate(x: &[f32]) -> Vec<f32> {
let mut v = x.to_vec();
fwht::fwht256_rows_in_place(&mut v);
v
}
fn input_fnv(k: &[f32], v: &[f32]) -> u64 {
fnv1a(&f32_bytes(k)) ^ fnv1a(&f32_bytes(v)).wrapping_mul(31)
}
#[test]
fn fwht_kernel_matches_the_reference_bit_for_bit() {
let fx = fixture("emulated_kernels.json");
let f = &fx["fwht"];
let mut g = Lcg::new(11);
let scale = [1.0f32, 20.0, 0.02];
let rows = f["rows"].as_u64().unwrap() as usize;
let mut input = Vec::new();
for r in 0..rows {
for _ in 0..256 {
input.push(g.soft() * scale[r % 3]);
}
}
assert_eq!(fnv1a(&f32_bytes(&input)) as i64, f["input_fnv"].as_i64().unwrap());
assert_hex_eq("fwht", &f32_bytes(&rotate(&input)), &f["out"]);
}
fn cells(seed: u64, n: usize, scale: f32) -> (Vec<Vec<f32>>, Vec<Vec<f32>>) {
let mut g = Lcg::new(seed);
let (mut ks, mut vs) = (Vec::new(), Vec::new());
for _ in 0..n {
ks.push((0..512).map(|_| g.soft() * scale).collect::<Vec<_>>());
vs.push((0..512).map(|_| g.soft() * scale).collect::<Vec<_>>());
}
(ks, vs)
}
#[test]
fn q4_0_append_batch_and_gather_match_the_reference() {
let fx = fixture("emulated_kernels.json");
let f = &fx["q4"];
let table = [2i32, -1, 0];
let rows = 3 * S.rows_per_page();
let (ks, vs) = cells(21, 12, 3.0);
let all_k: Vec<f32> = ks.concat();
let all_v: Vec<f32> = vs.concat();
assert_eq!(input_fnv(&all_k, &all_v) as i64, f["input_fnv"].as_i64().unwrap());
let mut pools = PoolSet::new(KvFormat::Q4_0, &S, rows).unwrap();
let mut host = PoolSet::new(KvFormat::Q4_0, &S, rows).unwrap();
for pos in 0..12 {
let (k, v) = (rotate(&ks[pos]), rotate(&vs[pos]));
cache::append_cell(KvFormat::Q4_0, &mut pools, Some(&mut host), &table, pos as i64, &k, &v, &S, C).unwrap();
}
assert_hex_eq("k", &pools.k_q4, &f["k"]);
assert_hex_eq("v", &pools.v_q4, &f["v"]);
assert_hex_eq("host_k", &host.k_q4, &f["host_k"]);
assert_hex_eq("host_v", &host.v_q4, &f["host_v"]);
// the prompt path: 6 cells from position 3, host copy and staging pool
let mut g = Lcg::new(31);
let big_k: Vec<f32> = (0..6 * 512).map(|_| g.soft() * 3.0).collect();
let big_v: Vec<f32> = (0..6 * 512).map(|_| g.soft() * 3.0).collect();
assert_eq!(input_fnv(&big_k, &big_v) as i64, f["batch_input_fnv"].as_i64().unwrap());
let (kr, vr) = (rotate(&big_k), rotate(&big_v));
let mut batch = PoolSet::new(KvFormat::Q4_0, &S, rows).unwrap();
let mut bhost = PoolSet::new(KvFormat::Q4_0, &S, rows).unwrap();
for t in 0..6 {
cache::append_cell(
KvFormat::Q4_0,
&mut batch,
Some(&mut bhost),
&table,
3 + t as i64,
&kr[t * 512..(t + 1) * 512],
&vr[t * 512..(t + 1) * 512],
&S,
C,
)
.unwrap();
}
assert_hex_eq("batch_k", &batch.k_q4, &f["batch_k"]);
assert_hex_eq("batch_v", &batch.v_q4, &f["batch_v"]);
assert_hex_eq("batch_host_k", &bhost.k_q4, &f["batch_host_k"]);
assert_hex_eq("batch_host_v", &bhost.v_q4, &f["batch_host_v"]);
// the staging pool has the identity layout of the host copy and receives every cell
assert_hex_eq("batch_stage_k", &bhost.k_q4, &f["batch_stage_k"]);
assert_hex_eq("batch_stage_v", &bhost.v_q4, &f["batch_stage_v"]);
let ids = [0i32, 1, 3, 8, 10, 11];
assert_hex_eq("gather_k", &u16_bytes(&cache::gather_q4(&pools.k_q4, &table, &ids, &S).unwrap()), &f["gather_k"]);
assert_hex_eq("gather_v", &u16_bytes(&cache::gather_q4(&pools.v_q4, &table, &ids, &S).unwrap()), &f["gather_v"]);
}
#[test]
fn int8_valueonly_and_k8v4_append_and_gather_match_the_reference() {
let fx = fixture("emulated_kernels.json");
let f = &fx["q8"];
let rows = 3 * S.rows_per_page();
let (ks, vs) = cells(41, 12, 2.0);
assert_eq!(input_fnv(&ks.concat(), &vs.concat()) as i64, f["input_fnv"].as_i64().unwrap());
let table = [1i32, 2, 0];
let stream = [2i32, -1, 0];
let ids = [0i32, 1, 3, 8, 10, 11];
// 1. INT8 K+V resident
let mut p = PoolSet::new(KvFormat::Int8, &S, rows).unwrap();
for pos in 0..12 {
cache::append_cell(KvFormat::Int8, &mut p, None, &table, pos as i64, &ks[pos], &vs[pos], &S, C).unwrap();
}
assert_hex_eq("int8_kq", &p.k_q, &f["int8_kq"]);
assert_hex_eq("int8_vq", &p.v_q, &f["int8_vq"]);
assert_hex_eq("int8_ks", &p.k_scale, &f["int8_ks"]);
assert_hex_eq("int8_vs", &p.v_scale, &f["int8_vs"]);
assert_hex_eq("int8_gather_k", &u16_bytes(&cache::gather_q8(&p.k_q, &p.k_scale, &table, &ids, &S).unwrap()), &f["int8_gather_k"]);
assert_hex_eq("int8_gather_v", &u16_bytes(&cache::gather_q8(&p.v_q, &p.v_scale, &table, &ids, &S).unwrap()), &f["int8_gather_v"]);
// 2. INT8 with the streaming host copy
let mut sp = PoolSet::new(KvFormat::Int8, &S, rows).unwrap();
let mut sh = PoolSet::new(KvFormat::Int8, &S, rows).unwrap();
for pos in 0..12 {
cache::append_cell(KvFormat::Int8, &mut sp, Some(&mut sh), &stream, pos as i64, &ks[pos], &vs[pos], &S, C).unwrap();
}
for (name, got) in [("stream_kq", &sp.k_q), ("stream_vq", &sp.v_q), ("stream_ks", &sp.k_scale), ("stream_vs", &sp.v_scale),
("stream_host_kq", &sh.k_q), ("stream_host_vq", &sh.v_q), ("stream_host_ks", &sh.k_scale), ("stream_host_vs", &sh.v_scale)] {
assert_hex_eq(name, got, &f[name]);
}
// 3. V-only
let mut vo = PoolSet::new(KvFormat::Int8Keyless, &S, rows).unwrap();
for pos in 0..12 {
cache::append_cell(KvFormat::Int8Keyless, &mut vo, None, &table, pos as i64, &ks[pos], &vs[pos], &S, C).unwrap();
}
assert_hex_eq("vonly_vq", &vo.v_q, &f["vonly_vq"]);
assert_hex_eq("vonly_vs", &vo.v_scale, &f["vonly_vs"]);
// 4. K8V4
let mut h = PoolSet::new(KvFormat::K8V4, &S, rows).unwrap();
for pos in 0..12 {
cache::append_cell(KvFormat::K8V4, &mut h, None, &table, pos as i64, &ks[pos], &rotate(&vs[pos]), &S, C).unwrap();
}
assert_hex_eq("k8v4_kq", &h.k_q, &f["k8v4_kq"]);
assert_hex_eq("k8v4_ks", &h.k_scale, &f["k8v4_ks"]);
assert_hex_eq("k8v4_v4", &h.v_q4, &f["k8v4_v4"]);
assert_hex_eq("k8v4_gather_k", &u16_bytes(&cache::gather_q8(&h.k_q, &h.k_scale, &table, &ids, &S).unwrap()), &f["k8v4_gather_k"]);
assert_hex_eq("k8v4_gather_v", &u16_bytes(&cache::gather_q4(&h.v_q4, &table, &ids, &S).unwrap()), &f["k8v4_gather_v"]);
}
// ---------------------------------------------------------------------------------------- KV streaming
use leleka_experimental_ref::{
kv_stream::{self, MissOrder, StreamMap},
layout::StreamFormat,
};
use std::collections::BTreeSet;
fn host_byte(array: usize, i: usize) -> u8 {
((((i + array * 7919) as u32).wrapping_mul(2_654_435_761)) >> 24) as u8
}
fn state_hash(m: &StreamMap, placed: usize) -> u64 {
let mut bytes = Vec::new();
for v in [&m.page_table, &m.slot_block, &m.slot_stamp, &m.slot_ref] {
bytes.extend(v.iter().flat_map(|x| x.to_le_bytes()));
}
bytes.extend(m.miss_slot[..placed].iter().flat_map(|x| x.to_le_bytes()));
bytes.extend(m.ctl.iter().flat_map(|x| x.to_le_bytes()));
fnv1a(&bytes)
}
#[test]
fn kv_stream_resolver_copy_and_ring_match_the_model() {
let fx = fixture("emulated_kernels.json");
let f = &fx["stream"];
let (n_blocks, n_slots, cap, n_q, calls) = (1600usize, 1030usize, 76usize, 3usize, 45usize);
let mut map = StreamMap::new(n_blocks, n_slots);
assert_eq!(state_hash(&map, 0) as i64, f["reset_state_fnv"].as_i64().unwrap());
let rows = S.rows_per_page();
let mut host = PoolSet::new(KvFormat::Int8, &S, n_blocks as u64 * rows).unwrap();
let mut slots = PoolSet::new(KvFormat::Int8, &S, n_slots as u64 * rows).unwrap();
for (a, name) in ["k_q", "v_q", "k_scale", "v_scale"].iter().enumerate() {
for (i, b) in host.array_mut(name).unwrap().iter_mut().enumerate() {
*b = host_byte(a, i);
}
}
let mut g = Lcg::new(51);
let recorded = f["calls"].as_array().unwrap();
assert_eq!(recorded.len(), calls);
let mut seen_evictions = false;
for (call, rec) in recorded.iter().enumerate() {
let mut ids = vec![0i32; n_q * cap];
let mut steps = vec![0i32; n_q * 4];
for q in 0..n_q {
let mut blocks = BTreeSet::new();
while blocks.len() < cap / 4 {
let b = if g.below(2) != 0 { g.below(n_blocks as u32) } else { (call as u32 * 7 + g.below(120)) % n_blocks as u32 };
blocks.insert(b);
}
let mut w = 0;
for b in blocks {
for i in 0..4 {
ids[q * cap + w] = (b * 4 + i) as i32;
w += 1;
}
}
steps[q * 4 + 3] = w as i32;
}
let order: Vec<i32> = rec["order"].as_array().unwrap().iter().map(|x| x.as_i64().unwrap() as i32).collect();
let report = map.resolve(&ids, &steps, n_q, cap, 4, &MissOrder::Observed(order.clone())).unwrap();
assert_eq!(report.placed, order.len(), "call {call}");
map.copy_missed(&mut slots, &host, &S, StreamFormat::Int8);
let ctl: Vec<i32> = rec["ctl"].as_array().unwrap().iter().map(|x| x.as_i64().unwrap() as i32).collect();
assert_eq!(map.ctl.to_vec(), ctl, "ctl after call {call}");
assert_eq!(state_hash(&map, report.placed) as i64, rec["state_fnv"].as_i64().unwrap(), "state after call {call}");
assert!(map.is_consistent());
seen_evictions |= map.resident_blocks() == n_slots;
}
assert!(seen_evictions, "the scenario must fill every slot so that later calls evict");
for (name, key) in [("k_q", "slots_fnv_k_q"), ("v_q", "slots_fnv_v_q"), ("k_scale", "slots_fnv_k_scale"), ("v_scale", "slots_fnv_v_scale")] {
assert_eq!(fnv1a(slots.array(name).unwrap()) as i64, f[key].as_i64().unwrap(), "{name}");
}
let ring: Vec<i64> = f["ring_table"].as_array().unwrap().iter().map(|x| x.as_i64().unwrap()).collect();
assert_eq!(kv_stream::ring_table(37, 8).iter().map(|x| i64::from(*x)).collect::<Vec<_>>(), ring);
assert_eq!(f["copy_u4_equal"].as_i64(), Some(1));
map.reset();
assert_eq!(state_hash(&map, 0) as i64, f["final_reset_state_fnv"].as_i64().unwrap());
}
// ---------------------------------------------------------------------------------- keyless routing
use leleka_experimental_ref::{
attn,
cvec::{self, CvecMode, CvecTables},
keyless,
};
fn routing_matrices(heads: usize) -> Vec<f32> {
let mut m = vec![0.0f32; heads * 256 * 256];
for h in 0..heads {
for d in 0..256 {
for j in 0..256 {
let a = if d == j { 0.8f32 } else { 0.0 };
m[(h * 256 + d) * 256 + j] = a + ((((h * 19 + d * 3 + j * 11) % 17) as i32 - 8) as f32) * 0.001f32;
}
}
}
m
}
#[test]
fn keyless_query_routing_kernel_matches_the_fmaf_reference_bit_for_bit() {
let fx = fixture("emulated_kernels.json");
let f = &fx["route"];
let (tokens, heads) = (f["tokens"].as_u64().unwrap() as usize, f["heads"].as_u64().unwrap() as usize);
let mut g = Lcg::new(61);
let mut q: Vec<f32> = (0..tokens * heads * 256).map(|_| g.soft()).collect();
keyless::route_query(&mut q, &routing_matrices(heads), tokens, heads).unwrap();
assert_hex_eq("routed", &f32_bytes(&q), &f["routed"]);
}
// ------------------------------------------------------------------------------------ control vector
#[test]
fn cvec_kernel_matches_the_reduction_tree_twin() {
let fx = fixture("emulated_kernels.json");
let f = &fx["cvec"];
let (n, hc, t_count, layer, l) = (
f["n"].as_u64().unwrap() as usize,
f["hc"].as_u64().unwrap() as usize,
f["T"].as_u64().unwrap() as usize,
f["layer"].as_u64().unwrap() as usize,
f["L"].as_u64().unwrap() as usize,
);
let unit = hex_f32(f["unit"].as_str().unwrap());
let add_dir = hex_f32(f["add_dir"].as_str().unwrap());
let r0 = hex_f32(f["r0"].as_str().unwrap());
let bo = hex_f32(f["bo"].as_str().unwrap());
let inj = hex_f32(f["inj"].as_str().unwrap());
// regenerate and cross-check the inputs
let mut g = Lcg::new(71);
let v: Vec<f32> = (0..n).map(|_| g.soft()).collect();
assert_eq!(v.iter().map(|x| x.to_bits()).collect::<Vec<_>>(), add_dir.iter().map(|x| x.to_bits()).collect::<Vec<_>>());
let r_ld = hc * n;
let table = |mode: CvecMode, dirv: &[f32], s_val: f32| {
let mut dir = vec![0.0f32; l * n];
let mut s = vec![0.0f32; l];
dir[layer * n..(layer + 1) * n].copy_from_slice(dirv);
s[layer] = s_val;
let steered = s.iter().map(|x| *x != 0.0).collect();
CvecTables { dir, s, mode, first: 1, last: l as i64 - 1, n_embd: n as i64, hc: hc as i64, steered, summary: String::new() }
};
let run = |t: &CvecTables, on: bool, layer_used: usize, write: bool| {
let mut r = r0.clone();
let pending = if write { Some((&bo[..], n, &inj[..], hc)) } else { None };
cvec::apply(&mut r, t, on, layer_used, t_count, r_ld, pending);
r
};
let cases: [(&str, Vec<f32>, bool); 8] = [
("project_s1", run(&table(CvecMode::Project, &unit, 1.0), true, layer, false), false),
("project_s2", run(&table(CvecMode::Project, &unit, 2.0), true, layer, false), false),
("add", run(&table(CvecMode::Add, &add_dir, 1.0), true, layer, false), false),
("off", run(&table(CvecMode::Project, &unit, 1.0), false, layer, false), false),
("off_write", run(&table(CvecMode::Project, &unit, 1.0), false, layer, true), true),
("project_write", run(&table(CvecMode::Project, &unit, 1.0), true, layer, true), true),
("add_write", run(&table(CvecMode::Add, &add_dir, 1.0), true, layer, true), true),
("no_direction_layer", run(&table(CvecMode::Project, &unit, 1.0), true, 1, false), false),
];
for (name, got, uses_sigmoid) in cases {
if !uses_sigmoid {
// no exp involved: bit-exact, including the dot reduction tree
assert_hex_eq(name, &f32_bytes(&got), &f[name]);
} else {
// the pending write evaluates sigmoid(): libm expf here, the device's __expf there. The harness and
// this test both use the platform libm, so they agree to a few ULP, not necessarily bit for bit.
let want = hex_f32(f[name].as_str().unwrap());
let mut worst = 0.0f32;
for (a, b) in got.iter().zip(&want) {
worst = worst.max((a - b).abs() / b.abs().max(1.0));
}
assert!(worst < 1e-5, "{name}: worst relative difference {worst}");
}
}
assert_eq!(f32_bytes(&r0), f32_bytes(&hex_f32(f["r0"].as_str().unwrap())));
}
// ------------------------------------------------------------------------------------------ attention
const CELLS: usize = 70;
const NQ: usize = 2;
const NH: usize = 24;
fn gqa_tensors(
ids: &[i32],
deq: &dyn Fn(&[i32]) -> Vec<f32>,
) -> Vec<f32> {
deq(ids)
}
fn check_attention(name: &str, got: &[f32], q: &[Vec<f32>], selections: &[Vec<i32>], k: &dyn Fn(&[i32]) -> Vec<f32>, v: &dyn Fn(&[i32]) -> Vec<f32>) {
assert_eq!(got.len(), NQ * NH * 256);
for b in 0..NQ {
let ids = &selections[b];
let want = attn::reference(&q[b], &gqa_tensors(ids, k), &gqa_tensors(ids, v), NH, 2, ids.len());
let (l2, max) = attn::errors(&got[b * NH * 256..(b + 1) * NH * 256], &want);
eprintln!("{name} query {b}: relative L2 {l2:e}, max abs {max:e}");
assert!(l2 < 1e-5 && max < 1e-5, "{name} query {b}: relative L2 {l2:e}, max abs {max:e}");
}
}
#[test]
fn quantized_attention_kernels_match_the_double_precision_reference() {
let fx = fixture("emulated_kernels.json");
let f = &fx["attn"];
let table: Vec<i32> = (0..18).map(|i| (i * 5 + 3) % 18).collect();
let rows = 18 * S.rows_per_page();
let mut g = Lcg::new(81);
let (mut kc, mut vc) = (Vec::new(), Vec::new());
for _ in 0..CELLS {
kc.push((0..512).map(|_| g.soft() * 1.5).collect::<Vec<f32>>());
vc.push((0..512).map(|_| g.soft() * 1.5).collect::<Vec<f32>>());
}
let q: Vec<f32> = (0..NQ * NH * 256).map(|_| g.soft()).collect();
let fnv = fnv1a(&f32_bytes(&q)) ^ fnv1a(&f32_bytes(&kc[0])).wrapping_mul(3) ^ fnv1a(&f32_bytes(&vc[CELLS - 1])).wrapping_mul(5);
assert_eq!(fnv as i64, f["input_fnv"].as_i64().unwrap());
let sel_full: Vec<i32> = (0..CELLS as i32).collect();
let sel_short: Vec<i32> = (0..66).collect();
let selections = vec![sel_full, sel_short];
let per_q = |x: &[f32]| -> Vec<Vec<f32>> { (0..NQ).map(|b| x[b * NH * 256..(b + 1) * NH * 256].to_vec()).collect() };
// ---- mode 2: Q4_0 K and V rotated, rotated query
{
let mut pools = PoolSet::new(KvFormat::Q4_0, &S, rows).unwrap();
for c in 0..CELLS {
cache::append_cell(KvFormat::Q4_0, &mut pools, None, &table, c as i64, &rotate(&kc[c]), &rotate(&vc[c]), &S, C).unwrap();
}
let qr = per_q(&rotate(&q));
let got = hex_f32(f["m2"]["out"].as_str().unwrap());
check_attention(
"mode 2",
&got,
&qr,
&selections,
&|ids| cache::dequant_q4(&pools.k_q4, &table, ids, &S).unwrap(),
&|ids| cache::dequant_q4(&pools.v_q4, &table, ids, &S).unwrap(),
);
}
// ---- mode 3: INT8 K (unrotated), Q4_0 V (rotated)
{
let mut pools = PoolSet::new(KvFormat::K8V4, &S, rows).unwrap();
for c in 0..CELLS {
cache::append_cell(KvFormat::K8V4, &mut pools, None, &table, c as i64, &kc[c], &rotate(&vc[c]), &S, C).unwrap();
}
let got = hex_f32(f["m3"]["out"].as_str().unwrap());
check_attention(
"mode 3",
&got,
&per_q(&q),
&selections,
&|ids| cache::dequant_q8(&pools.k_q, &pools.k_scale, &table, ids, &S).unwrap(),
&|ids| cache::dequant_q4(&pools.v_q4, &table, ids, &S).unwrap(),
);
}
// ---- mode 4: V-only, routed + position-encoded queries, keys rebuilt from V
{
let mut pools = PoolSet::new(KvFormat::Int8Keyless, &S, rows).unwrap();
for c in 0..CELLS {
cache::append_cell(KvFormat::Int8Keyless, &mut pools, None, &table, c as i64, &kc[c], &vc[c], &S, C).unwrap();
}
let cos = hex_f32(f["cos"].as_str().unwrap());
let sin = hex_f32(f["sin"].as_str().unwrap());
let mpos: Vec<i32> = (0..CELLS).flat_map(|cell| (0..3).map(move |sector| (cell / (sector + 2)) as i32)).collect();
let qpos = [CELLS as i32 - 1, 51];
let matrices = routing_matrices(NH);
let kids: Vec<Vec<i32>> = qpos.iter().map(|p| (0..=*p).filter(|c| c % 3 != 1).collect()).collect();
for (vision, key) in [(false, "m4"), (true, "m4_mrope")] {
let mut routed = q.clone();
keyless::route_query(&mut routed, &matrices, NQ, NH).unwrap();
for b in 0..NQ {
for h in 0..NH {
for d in 0..32 {
let i = (b * NH + h) * 256 + d;
let rp = if vision { mpos[qpos[b] as usize * 3 + d % 3] } else { qpos[b] } as usize;
let (a, v2, c, s) = (routed[i], routed[i + 32], cos[rp * 32 + d], sin[rp * 32 + d]);
routed[i] = a * c - v2 * s;
routed[i + 32] = a * s + v2 * c;
}
}
}
let got = hex_f32(f[key]["out"].as_str().unwrap());
let mrope = if vision { Some(&mpos[..]) } else { None };
let value = |ids: &[i32]| cache::dequant_q8(&pools.v_q, &pools.v_scale, &table, ids, &S).unwrap();
let keys = |ids: &[i32]| -> Vec<f32> {
let v = value(ids);
let mut out = Vec::with_capacity(v.len());
for (i, &cell) in ids.iter().enumerate() {
for kvh in 0..2 {
out.extend(keyless::key_from_value(&v[(i * 2 + kvh) * 256..][..256], cell, &cos, &sin, mrope));
}
}
out
};
check_attention(key, &got, &per_q(&routed), &kids, &keys, &value);
}
}
}
+20
View File
@@ -0,0 +1,20 @@
{"n_layers":6,"n_embd":40,"hc":4,"cases":[
{"name":"add_two_files","options":{"first":-1,"last":-1,"mode":1,"single":-1},"files":[{"label":"a.gguf","scale":1069547520,"bytes":"474755460300000004000000000000000200000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f721800000000000000636f6e74726f6c766563746f722e6d6f64656c5f68696e740800000008000000000000007177656e346578700b00000000000000646972656374696f6e2e300100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3201000000280000000000000000000000a0000000000000000b00000000000000646972656374696f6e2e330100000028000000000000000000000040010000000000000b00000000000000646972656374696f6e2e3901000000280000000000000000000000e00100000000000000000000000000000000000000000000000000b4af123f00159bbc6094d63fa2e1f93f3aeacfbf9cfcd33fec02103f4c38f73f3ae6ee3f38db23bf580254bf0068b0bb0486163fc806f7bf40520abff4c15f3f38ad3c3f6888f43f065d863fa03d38be9859673f006165bcf0e89abfe0f3d4bd5ab8f33fccb37ebf90a4fe3f043b9dbfb0b5023e3c55063faced093f8cbc7abf708b253e7003043e5cdf37bf04bcc53fc497d63f508c4c3fde79933f447ed53f124293bf48c9693f8290d9bfe809c6bf8a39923f70b7fabf9e8f8abfe635c0bf30f03d3f66becebf589cac3ef88cac3f88e0173f7293973f483e003ff2c59a3fe8769c3e3886d13fc08fe7bd0ad28a3f6cd4f53fc0ef7ebd80d1c5bf8ec5dabf08b7c2be3a4ffc3fd0c4903e08c4ba3f085e83be4ebed23f40d124bdb81385be2c9c643fc26dbbbf1018a63e20f3ecbe9cd536bffab4913f284c2b3fa84eb43f603ff53fe692af3f8881df3eb82d953f00db353e007ae0bd903f37bf5cbde9bf4837973ec68ad63f925193bfb25a893f0883893e488efb3fe8f7b8bf08f7bbbe8017c2bc800911bdcca755bf661ef03f00c9ca3d92c0893f1087243e18fa573fb81f6b3f2eb08a3f74fdcd3f80eaa63c6e3d913fd8d27abfea93c93fee1b9e3f1403dd3fdcc667bf66a8f83f8614a7bf80a4573e4c70573fc051adbecc58f13f5c19b8bf807fb8bdb01c163e0093bb3fe802f4bf66d2a43f8868eb3f98cf6e3f66cca3bf2e37a63feca3a53f8077d63e5c1878bfa87bb43fae6e9e3f6a1ed9bfb6a2cc3fe05ba13e465283bf387fcc3f087def3f7aacdebfe896b83ea8b07fbf34c8203f6c5525bf908824bf3869d73efa5994bf3638b9bf1470133f7aaf963fb46191bf3443483f9217ef3fd80b3b3f2200ef3f64d0e03fc00cd43d7c43703f"},{"label":"b.gguf","scale":3204448256,"bytes":"474755460300000002000000000000000100000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f720b00000000000000646972656374696f6e2e320100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3401000000280000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000001e368d3f1ca1a9bfc6b1debf4ebbb0bfc035b63e7651b2bfd24ba9bfe05585be38a6e3bed2729ebf70f6dbbf00610e3e6ab6d33f942d3c3fc8451e3ff015b53fac7df93fe66f85bf0291da3f600ce03f8090253d8c7b3a3f40122bbdcc479e3f84f8e43f0843bcbf886fb83f30057abe884c8ebf3055b13f4c06a9bfd872fcbeb6deedbfd4d306bf9607ae3f40d7bb3fa262833f6069293fa0f9a33e902ccebe72b1e93f0039fd3ea420c0bf20ec083f389ceabf4c02cf3f005513be9e46be3f02eba93fec1d063ffc4bf2bf6055f8be341fd23f2042873fa269d6bf74d062bfdc12993f4007bdbf8c636d3f6c8c743f8effdb3fb4e8ccbf7c3eb0bfe0dcde3fb88983be34c2723f8094c03f48e4bc3ef29cb93f5009c13e70df5fbfbcb3113fe0be2bbe4086c9be4ec6cabfa0b34fbe18106f3fb4ba363fd2c697bf7c0c93bf"}],"ok":1,"error":"","summary":"add:1-5","mode":1,"first":1,"last":5,"dir":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3222388501,1073877954,3218538465,3218125109,1069846423,3222238518,3212206856,3221738254,1068165355,3219579951,1068414425,1073343844,1031852816,1068782022,1055028496,1066245619,3204719742,1077837988,3213032955,1061185982,1077351472,3203025024,3222472444,3226183197,3216736485,1080839214,3197614040,1075045168,1043273736,1071870684,1058640558,3188901968,1074868798,3220664239,3192247848,3216426700,3217740166,1068512543,1062728660,1075060167,1077407624,1073983020,1059561766,1071629460,1049125952,3190315904,3213455276,3224325637,1055052524,1075898388,3218930267,1070467083,1053705356,1077717686,3221928430,3205298502,3172045216,3176762944,3214949849,1077155532,1041766080,1070506203,1047972504,1067580306,1068521418,1070598213,1075478039,1023041472,1071242277,3216776738,1075261168,1072507365,1076216399,3215840549,1077575244,3220872905,1050786656,1067553849,3204578640,1077215897,3211374962,3195877632,1061167268,3196644384,1063951416,3209626188,1033065728,3208529566,3207195394,3196460524,1064455164,1048073568,3209830196,3204923936,1062627746,1055051892,3206091484,1060964160,3203228556,3203697772,3210477454,1062004916,1060126332,3210665184,1040419256,3203580468,3208680576,3191661640,3208223986,3191933264,1054859120,3197219772,1034665696,1045005888,1061865038,1037022112,3203338264,3199646388,1058522834,1058212988,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"s":[0,0,1065353216,1065353216,1065353216,0]},
{"name":"add_range","options":{"first":2,"last":4,"mode":1,"single":-1},"files":[{"label":"a.gguf","scale":1065353216,"bytes":"474755460300000004000000000000000200000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f721800000000000000636f6e74726f6c766563746f722e6d6f64656c5f68696e740800000008000000000000007177656e346578700b00000000000000646972656374696f6e2e300100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3201000000280000000000000000000000a0000000000000000b00000000000000646972656374696f6e2e330100000028000000000000000000000040010000000000000b00000000000000646972656374696f6e2e3901000000280000000000000000000000e00100000000000000000000000000000000000000000000000000b4af123f00159bbc6094d63fa2e1f93f3aeacfbf9cfcd33fec02103f4c38f73f3ae6ee3f38db23bf580254bf0068b0bb0486163fc806f7bf40520abff4c15f3f38ad3c3f6888f43f065d863fa03d38be9859673f006165bcf0e89abfe0f3d4bd5ab8f33fccb37ebf90a4fe3f043b9dbfb0b5023e3c55063faced093f8cbc7abf708b253e7003043e5cdf37bf04bcc53fc497d63f508c4c3fde79933f447ed53f124293bf48c9693f8290d9bfe809c6bf8a39923f70b7fabf9e8f8abfe635c0bf30f03d3f66becebf589cac3ef88cac3f88e0173f7293973f483e003ff2c59a3fe8769c3e3886d13fc08fe7bd0ad28a3f6cd4f53fc0ef7ebd80d1c5bf8ec5dabf08b7c2be3a4ffc3fd0c4903e08c4ba3f085e83be4ebed23f40d124bdb81385be2c9c643fc26dbbbf1018a63e20f3ecbe9cd536bffab4913f284c2b3fa84eb43f603ff53fe692af3f8881df3eb82d953f00db353e007ae0bd903f37bf5cbde9bf4837973ec68ad63f925193bfb25a893f0883893e488efb3fe8f7b8bf08f7bbbe8017c2bc800911bdcca755bf661ef03f00c9ca3d92c0893f1087243e18fa573fb81f6b3f2eb08a3f74fdcd3f80eaa63c6e3d913fd8d27abfea93c93fee1b9e3f1403dd3fdcc667bf66a8f83f8614a7bf80a4573e4c70573fc051adbecc58f13f5c19b8bf807fb8bdb01c163e0093bb3fe802f4bf66d2a43f8868eb3f98cf6e3f66cca3bf2e37a63feca3a53f8077d63e5c1878bfa87bb43fae6e9e3f6a1ed9bfb6a2cc3fe05ba13e465283bf387fcc3f087def3f7aacdebfe896b83ea8b07fbf34c8203f6c5525bf908824bf3869d73efa5994bf3638b9bf1470133f7aaf963fb46191bf3443483f9217ef3fd80b3b3f2200ef3f64d0e03fc00cd43d7c43703f"},{"label":"b.gguf","scale":1073741824,"bytes":"474755460300000002000000000000000100000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f720b00000000000000646972656374696f6e2e320100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3401000000280000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000001e368d3f1ca1a9bfc6b1debf4ebbb0bfc035b63e7651b2bfd24ba9bfe05585be38a6e3bed2729ebf70f6dbbf00610e3e6ab6d33f942d3c3fc8451e3ff015b53fac7df93fe66f85bf0291da3f600ce03f8090253d8c7b3a3f40122bbdcc479e3f84f8e43f0843bcbf886fb83f30057abe884c8ebf3055b13f4c06a9bfd872fcbeb6deedbfd4d306bf9607ae3f40d7bb3fa262833f6069293fa0f9a33e902ccebe72b1e93f0039fd3ea420c0bf20ec083f389ceabf4c02cf3f005513be9e46be3f02eba93fec1d063ffc4bf2bf6055f8be341fd23f2042873fa269d6bf74d062bfdc12993f4007bdbf8c636d3f6c8c743f8effdb3fb4e8ccbf7c3eb0bfe0dcde3fb88983be34c2723f8094c03f48e4bc3ef29cb93f5009c13e70df5fbfbcb3113fe0be2bbe4086c9be4ec6cabfa0b34fbe18106f3fb4ba363fd2c697bf7c0c93bf"}],"ok":1,"error":"","summary":"add:2-4","mode":1,"first":2,"last":4,"dir":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1065822762,3219021204,3232087300,3230261281,1072518250,3231176343,3228472225,3221319787,3189168160,3229804802,3225838309,1070605624,1081716364,1076486275,1071539436,1082211444,1082558020,3202704976,1079202948,1083357874,1073747642,1068663822,3218113188,1061393428,1078763939,3212340652,1078626338,1064863096,3223238729,1083005484,3224082833,3214900826,3224680363,3223396555,1078119064,1075722460,1068194422,1075679021,1067950820,1058697408,1073037152,1068471014,1054835080,1066741176,1043716864,3185605120,3208069008,3219766620,1050097480,1071024838,3214102930,1065966258,1049199368,1073450568,3216570344,3199989512,3166836608,3172010368,3210061772,1072701030,1036699904,1065992338,1042581264,1062730264,1063985080,1066053678,1070464372,1017571968,1066483054,3212497624,1070175210,1067326446,1071448852,3211249372,1073260646,3215398022,1045931136,1062694988,3199029696,1072781516,1080668530,1065171200,3225428132,1065937952,3228212280,1078919756,3197326592,1077823134,1076488962,1065754092,3228716028,3212334432,1079123764,1074217504,3226888610,3219312756,1075385052,3225225024,1072522124,1072991340,1079771022,3226265780,3224387196,1079958752,3204680120,1072874036,1077974144,1060955208,1077517554,1061226832,3219119984,1066513340,3198926560,3209266752,3226125902,3201282976,1072631832,1068939956,3222783698,3222473852,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"s":[0,0,1065353216,1065353216,1065353216,0]},
{"name":"add_last_beyond_model","options":{"first":-1,"last":100,"mode":1,"single":-1},"files":[{"label":"a.gguf","scale":1048576000,"bytes":"474755460300000004000000000000000200000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f721800000000000000636f6e74726f6c766563746f722e6d6f64656c5f68696e740800000008000000000000007177656e346578700b00000000000000646972656374696f6e2e300100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3201000000280000000000000000000000a0000000000000000b00000000000000646972656374696f6e2e330100000028000000000000000000000040010000000000000b00000000000000646972656374696f6e2e3901000000280000000000000000000000e00100000000000000000000000000000000000000000000000000b4af123f00159bbc6094d63fa2e1f93f3aeacfbf9cfcd33fec02103f4c38f73f3ae6ee3f38db23bf580254bf0068b0bb0486163fc806f7bf40520abff4c15f3f38ad3c3f6888f43f065d863fa03d38be9859673f006165bcf0e89abfe0f3d4bd5ab8f33fccb37ebf90a4fe3f043b9dbfb0b5023e3c55063faced093f8cbc7abf708b253e7003043e5cdf37bf04bcc53fc497d63f508c4c3fde79933f447ed53f124293bf48c9693f8290d9bfe809c6bf8a39923f70b7fabf9e8f8abfe635c0bf30f03d3f66becebf589cac3ef88cac3f88e0173f7293973f483e003ff2c59a3fe8769c3e3886d13fc08fe7bd0ad28a3f6cd4f53fc0ef7ebd80d1c5bf8ec5dabf08b7c2be3a4ffc3fd0c4903e08c4ba3f085e83be4ebed23f40d124bdb81385be2c9c643fc26dbbbf1018a63e20f3ecbe9cd536bffab4913f284c2b3fa84eb43f603ff53fe692af3f8881df3eb82d953f00db353e007ae0bd903f37bf5cbde9bf4837973ec68ad63f925193bfb25a893f0883893e488efb3fe8f7b8bf08f7bbbe8017c2bc800911bdcca755bf661ef03f00c9ca3d92c0893f1087243e18fa573fb81f6b3f2eb08a3f74fdcd3f80eaa63c6e3d913fd8d27abfea93c93fee1b9e3f1403dd3fdcc667bf66a8f83f8614a7bf80a4573e4c70573fc051adbecc58f13f5c19b8bf807fb8bdb01c163e0093bb3fe802f4bf66d2a43f8868eb3f98cf6e3f66cca3bf2e37a63feca3a53f8077d63e5c1878bfa87bb43fae6e9e3f6a1ed9bfb6a2cc3fe05ba13e465283bf387fcc3f087def3f7aacdebfe896b83ea8b07fbf34c8203f6c5525bf908824bf3869d73efa5994bf3638b9bf1470133f7aaf963fb46191bf3443483f9217ef3fd80b3b3f2200ef3f64d0e03fc00cd43d7c43703f"}],"ok":1,"error":"","summary":"add:1-5","mode":1,"first":1,"last":5,"dir":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3197321746,1047120200,3201929346,3200649704,1049770378,3204102000,3196751774,3200267750,1044246576,3201220198,1034722392,1051495672,1041752200,1050121074,1040203336,1050330610,1033664232,1053918776,3169292224,1049285130,1056298092,3162435520,3200635264,3202008462,3183654664,1056722746,1032897744,1052427272,3179503112,1053998670,3156529472,3179615160,1046780972,3199954370,1034295312,3186422560,3191264668,1049736442,1043024936,1052004008,1056259936,1051693798,1038057864,1049963960,1026939648,3168827904,3191291792,3202989404,1033320264,1054247622,3197325714,1049189042,1032422152,1056673352,3199793128,3183212296,3150059392,3155233152,3193284556,1055923814,1019922688,1049215122,1025804048,1045953048,1047207864,1049276462,1053687156,1000794752,1049705838,3195720408,1053397994,1050549230,1054671636,3194472156,1056483430,3198620806,1029153920,1045917772,3182252480,1056004300,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"s":[0,0,1065353216,1065353216,0,0]},
{"name":"project_two_files","options":{"first":-1,"last":-1,"mode":0,"single":-1},"files":[{"label":"a.gguf","scale":1065353216,"bytes":"474755460300000004000000000000000200000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f721800000000000000636f6e74726f6c766563746f722e6d6f64656c5f68696e740800000008000000000000007177656e346578700b00000000000000646972656374696f6e2e300100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3201000000280000000000000000000000a0000000000000000b00000000000000646972656374696f6e2e330100000028000000000000000000000040010000000000000b00000000000000646972656374696f6e2e3901000000280000000000000000000000e00100000000000000000000000000000000000000000000000000b4af123f00159bbc6094d63fa2e1f93f3aeacfbf9cfcd33fec02103f4c38f73f3ae6ee3f38db23bf580254bf0068b0bb0486163fc806f7bf40520abff4c15f3f38ad3c3f6888f43f065d863fa03d38be9859673f006165bcf0e89abfe0f3d4bd5ab8f33fccb37ebf90a4fe3f043b9dbfb0b5023e3c55063faced093f8cbc7abf708b253e7003043e5cdf37bf04bcc53fc497d63f508c4c3fde79933f447ed53f124293bf48c9693f8290d9bfe809c6bf8a39923f70b7fabf9e8f8abfe635c0bf30f03d3f66becebf589cac3ef88cac3f88e0173f7293973f483e003ff2c59a3fe8769c3e3886d13fc08fe7bd0ad28a3f6cd4f53fc0ef7ebd80d1c5bf8ec5dabf08b7c2be3a4ffc3fd0c4903e08c4ba3f085e83be4ebed23f40d124bdb81385be2c9c643fc26dbbbf1018a63e20f3ecbe9cd536bffab4913f284c2b3fa84eb43f603ff53fe692af3f8881df3eb82d953f00db353e007ae0bd903f37bf5cbde9bf4837973ec68ad63f925193bfb25a893f0883893e488efb3fe8f7b8bf08f7bbbe8017c2bc800911bdcca755bf661ef03f00c9ca3d92c0893f1087243e18fa573fb81f6b3f2eb08a3f74fdcd3f80eaa63c6e3d913fd8d27abfea93c93fee1b9e3f1403dd3fdcc667bf66a8f83f8614a7bf80a4573e4c70573fc051adbecc58f13f5c19b8bf807fb8bdb01c163e0093bb3fe802f4bf66d2a43f8868eb3f98cf6e3f66cca3bf2e37a63feca3a53f8077d63e5c1878bfa87bb43fae6e9e3f6a1ed9bfb6a2cc3fe05ba13e465283bf387fcc3f087def3f7aacdebfe896b83ea8b07fbf34c8203f6c5525bf908824bf3869d73efa5994bf3638b9bf1470133f7aaf963fb46191bf3443483f9217ef3fd80b3b3f2200ef3f64d0e03fc00cd43d7c43703f"},{"label":"b.gguf","scale":1065353216,"bytes":"474755460300000002000000000000000100000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f720b00000000000000646972656374696f6e2e320100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3401000000280000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000001e368d3f1ca1a9bfc6b1debf4ebbb0bfc035b63e7651b2bfd24ba9bfe05585be38a6e3bed2729ebf70f6dbbf00610e3e6ab6d33f942d3c3fc8451e3ff015b53fac7df93fe66f85bf0291da3f600ce03f8090253d8c7b3a3f40122bbdcc479e3f84f8e43f0843bcbf886fb83f30057abe884c8ebf3055b13f4c06a9bfd872fcbeb6deedbfd4d306bf9607ae3f40d7bb3fa262833f6069293fa0f9a33e902ccebe72b1e93f0039fd3ea420c0bf20ec083f389ceabf4c02cf3f005513be9e46be3f02eba93fec1d063ffc4bf2bf6055f8be341fd23f2042873fa269d6bf74d062bfdc12993f4007bdbf8c636d3f6c8c743f8effdb3fb4e8ccbf7c3eb0bfe0dcde3fb88983be34c2723f8094c03f48e4bc3ef29cb93f5009c13e70df5fbfbcb3113fe0be2bbe4086c9be4ec6cabfa0b34fbe18106f3fb4ba363fd2c697bf7c0c93bf"}],"ok":1,"error":"","summary":"project:1-5","mode":0,"first":1,"last":5,"dir":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3146255891,3172225868,3197814934,3196306029,1040636166,3197556321,3193468950,3189675855,1020662670,3196085342,3187189158,1040570305,1045054175,1043119393,1036613255,1047275664,1045098226,1029046413,1041203733,1048520320,1043365407,1030739879,3188644548,3173655323,1040026427,1026827211,1041965645,1037742738,3187035321,1049128956,3186946325,3179776622,3182281938,3191025953,1041731794,1035262648,1021367269,1042416547,1035081928,1035277426,1049001104,1044418335,1031086293,1042521150,1019704011,3161862486,3184064986,3196071182,1025890371,1047219219,3189871112,1041671266,1024905375,1049227809,3192577227,3176015393,3142901334,3147764085,3186250532,1048816784,1012819746,1041699869,1018458552,1038933742,1040248672,1041767143,1046604533,993464398,1042238057,3188296536,1046287397,1043163040,1047684253,3187553022,1049123661,3191291493,1022132495,1038895054,3174962724,1048860920,1048034798,1032206597,3192630640,1032922964,3195582161,1046180894,3164352616,1045018347,1043603969,1032728051,3196087920,3179520406,1046397166,1041195960,3194178917,3186651922,1042433697,3192415322,1039902952,1040293884,1047083335,3193518644,3191527127,1047282350,3171643919,1040231706,1045178435,1028144968,1044694397,1028432921,3186447562,1033532942,3166048768,3176506282,3193370357,3168546843,1040019255,1036105437,3189827233,3189498760,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"s":[0,0,1094060510,1089039156,1089567650,0]},
{"name":"project_range","options":{"first":2,"last":5,"mode":0,"single":-1},"files":[{"label":"a.gguf","scale":1061158912,"bytes":"474755460300000004000000000000000200000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f721800000000000000636f6e74726f6c766563746f722e6d6f64656c5f68696e740800000008000000000000007177656e346578700b00000000000000646972656374696f6e2e300100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3201000000280000000000000000000000a0000000000000000b00000000000000646972656374696f6e2e330100000028000000000000000000000040010000000000000b00000000000000646972656374696f6e2e3901000000280000000000000000000000e00100000000000000000000000000000000000000000000000000b4af123f00159bbc6094d63fa2e1f93f3aeacfbf9cfcd33fec02103f4c38f73f3ae6ee3f38db23bf580254bf0068b0bb0486163fc806f7bf40520abff4c15f3f38ad3c3f6888f43f065d863fa03d38be9859673f006165bcf0e89abfe0f3d4bd5ab8f33fccb37ebf90a4fe3f043b9dbfb0b5023e3c55063faced093f8cbc7abf708b253e7003043e5cdf37bf04bcc53fc497d63f508c4c3fde79933f447ed53f124293bf48c9693f8290d9bfe809c6bf8a39923f70b7fabf9e8f8abfe635c0bf30f03d3f66becebf589cac3ef88cac3f88e0173f7293973f483e003ff2c59a3fe8769c3e3886d13fc08fe7bd0ad28a3f6cd4f53fc0ef7ebd80d1c5bf8ec5dabf08b7c2be3a4ffc3fd0c4903e08c4ba3f085e83be4ebed23f40d124bdb81385be2c9c643fc26dbbbf1018a63e20f3ecbe9cd536bffab4913f284c2b3fa84eb43f603ff53fe692af3f8881df3eb82d953f00db353e007ae0bd903f37bf5cbde9bf4837973ec68ad63f925193bfb25a893f0883893e488efb3fe8f7b8bf08f7bbbe8017c2bc800911bdcca755bf661ef03f00c9ca3d92c0893f1087243e18fa573fb81f6b3f2eb08a3f74fdcd3f80eaa63c6e3d913fd8d27abfea93c93fee1b9e3f1403dd3fdcc667bf66a8f83f8614a7bf80a4573e4c70573fc051adbecc58f13f5c19b8bf807fb8bdb01c163e0093bb3fe802f4bf66d2a43f8868eb3f98cf6e3f66cca3bf2e37a63feca3a53f8077d63e5c1878bfa87bb43fae6e9e3f6a1ed9bfb6a2cc3fe05ba13e465283bf387fcc3f087def3f7aacdebfe896b83ea8b07fbf34c8203f6c5525bf908824bf3869d73efa5994bf3638b9bf1470133f7aaf963fb46191bf3443483f9217ef3fd80b3b3f2200ef3f64d0e03fc00cd43d7c43703f"},{"label":"b.gguf","scale":1056964608,"bytes":"474755460300000002000000000000000100000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f720b00000000000000646972656374696f6e2e320100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3401000000280000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000001e368d3f1ca1a9bfc6b1debf4ebbb0bfc035b63e7651b2bfd24ba9bfe05585be38a6e3bed2729ebf70f6dbbf00610e3e6ab6d33f942d3c3fc8451e3ff015b53fac7df93fe66f85bf0291da3f600ce03f8090253d8c7b3a3f40122bbdcc479e3f84f8e43f0843bcbf886fb83f30057abe884c8ebf3055b13f4c06a9bfd872fcbeb6deedbfd4d306bf9607ae3f40d7bb3fa262833f6069293fa0f9a33e902ccebe72b1e93f0039fd3ea420c0bf20ec083f389ceabf4c02cf3f005513be9e46be3f02eba93fec1d063ffc4bf2bf6055f8be341fd23f2042873fa269d6bf74d062bfdc12993f4007bdbf8c636d3f6c8c743f8effdb3fb4e8ccbf7c3eb0bfe0dcde3fb88983be34c2723f8094c03f48e4bc3ef29cb93f5009c13e70df5fbfbcb3113fe0be2bbe4086c9be4ec6cabfa0b34fbe18106f3fb4ba363fd2c697bf7c0c93bf"}],"ok":1,"error":"","summary":"project:2-5","mode":0,"first":2,"last":5,"dir":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3174142913,994812311,3197695382,3196321448,1041471445,3197793097,3193053922,3191027731,1027516016,3196226040,3182230788,1041899911,1043689076,1043536900,1036213990,1046888781,1043051683,1036617897,1037787003,1047583805,1045452724,1026895218,3190312892,3183300223,1034799652,1037300966,1040515984,1040887427,3184883886,1049196716,3183802194,3179012706,3172205632,3192010269,1040428014,1029479592,3142366458,1042872797,1035786618,1039398067,1049001104,1044418334,1031086293,1042521150,1019704011,3161862487,3184064986,3196071182,1025890371,1047219219,3189871112,1041671266,1024905375,1049227809,3192577227,3176015394,3142901334,3147764085,3186250532,1048816784,1012819746,1041699869,1018458552,1038933743,1040248672,1041767143,1046604533,993464398,1042238057,3188296536,1046287398,1043163040,1047684253,3187553022,1049123661,3191291493,1022132495,1038895054,3174962724,1048860920,1048034798,1032206597,3192630640,1032922964,3195582161,1046180894,3164352616,1045018347,1043603969,1032728051,3196087920,3179520406,1046397166,1041195960,3194178917,3186651922,1042433697,3192415322,1039902952,1040293884,1047083335,3193518644,3191527127,1047282350,3171643919,1040231706,1045178435,1028144968,1044694397,1028432921,3186447562,1033532942,3166048768,3176506282,3193370357,3168546843,1040019255,1036105437,3189827233,3189498760,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"s":[0,0,1088797105,1085214823,1081179042,0]},
{"name":"project_single_layer","options":{"first":-1,"last":-1,"mode":0,"single":3},"files":[{"label":"a.gguf","scale":1065353216,"bytes":"474755460300000004000000000000000200000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f721800000000000000636f6e74726f6c766563746f722e6d6f64656c5f68696e740800000008000000000000007177656e346578700b00000000000000646972656374696f6e2e300100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3201000000280000000000000000000000a0000000000000000b00000000000000646972656374696f6e2e330100000028000000000000000000000040010000000000000b00000000000000646972656374696f6e2e3901000000280000000000000000000000e00100000000000000000000000000000000000000000000000000b4af123f00159bbc6094d63fa2e1f93f3aeacfbf9cfcd33fec02103f4c38f73f3ae6ee3f38db23bf580254bf0068b0bb0486163fc806f7bf40520abff4c15f3f38ad3c3f6888f43f065d863fa03d38be9859673f006165bcf0e89abfe0f3d4bd5ab8f33fccb37ebf90a4fe3f043b9dbfb0b5023e3c55063faced093f8cbc7abf708b253e7003043e5cdf37bf04bcc53fc497d63f508c4c3fde79933f447ed53f124293bf48c9693f8290d9bfe809c6bf8a39923f70b7fabf9e8f8abfe635c0bf30f03d3f66becebf589cac3ef88cac3f88e0173f7293973f483e003ff2c59a3fe8769c3e3886d13fc08fe7bd0ad28a3f6cd4f53fc0ef7ebd80d1c5bf8ec5dabf08b7c2be3a4ffc3fd0c4903e08c4ba3f085e83be4ebed23f40d124bdb81385be2c9c643fc26dbbbf1018a63e20f3ecbe9cd536bffab4913f284c2b3fa84eb43f603ff53fe692af3f8881df3eb82d953f00db353e007ae0bd903f37bf5cbde9bf4837973ec68ad63f925193bfb25a893f0883893e488efb3fe8f7b8bf08f7bbbe8017c2bc800911bdcca755bf661ef03f00c9ca3d92c0893f1087243e18fa573fb81f6b3f2eb08a3f74fdcd3f80eaa63c6e3d913fd8d27abfea93c93fee1b9e3f1403dd3fdcc667bf66a8f83f8614a7bf80a4573e4c70573fc051adbecc58f13f5c19b8bf807fb8bdb01c163e0093bb3fe802f4bf66d2a43f8868eb3f98cf6e3f66cca3bf2e37a63feca3a53f8077d63e5c1878bfa87bb43fae6e9e3f6a1ed9bfb6a2cc3fe05ba13e465283bf387fcc3f087def3f7aacdebfe896b83ea8b07fbf34c8203f6c5525bf908824bf3869d73efa5994bf3638b9bf1470133f7aaf963fb46191bf3443483f9217ef3fd80b3b3f2200ef3f64d0e03fc00cd43d7c43703f"}],"ok":1,"error":"","summary":"project:1-5:single3","mode":0,"first":1,"last":5,"dir":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1049001104,1044418335,1031086293,1042521150,1019704011,3161862486,3184064986,3196071182,1025890371,1047219219,3189871112,1041671266,1024905375,1049227809,3192577227,3176015393,3142901334,3147764085,3186250532,1048816784,1012819746,1041699869,1018458552,1038933742,1040248672,1041767143,1046604533,993464398,1042238057,3188296536,1046287397,1043163040,1047684253,3187553022,1049123661,3191291493,1022132495,1038895054,3174962724,1048860920,1049001104,1044418335,1031086293,1042521150,1019704011,3161862486,3184064986,3196071182,1025890371,1047219219,3189871112,1041671266,1024905375,1049227809,3192577227,3176015393,3142901334,3147764085,3186250532,1048816784,1012819746,1041699869,1018458552,1038933742,1040248672,1041767143,1046604533,993464398,1042238057,3188296536,1046287397,1043163040,1047684253,3187553022,1049123661,3191291493,1022132495,1038895054,3174962724,1048860920,1049001104,1044418335,1031086293,1042521150,1019704011,3161862486,3184064986,3196071182,1025890371,1047219219,3189871112,1041671266,1024905375,1049227809,3192577227,3176015393,3142901334,3147764085,3186250532,1048816784,1012819746,1041699869,1018458552,1038933742,1040248672,1041767143,1046604533,993464398,1042238057,3188296536,1046287397,1043163040,1047684253,3187553022,1049123661,3191291493,1022132495,1038895054,3174962724,1048860920,1049001104,1044418335,1031086293,1042521150,1019704011,3161862486,3184064986,3196071182,1025890371,1047219219,3189871112,1041671266,1024905375,1049227809,3192577227,3176015393,3142901334,3147764085,3186250532,1048816784,1012819746,1041699869,1018458552,1038933742,1040248672,1041767143,1046604533,993464398,1042238057,3188296536,1046287397,1043163040,1047684253,3187553022,1049123661,3191291493,1022132495,1038895054,3174962724,1048860920,1049001104,1044418335,1031086293,1042521150,1019704011,3161862486,3184064986,3196071182,1025890371,1047219219,3189871112,1041671266,1024905375,1049227809,3192577227,3176015393,3142901334,3147764085,3186250532,1048816784,1012819746,1041699869,1018458552,1038933742,1040248672,1041767143,1046604533,993464398,1042238057,3188296536,1046287397,1043163040,1047684253,3187553022,1049123661,3191291493,1022132495,1038895054,3174962724,1048860920],"s":[0,1089039156,1089039156,1089039156,1089039156,1089039156]},
{"name":"project_single_missing","options":{"first":-1,"last":-1,"mode":0,"single":5},"files":[{"label":"a.gguf","scale":1065353216,"bytes":"474755460300000004000000000000000200000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f721800000000000000636f6e74726f6c766563746f722e6d6f64656c5f68696e740800000008000000000000007177656e346578700b00000000000000646972656374696f6e2e300100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3201000000280000000000000000000000a0000000000000000b00000000000000646972656374696f6e2e330100000028000000000000000000000040010000000000000b00000000000000646972656374696f6e2e3901000000280000000000000000000000e00100000000000000000000000000000000000000000000000000b4af123f00159bbc6094d63fa2e1f93f3aeacfbf9cfcd33fec02103f4c38f73f3ae6ee3f38db23bf580254bf0068b0bb0486163fc806f7bf40520abff4c15f3f38ad3c3f6888f43f065d863fa03d38be9859673f006165bcf0e89abfe0f3d4bd5ab8f33fccb37ebf90a4fe3f043b9dbfb0b5023e3c55063faced093f8cbc7abf708b253e7003043e5cdf37bf04bcc53fc497d63f508c4c3fde79933f447ed53f124293bf48c9693f8290d9bfe809c6bf8a39923f70b7fabf9e8f8abfe635c0bf30f03d3f66becebf589cac3ef88cac3f88e0173f7293973f483e003ff2c59a3fe8769c3e3886d13fc08fe7bd0ad28a3f6cd4f53fc0ef7ebd80d1c5bf8ec5dabf08b7c2be3a4ffc3fd0c4903e08c4ba3f085e83be4ebed23f40d124bdb81385be2c9c643fc26dbbbf1018a63e20f3ecbe9cd536bffab4913f284c2b3fa84eb43f603ff53fe692af3f8881df3eb82d953f00db353e007ae0bd903f37bf5cbde9bf4837973ec68ad63f925193bfb25a893f0883893e488efb3fe8f7b8bf08f7bbbe8017c2bc800911bdcca755bf661ef03f00c9ca3d92c0893f1087243e18fa573fb81f6b3f2eb08a3f74fdcd3f80eaa63c6e3d913fd8d27abfea93c93fee1b9e3f1403dd3fdcc667bf66a8f83f8614a7bf80a4573e4c70573fc051adbecc58f13f5c19b8bf807fb8bdb01c163e0093bb3fe802f4bf66d2a43f8868eb3f98cf6e3f66cca3bf2e37a63feca3a53f8077d63e5c1878bfa87bb43fae6e9e3f6a1ed9bfb6a2cc3fe05ba13e465283bf387fcc3f087def3f7aacdebfe896b83ea8b07fbf34c8203f6c5525bf908824bf3869d73efa5994bf3638b9bf1470133f7aaf963fb46191bf3443483f9217ef3fd80b3b3f2200ef3f64d0e03fc00cd43d7c43703f"}],"ok":0,"error":"--cvec-dir single:5: the vector has no direction for that layer"},
{"name":"add_ignores_single","options":{"first":-1,"last":-1,"mode":1,"single":5},"files":[{"label":"a.gguf","scale":1065353216,"bytes":"474755460300000004000000000000000200000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f721800000000000000636f6e74726f6c766563746f722e6d6f64656c5f68696e740800000008000000000000007177656e346578700b00000000000000646972656374696f6e2e300100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3201000000280000000000000000000000a0000000000000000b00000000000000646972656374696f6e2e330100000028000000000000000000000040010000000000000b00000000000000646972656374696f6e2e3901000000280000000000000000000000e00100000000000000000000000000000000000000000000000000b4af123f00159bbc6094d63fa2e1f93f3aeacfbf9cfcd33fec02103f4c38f73f3ae6ee3f38db23bf580254bf0068b0bb0486163fc806f7bf40520abff4c15f3f38ad3c3f6888f43f065d863fa03d38be9859673f006165bcf0e89abfe0f3d4bd5ab8f33fccb37ebf90a4fe3f043b9dbfb0b5023e3c55063faced093f8cbc7abf708b253e7003043e5cdf37bf04bcc53fc497d63f508c4c3fde79933f447ed53f124293bf48c9693f8290d9bfe809c6bf8a39923f70b7fabf9e8f8abfe635c0bf30f03d3f66becebf589cac3ef88cac3f88e0173f7293973f483e003ff2c59a3fe8769c3e3886d13fc08fe7bd0ad28a3f6cd4f53fc0ef7ebd80d1c5bf8ec5dabf08b7c2be3a4ffc3fd0c4903e08c4ba3f085e83be4ebed23f40d124bdb81385be2c9c643fc26dbbbf1018a63e20f3ecbe9cd536bffab4913f284c2b3fa84eb43f603ff53fe692af3f8881df3eb82d953f00db353e007ae0bd903f37bf5cbde9bf4837973ec68ad63f925193bfb25a893f0883893e488efb3fe8f7b8bf08f7bbbe8017c2bc800911bdcca755bf661ef03f00c9ca3d92c0893f1087243e18fa573fb81f6b3f2eb08a3f74fdcd3f80eaa63c6e3d913fd8d27abfea93c93fee1b9e3f1403dd3fdcc667bf66a8f83f8614a7bf80a4573e4c70573fc051adbecc58f13f5c19b8bf807fb8bdb01c163e0093bb3fe802f4bf66d2a43f8868eb3f98cf6e3f66cca3bf2e37a63feca3a53f8077d63e5c1878bfa87bb43fae6e9e3f6a1ed9bfb6a2cc3fe05ba13e465283bf387fcc3f087def3f7aacdebfe896b83ea8b07fbf34c8203f6c5525bf908824bf3869d73efa5994bf3638b9bf1470133f7aaf963fb46191bf3443483f9217ef3fd80b3b3f2200ef3f64d0e03fc00cd43d7c43703f"}],"ok":1,"error":"","summary":"add:1-5","mode":1,"first":1,"last":5,"dir":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3214098962,1063897416,3218706562,3217426920,1066547594,3220879216,3213528990,3217044966,1061023792,3217997414,1051499608,1068272888,1058529416,1066898290,1056980552,1067107826,1050441448,1070695992,3186069440,1066062346,1073075308,3179212736,3217412480,3218785678,3200431880,1073499962,1049674960,1069204488,3196280328,1070775886,3173306688,3196392376,1063558188,3216731586,1051072528,3203199776,3208041884,1066513658,1059802152,1068781224,1073037152,1068471014,1054835080,1066741176,1043716864,3185605120,3208069008,3219766620,1050097480,1071024838,3214102930,1065966258,1049199368,1073450568,3216570344,3199989512,3166836608,3172010368,3210061772,1072701030,1036699904,1065992338,1042581264,1062730264,1063985080,1066053678,1070464372,1017571968,1066483054,3212497624,1070175210,1067326446,1071448852,3211249372,1073260646,3215398022,1045931136,1062694988,3199029696,1072781516,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"s":[0,0,1065353216,1065353216,0,0]},
{"name":"nothing_in_range","options":{"first":5,"last":5,"mode":1,"single":-1},"files":[{"label":"a.gguf","scale":1065353216,"bytes":"474755460300000004000000000000000200000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f721800000000000000636f6e74726f6c766563746f722e6d6f64656c5f68696e740800000008000000000000007177656e346578700b00000000000000646972656374696f6e2e300100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3201000000280000000000000000000000a0000000000000000b00000000000000646972656374696f6e2e330100000028000000000000000000000040010000000000000b00000000000000646972656374696f6e2e3901000000280000000000000000000000e00100000000000000000000000000000000000000000000000000b4af123f00159bbc6094d63fa2e1f93f3aeacfbf9cfcd33fec02103f4c38f73f3ae6ee3f38db23bf580254bf0068b0bb0486163fc806f7bf40520abff4c15f3f38ad3c3f6888f43f065d863fa03d38be9859673f006165bcf0e89abfe0f3d4bd5ab8f33fccb37ebf90a4fe3f043b9dbfb0b5023e3c55063faced093f8cbc7abf708b253e7003043e5cdf37bf04bcc53fc497d63f508c4c3fde79933f447ed53f124293bf48c9693f8290d9bfe809c6bf8a39923f70b7fabf9e8f8abfe635c0bf30f03d3f66becebf589cac3ef88cac3f88e0173f7293973f483e003ff2c59a3fe8769c3e3886d13fc08fe7bd0ad28a3f6cd4f53fc0ef7ebd80d1c5bf8ec5dabf08b7c2be3a4ffc3fd0c4903e08c4ba3f085e83be4ebed23f40d124bdb81385be2c9c643fc26dbbbf1018a63e20f3ecbe9cd536bffab4913f284c2b3fa84eb43f603ff53fe692af3f8881df3eb82d953f00db353e007ae0bd903f37bf5cbde9bf4837973ec68ad63f925193bfb25a893f0883893e488efb3fe8f7b8bf08f7bbbe8017c2bc800911bdcca755bf661ef03f00c9ca3d92c0893f1087243e18fa573fb81f6b3f2eb08a3f74fdcd3f80eaa63c6e3d913fd8d27abfea93c93fee1b9e3f1403dd3fdcc667bf66a8f83f8614a7bf80a4573e4c70573fc051adbecc58f13f5c19b8bf807fb8bdb01c163e0093bb3fe802f4bf66d2a43f8868eb3f98cf6e3f66cca3bf2e37a63feca3a53f8077d63e5c1878bfa87bb43fae6e9e3f6a1ed9bfb6a2cc3fe05ba13e465283bf387fcc3f087def3f7aacdebfe896b83ea8b07fbf34c8203f6c5525bf908824bf3869d73efa5994bf3638b9bf1470133f7aaf963fb46191bf3443483f9217ef3fd80b3b3f2200ef3f64d0e03fc00cd43d7c43703f"}],"ok":0,"error":"the control vector has no direction in layers 5..5"},
{"name":"zero_scale_project","options":{"first":-1,"last":-1,"mode":0,"single":-1},"files":[{"label":"a.gguf","scale":0,"bytes":"474755460300000004000000000000000200000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f721800000000000000636f6e74726f6c766563746f722e6d6f64656c5f68696e740800000008000000000000007177656e346578700b00000000000000646972656374696f6e2e300100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3201000000280000000000000000000000a0000000000000000b00000000000000646972656374696f6e2e330100000028000000000000000000000040010000000000000b00000000000000646972656374696f6e2e3901000000280000000000000000000000e00100000000000000000000000000000000000000000000000000b4af123f00159bbc6094d63fa2e1f93f3aeacfbf9cfcd33fec02103f4c38f73f3ae6ee3f38db23bf580254bf0068b0bb0486163fc806f7bf40520abff4c15f3f38ad3c3f6888f43f065d863fa03d38be9859673f006165bcf0e89abfe0f3d4bd5ab8f33fccb37ebf90a4fe3f043b9dbfb0b5023e3c55063faced093f8cbc7abf708b253e7003043e5cdf37bf04bcc53fc497d63f508c4c3fde79933f447ed53f124293bf48c9693f8290d9bfe809c6bf8a39923f70b7fabf9e8f8abfe635c0bf30f03d3f66becebf589cac3ef88cac3f88e0173f7293973f483e003ff2c59a3fe8769c3e3886d13fc08fe7bd0ad28a3f6cd4f53fc0ef7ebd80d1c5bf8ec5dabf08b7c2be3a4ffc3fd0c4903e08c4ba3f085e83be4ebed23f40d124bdb81385be2c9c643fc26dbbbf1018a63e20f3ecbe9cd536bffab4913f284c2b3fa84eb43f603ff53fe692af3f8881df3eb82d953f00db353e007ae0bd903f37bf5cbde9bf4837973ec68ad63f925193bfb25a893f0883893e488efb3fe8f7b8bf08f7bbbe8017c2bc800911bdcca755bf661ef03f00c9ca3d92c0893f1087243e18fa573fb81f6b3f2eb08a3f74fdcd3f80eaa63c6e3d913fd8d27abfea93c93fee1b9e3f1403dd3fdcc667bf66a8f83f8614a7bf80a4573e4c70573fc051adbecc58f13f5c19b8bf807fb8bdb01c163e0093bb3fe802f4bf66d2a43f8868eb3f98cf6e3f66cca3bf2e37a63feca3a53f8077d63e5c1878bfa87bb43fae6e9e3f6a1ed9bfb6a2cc3fe05ba13e465283bf387fcc3f087def3f7aacdebfe896b83ea8b07fbf34c8203f6c5525bf908824bf3869d73efa5994bf3638b9bf1470133f7aaf963fb46191bf3443483f9217ef3fd80b3b3f2200ef3f64d0e03fc00cd43d7c43703f"}],"ok":0,"error":"the control vector has no direction in layers 1..5"},
{"name":"zero_direction_project","options":{"first":-1,"last":-1,"mode":0,"single":-1},"files":[{"label":"z.gguf","scale":1065353216,"bytes":"474755460300000001000000000000000100000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f720b00000000000000646972656374696f6e2e32010000002800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}],"ok":0,"error":"the control vector has no direction in layers 1..5"},
{"name":"wrong_architecture","options":{"first":-1,"last":-1,"mode":1,"single":-1},"files":[{"label":"w.gguf","scale":1065353216,"bytes":"474755460300000001000000000000000100000000000000140000000000000067656e6572616c2e6172636869746563747572650800000005000000000000006c6c616d610b00000000000000646972656374696f6e2e3201000000280000000000000000000000000000000000000000000000000000000000000000000000008be6bd983599be5224a2bfa091cf3e5a4ae1bfb078703edc077d3f1070b6be108da3be9c898d3ff06edfbf10017ebfc02bce3e84774f3ff4ae4abf04b2ba3f0074e4be006abe3be6cbea3f209a633fb0451ebf384eedbfe60ab03fc075383d7c75633f0463dcbf42439bbf2c563abf42caecbf963fc2bfbedeebbfd0b7c9bfbc9a493fe8b17c3fd4c78cbfc03262bd40877f3e6023e43fc8bb7a3f687ba6be"}],"ok":0,"error":"w.gguf: not a control vector GGUF (general.architecture is not 'controlvector')"},
{"name":"wrong_shape","options":{"first":-1,"last":-1,"mode":1,"single":-1},"files":[{"label":"s.gguf","scale":1065353216,"bytes":"474755460300000001000000000000000100000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f720b00000000000000646972656374696f6e2e320100000029000000000000000000000000000000000000000000000000000000e8df14bfc077f13e404dc33ebcec91bff031fb3ff008ed3f74f9db3f7c1a703fb61399bf98aac33f0c68df3fd08f743ece47de3f28bdd1bff4bd61bf70f8be3ede51b6bf30d43fbed4ba403fb80fc13f5aaf8dbf30f9253ecc3e863f46dce33f10f72f3f00bb9e3c1276ce3fb82bd73ea0665bbffe46b73fb27ee63f9e26b23fb8802ebf4852743f7650dd3ff46cc93f64c4fcbfa07d8fbd1645e9bf2e7bf23ffa08cd3f00000000000000000000000000000000000000000000000000000000"}],"ok":0,"error":"s.gguf: direction.2 must be 40 f32"},
{"name":"wrong_type","options":{"first":-1,"last":-1,"mode":1,"single":-1},"files":[{"label":"t.gguf","scale":1065353216,"bytes":"474755460300000001000000000000000100000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f720b00000000000000646972656374696f6e2e3201000000280000000000000001000000000000000000000000000000000000002e5c8f3fd6c4fdbf782ff7bec093abbfd84aefbee0d4aabdf419553fdcd55fbf6016913d001606bd42a6bdbfd07a393e403b423d1608ffbf9479f23fc2def1bf54e5d4bf509c4b3e8c6cbebf10ed113e9c83cd3ffe95acbf64f5603f8cafc5bf981027bfc246843f80e61d3d1c31a63fe8a8b0bfa4c6e63fd2b5913f9283e63f6477b9bf8cfbe9bfc835973ee8162d3f283154bf143ede3f74a15a3fe8c240bf"}],"ok":0,"error":"t.gguf: direction.2 must be 40 f32"},
{"name":"no_direction_tensors","options":{"first":-1,"last":-1,"mode":1,"single":-1},"files":[{"label":"n.gguf","scale":1065353216,"bytes":"474755460300000001000000000000000100000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f7207000000000000006f746865722e3201000000280000000000000000000000000000000000000000000000000000000000000038aa39bff00c733f6c6aee3fa441bc3fa48176bf2e8594bf602d233ffc5acd3f4c93a63f00b72fbfe0e9333eb841af3fe83995befeea9bbf40c40fbd5ab2a73fccf92d3fccdef0bf30ea023f58bcfc3fa057debe2071c6be64ee1fbfb0bd81be1cfa64bfb2a2933f4065443eccbca1bf8095dfbc9a6df5bf5014183e6886bdbea83c53bf20b17abede49963f84c14a3fdcb8e8bf600b2abf526fd63f0071e03c"}],"ok":0,"error":"n.gguf: no direction.<layer> tensors"},
{"name":"only_layer_zero","options":{"first":-1,"last":-1,"mode":1,"single":-1},"files":[{"label":"o.gguf","scale":1065353216,"bytes":"474755460300000001000000000000000100000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f720b00000000000000646972656374696f6e2e300100000028000000000000000000000000000000000000000000000000000000ec497dbf60e82abe08bab6be4438a7bf6474313fb278ecbf903071be3ad2cebfd2b4ecbfa2b28bbfe0e4c43e0086393c98ff7fbfb2d0e03f081064bf2046fcbdb085b63f921e8fbf980cb0be608ce83e3e78e63feccddebf526ffbbf2c85d53fc6ecf0bfbed3923fb213c8bfe4dc553f8050873f10fa3bbe3223963f085a49bfd0dc9abecc1794bf04db42bf204dddbfaeceb6bf80deb2bff8299a3f306ca63e"}],"ok":0,"error":"o.gguf: no direction.<layer> tensors"},
{"name":"truncated","options":{"first":-1,"last":-1,"mode":1,"single":-1},"files":[{"label":"x.gguf","scale":1065353216,"bytes":"474755460300000004000000000000000200000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d000000"}],"ok":0,"error":"GGUF: unexpected end of file in header"},
{"name":"bad_magic","options":{"first":-1,"last":-1,"mode":1,"single":-1},"files":[{"label":"m.gguf","scale":1065353216,"bytes":"584755460300000004000000000000000200000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f721800000000000000636f6e74726f6c766563746f722e6d6f64656c5f68696e740800000008000000000000007177656e346578700b00000000000000646972656374696f6e2e300100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3201000000280000000000000000000000a0000000000000000b00000000000000646972656374696f6e2e330100000028000000000000000000000040010000000000000b00000000000000646972656374696f6e2e3901000000280000000000000000000000e00100000000000000000000000000000000000000000000000000b4af123f00159bbc6094d63fa2e1f93f3aeacfbf9cfcd33fec02103f4c38f73f3ae6ee3f38db23bf580254bf0068b0bb0486163fc806f7bf40520abff4c15f3f38ad3c3f6888f43f065d863fa03d38be9859673f006165bcf0e89abfe0f3d4bd5ab8f33fccb37ebf90a4fe3f043b9dbfb0b5023e3c55063faced093f8cbc7abf708b253e7003043e5cdf37bf04bcc53fc497d63f508c4c3fde79933f447ed53f124293bf48c9693f8290d9bfe809c6bf8a39923f70b7fabf9e8f8abfe635c0bf30f03d3f66becebf589cac3ef88cac3f88e0173f7293973f483e003ff2c59a3fe8769c3e3886d13fc08fe7bd0ad28a3f6cd4f53fc0ef7ebd80d1c5bf8ec5dabf08b7c2be3a4ffc3fd0c4903e08c4ba3f085e83be4ebed23f40d124bdb81385be2c9c643fc26dbbbf1018a63e20f3ecbe9cd536bffab4913f284c2b3fa84eb43f603ff53fe692af3f8881df3eb82d953f00db353e007ae0bd903f37bf5cbde9bf4837973ec68ad63f925193bfb25a893f0883893e488efb3fe8f7b8bf08f7bbbe8017c2bc800911bdcca755bf661ef03f00c9ca3d92c0893f1087243e18fa573fb81f6b3f2eb08a3f74fdcd3f80eaa63c6e3d913fd8d27abfea93c93fee1b9e3f1403dd3fdcc667bf66a8f83f8614a7bf80a4573e4c70573fc051adbecc58f13f5c19b8bf807fb8bdb01c163e0093bb3fe802f4bf66d2a43f8868eb3f98cf6e3f66cca3bf2e37a63feca3a53f8077d63e5c1878bfa87bb43fae6e9e3f6a1ed9bfb6a2cc3fe05ba13e465283bf387fcc3f087def3f7aacdebfe896b83ea8b07fbf34c8203f6c5525bf908824bf3869d73efa5994bf3638b9bf1470133f7aaf963fb46191bf3443483f9217ef3fd80b3b3f2200ef3f64d0e03fc00cd43d7c43703f"}],"ok":0,"error":"not a GGUF file (bad magic)"},
{"name":"version_2","options":{"first":-1,"last":-1,"mode":1,"single":-1},"files":[{"label":"v.gguf","scale":1065353216,"bytes":"474755460200000004000000000000000200000000000000140000000000000067656e6572616c2e617263686974656374757265080000000d00000000000000636f6e74726f6c766563746f721800000000000000636f6e74726f6c766563746f722e6d6f64656c5f68696e740800000008000000000000007177656e346578700b00000000000000646972656374696f6e2e300100000028000000000000000000000000000000000000000b00000000000000646972656374696f6e2e3201000000280000000000000000000000a0000000000000000b00000000000000646972656374696f6e2e330100000028000000000000000000000040010000000000000b00000000000000646972656374696f6e2e3901000000280000000000000000000000e00100000000000000000000000000000000000000000000000000b4af123f00159bbc6094d63fa2e1f93f3aeacfbf9cfcd33fec02103f4c38f73f3ae6ee3f38db23bf580254bf0068b0bb0486163fc806f7bf40520abff4c15f3f38ad3c3f6888f43f065d863fa03d38be9859673f006165bcf0e89abfe0f3d4bd5ab8f33fccb37ebf90a4fe3f043b9dbfb0b5023e3c55063faced093f8cbc7abf708b253e7003043e5cdf37bf04bcc53fc497d63f508c4c3fde79933f447ed53f124293bf48c9693f8290d9bfe809c6bf8a39923f70b7fabf9e8f8abfe635c0bf30f03d3f66becebf589cac3ef88cac3f88e0173f7293973f483e003ff2c59a3fe8769c3e3886d13fc08fe7bd0ad28a3f6cd4f53fc0ef7ebd80d1c5bf8ec5dabf08b7c2be3a4ffc3fd0c4903e08c4ba3f085e83be4ebed23f40d124bdb81385be2c9c643fc26dbbbf1018a63e20f3ecbe9cd536bffab4913f284c2b3fa84eb43f603ff53fe692af3f8881df3eb82d953f00db353e007ae0bd903f37bf5cbde9bf4837973ec68ad63f925193bfb25a893f0883893e488efb3fe8f7b8bf08f7bbbe8017c2bc800911bdcca755bf661ef03f00c9ca3d92c0893f1087243e18fa573fb81f6b3f2eb08a3f74fdcd3f80eaa63c6e3d913fd8d27abfea93c93fee1b9e3f1403dd3fdcc667bf66a8f83f8614a7bf80a4573e4c70573fc051adbecc58f13f5c19b8bf807fb8bdb01c163e0093bb3fe802f4bf66d2a43f8868eb3f98cf6e3f66cca3bf2e37a63feca3a53f8077d63e5c1878bfa87bb43fae6e9e3f6a1ed9bfb6a2cc3fe05ba13e465283bf387fcc3f087def3f7aacdebfe896b83ea8b07fbf34c8203f6c5525bf908824bf3869d73efa5994bf3638b9bf1470133f7aaf963fb46191bf3443483f9217ef3fd80b3b3f2200ef3f64d0e03fc00cd43d7c43703f"}],"ok":0,"error":"GGUF v2, this reader handles v3"}]}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,578 @@
{"mode":"fused",
"q4":[
{"x":[1050397984,3213307544,1070036736,1073741824,3210671704,1052328624,1062556224,3191331584,1074280832,3192392512,1077468724,3216005708,1069278248,3206413048,1053998080,3213541664,1060273592,3213155368,3202853008,3204903008,3221225472,1061321016,3217158536,1057047216,3203295408,3205483984,3204434080,3196421664,1071746220,3213914016,3211846208,3205566488],"block":"c7b567bb9492ea67c67892a9909c34bab7ab"},
{"x":[974866841,3144371261,3153611970,3162971914,977030758,1013340206,996687011,1005055262,1005657907,3155799388,3119007826,3155130265,3127772774,3150798315,3154191959,967580549,3145545502,3153994393,1008260470,999992330,3150107556,3165440043,1005003100,3121863967,995237785,999507671,969731113,1011348710,3157310602,3149061581,999683133,997454336],"block":"66197857c5a2680db98b9ba488d54866a598"},
{"x":[3283225643,1130229586,3282107253,1133815663,3289185351,1107572548,3276530343,1133523838,1133066113,3255597246,3237364572,3272647396,3272367806,3258220934,1134155534,3291721920,3286153231,3281387989,1090718982,3289080611,1124755626,3289232980,3275731218,3277134131,1130781886,3282977553,1100761940,3288969918,1132727310,3287661861,1074071816,3279747637],"block":"9e55345a842ba228666bbb488826b6378b50"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1077936128,3225419776,1082130432,3225419776,1080033280,1065353216,3225419776,0,3225419776,3227516928,3204448256,3204448256,3227516928,3217031168,3229614080,3217031168,3221225472,1065353216,1080033280,3227516928,1073741824,3212836864,1056964608,0,1069547520,3217031168,1069547520,1069547520,3221225472,3227516928,3212836864,3227516928],"block":"00b8c26e10fe41a67e885ebf5959cffbaffb"},
{"x":[986506224,984062264,3100564456,965951849,987860174,982345171,986013070,1176256512,3122556060,951592485,982269539,959990596,991818163,965982684,958024844,3100324725,3133307831,990154310,3116687688,964703437,3114884580,3121724810,982960997,3116406096,3072982516,966905431,3129435833,3110397281,980325270,979358270,959040128,3132178330],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2988513686,831561460,2985197520,834393347,846104090,2975112829,2992569584,2988303458,2998797557,840517170,802985668,2979569728,847541788,830749980,842346467,2986492791,2938539594,2977300492,2968474807,2998143047,830243184,2962613551,804060956,2995062625,2983297008,2998527286,852894847,2981564407,841479522,834024549,2986298309,2989967081],"block":"00808b979af674898cdbaff508a95367a5ba"},
{"x":[1048127904,3205685624,3209291496,1051390720,1067174960,3207881936,1058365408,1061912400,1068264400,3197081200,3212408680,1046364352,3188102688,1067987860,1052196688,3224246547,3196955792,1066365760,1058150264,1048682368,3198872272,3212290920,3210259496,3207436200,1074230612,3196123088,1065753156,1066431548,3199544064,3217072404,3208763984,3206938256],"block":"713579b6a6997c566a6aec77b5b9784c6960"},
{"x":[3163174285,3137298145,985931202,1019942492,1007596605,3132281282,993867448,3099569029,1000498299,975908045,3139200307,3157692621,3143626158,1013429949,3143542231,3157458176,3099933409,3110957875,1013933670,3145792799,1011803863,1001444956,3167037444,999294843,3167277115,3154732196,965507809,3163010619,3139851817,993777500,1009003617,3156720676],"block":"599a8d8938904568f778f6b889dc997359bc"},
{"x":[1114191860,3265467048,3280070998,3239977880,1125172148,1116538187,1126938464,1118691606,1133470963,3266733554,1130854767,3278689818,3282523151,3260890971,3253335988,1124465583,3267628548,3276046593,3273196481,3271914074,3230118972,3246679963,3283002476,3280397464,3281651515,1115344573,1125444773,1128256308,1147836100,3274077168,1132500861,3251286538],"block":"55d798a99a988787b7a7b679766a0b986887"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3217031168,3204448256,1080033280,3223322624,3204448256,1082130432,1065353216,3229614080,1056964608,1077936128,1069547520,1056964608,3221225472,3217031168,1082130432,3223322624,3227516928,3227516928,1065353216,1080033280,3223322624,1069547520,3229614080,3227516928,3225419776,1082130432,1073741824,1069547520,3217031168,1080033280,1065353216,3204448256],"block":"00b8fbf9611dd950f6ffe7024557bc1b609d"},
{"x":[3113538569,980119405,985863611,980236526,938436723,963230172,3118914569,1176256512,985632883,967312622,975739339,961908475,990073594,967779402,3129321153,954508838,979720324,954451166,977378616,961811776,3131278779,3129257477,3116894897,3133202379,3126376801,3130957763,983677223,979381560,974790542,987204908,3129879593,976361808],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2998192225,843035841,2978515796,839624112,838221988,2983545998,2986008109,3000292370,2989583621,2992300231,841891415,836241954,849386382,833467405,2978447914,2961079625,2981295080,2978019771,826237633,847828029,2969482149,2999140464,2981616000,2982511426,843093887,846058081,816255356,2999315622,3000042503,2987712422,840978777,2981997286],"block":"0000617c97db7a166660c5c48b1a0e5ab768"},
{"x":[1076142068,1023845888,3198795936,1073741824,1065495452,1074940224,1063043072,3201960000,3218517032,1060709336,3202244448,1041059456,3183012800,3213134864,1065012096,1031886656,1058677288,1066289956,3221639966,1074239088,3221225472,3148390400,1042561248,1038431616,3214372792,1039817344,3190756160,1070457572,3215720184,3212580096,3211142552,3207483776],"block":"25b56058f912e5818589cd869938c8bbb5a8"},
{"x":[3122893127,3153239900,3111616184,1004184391,3144907530,1010671401,3158782622,1015655608,3140612403,1011906642,1010551613,970646814,3145705758,996211630,1010731131,1007321759,1016982748,3155575414,3156586066,995847434,994938572,994315796,3141323550,3147299502,1019691678,1006861762,1002639032,979870924,3160738099,1011248138,1008147558,3159117583],"block":"3a9a28bab87679749ca209546488d94754c5"},
{"x":[1111074523,1085061424,3269906129,1134493034,1136879760,1135303124,3283624953,3282102917,3275034187,3267818898,3272199000,3284313462,1098958490,3276248934,1133516033,1142153339,3266268966,1133165239,1134143216,3269967760,3249735688,3268231416,1117094931,1126320914,3263474916,3256005058,1112093998,1132748249,3289200358,3275299003,3285779947,3280680734],"block":"9fd497484aa483937d6c9a897a4df8bbe4c0"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1077936128,3227516928,1082130432,0,1056964608,1075838976,1069547520,3223322624,3225419776,1082130432,3227516928,1082130432,1075838976,3223322624,3229614080,3221225472,1065353216,3212836864,1077936128,1073741824,3204448256,3221225472,3225419776,3217031168,1080033280,3225419776,3221225472,3204448256,1080033280,3204448256,1073741824,1065353216],"block":"00b862af204897c3e5bd1ee0cf90139d4f6c"},
{"x":[3118028817,967606879,985210393,980055573,967758939,3142807548,3133008340,1176256512,3137389927,970855089,959142560,3096961942,3125318591,982611772,3123221857,961883538,971730191,964049143,973155042,3128931190,947809682,3128192795,963702359,3059874792,981581034,984831550,3102725768,948568196,3124280378,3100934931,3122314593,3122520097],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[844904571,841853710,834871398,848640046,2981236035,2988228967,820173182,831840096,844920730,2996239569,2970184440,2951321438,841165356,812685616,845203361,2962113917,845501168,2983852207,830156211,2990665663,832871318,834345200,2969395476,2956221072,826002999,822388355,2985497845,817298690,2987967865,2991823500,845366135,830183763],"block":"0000ee5dab3fa6a4798a9e9057984c28eea8"},
{"x":[1052545024,3199656480,3193795168,3164496384,3222282250,1062097096,1060981144,3200043952,3188019232,3209078344,3216384408,1066723236,3205195632,1059599960,3216503660,3196508512,3177266944,3221185976,1066843060,3213825972,1045344128,1063551704,1058761104,1036971968,1066415588,1059030832,1074383096,1058305672,3197969968,3216157808,1021176832,3174124288],"block":"81348917c74890bbab87c8a5f3ac763a8387"},
{"x":[1007484528,3153005465,3142403256,3112249262,3140645642,1002897797,1017261639,1007510390,1007879506,998584453,988058214,994122281,3139802767,3159826227,3160593213,3140900741,3155856855,3166812024,3133522002,1015118392,3160915154,1008472985,3148868065,3152127426,3152463790,1010533237,1006378086,3162098524,999906334,1022904719,3161746939,1010133837],"block":"c29ba6ea8948c95693a6a65768c7790bcc59"},
{"x":[3273120440,3254159938,3274588734,3284575920,3269466704,3279775153,3283510423,3275314228,1128562111,3286266195,1142661086,3277312687,1111603498,3283069072,3255809496,1122931206,1127956720,3277058550,3285282912,3258436971,1108992673,1099153640,3282573908,3254278813,1121115494,3285154212,1118822106,3279558900,3271618462,3254978196,1134851670,3275714343],"block":"ddd46ab8da9d898bcd8a75de70bba78d48a6"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3223322624,0,1077936128,3229614080,1077936128,3217031168,1056964608,1082130432,1069547520,3217031168,0,1069547520,3212836864,3229614080,1056964608,3229614080,1075838976,1082130432,1082130432,1080033280,3229614080,1082130432,1065353216,1077936128,3204448256,1073741824,3212836864,3212836864,3227516928,1080033280,3223322624,1065353216],"block":"0038d3f8fef00ef5a9ef7bc5686b16f039a0"},
{"x":[3095971103,3128736474,977232536,986114557,3123294077,978275755,3116566283,1176256512,3136707560,972369872,990012939,986172839,3131686917,3120501818,3117708313,938392683,3122379523,968376878,3127676306,950057173,979486901,983444177,3116581520,976398017,3131521786,978133329,952465753,972794299,3125693351,982336803,970824926,3103144346],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2962056451,2992371678,2981448357,2980754537,2973849207,818717876,835844455,839573458,849626503,2971957489,2989807706,845310257,830993086,832858057,801994046,817974116,2994311473,2989959211,2997847382,850841429,818780196,840752481,2997545827,843915246,2994124727,843313269,2975386462,822211552,2988954532,832124842,2991885380,831329747],"block":"0080d8cdfa0a7957f645d1499c73c766d867"},
{"x":[1035101760,1058417672,3196526656,1073741824,1068455248,3199460000,3206255376,3202015440,1064589088,3216645228,1059559936,1027761664,3213472232,1061502000,1075017500,1027045760,1069906616,1058240512,3207255464,3197078496,3221225472,1053851312,3216260920,1047134336,3213698684,1069208208,1056802992,1024838784,3200430304,1049722912,3204797416,1017682944],"block":"9cb43866a991f379da79c53d66889c75a088"},
{"x":[987022377,3139158876,1009949619,3149005045,3151030825,3138413773,3161930137,3164845424,1006796109,3140284416,3162818875,974959411,3148874004,3148805038,1011515407,1008342313,3145060208,3153891205,963346759,3156662323,3163622571,3153436006,1007446968,1009956659,3158983352,3166975713,1005118105,3154992153,994734551,983819305,1005077135,3155011374],"block":"221a79578c562657b3c14b07a3589686ac5b"},
{"x":[1140399510,3256291858,1080007016,3283503476,1131364523,3288026539,1084388824,3289356801,1118104056,3282685484,3274306134,3288987632,3263812266,1117273487,1141433749,3250081138,3271021116,1128055767,1117449475,1109098798,3268191066,3281024403,1138848224,1134744467,1142772002,1116049675,1137769353,3282867172,3274198359,1108009310,1111264686,3240484430],"block":"ebd4a268788d95ce284f077c3acfa9877188"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3223322624,1075838976,3227516928,3221225472,3223322624,3221225472,1077936128,3227516928,1073741824,3229614080,3229614080,3223322624,3204448256,1069547520,1080033280,3223322624,3212836864,3217031168,3229614080,1056964608,1080033280,1077936128,3221225472,3212836864,3227516928,3229614080,1073741824,1056964608,3212836864,1077936128,0,1082130432],"block":"0038635d0194f3e44e611c00c09367eb8ff3"},
{"x":[977466655,3125557109,990391964,987854124,966815482,984909628,979160245,1176256512,973003785,980706247,3127636813,3126305301,3133750670,973767893,954490815,955308704,936822178,3121499104,973782074,3106863678,960579634,963336275,3119579596,976001328,975088223,971150460,3126820848,960906298,976694518,977744962,3126938543,967218578],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[826946088,840052589,2967365460,2981191615,813885780,2986599757,823418696,840705939,830866760,836057786,826010752,833061145,2980410875,2995861532,2930333779,2988801083,851619387,825316857,849320667,2969973600,2965382216,2978364571,841065079,2986474773,842698353,792251321,849876666,822209727,2989967145,843891726,844505412,796985084],"block":"00800775199a889b57b547861776ca4e488b"},
{"x":[3180776128,3220221252,1058921440,3207900128,1044385536,3213075448,3218991852,1076186212,1068810428,1072444312,3218160488,1067315320,1044226816,1071004568,1066314824,3213233852,1072360776,3215896608,1061091632,3212997424,3205026160,3207972424,3204011184,3185940480,3191334592,1067554696,1054779872,3206538408,1062081128,1059646824,3219892640,3199964016],"block":"2ab528ce66baa7abad8094427da46763e59b"},
{"x":[3131719639,1018832368,3146879478,995555983,999352125,3155478917,3143800770,1016307092,3163720558,1011316582,1019444592,3161520660,3155689421,989634150,1010179538,1008552627,1013885706,3140798791,3153070950,981354250,3158035179,1005021911,994753413,996902727,3147199457,3154549698,3093529886,998822871,3151711682,3137891717,3157779077,3150189148],"block":"1c9a3890a987c76b7972aeb4807dab97c4a5"},
{"x":[1134467460,1133259022,3262489371,1114977786,1119986800,1116220637,3277466934,3235009272,3286963222,1134387641,1088264824,1124998776,3273797362,1099462790,3265890198,3280073590,1142271644,1133475008,1128890002,3279993626,3261895858,3273774993,3255875271,1123570618,3281727073,3283406150,1140683408,3279162215,1143898089,3277859850,1118357350,1106354690],"block":"74d5145569b797a78b78cdc428b60ab8798b"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1082130432,3204448256,1065353216,3221225472,3204448256,1082130432,3227516928,1056964608,1080033280,0,3221225472,1080033280,3204448256,1077936128,3217031168,1075838976,3212836864,1065353216,3217031168,1056964608,3223322624,1056964608,1056964608,1065353216,3227516928,1056964608,1073741824,1080033280,3229614080,3223322624,3223322624,1069547520],"block":"00b8a069b67cd9707f67f1784c11f9d2db53"},
{"x":[978170528,3127763174,978371724,3124782187,3122798560,974458217,3124914775,1176256512,3132528235,982561866,977748264,973902422,970905879,986606449,986421519,981400388,3123063571,3088326984,3123516875,987273741,968933147,963972039,970539517,982632518,973302424,3124927054,973895713,976988316,3130583409,973590889,966821495,3125302117],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[832858862,816943066,832901586,839391953,2970193030,2981566490,2977905116,814777544,2988443844,826672971,847053273,2990301541,2936330950,844021670,2976983395,2957485682,2992597754,2982191762,842494917,841019338,826205936,841309720,831848364,2977163891,828263505,2996325890,834521369,2971298855,813026207,829661753,840232086,843963828],"block":"00002a59dacc97c6a6689409af7388adc6d8"},
{"x":[1041202016,1060611480,1047301792,1073741824,1038661824,3203446000,1049604896,3222087018,1037559936,1065871540,3171143168,1049628896,1064796208,1034394432,1050764688,1065078080,1058267120,1070046724,1010174464,3205781048,3221225472,3219140212,1075637720,1014163456,3217606924,3175386368,3200809024,1045261184,3189172032,3208189464,3215752224,3210118888],"block":"e7b4683687a1f8ea078fd885987785a8c7b5"},
{"x":[3140703600,3155463757,3156456637,3155685601,3123390546,1008530125,3157284239,3157061063,3152959283,992788541,999209103,3139876475,3163329705,3156276470,3138321858,990037504,3145879736,3151965204,3151394631,3151663186,3121987502,1003811850,3148946247,3145418506,1015352735,1007743022,1014579210,3156236431,3156744878,963373957,3146656870,3158581084],"block":"65186754535488bc5363f5c9fa3730836729"},
{"x":[3273154359,1129227108,1113566736,3280950359,3274383028,3269868329,1136591300,1093220382,3256085758,3287039075,1133789900,3261842046,3290584023,3260735196,3281189187,1133736838,3283722551,1140962964,3282361704,1136255970,1137876106,3287255051,1128926555,1117975206,3235136472,3265670860,3275050668,1122122875,1129305755,1137413164,3258241221,1132660677],"block":"135536eb49d4d627ad9888726c97b0d774bc"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1073741824,3221225472,3223322624,3212836864,0,3221225472,3204448256,1082130432,1075838976,1077936128,3204448256,3204448256,3212836864,3217031168,3221225472,3204448256,1075838976,1065353216,1073741824,0,1069547520,3221225472,3227516928,1069547520,3225419776,1056964608,3217031168,3229614080,3217031168,1056964608,3229614080,3223322624],"block":"00b8346c4d8a58ccf950e372b9f9ba7bfcd9"},
{"x":[979816826,965008458,985973109,3096998511,3127303029,964769383,3118577009,1176256512,3132605719,977854891,3141164197,3137405127,979325535,3098530939,957284516,986587104,934294848,983389651,980336559,976596911,3114881238,959814140,3120764994,3125884847,3134905353,3121868145,3131349009,986096751,3132081292,968852702,3123832783,3126918497],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2990236359,2987221153,839237410,2977062766,805408395,836448972,844198966,2981848100,2976614522,822393960,780411277,840911668,845766281,2995402851,2998629171,2983403050,840351760,818250025,2981582296,842774847,2965327197,850577261,851020856,844459445,843800941,847478579,2979452078,829790666,846879423,823172036,804367960,846437466],"block":"0000b4956bc778fafcd6c7e9689bdd9280d6"},
{"x":[3188534816,3220524520,3216584784,3216820556,3210547168,1066037640,3199749008,1057240520,3206833792,3219485840,3224046989,1068542020,3196020800,1052128000,3206121120,1058124160,3183290880,1057324528,3173440768,1074496092,1067410136,3208386424,1077584964,3189587264,3192021152,3221445382,3206023552,3197641840,1066828120,1039555712,3194097888,3170242304],"block":"d5b5887d8c2c5aa509879aedaf9459879a86"},
{"x":[3149531115,3137346990,1014089487,3129148211,3134601830,1007831634,984309350,3154708746,3153092444,3150228377,934763561,3163899771,3163829158,3142596178,3146725345,3156526592,989995151,1001035407,3116049694,1007312174,998545869,3160985118,3125949644,3142811709,3155096299,3137841111,981417083,1008286438,3158034278,3149831137,1019412946,3139567124],"block":"189a7a69835879d5889bba9a885ecea9099b"},
{"x":[1144137068,3262860584,3267120535,1134169639,1125267052,3284572812,1118718231,3265977779,1120130294,1135341477,3241530230,1127572945,1127786948,1134439981,1091449782,1112774173,3289082080,3276822487,3280897390,1128841561,3222670864,1136808819,3257903271,1143911046,1109068610,3281162529,1132844263,3257379284,1119621344,1135550647,3263491604,3275623837],"block":"91d5e0a9b965864c870987b45886764498a7"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1069547520,1075838976,0,3229614080,3217031168,3204448256,1082130432,1080033280,3227516928,1077936128,1073741824,1077936128,0,3227516928,3223322624,1080033280,1080033280,1077936128,3212836864,0,1065353216,1056964608,3229614080,1082130432,3227516928,3204448256,1080033280,3204448256,3227516928,3227516928,1080033280,1075838976],"block":"0038fbed6880a5970fff117efc7e1811f3df"},
{"x":[943623373,973372318,977037730,3127181051,960990348,3127947199,3130904728,1176256512,3130003690,3121981113,3116560237,974571422,961589609,944143860,3130108060,3135857165,959389860,3133189850,958030250,3129056998,3130309452,3112163706,3113526805,3116599788,987806463,973123396,3132769125,962377483,3132157072,971271177,3099880457,972359779],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[843851283,2967982947,832146370,2992148232,2986310335,828480100,2981269225,802166876,837000789,839933436,841519224,2987488552,805615842,2987527728,2979804856,2955824475,2989383191,2960987025,831928583,2985716706,2979649625,2964555478,833063346,2989091445,2974539108,2984087786,816703794,818456871,809006976,839033361,2997131218,2988163104],"block":"00004d87aa536579a6487b5c9c9488b40648"},
{"x":[1067868544,3205803000,1034638144,1073741824,3184921280,1017446912,3203881744,1057190432,3208095776,1063963168,1056076656,1067274972,1029539328,1040453248,1074245696,3217929816,1036725504,3209197856,1071400028,3202647520,3221225472,1034732288,3196038112,1059540344,3197705136,3216249488,3210181168,3205900768,3203159904,3218638516,1075126348,3195218048],"block":"a9b484ba28a1f8889a669ad5b6a4a8e8019e"},
{"x":[984555274,3130017997,3130357514,3130941194,3153965250,1015764219,1009451126,3161232384,998977607,3162911606,974341570,1006522747,1000885852,3135587000,1018291353,1014543006,1007310643,3159900149,3153896509,999504722,3163237168,3151174318,1008864589,3154886866,3122465997,1013669155,3168518471,3164814420,1000904253,997920338,3168350150,1010513607],"block":"de1ab8486898366dbb5489c3082aaa970ebd"},
{"x":[3268870379,1107951186,3277229559,3237782172,3280001876,1140908967,3279267450,1113354223,3268794404,1098400782,1137564181,1139454636,3263517666,3264578392,1134206150,3282554558,1127103961,1140837617,1133210656,1077795416,3257133921,1141588603,3248531038,3281795989,1134774992,3281989709,1115964756,3285968867,3285748058,1138610103,3279927628,1120760837],"block":"5ad45a184b889c018cc73ad872e1e929c47d"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3229614080,1056964608,3212836864,3221225472,1082130432,1077936128,3223322624,1056964608,1080033280,1082130432,0,1077936128,3225419776,3227516928,1075838976,3223322624,3229614080,1077936128,1075838976,3223322624,1065353216,3221225472,1065353216,1080033280,3229614080,3217031168,3227516928,3204448256,3204448256,3212836864,3225419776,3217031168],"block":"003800e9d634af4ea3f90f5f187e72612d53"},
{"x":[990208414,950562718,953714345,3123615360,966510920,934084871,966617449,1176256512,3113176499,990209807,3137239164,3111970866,3137764939,3132581233,3094439527,3089531929,981357053,962228159,3087771894,3134984750,983799755,978185225,969581692,3123141493,973076399,3111406077,981182194,973743473,929428931,968860189,3129993757,3125154808],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2991638919,822167722,2955715297,848384533,2989902458,2970355251,2980374637,833562281,2936933963,2992680287,2962115635,830825668,851980588,822603039,840908044,844366191,841566968,2978577171,808063372,837559929,2964110648,2989015553,840192959,814552874,2971258826,839148031,2979213063,827876851,2982268878,2993817380,850154529,824701646],"block":"00805c9788628cb95a86985c9877a0d71574"},
{"x":[3208318016,1061578328,3198785968,3194836160,1025040512,3221280772,1059596232,3219583300,1049239392,3211140816,1073588152,1042137024,1057057568,1058918336,3216401260,1065439224,3205778600,3190686176,3191323456,3221800304,1073874448,3217579052,1052433376,3189494720,1061011536,1052909744,3215451312,1054868512,1069077716,3198790800,3214998816,3222622614],"block":"ab34657b7717f8319a72b9954fa9da7a430b"},
{"x":[3127109386,995262668,991272100,3158683504,1007021604,3151416115,1009768965,1002479042,3154339389,3168963852,1016198169,983892418,3160066601,3154612234,978309529,3155521966,3163452475,989397729,3129655009,3150617241,1000596961,3153469962,3128147558,1007874667,3125432156,3145371525,1005393285,3145226014,992273899,3162037135,1001054003,3158768609],"block":"141b389989659a668bba8670ad789446a845"},
{"x":[3240766580,1125359639,3245571380,1130706876,1126278173,3291436394,1114100998,1134248075,3283915662,3283923518,1147674044,1141299761,1138082122,3268536554,3282844920,1032798976,1114543948,3277805718,3265671610,1123248006,3280513592,1128557733,3269563492,1142407980,3273075534,3277750124,3276902334,3286216100,1124444470,3285331798,3274401009,1126885476],"block":"41d778a79876a76e98359baba0c374c99b78"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3223322624,1082130432,1069547520,1065353216,1075838976,1065353216,3227516928,1065353216,1080033280,3217031168,3229614080,1056964608,3221225472,1080033280,3204448256,3223322624,3204448256,3229614080,1056964608,1056964608,3225419776,3229614080,1073741824,3217031168,0,1077936128,3227516928,3225419776,3227516928,1075838976,1073741824,3225419776],"block":"00b89df07576e3f64fb6812bffe7fc3149ed"},
{"x":[978608440,954940458,969008874,3117899007,3122132460,3126469100,3129573921,1176256512,981370463,3123490128,3121926497,966260573,3134607066,3113233171,983265616,3125739259,954526532,977376715,961246757,965357454,3119432942,3131710280,967831684,972778456,3121705984,959142790,3066705216,982355522,946297767,3120081011,3132701254,977848616],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[823841106,812589666,2991687119,808163101,2987824488,2989296143,2995634545,2989476966,2994921130,2995590042,833300117,836796070,817694041,817479766,2975771871,842146530,2986709273,849789556,2999979038,823943885,2957497880,833702501,849900391,843952366,2980389916,852986035,2981541987,2982651399,838292619,829289766,845575256,839076627],"block":"0080a728fc788b6b2d4bad0da6a668784965"},
{"x":[3204841240,1066415696,1060216240,1073741824,3213655380,3210398768,3199682256,1071147888,1054839600,3207880248,3200237568,3222081380,3189025440,3191645472,3181398336,1060512016,1067785888,1071387884,3215368832,3200176352,3221225472,1057747200,3171453696,1064349616,3221302706,1060085816,3209199200,3216286780,1021432064,1058954256,1066905496,1063014176],"block":"6834d6ec3b7f14a587be1aa5573087a7c8bb"},
{"x":[3133498818,961144094,3149858232,3151731691,996026982,3110515507,3164595126,983089479,993377669,997077319,3130033971,1001303367,3156372505,3161295815,992313221,1009562204,3151595663,3140806820,998565161,3151158046,3141613691,3153887959,1006935045,1012047826,3160589404,1008736522,1008614635,3145405112,3138935070,1003272970,3146494392,989324165],"block":"ff185778a6557958b0d829c9c86a74b2699c"},
{"x":[3265522604,3280808332,1135452013,3281947808,3274294218,1135636269,1123516544,1128435539,1122179256,1131588576,1130993508,3272545396,1137563910,3285252612,3276343012,1100648090,1129162476,1111007173,3288931565,1145854628,3277862765,1143663105,1116561118,3280847637,3289536379,1126756702,3283868459,3284670622,3285189495,3279361724,1116894306,1128421542],"block":"63d6698bd50baa1577b6e766c6c9c4ac7a68"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1080033280,1069547520,3227516928,1075838976,3229614080,1075838976,1065353216,1056964608,3212836864,1056964608,1056964608,3221225472,1073741824,1075838976,3229614080,1075838976,3223322624,3223322624,3204448256,1075838976,3223322624,1065353216,3227516928,1082130432,3212836864,3225419776,1075838976,1069547520,3229614080,3204448256,3217031168,1080033280],"block":"00383f3b71dd30ad1af96629d9b40c7d50fd"},
{"x":[3096856036,983050146,980724638,3115608179,968183153,974882243,3128739505,1176256512,3107915433,990672462,977963459,965181719,3128257832,960741639,970273162,982945985,985337517,3120864142,3120734905,988767917,959429641,986737722,3120530638,3120787293,3122988205,3130170115,991647822,3072294126,979152733,981781504,3125182088,3126350152],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[834713622,824744982,826551123,2976590255,2989257477,2988782508,2966180307,2988568361,2986838584,2995981708,2993946229,829443848,2964337766,834848839,2993816258,2937222585,2987841566,2996355700,842646948,2978451286,832036290,838020651,846272271,843225206,830950093,2995178836,788642518,2967148006,838927372,2945971970,834179683,2968460333],"block":"00004b09d966a3b4e7d4a410827ab78ba278"},
{"x":[3216820712,3190790144,1067468196,1057902632,3186742784,3219495860,1057862376,1069337624,1052871072,3162742272,1068451652,3211859136,1059525976,1059762600,1038439040,1064332200,1059917032,3218436588,1064648504,1068970580,1065696760,1060816040,1059620456,1049904912,1057224440,3209017080,3202667104,1057684576,1065721408,1070285044,1017704192,3221254040],"block":"0334b217cdeac8b1ba9eaa586da4cbeb880c"},
{"x":[1013946281,3131872010,3157928279,3089474519,1009615606,3145002147,3149579991,3141261639,3163755909,3137501798,1017635947,3153553428,3149095977,3146020014,991434649,3155830912,3164239472,1006617006,3153629153,3143418695,3132704112,3158099620,1008532848,3158324710,3152626083,3157687900,966305546,3165258388,3160222402,1014850181,3158224466,3162515932],"block":"50191eb754787c47c63751478f0536e64924"},
{"x":[3253553863,3258633546,3212394048,1141421660,1137692549,1142897458,1134712231,1105734815,3263503060,1127452139,1112034748,1126442555,3216025856,3284719545,3258820258,3270761466,3269934610,3266778535,3288479692,1136693586,3293795254,3276441993,3262761358,1107665548,3284901476,1125701226,3286552723,3258650084,3282383028,3277724362,1119559618,3249993088],"block":"9b56787838cd0c6e7b88479a488a58649887"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3227516928,3212836864,3223322624,1075838976,3223322624,3221225472,1056964608,3225419776,1065353216,1082130432,3223322624,3217031168,3221225472,1082130432,3229614080,1077936128,3229614080,3204448256,1080033280,1065353216,3221225472,0,1065353216,3221225472,3223322624,1077936128,3221225472,1056964608,1077936128,3212836864,3229614080,1080033280],"block":"00b8ff9a1d63cd8c67ced620cd7b2ca0ff12"},
{"x":[3136086557,3130435945,3099484161,982387069,982219375,3122179974,957207708,1176256512,981239588,3127492854,3132485923,973749592,3140299109,977858708,3107427550,957738320,958197990,3124309255,3124494533,971755422,3137764734,982926762,3138780501,3124722762,3138778358,956749710,3118665958,3120004941,973144318,3103064851,953711920,981521875],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2986526700,844240569,2987069460,2978796623,825922619,2986444317,2995335057,2989687710,2983705191,832112633,835284209,2975890111,844622509,2986977676,2979972950,847462632,831017309,3000098681,2983705556,827732046,2983680430,2988304999,837919708,809764694,843800877,2978983883,2991872393,845719643,2984906149,2997234453,2993366580,2992841300],"block":"0000960c65976956a385c6794ac76c25464d"},
{"x":[3204087088,1062088592,3212841596,1073741824,1057777456,3211023424,1044897856,3214705756,3219059904,3206413016,1066054244,1052151408,1068192376,3197512912,3215501092,3215112692,3199055296,3213256088,3197564864,3188065824,3221225472,1054443088,1061451936,1056768560,3220684040,1065830748,1045049440,1034795456,1049405824,3172515584,1065896824,1072240816],"block":"00b49ac59c90f66c576dff4a748773894d1d"},
{"x":[3163996779,1006968366,3164534704,3140542853,3126856007,1021123056,3152780359,3155849820,1007709552,961336770,1012933468,957381673,3139880509,995699589,1016485391,3159761541,979615826,3095024107,3144664637,1012075591,1012900981,998608916,3136250798,1011696184,3159084032,3144221450,3155927014,3145012572,992837140,3157149624,945723801,996705792],"block":"e99a8d869e4948709a4bc598b49879b7837c"},
{"x":[3263129984,1123497100,3285463025,1120186768,3291199075,3253841488,3276901162,1123216056,1122171344,3285897875,3288588972,1136499013,3274608262,1114728636,1128282736,3285620698,3272759756,3275279493,3285219078,3256484084,1132756447,1141688027,1132623655,3290812382,3277621228,1137148531,1095284832,3287372417,1121096406,3279116278,1114764673,1122268825],"block":"5e5567693389b0f8b60959d3822c96599a93"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1073741824,3229614080,1056964608,1075838976,3225419776,1077936128,3221225472,3217031168,3225419776,1065353216,3221225472,1080033280,1075838976,3212836864,1080033280,3227516928,3229614080,1065353216,1073741824,1069547520,1080033280,1080033280,1075838976,3212836864,1077936128,1077936128,1082130432,1069547520,1056964608,1082130432,0,3221225472],"block":"00380ca0c9bdf2fed465e2eaf4bf9df68f41"},
{"x":[3134159365,990253486,3127967188,979233244,973389079,3132975592,974069359,1176256512,976671056,973718348,973165790,3101175579,3134768440,3129843757,968632615,3127545308,981804037,972317295,975482233,981114971,974424212,970351576,972070225,974163993,972193514,3108908893,981694882,3077011670,3125847360,3131969238,983493149,987722986],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[806640707,826548567,811362680,811244225,848000458,2995472832,846560951,825490545,831876915,2948118767,2986868423,2979858178,2993231009,838138258,2964047297,2989026204,2969054885,824010822,2988231259,2991445989,2972254292,2995947828,819364827,2966153850,834169794,2993526245,2992935575,2990202402,844997191,833495645,2984450969,2990547514],"block":"0000789948287f009f79ba282436e2ab5733"},
{"x":[1062564904,3200472592,1062959360,3190752704,3196248848,3209554104,1060198960,3193109248,3216793288,3208973520,1051617872,3197329600,3203665152,1063975536,1051144544,1071320852,1068488632,3209688912,3204469488,1028057472,1056967272,3196368128,1053788288,3206424168,1060027240,1073679664,3217802376,1044167232,3218243388,1066405424,3185248064,3193873344],"block":"f8b325baa589699b65a95e0be779fa348791"},
{"x":[1016998715,1011101010,1009290880,3164335042,999803218,990323650,3154558930,3156712663,3138418012,1003949455,3133422387,983108567,3162009441,3147384924,981895577,1019597214,984737546,1005891143,1009127762,1012293606,983396516,984157389,1004092723,3160560650,3148747653,3145978747,3147513354,1008861604,980545044,3159093668,3131349442,998559713],"block":"2f9a8264554e86876bdba996a8588dca8870"},
{"x":[1115690256,1119327231,1136105460,3273111224,1125396680,1100694290,3280042025,1110536173,3285037582,3275063493,3278740481,1099965740,3284915539,3229843272,3271816481,3263278792,3283416725,3279353418,3277326196,3279524653,1133635067,1114166773,3261730446,1135941800,3272620987,1108284073,1141509574,1121843481,1107888373,1133059377,3252861163,3266093260],"block":"50d4d7c7b3ca46789c37ae7b0b688e488a99"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3229614080,1069547520,3227516928,0,3217031168,3229614080,3223322624,1077936128,3217031168,3212836864,1077936128,1069547520,3221225472,3204448256,3229614080,1073741824,3221225472,3223322624,1069547520,1077936128,3225419776,1082130432,3212836864,1080033280,1077936128,3227516928,3225419776,3217031168,1082130432,3212836864,1082130432,3227516928],"block":"0038403bb1e825f063fee5162e5bf467f01c"},
{"x":[970180953,980209575,988599878,986610558,979210970,975802139,981465130,1176256512,3136760124,975549645,3108687643,974699529,3124068189,3129740247,3133771547,978012308,3104724976,3110166889,3100322104,960775980,3124409443,989695436,973799957,975005074,985381102,985970259,982400545,3138431918,978516690,961735165,3122415911,3131736806],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2965973160,839640235,838872890,2994789183,2979094436,2963279185,831381887,2982248928,840363695,2981733586,2980846117,2947468852,2986016216,848450845,845389505,2983169748,2978229515,2994608309,820690082,810259818,2975437271,742915075,848952451,837376631,845201417,835657903,2986955149,824326029,2995788305,2986081574,2970242487,838735301],"block":"0080a9f4758f9a89065b245aca78fbb0925b"},
{"x":[3201855472,3197708240,1068529712,1073741824,3183729856,1067865940,3194296608,3201398640,3213601056,3173259392,3213655180,3209993440,1065880564,3139917824,3215351988,3207404424,1067441860,3218130280,3210429960,1057141216,3221225472,1062398344,3209083224,1052912320,3213011496,3221662710,3200228800,1066166788,1054354784,1057906048,1028242048,3216247680],"block":"3534d6275daf08bd5796440874c5aca88335"},
{"x":[995186892,3139970785,3157323371,3144253337,995007426,3156733163,3145982925,1016321638,1009333130,3155142482,3149954652,1001980242,1016412449,3145932196,3163272678,3108597268,987434926,3141049241,3151980779,3153446871,974510653,3141636526,1006743030,3155647606,3165511641,1008675522,999877028,977310515,3105812644,997784043,1011333140,999935160],"block":"6f19997754578974b65f0cc5a68a8f96d2a8"},
{"x":[1134792247,1133126188,1122224068,3279837487,3250854838,3282068211,1134649541,1103783465,3267560373,1134502344,1102655240,3289490448,1118370212,3278987943,3272232656,1119384362,1125423098,1142418124,3255580408,3268581854,1135604797,3266505066,1140976392,1118407300,1116453812,1140063224,1113906898,1127188673,3285355123,1142271189,1136796425,3282419436],"block":"bfd46404879b389c14787924786fe70b3ac7"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1077936128,3212836864,3225419776,3212836864,1082130432,1073741824,1069547520,3217031168,1082130432,3229614080,1082130432,3227516928,3225419776,1065353216,3221225472,3229614080,1073741824,1056964608,0,1073741824,1073741824,1082130432,3212836864,1073741824,3212836864,3212836864,1077936128,3212836864,1069547520,1077936128,1069547520,3212836864],"block":"00b8427a8e4a4004a54ba0af20af5e265caf"},
{"x":[970094642,972254233,3124296287,951894803,982445769,978303820,3129200161,1176256512,3126569067,982916404,979582477,3115663983,951287874,983722709,3073280312,961890911,978828567,3122200519,3108910007,3127418741,3116655526,3120955949,3128221787,3101113844,986973463,3131344561,3113053979,3113151710,3109543249,3122540413,3129498596,966456902],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2977719295,2994427711,2992039993,832103506,2980239410,2939843889,2970504501,2980736144,2987288825,829210953,845473729,2970890876,827792476,2986468793,834986256,2935509730,853518326,840446019,835893718,811609211,2979236653,2989939615,2994532051,2999698196,828086166,2992607901,851208772,834533706,2970092635,815304493,819065639,2982832077],"block":"0080095c6c8799b8d9fa7bc71469978a86a8"},
{"x":[3211618144,1073239780,1048952288,3212883064,1038421440,3196714272,3214057916,1055008976,3200182880,1004533760,1053143376,3187869856,1064797840,1075762300,1066326872,1044040576,1063403472,1029686016,3200461264,3209027592,1060018064,3196682144,3210631448,3186537664,3214117456,1063591968,1074989236,3197063728,3216745952,3219032588,3175802880,3191385280],"block":"f7b45b8297ab6899bc87c9581798d5e08497"},
{"x":[3158315033,1010037918,1008452695,999116564,3112039874,999302328,3147302410,1009706910,3151239157,1005416591,1003826636,1006036347,994718453,1007916523,992074711,1010794562,3146510500,1006210078,1001818388,1018135040,1003392932,969552036,3146740838,3147141263,3163872453,3148036567,1005039493,1012856949,1007456281,3138853970,3155832760,1018274468],"block":"8d99ac5464066886aaa4faa556355795b704"},
{"x":[3287277509,3277179431,1125521555,3277554506,3289665883,3256554358,3272602143,3271272929,1129930814,3262143958,3231204672,1124924555,3242853080,3266602042,1137180786,3271609143,3287953658,3272900174,1116652412,1117518756,3283193506,3279640387,1137270364,1114510198,1054174592,3263668979,3280164387,1124872176,3285134234,1136073125,1111101786,1085152024],"block":"a35412659a953057d6968b7748aa28d79d86"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1080033280,1082130432,1073741824,1077936128,3221225472,1065353216,1082130432,1056964608,1069547520,3221225472,3229614080,3212836864,3204448256,1082130432,1056964608,3225419776,3217031168,1080033280,1077936128,3229614080,3221225472,1077936128,3223322624,1065353216,1075838976,1056964608,1080033280,3227516928,3223322624,3223322624,3212836864,1075838976],"block":"00b8b11024f2cc26d067357c1ffad9d0a73e"},
{"x":[3135031854,3124941505,3126927180,965912413,3109154391,919508878,987106530,1176256512,983085777,958865736,3129586312,3130962043,965186208,3106321662,3131292333,3129825858,986064520,971166975,937096643,3132423353,3132808336,3127559840,3123526452,3104172802,3124349158,3115119985,3114337698,3118414726,3121297474,987389797,980135199,3125605868],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2992887358,2991064472,2979414830,835342126,840777569,2978374256,2995257614,850655129,2995153745,830181229,2973668797,848407132,831733720,837636240,2969779725,3000968165,843804570,2994145918,839602627,2986869712,2992230357,831386419,2985166392,2996305830,841497330,2992815031,2988001683,842098470,823650796,840043269,2980136287,841355199],"block":"0000c444a76a4b97633eb34957bd99ba77b0"},
{"x":[1067882104,3193437568,1030442496,1073741824,3224035770,1067019860,1056126640,3197849936,1056108848,3205620712,1048292352,3199165392,1079664312,1024755712,3199978304,1054736656,1073347064,3213966200,3207324896,3197629600,3221225472,1068644364,1049561440,1053731680,3221726004,1067721340,3194033760,1058450952,3197821632,1050358928,1067377824,3183215936],"block":"d3b635b8a893de557779d759977990785987"},
{"x":[989139599,3163130276,1015028219,1019515136,3150490009,3157426345,3150727987,3118052638,3159498982,1015389604,1002708941,3144772751,3131495014,1004524933,990054687,1001324523,3154717988,1016016691,998816850,1008278226,1004981289,3160740746,3153595934,3150836777,986762690,1016617277,3153702809,3140336128,3129897042,1001419643,1014115840,1012954414],"block":"259ab72e73506adcbaa87c23b69988663736"},
{"x":[1117923306,1125239967,3282013915,1122884294,1115930106,1139351333,3280592023,3290095267,3281993708,1128846211,1120148818,3281407212,1125504633,3280964248,3275540006,3256491208,3275965528,3280837751,1127735180,3256773508,3277188609,3284025434,1104834290,1136803175,1126658780,3280895318,1144595280,1141674213,3287924534,3277965506,3264176279,3290363800],"block":"c9d5a7b66b87a7c38b4f6bb6072bd6ab9af8"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3223322624,0,3227516928,3223322624,0,3227516928,1065353216,1080033280,1077936128,1080033280,1065353216,1069547520,3223322624,3221225472,1065353216,3212836864,1082130432,1082130432,3223322624,3217031168,1077936128,1069547520,1082130432,3212836864,3221225472,3227516928,0,1069547520,1080033280,3223322624,1073741824,3212836864],"block":"00b80d08dfbd285f06a1c2f186551ddc46aa"},
{"x":[956742894,3109931713,3114556785,985111626,982355551,3114737992,977235526,1176256512,3127372416,966469485,991157674,3130704974,982522463,3116125406,981080974,982349730,3110727582,976549610,966008816,979004155,985920013,972357780,3125136319,982167421,978670265,983459517,985832596,3089794073,976741581,983156822,3134768256,970475422],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[846484061,2986385154,825650490,823229159,2986640173,2969039509,2988226964,851416777,833967898,840258039,2962340477,2994964337,2987878363,2984185948,834387549,844398741,2984342574,839984208,850050806,839310086,833959759,2991639933,828586787,2974246448,830999646,2989335334,810692235,2929865800,2989003145,833124957,843585634,828657225],"block":"0080a35b17576bc97b9076c5888dcb6a4674"},
{"x":[3217533916,3214915064,3202638208,3209996992,1027012352,3205732288,3218772640,3177079680,1060088280,3212874200,1070535864,3207956768,3216959392,1057546208,3205846864,3214595028,3211780648,1058904424,1057925520,1068360372,3215746596,3179833792,1068135908,3214878232,3198320944,1070452080,3198166656,3203199392,1069235372,3205028128,3208398600,1040639072],"block":"d53241b2b6e42885e0287bf37f65f15b5592"},
{"x":[1015656678,3117134151,3163455206,3136174162,1008813706,3158923003,970895851,1016999951,3154732656,3163905267,1000674171,1008334807,3164001817,3158494950,3161503631,1007743856,3076511498,1021231426,1004522383,3158346706,3150555484,3166168266,1005335296,3156090921,3144856842,1006536048,3149436088,1006977479,1012876042,3145820324,996763054,3153129451],"block":"f69a83086db9a5fc68b29a6da7654d9b7ca5"},
{"x":[3283668078,3277858481,3264968335,3279605943,1127832005,3287230812,1129963495,3289531907,1142712461,3274814006,3271037223,3290723074,3282346048,3288073681,1132139452,1143588569,1132313526,1118079850,1102802840,1138313530,3274793662,3272437021,3265100823,3286140800,3277402893,3270326804,3241304480,3276497428,1141345846,3263110934,1139820894,3282678190],"block":"4ed55c7b893ba6ae95dfb19a89af2c9e25c0"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3229614080,1077936128,3204448256,1077936128,1082130432,1056964608,3212836864,3204448256,3212836864,3212836864,3212836864,3221225472,1073741824,3229614080,1075838976,1077936128,3225419776,3204448256,3229614080,1075838976,3204448256,3225419776,1069547520,1080033280,1080033280,1077936128,1082130432,3204448256,3227516928,3212836864,1075838976,1080033280],"block":"0038207e07de7f29b6f7f6e6f6741c60ddfe"},
{"x":[3130071385,977644266,985796772,3127154623,3089217881,976467649,984599434,1176256512,987602793,3126163719,973007979,983512064,982640006,989409666,970343400,970478748,968981480,973667591,983275295,967885521,3123613565,3132697101,3108863444,979380348,3132053754,945157571,976400778,978725405,982893794,973882336,3131564811,940439503],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[842122656,816369731,835471341,834756304,805896131,2956278367,843693723,837799814,2969080698,848179386,2981562700,844566358,2984425027,847932378,847300717,2988063294,2997789328,844578701,2997877077,840800160,2990288082,2988466140,2980284528,2972955016,852310281,850261941,849359029,2978660515,826548610,842953066,2993137894,842531311],"block":"0080f548f656c8b8a49609122a947a43d34b"},
{"x":[3215006868,1042628928,3215219840,1073741824,1064392088,1041530368,1059226600,3200155456,1033727360,1060504960,1070925416,1072931888,1071989480,1063357016,3191928960,3197790432,1061587040,1060363336,3208934864,3199629312,3221225472,3189643104,3214054608,3214773808,1049103152,3209882896,3209345840,3217646088,3208132216,1065445512,1075410404,3182173184],"block":"ccb45c67bc91f598c6c978b6b2d2a2550989"},
{"x":[3147948718,975496151,3162682084,995397857,1000207094,3140379771,991053496,941699891,3157753472,1017863147,1018659742,1013806208,3156736292,1011672228,1009180820,3157471565,1012720061,3145739192,3160398238,3161295805,992734249,3134048133,3153925386,3146415350,3147371878,3143224975,3154244782,1010276162,1004719339,3127335567,3159638466,1019417057],"block":"199a3a98ddd77699b798ac91b0436b84c50c"},
{"x":[1133107316,3272186643,1131840483,1128196205,1127324686,3218380256,3288064864,3279697396,3277524862,1140062891,1125817252,1132031808,1133339375,1138407458,1124817511,3272149481,1127323317,1127157961,1137023314,3266190666,3280591479,3280282386,3290132289,1128816867,3280045648,1116981644,3288623884,3243702530,3259193908,3281780365,3289131988,3276233400],"block":"db54aca6db7a4a5802b5559e1a8b7c4e1a56"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3212836864,3212836864,0,1056964608,1082130432,3223322624,1065353216,1082130432,3204448256,3212836864,3212836864,3227516928,1077936128,3204448256,3204448256,3229614080,1075838976,1056964608,1082130432,1056964608,1080033280,3227516928,3227516928,1065353216,1056964608,1077936128,1082130432,3225419776,3223322624,3223322624,1077936128,3204448256],"block":"00b83a7a087710fdf660792a0aefd2d9299f"},
{"x":[3082276832,989392893,980647650,982601663,970972333,950729311,971359028,1176256512,976559047,3114624926,965411095,949631714,981357733,3123662308,3106329330,3136945874,3126632432,3120964813,977280697,973962601,3126309266,977054098,963991471,974120338,976649626,3128643781,978308883,975606891,3119204140,3113481536,986699207,3102178870],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2974754328,2988924327,839464726,2990391166,2992681210,840390372,2995635563,2982577278,2994245094,2946600238,2978763927,833819808,832410940,2945106620,2931040903,830619896,839405037,851147483,2986502605,840423169,2983595390,2957887949,843613691,2980441917,824561930,2961722732,829774346,2974791394,843411742,840316542,832084211,2986432044],"block":"0080590cb55cad854eaa7d887996465868b7"},
{"x":[3205199072,1058795888,1072740996,3216013520,3200146832,3174551808,3215535856,1049713568,3175103488,3213231416,3197813760,3196503936,1062429096,1068285000,3213974552,1071476744,1067176924,1069322832,3209150448,1050638656,3224170318,3203517184,1039922752,3181094592,3213416652,1072686136,3216690784,1059286400,1062518384,3218742328,3221904228,1069145676],"block":"6735c6ca6e940778848958e547a7aa3c25cd"},
{"x":[3159812147,1009757793,1013111101,1003947970,1010753756,1001448909,988898549,974136033,991505735,960060457,1008821227,989151314,3147261112,3150172928,3146639288,1015688151,3156113659,3149148221,1015058800,3139719291,1010815370,3154433055,3145150464,1000115169,1017407826,3158330204,3124413071,3164238722,1006038384,3151165962,3154756408,3163071078],"block":"2399cda4229533b6a76807d884f75ababaf1"},
{"x":[1114581373,1108312498,1126793789,1127703839,1094764332,1143865666,1122397187,3288093242,1140273903,1128578836,3245038130,1126166714,1129565892,1119141868,1135606484,3283333132,1143414091,3227251864,1093252482,1138229947,3276749606,1135519878,3271640324,3281236039,1124349708,1133028903,3289364385,1131995995,1124950786,1111677036,1109196673,3268442598],"block":"70d507888636a84097be6256f8566677849c"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3217031168,3229614080,3217031168,1056964608,1080033280,3212836864,3212836864,3225419776,0,1056964608,1056964608,3223322624,1080033280,3225419776,3221225472,3204448256,3212836864,3204448256,3229614080,3225419776,1073741824,3229614080,1077936128,3229614080,3227516928,1082130432,1080033280,3221225472,3217031168,1073741824,1082130432,1065353216],"block":"003865700529cf06e60218f9f9435fc2f4a7"},
{"x":[3139841150,979069379,960913114,3122434966,3130422326,3113972253,973650191,1176256512,952186176,3118727709,3094535865,3121272587,974737343,979145426,3123601433,3124987143,988830819,937669166,3130809631,3098486047,973359629,3129086567,3110527370,3129341178,3124171801,3114245424,3135610799,975785272,3116045763,871744144,960905512,961720452],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2982953722,831425417,2976691036,847645793,835724314,2982781966,2992099393,2989770006,2992486546,841505421,840934496,2984860687,844388493,830727700,2983053590,2973195234,2976317009,846668927,2986456246,2997391928,2977954659,849052258,2993361147,2996547065,2996107260,852695142,2995943555,2982213012,2988250919,2993469793,2991110664,2987040281],"block":"00809a37a9e3962accebec05e5aab4c7cab9"},
{"x":[3188469056,3216339668,3215415604,1073741824,3213801600,3201127536,3214838504,3213307760,1051314400,3209078976,3203930336,3207347272,3216940120,3179520000,1069342740,3218076296,3212477728,3216790652,1070631380,3215254888,3221225472,1071591564,3164448768,3200450848,3197169552,3214390268,1066022412,1069404724,3211756024,3217416892,3167474688,3222725734],"block":"b7345833e44f14e784747945c6d653388d02"},
{"x":[3125053522,3129579479,3147711600,3148726753,1001580144,1011290245,1000758968,1005056317,3140021207,994164121,984227922,3143265689,3146655652,969154887,1004728709,3150097305,3148239503,997376307,3150111416,3150355220,999771463,3147320402,3153817344,3135243264,3163570844,3144885145,996344565,3139625984,3163971970,1007885414,1018072135,998651351],"block":"7499a878aaaa66a3b695f9977899fa58056a"},
{"x":[3289348283,1097808132,3266179210,3262181008,3273788503,1134752834,1130731167,3278261456,3278785724,3270605766,1127543920,3290021549,1147716086,1120931256,3267210235,1136685317,1139601734,1141964807,3276968840,1121518544,1135972316,3283056401,1143326050,1102937315,1118641881,3270195854,3248973763,3265491179,1127191355,3275769703,1133737677,3272555306],"block":"46d74d38a97959b5268a7a99869d60a75995"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3217031168,1069547520,1075838976,1075838976,1082130432,3217031168,3229614080,3225419776,3212836864,1080033280,1065353216,3223322624,1082130432,3225419776,1075838976,3204448256,3217031168,1073741824,1069547520,0,3227516928,3227516928,1073741824,3204448256,3204448256,3204448256,1082130432,3212836864,1077936128,1080033280,3227516928,3223322624],"block":"00b8bb455383f0fb4f9e9a9106ad201ef3d9"},
{"x":[3129795412,3128000038,3121513939,3137122022,3140046701,972281644,3129936028,1176256512,968443610,976808297,951242982,981910557,3140088287,983795127,986978088,3121324475,3116608767,3110444827,3132599272,973322101,979890308,3137832186,3084449219,3113544451,978011227,3135360902,976932586,979262522,3132225999,3121033511,3128065361,979592676],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[835130052,2996282962,2988027388,820018349,845102262,2942439767,826620594,832668252,806582725,2991227144,2990985106,841330975,2995131771,2987959189,841983499,2990325394,842998598,829303574,2974038808,837735025,854352683,848956123,2994966563,2982042351,2998704169,2985164212,843768466,2991087627,2980901318,842102222,844074369,2996656616],"block":"0080567d9b680438c7a7e8ab5bb59d5b45db"},
{"x":[3221652640,3205811888,3210941072,3217900960,3202939424,1044434976,1068832128,3170904832,3188585632,3189772192,3212163200,3214722552,1071998296,1074848016,1068759512,1072156896,1057228368,3210756992,1065758116,1028739584,3205049208,1049768176,3216585496,3214992456,1045261376,1065724572,3204129392,1057433592,1055455072,3215836952,1048885840,3204263616],"block":"87b46fba4b8eaa77d3c87849ab6c62d073a2"},
{"x":[3154225833,3159747358,3156525133,3150093025,3146121339,1011037225,945536368,1013456041,3125891645,1019769042,1010890470,3143398297,3165156024,1021239613,3156024335,998103715,3135637586,978662932,1009525903,3164111588,990432174,3133940080,1007184681,3144732631,3140071833,1012671524,993339474,1017171279,1015236052,3143385067,3138843156,3156815969],"block":"f79a9a8c5bda79846894984175293e909bb7"},
{"x":[3273113587,3285191553,3260334546,3248674513,3276199865,3280483137,1141819788,3223290064,1075643816,3281717089,3280082225,3233276472,3276279881,3281465558,1133717141,1118784850,3288184765,3264768760,1139967889,1137179141,1133528277,3275934693,3248179063,1135202511,1125885764,3256024071,1140812511,3281553495,3289136472,1128579033,1135480541,1122934468],"block":"76d4fa9e19284bbc8038689c1cc8fb5c3467"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1069547520,3221225472,1077936128,0,3212836864,1077936128,1075838976,3223322624,1075838976,0,3212836864,3221225472,3223322624,3217031168,1073741824,1073741824,3225419776,1080033280,1082130432,1077936128,1073741824,3223322624,3217031168,1069547520,1056964608,3225419776,1069547520,1073741824,1056964608,1075838976,1069547520,1080033280],"block":"00b8e51c02284ad2b35d73e85a4c7d3b5414"},
{"x":[981740688,974722966,3112305132,957612590,3127538074,3124336223,982499161,1176256512,3134889276,3110392300,964887053,987442594,3108307305,3066617136,979323471,3116973933,973421708,3132391334,974701790,3107753690,3121505919,3074076181,3137342944,3130015048,993838154,3115648713,3118970569,977080239,982289965,990825513,855973561,975597806],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2962611489,2977326649,2974418097,2975827898,806415221,846728852,841567440,2996091731,808018790,2983220750,801260809,853644153,841157416,809977295,2969919999,817860386,839299542,830541953,2997646100,2979071082,2980815461,2965340340,2997561931,2991013158,829849851,2982806061,2990668669,2991130577,2980522996,835327298,840368398,2980029354],"block":"00806879e999a884e5cd78aab8c095685998"},
{"x":[1075379688,3214022744,3210529328,1073741824,1075404760,3205122432,3205917400,3211854448,3208926936,1050059872,1071766320,1068308960,3205975992,3204999456,3205444280,1054261088,3208074568,1054502592,1066970032,3194953760,3221225472,1067818300,1067867840,3213149452,3191517824,3199502832,1066809640,1057592768,1062728720,3208374776,1055087248,3223639662],"block":"27356f94c57e2fc6c6557679cdacb6669609"},
{"x":[3164606523,3161811727,3151960023,1009340144,3142037709,995723264,3161435346,1006699714,3154271877,991416484,3142902743,3166705513,991722189,3125238251,3161066967,1015924751,1007337968,3149085051,3157544018,3163234204,3153937408,3154646574,3154161177,990586655,3141442253,3159302482,1017358994,3146215639,3157780690,3158250639,3141116190,3150928875],"block":"011ab163462c5759539b7549f7704948736e"},
{"x":[3280632251,1135030925,1126726336,1116819062,3267998410,1123942431,3277808624,3248608738,3261320158,1133769144,1136569860,1132773899,1134301339,3283140987,1126872661,3278553046,1130514089,1108241510,1106385740,1112745448,1136275845,1139417033,1129832470,3277067559,3278612896,3256971696,1133269860,3260650971,3265468792,3264213385,1127296298,1111826773],"block":"51d34d7275772a064cc8c9933193939e557c"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3223322624,1056964608,1077936128,1075838976,3221225472,3204448256,1075838976,1069547520,1082130432,1075838976,1080033280,3212836864,3227516928,3223322624,3217031168,3227516928,1082130432,3223322624,1069547520,1065353216,3227516928,1069547520,3217031168,1077936128,3212836864,3223322624,1080033280,1075838976,3223322624,1069547520,1080033280,3221225472],"block":"00b80dd75263fc59b325a0d3113adf5d1bcf"},
{"x":[3135371744,3132478620,960175932,974815945,979364979,3124899931,3106862597,1176256512,976342115,974859666,979226018,3122059961,3123638109,954711737,3128275059,967316931,970567402,3118674363,966433129,969589277,3097684870,991953253,983428326,971622352,983710397,986580714,3103607620,3129553273,3132052243,950742025,3128649508,3128922842],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[848307108,2962866138,2989444727,841669521,835041672,844721385,2991196242,2977732888,2977875223,837145465,2988128014,838404771,2963705246,2974041171,3003134321,2998764197,2975034403,2984754870,846672991,846833805,845591003,826615698,832357554,841564256,2982359116,849908103,2989449350,847821656,824353818,2981495752,816654874,802489685],"block":"00007c68c5cbca9b95b767da56ca98778082"},
{"x":[3213822972,3221899607,3203962096,3196329504,1079858384,3202998976,1066458024,3213009492,1067228412,3201846304,1028139008,3197150128,1053994912,1061933984,1071269580,1062471552,3209803896,1072631908,3219846832,3217337988,1058785760,3214687632,3222286606,3200472416,3221373068,1062559152,3202855424,3214115108,1045353216,3201722400,1063224072,1068310360],"block":"ebb6ab4dc9c970b9d59ad56998b987966456"},
{"x":[3159585628,3132065833,1012082375,3159931694,3148476201,952050647,3147605842,1011844695,3138870907,1018084900,3131746345,986438492,1006704916,3136197017,1007384279,3137912709,1020987760,1000287539,3160535347,3141817815,990183219,1010498150,3112962621,3157970130,3152321321,3106652815,1012444042,3140414648,3155101865,994071511,1004667576,998841057],"block":"d89a0c78c49c7a5889b4a9824898b6796579"},
{"x":[3272692762,1125857526,1137754756,3283241089,3282098834,1070131008,3289731294,3289371937,1115855725,3272979168,3251299438,3276696084,1134129950,3281610982,1087765024,1139856870,1122841318,3266307479,3283151459,1129974108,1109587610,1134235625,3276145987,1134916527,1135658928,1136165558,3271760503,3280572336,3279238293,1116615606,1118137918,1135205117],"block":"ab54a67a3eb394c850c0d9d668455c9498de"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1077936128,3225419776,3229614080,1077936128,1082130432,1080033280,1075838976,3217031168,1082130432,3221225472,1082130432,1077936128,1073741824,0,1065353216,3204448256,3212836864,3217031168,3229614080,3227516928,3212836864,3229614080,1075838976,1082130432,1065353216,3227516928,3217031168,1065353216,3217031168,3217031168,1065353216,3221225472],"block":"00386e52001e6f0fddf5af145fae5c58aa47"},
{"x":[3108369663,3131862668,928740017,3109390681,966879790,962954855,3113633448,1176256512,3126387885,3124601971,3123152864,3114427532,959315248,3130847200,3132301579,3121067828,3130130662,985224107,3094520530,981665346,968318780,986017666,987937338,961770816,3107881059,3121316053,980832707,3118851507,993032201,3125213144,3115502699,3076506256],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2994028058,848963728,831920025,840684733,2991815141,2992113464,842564866,2987593043,848990741,2952012927,848637370,834435373,827778388,2996546850,2991605106,2985087397,848516813,811869228,849447454,2996091224,2996072015,2970846896,2993865371,2993799931,2998120177,2980818930,840422488,2982284533,832275939,842443919,838962682,2988291904],"block":"0000f38ffa1b13733c350f68bf6aa9c1b345"},
{"x":[3204460832,988094464,3219306928,1073741824,3212505552,1062891664,3198501632,1070226600,1066731636,1043422464,3214918528,1057216184,3196923424,1051007904,3210006496,3198667840,1064417496,3215507712,1067747072,1061070888,3221225472,1053511296,1071358984,3213003684,1067759612,3198341760,1057777976,3205413352,1073487788,1067571404,3218070772,3214805304],"block":"00b44ad83f50fc6519c233976da60937ebd9"},
{"x":[1002350151,1012571796,3157868810,1005185321,968134164,1012940252,3159915371,3143691305,982490194,3156479652,3153510768,3156863175,1004896338,3143412510,3169651471,3136363479,1007219640,3142533365,3163220541,3138941890,3150312949,1013670625,1013757588,991392317,1001955993,3152906700,1005275340,3168530931,1014806814,3147511931,3129577718,3147144417],"block":"681baa7c357a68ccc497a865a615ca778077"},
{"x":[3286234948,1137011820,1122034937,1135306002,3275057531,3265602873,3285965286,1130225855,3282989436,1124713392,3284441258,1141292046,3286714512,3271966181,1129546833,3272294690,3267706042,3284139565,3281635976,1140961614,1138144803,1130152036,3287492590,3278360859,3215147456,3288034939,3247395463,3267988942,3283865468,1103573840,3274376971,3288593929],"block":"36d49fe2d6032b59ffb58df68e90ef8ab5fa"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3212836864,1075838976,3221225472,1073741824,3217031168,0,3225419776,3223322624,0,3227516928,3227516928,1069547520,1073741824,1077936128,1080033280,3204448256,3221225472,1073741824,3204448256,3217031168,3221225472,3204448256,3221225472,1082130432,1082130432,1075838976,3217031168,3221225472,1069547520,3223322624,1082130432,3212836864],"block":"00b8ca439cb4cb98ce0d083fbfc554d201a9"},
{"x":[965968167,3116813354,984973042,3129489818,940151276,963063252,3119017084,1176256512,3135992988,947810469,984464434,3132508378,978534605,975412782,3123708355,3123221529,3129359262,3088693461,977314481,3108926882,3126006858,3124374127,989048833,972712707,982806479,3130109928,3124581794,978044699,3134007608,989536134,3111114179,961545307],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[835675158,2992110560,840774782,836506621,846482091,2987415269,3002519832,849363538,843009116,842878586,816937311,2993042981,834432356,2974457417,845129514,2996194657,3000274389,2990598871,2980389916,845114525,2991821863,2978889716,856653942,2981988642,836096269,2992331294,2992152446,828465562,843263721,833796937,812766705,2986810001],"block":"0080e7bb9656b59a0f9475b5b87b577985ac"},
{"x":[3166307328,3216720540,1072433440,1061327168,3191310784,1068552308,1073889088,3222965561,3214760328,1061643056,3212019984,1009146368,3171278080,1066283620,3197931264,1057106112,1059974616,3199385792,1069233128,3214995484,3199145392,3180328832,1079912368,3214249384,1057333416,3196645296,3178827136,3178458880,3192731776,1071977692,1075150860,1068521912],"block":"f1b6689b54b6988503be7b968a8888453957"},
{"x":[3144980889,998829138,1008989296,3160876580,1013949035,1015611955,991405936,986383565,1009229834,3143291269,3154261074,3162421611,3168292883,1003410677,965674107,3156825374,3146914406,989717586,1006677483,3143163105,3156121405,1010156994,999605350,3137662075,3156289147,1017257840,3149763829,3147823145,3149122304,3143260119,1007990077,1002480957],"block":"c31a7799ab745cbd99785be76673607ab8a5"},
{"x":[3278428612,1115881506,1135701852,1144215264,3266121216,1139413203,1114816086,1123988575,1094538432,1104041765,3282665248,1139952552,3277325474,1132274602,3259897971,3254545438,3279904012,1140914446,1125030023,3272808065,3257494334,1138699597,3268901954,1143198030,1132316770,1111700248,3276094134,3273863550,1145296774,3276229987,3273975600,1109639136],"block":"1fd6ba3774a1893397175888aba30aa5a988"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3227516928,3204448256,3225419776,3227516928,1082130432,3212836864,0,3223322624,3223322624,1056964608,3227516928,1073741824,3221225472,1082130432,1075838976,3223322624,1080033280,3223322624,3217031168,3221225472,3223322624,3229614080,3227516928,1065353216,3212836864,1082130432,3217031168,3229614080,0,3204448256,3217031168,3221225472],"block":"00b81fd9becfd0faf86dad07bff48c90b3cd"},
{"x":[965373510,3129532674,968952906,3132908012,3123500344,3123585098,3132154917,1176256512,981061330,981302781,981624128,3123484582,973043369,3101051978,3110949061,3132960633,3114594632,991946548,3123633251,3104140133,985747584,979034498,3122568455,966262260,3114609050,3113675703,985806697,978923979,3117478216,990429500,3128225613,3114322232],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[844652359,2994793897,808928722,2978485431,2993146055,2986388471,2989858107,822570698,2988288382,2969793276,2980071025,839313017,836390227,2981807191,826643293,833910421,2996386162,835047749,841835908,2984114415,2993396677,2981423446,837161496,841380716,830358440,840892572,847571020,823796438,2989047507,835664872,815196174,2971097250],"block":"00000eb1d8562265b3c9a4c7f69c4bb6897a"},
{"x":[1068090540,3212294800,3197770720,1073741824,1054652272,1035985792,1064303704,1066386816,1039821888,3209765144,1066244068,3205114944,1064096944,1014235136,1063597448,1054837216,3205351136,3183193920,1055886016,3176260736,3221225472,3192458848,1069309328,3205818448,3207497368,3221019208,1046684256,1060854192,3204406368,1075888540,1053238640,3206822184],"block":"06b5a48b7982e79835a4a8eb746aa50875a7"},
{"x":[998228234,1000291799,1006811535,3154461133,3157008461,996360949,1013882424,998058946,3142405632,3146586829,1017287526,998326210,1010411469,3144186654,3154347489,994537513,1002593904,3154789867,1001578086,3134020649,3156509496,1013672632,3163081226,993067417,1000280391,3159586764,3126420603,3155292426,1006972974,3152326942,921467617,3142923755],"block":"159966b6659bcc27f27669da80c653b98b97"},
{"x":[3247231888,3291226803,3278210962,1123056025,3293744494,3272486653,1134045238,1134391128,3269122360,3281914236,1130482289,3256034608,3275300268,3275699624,3270407992,1132387730,3266844592,1139629789,1118388944,3280709923,3271208766,1099838090,3272746593,3255606996,3271329666,3271948050,1142111158,1133323728,3283710481,1127007108,1134533628,3276207703],"block":"945678d1965970877b8b7775eab846a6b76a"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3217031168,3229614080,3221225472,3212836864,1080033280,3212836864,3229614080,1082130432,1073741824,0,3221225472,1056964608,1075838976,1075838976,1065353216,1080033280,3217031168,0,1065353216,0,3204448256,1073741824,1077936128,3225419776,0,3229614080,3223322624,1080033280,1075838976,1065353216,1082130432,1065353216],"block":"00385580a4867fc6e02f8c0834f9ddadfaaf"},
{"x":[990693180,3119043101,983568151,3106849195,3113192375,975829025,3094034515,1176256512,3113141420,3133880357,3121675404,979146957,979427247,936826897,981910938,3135079228,3139054889,3131405054,3134407517,965230953,968779039,3134523520,3106386478,981736379,3139448357,3126467060,989709190,947803915,3125154251,993934025,959307482,991543944],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[840025423,832872649,2971411426,816323732,823164327,2987941532,2971322306,2981875083,2964356921,2964804156,788718796,2963337339,823326397,2986783426,2991881155,2970639170,833298087,831664239,2994812542,2976213307,848364932,832373746,829258262,2957484651,831219849,840348722,2981013041,2981950213,2989220997,2986875472,2975246145,2979416623],"block":"00806466f9a7076c698b6949a8b9d7cc9ea9"},
{"x":[1060370656,3209006968,3213923184,1050248672,3208380440,1067455660,1060768688,3188319840,1053179296,3211428496,3204457040,1062857632,1046646560,3200362784,1066114048,1064062328,1069178312,1057395960,1063793120,1053184944,3203824384,3212978816,1064310760,3193359968,1068200104,3211980984,3209238064,1059295016,3161223168,3214689092,3198614624,1043907744],"block":"d3b1045c3e66bce1349916ddcb4387faa273"},
{"x":[3148911657,3153837547,994168013,982519152,3119000617,993920000,1006651622,1002762393,3157313587,1016894256,3160229826,3139091005,3164510057,981584609,985774407,1010507597,3148319897,3137802977,3160828713,3136659251,3146042368,975478374,3162986163,1010346547,1008966512,3155148994,1004763760,3162621432,3157856414,1022630671,3137653309,989504143],"block":"a19b999ac7989887c6565ba36cc9bd089875"},
{"x":[3278014396,1140093406,3283378306,3283202389,3277297096,3263627523,1140087688,3273222478,3286679947,1135580638,3275523890,3268887742,3271384979,1106780015,3274767515,1112092198,3266998642,1127946876,1106581790,1143541966,1067768208,1134286002,3288855948,1110294786,1129124170,1107431398,3280845692,1136925045,3286215626,1136529013,1113696898,1138836870],"block":"49d59b628c0c8b49e27a6d84ba39d9487a37"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1082130432,3227516928,1082130432,3204448256,1082130432,3227516928,0,3225419776,1069547520,3223322624,1073741824,3217031168,3221225472,3221225472,3227516928,3229614080,1056964608,3223322624,1075838976,1065353216,3212836864,0,3223322624,1056964608,1075838976,1073741824,1082130432,1065353216,3221225472,3221225472,1065353216,3221225472],"block":"00b870df3069a08fd87e354d046bcccc6fcf"},
{"x":[3118623048,962661844,3135421224,981899002,3133617374,933388354,3116429853,1176256512,961690272,981160092,965209359,969899295,988750120,977313842,3145762016,3114131456,3117166986,3130746323,3109288838,978371257,995217331,988778579,3130560996,952880661,3098607944,972254561,3137223623,972584928,3118118143,989900630,978627994,3122235851],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[831506366,842540089,2965652112,839279269,843581415,832971594,2969033711,2968165784,2961861159,2994945979,2978333045,829072548,2986279626,848656917,2977672995,845241586,2992668207,847205723,832507813,2997589566,845047829,850112610,2982023636,822839198,2980899611,828959139,2975603959,2970179866,2986895036,2980560426,845604081,827712310],"block":"0080d62469f53306a979a87e9a97bba13973"},
{"x":[3209085048,3209433920,3155082752,1073741824,1064585408,1062520280,1057896696,3196485952,3164560896,3215178816,1068583772,1066938652,1059565432,1033674752,3187816224,3213655404,3206773576,3168941824,3195650720,3217572092,3221225472,1059588200,3211933016,3209207928,1066492004,3213043620,3212903424,3219088040,3213921192,1071697224,3210805984,1064623504],"block":"00b4bb8b98e0f455c6b938cdc2f3d518c94c"},
{"x":[974223851,1006817874,1000266895,3155719342,1008444457,3163560650,3158210273,1005922693,1002718208,1002112471,3149711974,3137361961,3165577824,3150669813,999090995,3133865287,1009748413,1009942799,3148799355,1011517967,983887421,987354480,3155060080,3157073377,966927483,3133590241,998245007,3143008747,1000534108,985069117,1010600422,984659517],"block":"7719c8cb6ad58c91544b8a7a9677a096ca97"},
{"x":[3286500847,3289932379,3263773866,3281831675,3283358567,3256305584,1123245831,1122063868,1132052273,1134226967,3273423806,3275079853,3281640898,3265837566,3276142340,1083931924,1134926155,3268210866,1104879065,3271159023,1134634939,3282783345,1134967649,1127844108,3283374814,3262492671,1116706544,1141803595,1125357352,3280030132,1138959294,3269067048],"block":"c354c2708764c348caa93b7c96f6a457e578"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3227516928,1073741824,1075838976,3225419776,3212836864,1080033280,1082130432,1082130432,1080033280,3212836864,1077936128,3217031168,1077936128,0,3221225472,1073741824,3217031168,1073741824,1075838976,3221225472,3225419776,1080033280,1056964608,1075838976,1082130432,3223322624,3225419776,1065353216,1077936128,3229614080,1075838976,1075838976],"block":"00b8bf4433ceea11703001dae26b22f83c34"},
{"x":[955888239,3127066199,987090957,956039759,959407752,3130561192,988058248,1176256512,990088545,986109289,3125040792,978596906,3136848585,964402611,978624857,974679499,3126187721,956426912,984446067,957571007,3131324642,3106070332,972534285,987484742,3115744461,991399113,3125384643,3126585697,980878640,978915976,3133909042,3120810099],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[847507254,811516526,833045618,2987265579,2978813652,828779030,2944671626,2984161112,845406239,2969886756,2981263920,809790121,821334413,2996622750,834429843,838322125,2987891946,811299200,2999125280,2984751187,2975143044,3001453857,2981473579,2952054331,848820043,839969986,833745075,825470724,838234862,841816328,2959965339,2984736541],"block":"00005d88196677096886dcb7a698a9b38a6a"},
{"x":[3218027532,1056599504,1057309448,1013842944,3204980840,1047967584,3215225432,1061387112,1061192400,3214834048,3216203780,3203442880,1029224320,1074974908,3215366540,1067085744,1034097920,1066990668,3218514804,1058889720,3207685936,1075413264,3218577876,1065657544,3196673808,3211122520,1046895904,1059238696,1054716960,1055615392,3216917868,1044387008],"block":"ccb48d46e668aa07ec5595bc7d6a7860dc74"},
{"x":[3142336389,1002722693,3149015920,3111602749,1002612244,3150716242,3152043274,3131494809,1003633940,3155020344,1002154475,3161740759,1014361036,1005660098,3139797094,990306079,1017572925,3147062999,1002915389,3162646164,3123462144,3158336645,989297746,3165457326,1001687931,3164613494,1017403166,3141112770,990671810,1008002841,999746775,999974297],"block":"6819f76aa6288a469508aa15fa729ebba7a9"},
{"x":[1083656224,3270710073,1131911517,1118049662,3272689734,3272342053,3266693898,1101575315,3275824528,3289056787,3275390212,1123661781,1101535640,3276739687,1131612689,3284546084,3255949446,3281929958,1142298194,1140564749,1131280795,1140352311,3279398062,3259570558,1135167880,3280396939,3269366842,1132971374,3289230887,3277883165,3278912184,1134988574],"block":"b1d488ca05175a1ab9983bcf9a46f8bbb54d"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1065353216,1065353216,3223322624,3227516928,1082130432,3225419776,1080033280,3204448256,3223322624,3212836864,3217031168,3212836864,1080033280,3221225472,3212836864,1082130432,1069547520,3229614080,3221225472,3223322624,0,1080033280,1056964608,3204448256,1082130432,3223322624,3217031168,1077936128,1077936128,3204448256,1073741824,3221225472],"block":"00b856f6cddf801e71990ddabb2a219c4ac0"},
{"x":[981603767,950422537,961255572,3131675403,973824295,984189260,979606054,1176256512,3104790184,964380656,3117591233,973439869,3128960598,974417888,3123888636,982043055,976719111,970382673,983402423,981554520,3129852298,3129680044,982434599,966241977,982450525,982758269,959207146,967406437,990252868,3125261689,967583122,975482258],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[831452540,825531154,841238365,2992822520,801826542,841460286,2995042127,833211157,2971222298,2969680211,834463784,844182259,839416596,2995450895,2962221249,2985244807,2993942202,849431858,850142229,2996702591,2988356855,2988142649,832287567,2973235091,779271887,840014562,2998142876,846003433,2991273825,2996628495,848240568,848537874],"block":"00003af9fc13485ca27a87b70add3b12e8f5"},
{"x":[3198495088,3212888008,3221544394,1073741824,1075199500,1067655920,1057398552,1077452292,1067456168,1058818800,1072059680,1050703472,1067562680,1061355680,3203971040,1057042352,3192917312,1068015324,3221729388,3207627304,3221225472,3205551848,3199733392,1067236188,1069172828,1072965848,1069440008,3212115520,1060248856,3205543960,3216659132,1062836896],"block":"c5b5994beea2e1a49750453643b764a6c967"},
{"x":[3164279365,3144849633,1012162831,999782297,1004902523,1010125711,3157251681,3159810724,972371067,3165777211,3149769963,991243059,3155881994,988536422,3112179138,995964989,3152177807,990735401,1005978962,3145927147,1015926154,3162988249,1006891612,3136915538,3150650142,3160831334,3147685355,1012361400,981833318,992164167,1004365588,1011053322],"block":"8f195197bd7aeb2cb473683066d98599a8c9"},
{"x":[1128575339,1140878936,1127471386,1140400386,3267857523,1126608708,3292913821,3274797768,3251872213,3289843774,3251726788,3288166864,1117140325,1128425236,1126724723,3278295871,3257401708,3283171925,3277343906,1122387737,3246309230,3260385884,3280700065,1122850468,3271337335,3277982540,3216069056,3289425798,3275294793,1120669356,1142108385,3274806956],"block":"2f568a4d6a9d877a509678628823699aea66"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[0,3217031168,1069547520,1065353216,3221225472,1073741824,3212836864,3227516928,3212836864,3227516928,1073741824,1073741824,1075838976,3221225472,0,3204448256,3204448256,1065353216,0,1082130432,3229614080,1082130432,3223322624,1082130432,1077936128,1069547520,1056964608,3221225472,1077936128,3217031168,3223322624,3212836864],"block":"00b8986b8506fc04da0f2a5f74c423bcd8a9"},
{"x":[3081987687,972877710,3124187178,3112230847,3122427192,3132261860,3122564916,1176256512,3123989939,967130924,3109164811,977291707,3130405651,963241968,977048085,3140728392,974082499,973348758,3138249580,3127519667,987106395,966929761,3125433246,958779786,982725944,964693590,984003933,3105327711,3133357397,3114117055,3134240076,3127569892],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2994737201,841570506,847386997,2992929744,818650874,820483193,842493510,827665946,832136363,841142770,2985919976,831515246,2985902388,2980374798,826102557,2981683260,820757942,841055308,843167492,847032254,2942959287,2983214115,2987922993,2999465903,2983547941,848724804,848458186,828749266,839136752,839862091,798762169,2988097675],"block":"000093bbcdd389695c096aebe699b6b68956"},
{"x":[3193683360,3224188842,1053810352,3207852280,1072404624,3213213968,3215726148,1068398312,1041793440,3216637312,1028556288,1055588880,3210807832,1060208432,3217893828,1074073960,3202497472,3216415888,1065722800,1053759120,3203529008,1037145088,3212450464,1030169472,3193007264,1066303636,1052827424,3218034304,3224413402,1067602788,1057505272,1072236528],"block":"85357740b9967d85548c78b4983905caa3de"},
{"x":[1008885028,1008509481,1006099179,1008063099,3140114043,3132143247,3162927367,1016232187,3149436641,3131550105,1012847083,1001045483,3148042537,3158545756,995287879,3134118092,1007834823,3156640722,3148100608,3147013437,3105663222,1001824317,3147319757,1005312041,3150691819,3157000944,3149507676,3154895918,1001287024,990474322,1020790021,3157116477],"block":"c09a55b5a69589689d63aab8a4b66a7c07b8"},
{"x":[1131868908,1115801481,1123564206,3254987646,3275645981,3268325579,1116336044,3283112511,3289721228,1134614530,3280876901,3284362282,3260610208,3287410986,3273927384,1133025495,1121889681,1134022349,3274501987,3289721284,3285005225,3282145498,1144430153,1123471131,1123613106,1128124392,3280040398,3285418353,3275530762,3267349998,3267799529,1133675469],"block":"b5d57557a7f8cac9077c7f64bbdca99d9a55"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3204448256,1065353216,3225419776,1065353216,3223322624,1082130432,1069547520,3204448256,3212836864,3221225472,1065353216,1080033280,3223322624,1056964608,3227516928,3217031168,1056964608,3212836864,1065353216,1056964608,3227516928,1082130432,1065353216,3212836864,1077936128,0,1080033280,1082130432,1075838976,3225419776,3225419776,1075838976],"block":"00b879a66e76fd0065a92a8c16013de7ef3b"},
{"x":[3122424087,989459211,3109512217,3137945298,3131700503,3132612809,3113138946,1176256512,990173053,3136165971,985277522,988434515,986447619,3113194455,990980084,984829543,3112710652,3131762705,3096374281,991735370,3124562863,3130089325,3134511961,3138952388,3130462876,976138257,983009125,985444951,3072577766,974257611,3115530748,990099194],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2994139089,839443600,2993558903,2987342255,2972386384,845967462,814383738,2999035319,2970802250,2970907111,840352098,2948325956,826997456,832682790,846271911,829080257,839847880,848084830,2998357571,825042580,803129464,2972739280,839553122,813863918,845090543,848260637,808690781,844559663,2988492721,834208212,2984610967,846905462],"block":"0000b3eb0395877db880d7e78bc859aa6dd9"},
{"x":[3206212752,3212679360,1052789248,1073741824,1057220128,1068706448,1057129464,3197877664,3213641504,3210847800,1066092740,1057318744,1036271872,1068547460,3221988753,1072753456,3202179248,3217539596,1062727192,1065627436,3221225472,3221502600,3189429824,1069268828,3205451376,1062571976,1041750336,3212190184,1037753856,3222393030,3215436988,1057710872],"block":"8f346635b9cf1a1d7ad764b59c5a880d30af"},
{"x":[3153824604,3164453181,3158268605,1005314693,1014033065,1012996920,998578749,3164450657,3145950474,3160351498,1011796823,3140747591,992770068,3154703242,3122219909,3161349606,3130466304,1014989373,1007298012,991025193,1002502942,1009381586,998306498,994930892,3119828500,992021504,1003254026,1004072089,3140097208,1016473715,3158732728,1008704804],"block":"ee1885e0c39baeceaa908692bdb779f538c2"},
{"x":[3258221008,3280229989,1133031125,3283783034,1115952868,1126913330,1132807400,3285574958,3267967642,3263687110,1139330441,3279726384,1133662560,1140832583,3278751093,3249828838,3276607312,1145213636,1124490426,3253857463,1129921139,3290055030,1140674872,1127170064,1107881360,3283102981,3284632484,3238855130,3248732788,1141822666,3271984650,1117773550],"block":"15d6a80b758c67e6356c89c9c38b85239a78"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3217031168,1065353216,3227516928,0,1077936128,1069547520,3204448256,1073741824,1069547520,3223322624,1069547520,3204448256,3212836864,1075838976,3204448256,3212836864,1075838976,1077936128,1065353216,3212836864,1077936128,3221225472,1069547520,1082130432,3217031168,3223322624,1073741824,3229614080,1075838976,1075838976,1080033280,3217031168],"block":"00b83b266fa822c55904b5dd45f93a3319ba"},
{"x":[3103388009,969246065,964456842,3127116088,3101015671,3131423093,3134321534,1176256512,3137480233,990929613,982210978,980560946,3131428336,3129251799,980390823,982522590,986069222,3129045963,3132628042,3084301894,3129215005,3130765681,916068500,3131179516,978207638,3134426875,3126562964,982729716,971217290,973645587,980221371,3121663280],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[818314879,841179078,2993273943,833756757,840948471,2952034231,2968838462,831971286,834754425,2980468804,2981775397,841715697,2994840742,833894808,2980423481,2992895159,2995231154,825434517,848737705,848386149,2973695104,839325456,2994813195,848830259,2992554305,2974893593,2971400002,844637450,838287250,2979564477,2996804129,2987436932],"block":"0000199cf2fa7cb827fa2a7676dcb26a0642"},
{"x":[3187607680,3197758160,3189764416,3211837136,3219485608,3208284512,3176017152,1050685376,3204334464,1017226240,3210019480,1059790264,3204551408,1059005472,1056006448,3201390912,3216384612,3165358592,3205581856,3163094016,3200538208,1060752584,1065531748,1061790552,3204719672,1059036168,3219601736,1036151424,1065849808,1063037512,3173128832,1032968512],"block":"3a332787578460b5d8b966b8048bd6cb8a86"},
{"x":[3153705953,3145405030,3161589698,1014188999,1000872786,3122383503,3131345101,3167004057,1002187294,1008170040,951660708,990355620,997718917,1003639470,3152415897,3148069273,974411530,3115321262,1011489152,3142606684,999216261,3146822420,992412733,3158193536,982737715,3153494548,1005430476,1018646226,3139662663,3164682253,3156415498,1000658094],"block":"251a8587c37d9a7898408a5ba8f9791a56a6"},
{"x":[3288459069,1121162556,1139220050,3277713656,3272091806,3284143737,3240857330,3267935054,3250225288,1141612143,3285260848,1133509053,3286013862,1133002344,1132998425,1122543737,1122520956,1134010649,1130461636,3275215378,3281376912,1115957125,1123664631,3281339361,3262225371,3289123506,1115859006,3279798590,3286470612,1138289595,1141519139,3281899901],"block":"6054a1cabf554693a847780f924c22ecfc3a"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3225419776,3204448256,0,1065353216,3223322624,0,1075838976,3223322624,0,3225419776,3225419776,3204448256,3204448256,3229614080,3225419776,1077936128,3221225472,3223322624,1077936128,1069547520,1073741824,0,3229614080,1056964608,1065353216,0,3217031168,3212836864,1065353216,3225419776,1073741824,3227516928],"block":"00384237e8bac3880d93a8825267a720c21e"},
{"x":[3122997224,989285278,3131999896,3133806802,939936318,3138789635,3108030153,1176256512,980759987,965896963,990604125,3129989944,955419002,982983607,3117964117,3120339698,3130880312,3129501025,961134822,3132736869,970503832,3120836682,980770931,987734746,3095990698,962306016,990453584,3131089499,3108598973,3136566387,3132101157,3116320310],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2993755452,843025640,830973790,818360105,846922904,836083867,835212515,2986304086,847897988,831305373,2980424759,2992947004,2988430889,2997009115,2958522917,838463022,839384689,2980323892,2998090724,848183773,2969292912,840838648,829831533,2979917652,2965089600,843869263,2993884585,832137351,2967132673,2978427460,849041000,2991646649],"block":"0000b36c0ae97eca9a657eda36a37461f83b"},
{"x":[1061896512,1054712592,3214982968,1073741824,1073281320,3194633440,1059026952,1072043428,1064478272,1053924256,3191658432,3217078340,3217943944,3207589752,3204733160,1067411940,1051503088,3185540864,1057027792,1070601888,3221225472,1065359956,3182319552,3206228736,3205968192,1059289232,3196654016,1035462400,1054710640,1060895056,1062126760,3223996876],"block":"52359a89a4de2eb78a6d6ba9778393a6a60c"},
{"x":[992114442,995971461,1000878489,3158064988,3164026672,3149221396,3145778831,3149548472,988466954,3129001656,3157771622,3145489735,3166483872,998946416,3137486684,1001874258,3157180272,3154913536,1009259028,998568939,1008213238,3151869552,3141626450,3152504842,1008937799,3138198876,979807191,3138163876,961558282,3164777817,995089285,3124649902],"block":"e6194959ca94b2667766b97884778019978a"},
{"x":[1117724968,1125551133,3288994912,1124877211,3264954179,1109376673,1125245442,1139746916,1115922681,3275835937,1078975616,1103960240,3266504954,3235933272,3284807220,3264996123,3280235286,3267801123,3255593271,3269248510,3291242810,1141617963,1135391802,3264910566,1049547392,1134132364,1125597802,1133195989,3267836879,1105986665,1116173631,3267711535],"block":"6355597a827a07e8ca7e89c6a8b877889377"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3217031168,1082130432,3227516928,1077936128,3212836864,1077936128,1069547520,1056964608,1073741824,3221225472,1065353216,1077936128,3221225472,1065353216,3229614080,3212836864,1082130432,1065353216,3221225472,3229614080,3212836864,3221225472,1069547520,3223322624,3217031168,3212836864,1069547520,1077936128,1056964608,3227516928,3227516928,3227516928],"block":"00b80b60cff2aac255d7b4ac56227cf6fffa"},
{"x":[953577702,3110465701,3120809837,953614730,982376289,3122528617,3120441918,1176256512,3115583390,3134102176,3118627718,3089501258,3130389337,3132355212,3064004084,973333308,3112595293,976767394,982693405,3129686754,3128201299,3136272319,3139191161,944923346,979356452,3092165559,983085179,3122338612,3134642410,976437625,3116352504,976914572],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2990636124,2974043039,2992747954,2981594085,806792405,2991033500,2988396895,2991501979,2993780679,834879226,836167072,831299607,2983653544,848254653,840863081,844604095,2980654271,841175589,2956388662,2975045205,2990693532,2991422028,2986877883,818350785,827489122,835967431,847612966,835660835,2982341914,2990942178,830590196,2978519350],"block":"0080ad398e9bd8eecc7e7f551556bbe064a2"},
{"x":[3215592148,1058753120,3208621656,3201884736,1049277504,3196720448,3208163280,1057429408,1062162952,3208741888,1074327388,3209223112,3207531600,1062378432,3186290944,3219147996,3210949952,1032267264,3211006008,3213449084,1066265412,3207398392,1076050372,3208534704,1067282288,3164197888,3216244928,3193338048,3196742272,1061295416,3197058928,1064382952],"block":"1ab5bc86bab957a90aa6458ac19a9a65985d"},
{"x":[1022027248,3141866209,3150832220,995344302,3146499184,1015471526,992412754,3163915694,999974553,1007462328,1009170273,3115287019,1003222589,3134358896,1009678469,1016850299,3160617661,998373314,1016071449,3145530839,3160760796,3120977183,3157296701,1015585961,990238310,3154977935,1001410201,3092157563,1017385569,3158232663,981700403,3162923049],"block":"579bc0793a97c983b73d77a6658826b885d3"},
{"x":[3252477538,3261671458,1124614439,1142621008,1114887786,1133654708,3282551951,3264240460,1130902476,1121629206,3288892860,3274450912,3271743637,3285545548,3282619817,3285748915,1117599625,1115819218,3268538560,1127154061,3285355367,3246539263,1134417425,3281346828,1109268636,3272882428,1110787123,3281085172,3279405534,3255767421,3270128223,1134554038],"block":"d8d478799660d7844cc975a77fcaba8eac4e"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1075838976,3223322624,1082130432,3225419776,1069547520,1082130432,3212836864,1080033280,1082130432,3227516928,1065353216,1080033280,3227516928,3225419776,1080033280,1069547520,3212836864,1069547520,1065353216,3229614080,1077936128,3227516928,1069547520,1082130432,3227516928,0,1077936128,0,3223322624,1073741824,3217031168,1080033280],"block":"00b8a35d60fe25f05a01f08f2681df4eb115"},
{"x":[3132989523,3132505220,3125227897,3116051219,3124207322,3132885705,3125759820,1176256512,966150783,3088428696,970981934,3102541939,3129712710,951125083,977944503,3127639213,3127762633,3129225819,3120864240,3115060233,3130014557,958721852,966636618,3130914964,968056243,972143641,3124823876,973034571,976783901,964508091,3125267481,3134376694],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[786546552,2987579133,834062828,2979591761,848446072,2995345336,2992138740,838200363,841171358,826940677,2984138617,836733610,2988328830,2978628453,2988024993,817736690,844719409,852869297,2982379076,2996827051,2990918234,2992244036,833664598,831000290,2963539374,848421147,2978965351,830733906,2986856360,2981623452,2989109714,2994931559],"block":"0080480ba6e9c3cd6c7685379a76bba9bbd8"},
{"x":[1058371728,1058116936,3218124200,1073741824,1056275184,3201583456,1053888736,3196497840,3209982304,3213809160,3200054304,3196156768,3190422016,1059624344,1041841728,3209469488,3209998024,1063881464,1047274368,3216851116,3221225472,1062109016,3198840304,1057954680,3201942080,3213171248,1058661440,1050837568,1062451928,3223245066,1076569912,3204676520],"block":"59b5a6567dc2e76997699abb697968f608aa"},
{"x":[3148791920,3139144806,3158885627,986004766,3160805058,3141902520,998335836,1007788144,991070495,3160016573,974507131,3126867804,3158729840,3149333463,999924080,1004372091,1015519572,999589632,3155599053,1010921093,3145535836,1010395146,3170591399,3163265405,1009134633,1017039682,3161083346,3152530821,1007530895,997279805,995313316,1014977239],"block":"db1bc79765b874b7094ab9d54868a59799ca"},
{"x":[3275343853,3269668529,3260603534,3270296560,3240561680,1138944669,1133005513,1139952786,3281646903,3275268646,1139057108,1132907811,3280770293,1141358039,3263648973,1127678189,1134564795,1126468186,1129348495,3264684835,3269184685,3286856075,3281659545,3285992065,1117098550,1142829878,1128816492,3244068080,3281853575,3277723659,1098703332,1134733236],"block":"f2d44a69599998e2c5e27c0a5285ccb18946"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1082130432,3223322624,1073741824,3229614080,1080033280,3204448256,1069547520,1069547520,1065353216,3223322624,3217031168,3217031168,3221225472,3204448256,1080033280,3217031168,1073741824,3223322624,3221225472,3225419776,3227516928,3212836864,1056964608,1075838976,1069547520,3229614080,1082130432,3217031168,3225419776,1080033280,1056964608,0],"block":"00b840ddc4eff1a9753556fd0bbbec19718b"},
{"x":[986000245,981752300,3122521981,983125337,942463517,3132645676,3133875385,1176256512,948978058,946448630,3112260141,3128009901,3117616366,3115600741,3134252803,3126765675,3125016175,989381965,981677237,967863649,990649254,973837722,974043587,975512036,984590603,964959191,962224555,3123858973,3121582850,3105583629,947428132,3123370083],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[833915886,2996419121,2980369343,844495040,2987578961,2970152013,2972783089,834517407,830193491,2972584618,841327904,2982279766,2989774779,843551554,2970607537,2991150500,2979028057,842865245,810994086,836101563,2987156556,2976033069,2998478548,830306170,2995268636,2993091466,2952969009,2995019895,826477572,810070840,2978752803,844502562],"block":"00006ac186ad5577079a29378c26948c67d4"},
{"x":[1058501528,3200472448,1057533736,3217471340,3195225856,3201932272,3204870496,1065068888,1070320060,1046209664,3192759168,1036981248,989943808,3207703824,3221872930,3192127296,3214493544,3217612080,3208651576,3196224176,1059993480,3208542536,1059266136,3201106400,3209909672,1059207856,1031827776,3198772912,3220271924,1072376532,1031940352,3213312220],"block":"4f344a275a72b756a67c5ea9877818f58047"},
{"x":[3163907118,3147261450,995049738,3155346698,3146888233,1009362637,1011929922,1010694436,985541427,3151921828,993667993,3164357552,3167758771,3162890516,986368696,968252948,3156250153,3141244723,3162346690,981868544,3155056916,3155595602,1007021629,993642045,3161353390,3147819776,995306578,3132442910,3152045158,1015812851,1001045852,3147852114],"block":"811a52773985575bbc9c3866998260d3a868"},
{"x":[1135091553,3272105803,1097425182,1112859898,3273703518,3281768576,3293324100,3277890562,1083282724,3285454681,1106269190,1127692514,1114366873,1126776145,1142202785,3285896647,1130580623,1129082395,1136128466,3266101454,1128721383,3276252065,3284864136,1136763116,3280905265,1129237158,1132716074,3272674903,1111992073,1112549436,3289460943,3285770379],"block":"6156aba7c879a66540c658a4b87a899a2e44"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3217031168,1082130432,1077936128,1082130432,1077936128,3212836864,1056964608,3227516928,3227516928,1073741824,3204448256,3204448256,1082130432,3227516928,1075838976,1056964608,3217031168,1056964608,3227516928,1080033280,3204448256,1056964608,1073741824,3227516928,1065353216,1073741824,3223322624,3212836864,1056964608,3229614080,1069547520,1080033280],"block":"00b8bb70f210927a47ff6f44d9a970ff5317"},
{"x":[3132377494,3133016032,3127479518,3135979713,3107810542,980532626,972711462,1176256512,985436021,3128040645,949184562,961583187,948676723,3135794267,968642675,3120850764,985337820,3111979943,3130201449,3111493960,992038454,969450357,3107725476,973951615,3128207705,3130374673,973157737,962981954,3081883354,967575766,990378206,3120563823],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2970207783,2984531757,840388998,2961380981,843219209,847358183,2990547659,838427255,803572533,2985902582,845985399,856182972,2981499016,3001120295,2990573461,2987126068,2981641598,2985416756,2984906568,825894831,816963854,2975546621,828861321,824359229,850116580,2973118375,2979137063,2986646057,2991977722,841375659,2975041812,2973501250],"block":"008099aaa67885947b76389a95a0b96f9b9a"},
{"x":[3189396448,3215023904,3218822688,1073741824,3212052208,1051979168,1066905260,1070210040,1068245016,3218960112,1063948176,3193381248,3211111368,1066205552,3193324384,3153292288,1045685088,1041562688,1058018040,1067031520,3221225472,3210579384,1051166208,1071014556,1065333224,3208388656,1039756032,1040628640,3212759424,1053789632,3214736360,3132891136],"block":"00b4797d6f30fcb7731243bf8479cc64d988"},
{"x":[3166210217,1009146450,1016988920,1004377804,1000166973,994388664,3150278533,3155425075,3158956564,3144150528,1005744373,3155010887,979625001,3158739763,3114561044,1004415580,1023954693,1005066905,1006973844,1007541340,1009491292,1008879078,1013945052,1001645568,1003011502,1002997063,3148738519,3145370624,3142720757,999616082,1003368253,992198328],"block":"429c0d6663665767497a7b79969a987b6876"},
{"x":[3264056542,3282149136,1145110647,1134647792,1135933897,1127549386,3289315204,3283866547,3275806996,1115732500,1133108534,1124731533,3282160503,1134213336,1133712486,1132739956,1118736118,1136910331,3288356010,3286680195,1118239168,1117711018,3290825074,3284638990,3268074910,3276465103,3277526400,3258307634,1124852245,3291782776,1120652500,3280765742],"block":"08d6794bd0d57476fecc9aa7a5877bf575b5"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3221225472,1056964608,1077936128,3229614080,3225419776,1075838976,1075838976,1077936128,3221225472,3221225472,3229614080,1056964608,1080033280,3217031168,3217031168,1069547520,3221225472,3221225472,1065353216,3223322624,3223322624,1082130432,1056964608,0,3217031168,3204448256,3223322624,3227516928,1069547520,1077936128,1075838976,1075838976],"block":"00384449ae3032fd9d8e54743019bfe5d5db"},
{"x":[3121414562,3109546984,946008622,3124282704,3129091892,973813097,3116681725,1176256512,968970011,3104067027,3129866339,983276667,973545964,974617297,3116879758,969594373,982051005,935006045,3126149285,984140362,3122507998,956551201,987786982,3139025256,3114641884,958004986,954514736,3134258177,3130325558,3135727330,3131413386,977883382],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[802985668,2996600757,822247072,2978889587,2998985753,2987364041,825002143,843769008,782450184,2986464986,829230775,2957023114,2968963531,2986596498,818193417,2987394374,2993969727,2979015580,853389622,2943315254,2958355757,807077935,852426524,846445911,836083373,817328969,2981928631,839327008,826605540,2989000805,2996723451,837664501],"block":"0080c89e07898f8b1744688aa76879bae86b"},
{"x":[3183512704,3218547236,3218303300,3197464032,1049227120,3194013888,1069134260,1067130336,1055319024,1058072920,3210356784,1069003496,3196228592,3186899648,3220593240,3210568928,1045913664,1070393892,3210922512,3206298984,1066133408,1064267488,3222059120,1051904864,3206443232,1061563256,3214020268,1069860904,3218605356,3213579504,3177767552,1049384064],"block":"663498e25267c9b70d9c6aba45ed27488195"},
{"x":[1006749087,3133303275,3154672937,1015157573,3158682245,1001974395,996133601,3125624176,987651686,3160614912,1009604848,1016352967,995836354,1019035899,1011697525,3158877634,3150044170,1008214835,3137230684,3161324764,3153543557,3151787960,3155882680,3162368635,3167274519,3158898043,3156480230,3153921659,1001649787,3108850565,3134437580,3156771358],"block":"461a6bb8753d646a593809435b5ea98f7c54"},
{"x":[1128383705,3263924973,1127837639,3283053917,3278504268,3283357512,3267669179,1096661832,3249625663,1139532411,1129265030,1134109691,3267997004,1128431536,3273916143,3283271539,3282155745,1094015382,3274788037,1130988670,3272570278,3234039972,1132419980,1109139448,3274876162,1133088256,1101610190,1133885905,3248187388,1135453780,3283935448,3274552865],"block":"5fd3d589b54eac8e4a78b83084338a25ebbe"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3223322624,1075838976,3204448256,3221225472,3227516928,3221225472,3212836864,1069547520,1073741824,1069547520,3217031168,3204448256,0,1082130432,3204448256,0,0,3225419776,1073741824,1069547520,1056964608,3204448256,1065353216,1073741824,3221225472,3223322624,0,3217031168,0,3217031168,1065353216,3229614080],"block":"00b88de3495c7f9c6a45c4d58bb988b069f8"},
{"x":[3129620444,3136704689,3128148583,3135785665,986415715,3123366200,965123261,1176256512,3139088904,3132802581,3130562294,3114279175,3074346714,977792050,979425682,980156171,3131850515,979263431,3126662128,945978082,3093173372,971580458,973149356,3129705796,984485020,947393660,984097682,979248645,986762069,962779448,3123301008,962343765],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2993208257,2983855493,839340795,821906502,845264338,847768573,853307035,2983880490,2973018346,816776894,2987329005,2985073374,2971313888,2997092998,841614588,2970966897,820271623,818708642,2985171342,2997196405,845403120,2976342994,2983109210,2989713587,807831272,833203920,2996026174,2995280372,2994977636,844553285,846849181,2987430157],"block":"00807c8aa6e74493a0ba8968dbdad94e35b9"},
{"x":[1059053360,3221137508,1066708832,1073741824,3214678816,3191370880,1064640544,1042228576,1061594584,1066040652,3218517296,1067660080,1060327280,3205837904,3163181824,3208362016,3211835568,1054817264,1059959616,3206187808,3221225472,3180242560,1062668816,3199662768,1068303508,1047403328,1056674896,1053718400,3219155588,1067911392,3177826176,3202828624],"block":"00b4c66f53a0fd89549735746f63f53a88ab"},
{"x":[3153567959,3149680967,3139450020,1012088719,3157883407,996571238,1007055319,3145216901,998827407,3155543275,992796303,3162947297,3153152501,3154828518,1016129131,1003604859,3159128704,3161318625,3161736519,1005145016,1010987709,3130090783,3156960655,3155024829,987642020,1020650229,3135818260,3160123571,978286756,1001072967,3118729298,999750502],"block":"af9acacad9644b87b5b9770b97cd8a6b8376"},
{"x":[1117890531,3273501374,3281612942,1135674444,1136016050,1115590010,1119511562,3273667659,3281458334,1133488377,3281454964,1108407823,3241057430,3281503193,1137608488,3273544181,3275527471,3269285110,3274577887,3280681667,1108614860,3290061155,1134523569,3291688888,3273074512,1131864633,3262686546,1125226720,3277307400,3273249581,3279348309,1119820150],"block":"99556976655c8c19c90665bb75a868655d96"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3223322624,3204448256,3227516928,1065353216,3212836864,3212836864,1069547520,1077936128,1056964608,3227516928,1077936128,1069547520,3223322624,1082130432,1082130432,3225419776,3223322624,1069547520,1065353216,1082130432,1075838976,1073741824,1065353216,1082130432,1073741824,1082130432,3225419776,1077936128,1069547520,1080033280,1075838976,3227516928],"block":"00b8dd596f063a4a6502470fe2255d1030fe"},
{"x":[982467048,978821031,979275990,3039125570,3137029276,984630686,3120512255,1176256512,972277023,934595265,975560410,974107411,3097592071,3129818977,965714805,3116440847,3122090034,3093512848,3130907972,3131312153,3121258103,3118921336,3134586328,3092394411,3120552133,3128771216,975403713,977738007,963448603,976379110,988761322,971286971],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[838118490,824879006,2997397925,849015826,825377910,847629083,846079314,839168942,2986427153,2986754875,2978678382,2925481476,2985618534,2977492799,810122207,841367944,831021368,2988930217,830822726,2991342093,840111065,841946895,2962795958,830582626,2977649523,796680291,840721761,839878041,837885187,851878712,2987442553,830610297],"block":"008076b77fc2574383759b8b59586a09b875"},
{"x":[1063885128,3207999720,1069338284,3193841504,3206549696,3218023928,1047322208,1057333688,1070921260,3204589080,1061219704,1067970564,1063168984,1034505088,1044988576,3211942824,1047137344,1051751504,3200112320,3210170184,3210876672,1059068928,3208429456,3186155328,3221191144,3210418448,1030241280,3205328616,3211480984,1039960256,3206577680,1017483264],"block":"fc339c957e5745b2598a0f568b6d4b885984"},
{"x":[1003292354,973470269,1005221007,3132081111,989151477,3166656257,1012166292,984078172,3095740416,1015594946,962720235,3138256937,3130856571,999694305,1011129758,3157505874,3106054799,3149703946,1009117174,3156318192,1017932912,3159194721,3141219348,993944862,1010729226,1006651970,993317826,1007453527,3163328901,1001364879,3155648174,975265956],"block":"fb198a68ba58f9407c98c8be98b728aa5c84"},
{"x":[3256179996,1140765772,1138732508,1115629723,3272543024,1139350541,3284433912,3281513886,3269513504,3276121631,1132547394,3280423414,1129454920,3274515900,1132572444,3267018592,1091732532,3252214888,1134815975,1144763552,3284110095,3285791065,1137641328,3271376823,3283504287,3286966475,1135506256,1133091186,1133108019,1106861315,1123295781,1135804878],"block":"ded588835307cad34c9bc9da455b568a7549"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1069547520,1077936128,3225419776,3227516928,3229614080,3225419776,1077936128,3227516928,3223322624,3217031168,1065353216,3223322624,1065353216,1075838976,3212836864,1077936128,3223322624,3221225472,3204448256,3227516928,3227516928,3225419776,1073741824,3217031168,3223322624,3217031168,3223322624,1056964608,3217031168,1077936128,1073741824,3223322624],"block":"00383b4e72111022ce5133553a935aedc63e"},
{"x":[981534950,3116784845,991064748,3129315558,3128730715,959313282,977921909,1176256512,932431004,955932869,3129212257,3127433725,971981309,3117561808,3140371208,978402124,974669259,3090900583,3124219028,3122920375,3122358617,3119315272,976121496,975487386,958045914,3116453413,3134054999,982698226,976954754,3125365228,3129142797,967122207],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2926106823,2992169277,847045295,3001100125,814078667,2965560500,838617297,2973976316,2984259757,848130000,845934665,841225824,2983993544,839175589,2988255161,843333933,2997203387,830020104,839373764,832933165,842437101,841847246,2994222094,2971446065,2980568962,769510264,2986401877,850555319,2992242871,2972001083,2984892588,830857612],"block":"00002894ac90b8b84a77768d6ceb467a659b"},
{"x":[3213564840,3205676712,1070698008,1073741824,1035532544,3221596282,3221713385,3208381672,1073190864,3197278864,1057235936,3187975264,3223269927,3194920256,1066897900,3217920380,3217121240,1028113408,3212356240,3212988416,3221225472,1063326496,1070899944,1055159760,1069158016,1062584360,3193357344,3210819392,3193710720,1065826208,1053458816,3221986750],"block":"fa3435865d5e28b1d196deb77a5870b79c13"},
{"x":[954802503,3136323215,3151532185,3161882368,1007402127,1007002747,3148139827,3139485204,1018095887,1015069302,1009367516,978484674,1008822118,990021099,3156196193,3149588582,3155109642,1005736929,1013666713,3139141714,1003954575,3162694589,3127212277,3130497474,3154335549,3157316971,3147558205,3150996459,1008765634,3148549304,3158261990,3165917332],"block":"a11958b7d673ab2b86875f4e6c68cc694406"},
{"x":[3228264064,1134430433,3256516108,1138404106,3242747330,3256608208,1133200574,1136447947,1139364983,1114803560,1141602248,1133407424,1132321955,1131372361,1116242781,3275761800,3272346112,1140995247,3274822021,1103418590,3282443698,3283445773,3280841445,3271823953,3271768340,3280221748,3264546535,1125791958,1140621875,1093164732,1132554205,1139111877],"block":"5cd4a813b982d8d9c4a3a1c790641485471b"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1065353216,3217031168,1075838976,3223322624,0,3223322624,3217031168,3229614080,3212836864,1077936128,1075838976,1056964608,0,0,1075838976,1075838976,0,1065353216,3223322624,3217031168,0,1082130432,1065353216,1075838976,3212836864,1056964608,1075838976,3204448256,3223322624,1073741824,1077936128,3212836864],"block":"00388aa53d5388f3a5d0669edd7938c8ed6d"},
{"x":[3136828540,962218755,3116225233,963152643,3129260700,956173255,990242132,1176256512,983500915,3112889516,980325958,977903535,977757463,986632758,3121007870,3116379440,3124341638,3100481881,931590046,964877009,982551868,3103819629,3121098458,981256774,3096413406,979155141,984506156,961331987,3136140215,973468484,966697501,973882704],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2976855297,2965820002,840274064,2974415412,2976633162,840012232,839209261,2992951992,847749957,831285916,2998662171,2999657098,2980622531,2986992596,851698956,827927724,822031443,2979221685,2996172302,832066172,2997770694,2995293061,2991655057,839098972,842760512,834663371,836614994,2962751377,2988408899,845475597,2984683595,846058371],"block":"000097782b97173b4bb3cda9a18056d56fd9"},
{"x":[3202052880,1056179536,1057738512,1063989072,3216891604,3200650144,1032300608,1058181224,1061481800,1056759584,3202519680,1060767744,1049452512,3223869221,1032973696,1072660492,1064172368,3203488000,1063361504,1057021784,1055743776,3213865684,3219776376,3221474833,3195570112,3213350412,1043828544,1048205792,1059715400,1052546832,3208220424,1046573504],"block":"4335b779baab9357282a7a5a979aa990689e"},
{"x":[988558418,1004494131,3157466045,1016222763,1008677688,3162986795,3140150354,1010255892,3155534889,982316687,1015390643,1014286356,1000181954,1012596823,3133920256,3162847577,3148286771,3148368926,1007110471,998706207,1014505861,3149693092,1006013122,3156714588,1015582018,3153528125,1008475207,3118902804,1008637158,3143182151,3109385339,1007130143],"block":"9398a7a54d6014bf59d31cb841814692894f"},
{"x":[3283054564,1133136584,1127560580,3290663026,1140997061,3266074042,1134218206,3267520960,3289047988,3284358954,1143019549,1136416784,1133223191,1112917536,3279434671,1138064591,1132913516,1129885317,1135385760,3286348822,1143012808,1126501176,1143797960,3289847472,3281412598,1141288971,3277655043,3280845711,3268785066,1140862237,1083555424,1143759527],"block":"68d55c5546df126904f9be2db1b495278b03"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3204448256,1075838976,3225419776,3217031168,3229614080,1065353216,1075838976,3229614080,3225419776,1080033280,3221225472,3212836864,3217031168,3227516928,3212836864,3217031168,3227516928,1069547520,3204448256,3212836864,1065353216,0,1073741824,3229614080,3229614080,1082130432,1073741824,1075838976,3225419776,3223322624,1065353216,1056964608],"block":"003817bd7265a08acd0002ffc4d62531a695"},
{"x":[3135522890,3108458497,974411482,3128253392,3102528111,940521030,3135803823,1176256512,982740280,3126801548,3129938064,3107400123,3114960356,975294014,3130410542,969762407,971468768,3116248794,984502789,973370712,968914338,3138692067,967628882,984380187,973618004,989276337,940020728,971476485,3117810320,3093927822,3115466851,3130667131],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2990985826,836213779,841533644,846516617,2996499184,2964257665,839915048,826624094,839264307,834065770,834430155,826904320,3003994875,2999220383,790863187,2986687627,846663279,845953788,839669231,2974375255,2985623774,2977040411,2987722826,839881837,2986674860,847761602,835846839,2991291815,2993948747,825707033,2981675851,843102053],"block":"0000b5baaa7b64786aa96ac99959509278b6"},
{"x":[1065772440,1067254312,3220496924,1073741824,1067839924,1030847744,1056217552,3205594408,1059354376,3204103008,3201835920,3210647168,1069399408,990097408,3194152544,1071127832,3196983120,3208392504,3209575880,1049050768,3221225472,3203449888,1049570016,1075164112,3216221212,3179288192,3216084496,3214037480,3210179528,3215822716,1068156580,3198136304],"block":"aeb494b4bf71f4a8760ad68ad9cbb3d83992"},
{"x":[999657185,1015321892,3156782474,3146436628,3164256345,986605691,3154284447,1008745144,1007225395,3138914570,3122769428,1010042158,999930931,3158140610,1001158779,999809300,3131171143,3147427225,979048120,1013668219,987189412,997224611,3072521666,3153660139,3148424192,997779783,1013059845,3154708388,998385910,1020392146,1009854418,1015901153],"block":"909a87938b497e788aa5a57948b5770c5637"},
{"x":[1142125296,1141553200,1124794045,3267296616,1118077056,3274063471,1126096664,3288114837,1126103105,3280842092,1131735483,1138751033,1108827186,1132500861,3271174304,1119593950,1120437681,3231749172,3268342510,3279960523,1112891398,1123349068,1130496895,1125191302,1134629070,1127664933,1130503739,1128015895,1126550086,3289332090,3289521419,1125782114],"block":"9cd4708096b9776a566f466c555267f5fa67"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1075838976,1069547520,1080033280,1075838976,1069547520,3212836864,1056964608,1065353216,3223322624,1073741824,3221225472,3225419776,1082130432,3221225472,3204448256,1073741824,1056964608,3212836864,1065353216,0,1065353216,3217031168,3223322624,3217031168,3225419776,3221225472,3225419776,3217031168,3212836864,0,3227516928,1075838976],"block":"00b873a5618365bad7b6edc4ecbea08cf934"},
{"x":[3108020585,3127920395,3112621130,3123928925,3102284711,3129421783,955876115,1176256512,942214349,981263901,985477514,3130844443,3113774416,983507493,971744216,971185358,982885057,3131265663,976266863,3137713771,962974647,984299791,974779941,3131204178,3070592811,3120934798,976224617,3131018523,965044306,3114335470,979291866,3113714942],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[847115834,830841913,2975323132,2986849316,811237696,833694105,2989394100,819170866,834387130,846443232,2972991008,843781732,838034599,2995238547,841575729,2980656891,2979863890,2985563236,2990551116,848371941,2997119329,2978697280,829728239,2989088261,833041280,2995531375,2995843581,845894544,835615490,840535767,2990307076,824769549],"block":"00006e5a37f5086a9449aa1e17edbbc13c96"},
{"x":[3209123024,1060844008,1070341864,1056461280,3217596456,1068506948,1059859584,3218495724,1070913264,3212970200,1066275000,1054218352,1057278848,3214264248,1054343424,3204504448,1060587040,1059330528,3205982344,3188697824,1039627968,1044983872,1057123568,3223329637,3193109120,3206283312,1064715672,1058912496,3164760064,3194029216,1051082896,3202173088],"block":"0135a6aa6d8a839caa037d65bca98a749976"},
{"x":[3147447204,3150465331,3130742046,1006048307,3154706022,3146015580,3140360397,1010393072,3163652920,1016035195,3163520537,3138526290,3166981650,3154171356,3135384699,3126298378,1011045453,1016236905,3150563758,3150176112,997839093,1019030948,993076306,3149271716,3146668288,3156746009,3164177950,3149257554,3148224317,3160107806,1008610253,1009505618],"block":"221ac6e6686b95f7976c725e22676045b7c8"},
{"x":[1133288830,3267757942,1110652236,3284996684,3280771648,3284440643,1126381308,3280794012,1139863878,3282266487,1129238611,3280988098,1141332956,3285909420,3281193659,3251792488,3267719523,1126896408,3288478293,3283130140,3283873962,1136101841,1130304989,1127968889,1138298605,3263807842,3256022008,1140886317,3247872238,3255109071,3264630085,1136156103],"block":"3bd49459f7deec3e565c219d950c808e9c38"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3223322624,3204448256,3229614080,0,1080033280,1073741824,3225419776,3223322624,1069547520,1073741824,1077936128,1073741824,1082130432,1080033280,3204448256,3212836864,1065353216,0,3223322624,3221225472,3225419776,3212836864,3225419776,1073741824,3225419776,1056964608,1082130432,1069547520,1077936128,1075838976,3217031168,3204448256],"block":"0038a38730482f6c22c32b9cfebcefdf5776"},
{"x":[978246149,3124712776,3129110016,3133386167,3133424972,3136072926,987465331,1176256512,3115710153,974924784,984001963,967598212,989883007,975927411,3132877263,968810857,3120613680,3123712377,982663902,3131654980,3129198715,975287133,988016743,985469187,3125631419,957510124,965140628,960800621,3121432568,3126975366,3113462186,988847875],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[790353976,2991603125,2985745021,843259856,841783531,843456297,841156889,834718519,2984833919,2986168805,2994085794,2959198515,840081387,849405302,2981409133,834532160,2992322860,848536784,832562628,848266113,2959046903,2975142250,2998630258,823155243,851243443,823708026,2963734237,2936944271,2982762263,842240381,842085333,808699886],"block":"0080d82c6b248494f5760a7b8d88a5414a86"},
{"x":[1071772364,3217602932,3201305632,1073741824,1064380000,1037080320,1072417836,1042492992,3223803652,1049306176,1057223696,1040281856,1032328000,3208977760,1037946496,3211752376,1071435876,3214042820,1056671312,3180292352,3221225472,3220599576,1061753904,3211544216,1072006568,3223553550,3214554832,1038745408,1071318212,1056277808,1047962528,3207331744],"block":"3b35dd53a78e2b28ae58d0094a88d8969865"},
{"x":[1014554337,1008500669,995198935,3138049024,3160459929,3161361418,3164996882,3158132633,3153322700,1015431478,1009717581,3145482834,3152025620,1004138363,3162925586,3163490271,1011855995,1013173022,994363822,1014240742,3160496046,1007829422,993042043,3121999053,3148477808,1005698386,996999843,3160311905,3163647068,3152194457,3142016102,3154676633],"block":"3019dedc99e733c2908365be9c36155b7251"},
{"x":[3266617004,1127486555,1136470381,1126311586,3257947408,1134924495,3274977993,3254044588,3279205378,3274479056,3283933142,3284438014,3233309472,3281866025,3270477348,1130361445,3283027967,1125967364,3273012103,3266759223,3283012404,1120682425,3290786877,1109741548,1129256770,3269243860,3284051478,3280061332,3289136659,3287177853,3273080437,1117528412],"block":"2b5547aa6d7a479c0688b57633531824679b"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3225419776,3212836864,3204448256,3229614080,1080033280,1056964608,3212836864,1080033280,3204448256,1077936128,3223322624,1065353216,3204448256,3221225472,0,3223322624,3223322624,3212836864,1073741824,1075838976,3229614080,1080033280,1080033280,0,1080033280,1056964608,1082130432,1069547520,3227516928,1069547520,1077936128,3227516928],"block":"00383266c7d00ff9f68ff79ef3ba17b4e813"},
{"x":[982649820,986059244,3110859211,976732578,3129928872,3110892995,976762954,1176256512,3098999653,3129696568,3122532312,984415728,3121825235,969139405,3132512023,3106795095,973649322,982014632,974081098,962567996,958179574,973164766,957149316,3116350473,3122462811,3131947246,974467982,3128516117,978236384,3126794609,3131315880,985237255],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2996819165,837808544,837584357,824138060,2980345603,825114628,2973810703,835041801,2992839974,839927546,837932539,839010238,2988160714,823240992,837885016,829008961,824801654,2986399767,804962556,848106179,832796521,816915364,2976212663,845808736,841099777,841702581,2975419404,2974387796,851025382,2948112582,843917651,839601752],"block":"00807fb585276a8799365d4595950b874557"},
{"x":[3209647592,3190485216,3184870400,1060095344,1061227824,3184480320,1069165576,1066152512,3204348944,3205348416,1068804568,1052101136,1056231104,1067352628,1039255424,3200803232,3208906952,3210201528,3215217468,3206320744,3214024040,1058764264,3188119616,3212140656,3192643392,1067764464,3165973504,3209895512,3215682064,3210441304,1059780528,1053008080],"block":"d1b1ccd9f9b4e45990d29b1b80d6f5d1476a"},
{"x":[1008000558,993967923,3159433595,969646080,3137611346,999755766,1010049761,3154360115,3145106677,987933368,1003335229,3159794375,1006786601,3156215833,999288013,1013172178,1012186680,3163891156,1010042306,1015996103,3137676923,3150648955,3158895631,998378793,3147054049,1005602252,3154298962,3142194483,1020984903,990936473,3157809792,1003787847],"block":"d89a45d75c3899a7c57a9967a69c067bb764"},
{"x":[1118713112,1134197755,1135080852,3275784459,1123150937,3274505493,1137755403,3283402418,3271673718,3289307821,3234226872,1101849215,3283622984,3271047910,1088921524,1131175898,1135227102,3277418146,3266210016,1119018306,1127483461,1135742056,3274277071,1128957614,3288037301,1134850761,1130948123,1126951317,3272041762,3276392756,1134530919,3290386117],"block":"fa54c95c7c96aac66db326c1b8a86356c80b"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3227516928,3204448256,1056964608,3225419776,1075838976,3227516928,1075838976,1065353216,1075838976,3212836864,1075838976,1080033280,3217031168,3229614080,3229614080,1080033280,1065353216,3225419776,1065353216,1056964608,1082130432,1056964608,1082130432,1080033280,1075838976,0,1056964608,1069547520,1080033280,3225419776,1082130432,1073741824],"block":"0038a127a992fd91fdfadd869dbff520f0cf"},
{"x":[3090181915,974918501,973523174,3135078605,3123966436,3124990526,950651913,1176256512,979003983,3132584846,3130275480,3122099225,985281451,979227378,3138536482,3126339798,3134751052,3120910082,970482271,3119407645,3127765968,3124482516,985028027,3131140858,3099144291,3121635541,981926159,987147764,3120271082,3122744337,3120808354,3132577289],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[824116263,838601330,2984720134,821260067,845088368,2964936269,2977378897,2998421751,2962472762,2996099529,842716430,2991541358,2980954683,2967660481,846796493,845949166,838791297,837228068,843307541,2977719209,2987340547,835685831,847840038,2995061782,2947324198,839751200,831895609,837830920,839366994,802632107,842274096,2987920910],"block":"0000b9bbc5795da7e72088b2acb4b687cd5d"},
{"x":[3213893176,1062499880,1050392288,1073741824,3205437168,3208615576,1062568416,3200901184,3206177712,1050829472,1061438392,3215813348,3207404112,3205243128,1057379808,3223849154,1059030176,1063930696,1058840944,3194506304,3221225472,3213910444,1065999156,3199908224,3169506048,3202342608,3210937488,3200714976,3215988268,3201021568,3182285504,3209327904],"block":"4035a5bba97e2656bb7786795a7446768a60"},
{"x":[3144509091,3155646489,1016959710,1009473566,1008057661,1013719639,3162255774,1010522429,3159645260,3154862495,3147421235,3137837240,3136738836,3160611072,3147478978,1010659389,960569344,1001912350,3155054264,1012085079,3157955681,1004432937,1008301716,998420828,995321262,1010283950,3157976975,3139442913,1016383785,1001109770,1015767862,1005167083],"block":"ed988a6cc034d4524e637d3cda99096e1a53"},
{"x":[1141304627,1140725202,3250778188,1126818605,1144212878,1116991768,1131581292,3273535509,1125305020,3289972783,1133503733,3274227093,1116332744,1136988078,1140314530,1133620128,1132556033,3283582015,3284497132,3280364267,3284761217,3279637500,1119999456,3265741154,3275381109,3288268217,3250028788,3251074513,3272156081,3246747238,3281914700,3273890278],"block":"9ad552c2c8b6c0b7759aa6ef858aa784c2a5"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1073741824,1056964608,3204448256,3225419776,3223322624,0,1069547520,3225419776,3204448256,3229614080,1080033280,1080033280,3217031168,3221225472,1075838976,1065353216,1080033280,3204448256,3204448256,3204448256,3225419776,1082130432,1056964608,3229614080,3204448256,3221225472,1065353216,0,1075838976,1065353216,1077936128,1065353216],"block":"0038fc79777223f89b027740af8fd5a4edaa"},
{"x":[3130778358,970074162,3125196375,985811928,3098110985,3096632361,3122668553,1176256512,984496276,3130968663,3118233486,3120406398,3112682668,3132001039,965724488,966003622,942327464,3126465946,3115817518,3121180083,3138626197,3123257467,969717843,3130834748,3120793854,979665765,983317861,3134384981,3136305702,945758799,977142113,965477893],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2988686719,822421856,2981935975,849100611,2989198115,841414818,2979432664,2990700232,835287548,849630275,2986802050,837425121,2986201898,814390610,2983285572,2987525564,818147118,845113521,2987114992,2987442585,2985650081,839081567,2951609029,814666691,2991160282,838970021,2969858538,820266770,839049993,2998124316,2963890531,841566688],"block":"000094d9565f54bc86844abf759bb50886c5"},
{"x":[1066833716,3221336649,1063867096,1068039836,1062503776,3196398880,3216037728,3212649712,3208596840,1054675184,3185110400,1067261884,3198686640,3198010928,1060930368,1076273556,1061163704,1071354052,1033843968,3177072384,3216146804,1069888432,3212907616,1047754784,1067876752,3213197820,3212596912,3200849616,1055851504,3205059280,3199611552,1062830264],"block":"35b5643e8584c539bc7b4ab7b89479a99650"},
{"x":[3111005716,3146834114,993762611,1003826114,983097139,3160756475,3146232064,1000231373,3124286341,3137169899,1012643573,3153943347,3169787233,3160065070,3129657753,3153028505,3150683044,998296105,3149930352,1006198845,999715983,999574548,1015094379,979407339,3158091233,3153382441,994371563,3140551373,1011380628,3148898181,1006866939,973803028],"block":"791b689769aa9894c78958679c76b074a886"},
{"x":[1102969940,1125469664,3252635563,1132053436,3267098560,3267013454,3275129803,1121470375,1116853937,3282989914,3281078009,1126645289,1111533410,1097728332,1124988520,1141340791,1130884364,3282191909,1132381683,3286202858,1125193336,3265732642,1120821062,3282797529,3285115348,1120549356,3282369945,3286614725,1135320167,1142586696,1143998369,1121772400],"block":"80d558c658d569997ac7d77ccbd647180672"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1075838976,3217031168,3221225472,1082130432,1082130432,3204448256,1069547520,1075838976,1056964608,1075838976,3217031168,1075838976,3217031168,1056964608,3212836864,3223322624,1080033280,1082130432,3223322624,1080033280,3229614080,1073741824,3225419776,1075838976,1069547520,1077936128,3229614080,3217031168,1073741824,1056964608,1077936128,3204448256],"block":"00b8130bdc10f049e5335723fbb34b772a9d"},
{"x":[3119421687,3101481305,3136691848,972787254,979816613,3126955918,984053396,1176256512,966802834,3130297340,3124484301,3131176391,982821118,982639702,938324002,3135121908,979977422,953345901,3129632232,3048512422,3128861418,984871142,3136022369,3133033493,950144599,985632461,3122223604,964441015,3113345287,965189682,3124988183,978335974],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[842145698,838330393,850006495,831752350,842215212,2998868739,2977004999,2956759747,2991055845,2988449717,2992805110,2981794649,808403276,831063265,841052071,2956369334,848685017,2928698256,849936798,2984618644,2968276079,2996812314,822830307,2979234419,845982822,847016975,2992604599,823697117,827513239,814722053,2964908266,2991926252],"block":"0000ec8bff6a7c109768d4d5339698898b48"},
{"x":[3215189456,1048774336,1061846464,1073741824,3189784960,3219498552,1061063448,3215506760,3193817568,3220773712,1016114688,3182720576,1040972768,1060309808,1048603072,3217887256,1060505280,3216944312,1047958656,1047194944,3221225472,1071384136,1068603072,1069135124,3208017856,1074390548,3180898752,3217155696,1050882224,3210664160,3212669744,3196458528],"block":"4fb45de77571f92f353db90f88e877b5c79e"},
{"x":[3162401464,3153901189,3160722324,1007030144,3128657264,3144719810,3144760197,3155189796,3146999992,3148647178,3163675871,1004799221,1005747794,1011823989,993919856,3133004513,1008185313,3152177561,993472184,3156548403,3136665190,3158493875,994120253,981015593,1013309148,3163967247,931856384,1004372674,3141077954,1003833446,3149487923,1010716334],"block":"b218c155924c78369684e60680bb7bbe69d7"},
{"x":[1108615536,3281696164,3269471448,1134643634,3281089208,1134575600,1083942124,1140921965,3273760284,3290048588,3280885629,1117243356,3273785212,3283689767,1132848472,3281311376,3282118409,1121849800,3273754959,1107206840,1122799000,1108503373,1128946636,3283620462,1133554016,3288066373,3274843162,3244970480,3273258450,1124507873,1117780994,1138149191],"block":"d1544894678ca48cb83fc610648966a39be4"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1056964608,3223322624,1073741824,3227516928,1075838976,3223322624,3229614080,1069547520,3227516928,3227516928,3212836864,3229614080,3229614080,1077936128,1075838976,1075838976,1075838976,3212836864,3212836864,3225419776,3227516928,3221225472,3229614080,3204448256,3223322624,3229614080,1056964608,1073741824,3221225472,3212836864,1073741824,3212836864],"block":"0038d9636c211d43007b310196c0406ecd6d"},
{"x":[3137414327,972031837,3128214791,982175503,982896776,3129371804,3140249422,1176256512,3130491188,3131518772,3099606713,3122192597,969903408,3111020332,939312809,976103228,3132710544,3115973805,3101814359,3125144470,3115553555,988200555,990844048,3122318656,3126004065,985345610,981552743,986418062,970196911,3126797370,3098358842,981833859],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[822429909,843738482,835384840,798787595,842089815,848915050,2999080506,849549003,2983970169,2979212086,2972052536,2970096673,2996428451,3002344279,844576757,2993511046,2971711602,839663014,847918330,2988124035,2959716746,2980508146,846702766,2989679222,2973714667,844197179,819262778,2991230290,849684437,2952666278,846854121,760868768],"block":"000079abda588b7dc25d76b78757d380cc84"},
{"x":[3194011040,3197706576,1053494688,1062427904,3196291648,1065589408,3212585352,3208679520,3204032784,1070539356,1046759936,1051844224,1070380412,3193103808,1073184572,3199789760,1036288640,1042425312,3167771904,3218418480,1055150656,1055462496,3211365480,1058664400,1053867184,1060388160,1061584960,1070036580,1058898488,1054343200,1052807264,3140575232],"block":"bcb3897986f56964cc6b6a51572751696089"},
{"x":[3140475003,1003349033,3128078827,981958246,3129377587,3143433175,3148707430,997268275,1013988387,991845499,3098038108,997718261,1004390246,1022105518,3156032568,3147025408,3160821396,3155577630,3144860385,3146386043,1015924449,3122540134,1007938795,3158460272,1002701711,1003693598,1012762583,993206374,1009968199,1006085048,1015351992,997561917],"block":"619bc9b69898388959b76467487756603b79"},
{"x":[3275287509,1140950250,1143199661,1118039744,1133393638,1140635272,3283509875,1094956932,3253563538,3280195840,1134708730,3250460488,1131204239,1122962912,1139412331,3239558180,3280079525,1087687024,1110651448,3264600666,1125632761,3274526868,3282987912,3247315588,1143331530,1125029836,1135650842,3279883228,3282748404,1130802126,3288174589,1125444595],"block":"2fd5ba82709765a2cc88086b44b8c557e268"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1056964608,1080033280,3223322624,1075838976,3225419776,3212836864,1065353216,1080033280,0,1075838976,1075838976,1082130432,1080033280,1056964608,1073741824,1077936128,1073741824,3227516928,1056964608,1065353216,3225419776,3221225472,3229614080,3223322624,1069547520,3217031168,0,3223322624,3223322624,3229614080,1065353216,3223322624],"block":"00b847f17d63eecaf6d158b383d0d1f764d2"},
{"x":[3088121463,975727109,3138733488,991340405,3132874871,3131193025,974112154,1176256512,3125568103,3129380422,3116957353,3118107002,950809789,3135537779,3117612860,976417809,3118281114,976818471,3124052329,978433295,3126691308,963245114,984792773,964839031,3123638871,988085380,981868704,3113242280,970568041,984099976,973969114,3100607317],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2980050410,2942267969,2989439874,2991311320,2989984121,848202767,2993897980,2995932168,841364046,2981644873,845093028,2968045181,2992499904,2970088512,841332548,2931510257,847696927,2986704726,845949166,2980351959,830161816,830779744,2978343751,836910552,2983684757,2989301973,2953311404,2962399232,2997306871,818666551,846477119,835681751],"block":"0000e658e463a4af62b15c468d870397eca8"},
{"x":[3213442308,3214576480,1046123488,1073741824,3193961952,3221937959,1068401384,3204989232,1059330880,3204073360,3215791068,3216118544,1061014920,1051830352,1037332672,3214424008,1071285048,3219498660,1059544160,1066854452,3221225472,1051058896,1067675736,1050746224,3215213004,3211928944,1041593856,1059635936,3218843672,1042230048,3215068388,1050830304],"block":"5734e414a9cf1790dd963a5693a32b993894"},
{"x":[3157034706,1011043215,975438151,991956746,3140066529,999859650,1002289991,3144789217,3165987515,1013908106,990184632,3134910136,3155303347,1007548457,982725673,3158808325,955573207,998296965,3155794068,1015492521,983407575,3140334571,1000446699,3126156083,3153552056,3171090098,1002699346,3164058775,1015725819,1017781965,1007571440,1006723246],"block":"181c859b68c987799987620c9938c6daa8a5"},
{"x":[3289529369,3268650985,1133902316,3276236456,1124973155,3277033659,3285076451,1117230437,1127101355,3284740789,1114764748,3286326153,1135801808,3267746279,3269802010,1139511252,3287303942,1135398688,1139225310,3289112880,3273995728,1134032497,1127587664,3276235978,1129207233,1134503028,3292883235,3285163882,3289142962,3276591318,1102791890,1111221486],"block":"2b5632c7db2669b6a469aab409432c67878d"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3204448256,1056964608,3204448256,1082130432,0,3217031168,1082130432,3229614080,1077936128,1077936128,3217031168,1073741824,3229614080,3221225472,1065353216,1075838976,1069547520,1077936128,0,1082130432,1082130432,3227516928,3229614080,1075838976,1056964608,3217031168,1056964608,3223322624,1073741824,1082130432,3212836864,1075838976],"block":"00b85927890008fbf03f72b27bd44f0ca633"},
{"x":[3117826229,976432505,979941934,976777651,959655281,954924991,985004782,1176256512,978857649,981180884,3128325612,967789806,3125724939,3103606375,979451471,3129709970,3108283679,976136889,981587862,3100589556,970418766,992037594,985374344,981014324,985104360,979845014,984514790,976438690,3137706055,3110656148,960436044,971298178],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[846573611,847244700,827810751,2994909091,835432160,836648269,837187105,788873759,2983994585,845151214,848294881,2996732199,2994432054,2975902631,832432093,2990304784,2989198346,848136139,824265427,2989537133,3001504900,2982657949,2969619631,2989486898,842042372,846017166,2957113652,2962830447,2971410009,2990563899,2987970335,2995912167],"block":"00005cdc99530a6a7a58b6cc8d8374575935"},
{"x":[1065790992,3201799968,3217540308,1057999408,1067851760,3199607952,3188989024,3217540700,3212762416,3220199344,1034377600,1051822464,1070972716,1065622012,3206351088,1070155368,3205024520,1068982776,3212326624,3205776048,1060716272,1053094448,3218285672,1072093516,1066629936,1063122256,1048977280,1067766424,1039478912,3216631904,3189852160,3178481280],"block":"83336ce6416abea617f1d4c098d99f2c758f"},
{"x":[1017872333,3154448880,3148600207,993393869,3149015408,3131419730,3142778962,1016099983,987466465,3137561395,3121757798,1017679984,3137418936,994142474,1008613995,1012324428,1003761408,3155347328,3152214292,989212958,3163335798,3156730491,3158804162,1010713707,1011585879,3162915131,1011533460,3158379586,1004128829,1006307799,1005123573,1015215990],"block":"5c9960bbba77fac8d94137e938d059575423"},
{"x":[1127550792,3283057362,3279816440,3287406326,3271266179,1141928392,1135681597,1113724648,3279111543,1134998103,1134303397,1124512383,3259178234,1109846286,3280014158,1117518981,3260094358,3277813453,1111318948,3268168416,3276536953,3264595679,3272928928,1117823200,3269925910,1106699540,1125421467,3288427037,3273748124,3245186630,3272004440,3287757809],"block":"84d495bd7c9fba90a377ab8364f6a987acf7"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3229614080,3227516928,3225419776,0,3225419776,3221225472,3225419776,1069547520,1073741824,3212836864,3229614080,3225419776,1082130432,0,1065353216,1080033280,3217031168,3229614080,3225419776,0,1082130432,3204448256,1069547520,1056964608,3229614080,1077936128,3223322624,1073741824,3212836864,1069547520,3204448256,1082130432],"block":"003850012288f274b29b0ce630c26fb87aff"},
{"x":[974577181,3114365109,965714805,3132334306,978192581,968617559,929802749,1176256512,984349352,965698077,3114798826,983857415,3126714991,977084589,3116457706,968630469,3133721863,3133886645,973923623,3105446396,3124646388,979044598,3125012563,3125105542,3130057409,982672028,3112257061,989734761,957836723,3124440622,3130528146,982461346],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2992247870,842276926,849629171,2992276002,2986355717,2986977193,2986255660,835061966,2978629420,806120243,2983594606,2973442302,841856765,2990565252,839119974,847048726,830651442,830502471,2991339006,830058651,2995458653,845883630,2972558161,838169332,2979556091,2974363980,844173707,827215576,821693687,841826754,830023626,840582867],"block":"00806d64d06dfb2b9b56aa983b79744d6542"},
{"x":[1047795872,1058792112,3204934128,1073741824,3199176608,1056289632,3193793984,3213091320,3204807616,1065992800,1047112672,3212602976,1014488064,1061528368,1054768448,3213163952,3215664344,1074536312,1053074944,1013019648,3221225472,1064382464,3200035968,3210025520,3217176172,1065920512,1046200800,3213557440,3174874752,1037917824,1074247488,3216101168],"block":"61b4d7067a81f95699bcea4477cc888506dc"},
{"x":[3170287114,1000840929,1016848194,1009542313,984825528,3138111365,993081590,1005051197,991644344,3157325158,3141625262,1013382415,3150628802,3166229262,3154020024,1010678077,3163640279,3151652096,3137787023,1015647856,985502843,3153326837,3163764198,1008168606,3149187133,3163422300,1011163120,3147301161,3161066444,1012161546,3161742008,1007332823],"block":"b61b30697dcb886739aa7935b77c46b246ab"},
{"x":[1139821780,1135287805,3271546398,3250257988,3274495884,3268447642,3255980871,1119261344,1126954636,1124588264,3272152284,3256088834,1103878190,1133335981,1138881622,1132670113,1117408918,3276810665,3290414029,1111170786,1145424742,3288609737,1128263320,1119637150,3265383404,1123219000,1124860542,3255786846,1139783464,1131487176,1144418383,1141408804],"block":"2ed673a5e9880ad968779677798838651325"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1075838976,1082130432,1077936128,1077936128,1056964608,3229614080,3223322624,3223322624,3212836864,3212836864,3227516928,1080033280,1073741824,3227516928,1073741824,1077936128,1077936128,1080033280,3204448256,1080033280,1080033280,1077936128,1065353216,3212836864,3221225472,1082130432,1077936128,3217031168,1082130432,1077936128,3204448256,1075838976],"block":"00b823109212172f6dadca0a2fb1042f9432"},
{"x":[979583558,3130056401,3132152841,975086879,3120813294,962153088,951164929,1176256512,981612249,3122506630,971725554,3131743650,961445626,965771920,3129665180,3137469397,3122681668,3040459359,975937733,3134816203,976627467,965215683,3086320927,3131198227,3115016487,986014807,3122202354,3105789084,975145690,3112544830,965386650,981270856],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2983009910,2990798866,2985830931,2976914632,837306065,2948958175,2988343712,2993903542,838019502,2988048353,2975455739,839143371,2972145329,832378459,833793651,793357017,830363765,813769472,847562248,837236594,821663107,2990836291,2975895780,2991868828,842441911,841653039,835258997,834044617,2971090141,2994061436,2970326840,818430972],"block":"00806b8e0c5a75e8adef243d5a5499f69578"},
{"x":[3160690176,1059953152,3177946112,1070085828,1034526016,3205309312,3215079464,1075075260,3209297504,1061092248,1056681312,3202242112,3193981568,3210662776,1066250360,1057582584,1062180944,3197579904,1070222048,1070632808,3215153708,3196412848,1066719556,1072058896,1057834464,1040914880,1070458532,1060452352,3178406528,1052491536,1053603440,1048001888],"block":"a3b458963823c89a4c206b852669897b7476"},
{"x":[3160041246,973342802,1000239595,3149680097,3137631437,3144594391,1007529262,3141526610,3168613816,3141058765,973838827,3159217618,991556403,999222374,1000408750,1007067842,1003474063,1003812628,3150636298,999848110,993755238,3160463155,3137047675,3134249861,3154420029,986582630,3164718059,992077066,3138254602,3144766627,1009694710,3148420034],"block":"ea1aa4a8699697477b87608728947979b96a"},
{"x":[1144781758,1135796577,1141946791,3272465287,3275069643,1124737139,3279848212,3262045971,3283038387,3263833173,1130289848,3244824380,1132481192,3268267698,3281756572,1126364423,3271819612,3289386304,3280421726,3267958754,1136953330,1116970768,1143042986,3288064320,1130561320,3243571880,3254284813,1126397330,1140270960,3262180034,3289732844,3277377937],"block":"e0d590e4b29a4a771bd96c8986683599eba6"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1065353216,1069547520,1080033280,1073741824,1075838976,3223322624,3212836864,1065353216,0,3217031168,3217031168,1075838976,1080033280,1082130432,3227516928,3217031168,3221225472,3204448256,0,1073741824,1073741824,3217031168,3221225472,3204448256,3227516928,0,3204448256,0,1065353216,1073741824,1065353216,3217031168],"block":"00b8c695814443bdca96f88b9b8361406fbb"},
{"x":[3131543303,3114105750,3120812901,3106283848,963139404,976412976,961723335,1176256512,990034275,984681661,984474584,985596380,981856449,978626413,971507614,3133111284,3126682010,3104065848,971176395,3127183639,975180030,3076819780,3088370238,3127238943,3106785297,967078527,3110046434,972381684,3122169824,985352492,975926797,3121367483],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[839554018,848951332,2966678480,831601167,843211596,826909194,823503221,837088546,2983749386,2985669988,2988885957,828962554,2998482043,844091732,2988024859,842061850,3000674553,2987524292,2985107605,835770345,2987799572,831766491,2949140625,842088414,843745225,844292463,2987638726,833342175,2963615996,801340352,2967602628,2960308936],"block":"00000b5e68a95c9989bac6c655a9818c758b"},
{"x":[3197151744,3219498452,3214838664,1073741824,3217764968,1058351288,1057282680,3208695472,3191263488,1049349600,1050252816,3181010112,1068596272,1060483216,3201793120,3216755332,3214733676,1066685424,3198547856,1043634432,3221225472,1049722128,3211073968,3193588768,3208906464,1063145456,1055301952,3212449168,3197352992,1063862664,1052509568,3208099560],"block":"00b4d93f9d70fe76c69bb95767c892457abe"},
{"x":[1002622607,1012166809,3100357427,1009460557,992359710,1007779425,1008740080,994215874,3155871365,3147409285,3164024274,3153746380,3154585354,3149228585,974190674,970947952,1015266680,3131692318,3156457374,1017141670,985294356,3147684362,988718366,995533885,997316034,1015056443,3160957383,3142218895,1005102315,1013198218,991358771,1016240850],"block":"03991693c80477a474776c2aef9b5b2a7818"},
{"x":[1131201773,3275135587,1086356524,1120530812,1124543742,3268072004,3283642151,3240202130,3281195979,3229890072,1125958036,1121945650,1112204698,3260342458,3283171962,1128642726,3273646406,1119918250,1140419464,1128370448,3276827315,1110105973,1078587416,1123495112,3291706028,1138794561,1133429506,3287127411,1124941917,3255470534,3280314036,1134656356],"block":"9c556b96e8a96a87849805d8ba39a98754ca"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3212836864,1073741824,3212836864,3217031168,1082130432,3225419776,3227516928,0,1056964608,3221225472,3204448256,0,1075838976,3212836864,3204448256,3229614080,3225419776,1069547520,3229614080,1080033280,1075838976,3225419776,1080033280,1080033280,3225419776,1082130432,1075838976,3212836864,1056964608,1069547520,1080033280,1065353216],"block":"00b8ea54fa1b30ee1f18e70c39a8735a196f"},
{"x":[977109926,971960435,978433205,3125052007,945224287,972791072,3124742177,1176256512,982880285,3109196563,3133383169,964725130,3121763124,990196753,3104501007,968752251,3135804355,965999936,982770619,3132007261,3123354043,3131588965,979056624,3134812271,978484790,988627956,986117850,3125770888,3136022164,3139055940,3127163094,3130436305],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[836678055,2995316449,845656625,837835473,2977434388,2978123064,2988168859,2898655389,841715573,2975209187,2968501178,2998259318,2999506797,822969421,845493507,845445114,2986562987,839254171,2969958761,828263849,830689968,2994244058,2982729159,832276218,2931144669,2996785342,835691007,2998981376,833326541,2978969195,2957045190,846446383],"block":"00005ab37d9a973765a88b27a701a0798ddd"},
{"x":[1032221120,3210566656,3206278504,3223059085,1065982728,3224418541,1074533184,1068630672,1072061136,3205417232,1032246208,3216221748,1066033716,1052067552,1053398144,3214295016,3180568768,3217958716,3199789008,3219433448,3209494320,3196104128,3191011616,3207641056,3217835600,1066252256,1062082520,3213907956,3210811184,1063989888,1067161784,1067566500],"block":"8635883576316b707e6c3db6a8545bb9c9c5"},
{"x":[3162842260,3137844551,1005214699,1013916539,1012072837,3152692183,3153675663,975216886,3094346465,1001032448,3157873879,1004120729,998507847,985612370,1014074107,3151152865,1006258391,3157628231,1012215465,1013026826,3158587433,1007696691,1015402895,991655731,3159024589,3144672809,1009160279,1005043814,3099857387,3157671634,1008340521,963967385],"block":"2f984fd92411e24c0c78e8a53e5586d7318b"},
{"x":[3277493859,3272121187,3273571068,3289087687,3273912778,1098180282,1062025600,1121648218,1138902345,1141454997,3267947204,3288395999,1143502727,3275321540,3271562474,3240003080,3279957092,3277740581,1127438208,3279598546,1141631121,3284050353,1109271560,1123647081,3281414478,1136405877,1125086339,3280501559,3292622543,1139495286,3288662394,3269050679],"block":"0b565667a652e64888995dce97530fd62778"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3225419776,1082130432,1056964608,3229614080,3223322624,1082130432,3225419776,1075838976,3221225472,3229614080,1073741824,1080033280,1075838976,3225419776,1075838976,3221225472,3217031168,1075838976,0,1075838976,1065353216,1069547520,1082130432,3212836864,1069547520,3225419776,1069547520,3229614080,1082130432,1082130432,3229614080,1073741824],"block":"00b8be30873f6d500ea35cef54f1030ef34c"},
{"x":[3124622271,3118973797,3134013412,3112184677,983850730,974559880,969782756,1176256512,3121497867,975616484,953448203,920940184,945681204,3122531353,981932155,977943200,973102097,986416718,3113204941,975048139,3130592146,961736574,984024208,984068436,965750080,970468263,3123238421,3122194432,3123157492,981155177,3117348422,3134466430],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2991953622,846531005,2989586257,2971289385,2970207848,831015806,2992937335,2986120465,848616045,2993341562,2996879409,2994801346,841011644,818837233,2994793594,825692108,2978030819,2988750789,2955879193,853711632,2975863933,2961335498,844739783,2975374328,840219980,2979476409,830911621,3002743830,841831151,829829665,822096297,854166635],"block":"0000755c85f77789b476ad749304bb9894f9"},
{"x":[1038561088,3206059112,3223152554,1073741824,3207344344,1066153128,1065783296,3206685680,1046602816,1054168832,1060423776,1047288512,1068513064,1074745064,1067318904,3197242112,3214266848,1061762136,3209547864,1062264064,3221225472,3219838388,3206246600,1048769056,3193804544,1076150872,3213782780,1067381752,3212241640,3215402580,3214629152,3165351168],"block":"26b5c86aaf52eae5a57a9707b647b4c1c489"},
{"x":[3154025298,3146141675,3139167047,3076972871,998466529,985968640,990323589,1000860047,3141526118,3107490365,3160846561,3162698675,987490058,1006680064,3139932283,3128609587,3163159385,3127602299,3155209846,3163462100,3131977892,3152709990,1015529326,1002526863,964185620,1007068820,3140510126,1006955883,1013220951,3146892431,1003749550,3155674721],"block":"7518048647087a59f9ba87c872c1e96cb748"},
{"x":[3282010634,1102014215,1135740599,1125474473,3282854426,3272073178,3273174553,1139709828,3281059943,1132980824,3264842316,3272190253,1115750256,3270408104,1132391002,1118367231,1127032552,3261346971,1135702316,1139821250,1133081000,1130268417,3265787898,1105925240,3285150804,1121280681,1143977833,1139934730,3292361028,1131429539,3278029603,3257597421],"block":"ec55a578ccdab4a7768d459bf7d709b76b89"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[1073741824,1069547520,3223322624,1075838976,3223322624,3225419776,1075838976,1069547520,3221225472,1073741824,1075838976,3225419776,3225419776,1082130432,3225419776,3217031168,3204448256,1082130432,3223322624,0,1082130432,1077936128,1077936128,1065353216,1082130432,0,1077936128,1056964608,1069547520,1073741824,1075838976,1077936128],"block":"00b89405dd830d2e23650c84237e5e403e2b"},
{"x":[3135605941,963643278,988080108,974626538,3132445758,927619613,986468324,1176256512,3120482370,972413928,989705008,980266255,970021143,3131078869,3129993438,965993825,984912389,3130599560,3120796935,3117894927,976582337,981780263,984019420,3131775063,3061579777,976996246,3137331905,977258693,3133687845,983576728,968340358,3132514997],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2973002304,2986945883,837833723,834651872,2989870272,2989080653,816550335,2996747388,838893275,2989969835,849741638,840325115,2985781958,2994830165,2986392895,2983108899,814526804,2993778290,2977695436,848386852,847616756,838762187,2978558703,809188825,2990389947,2987841802,2981267711,804306628,2980435357,2994949326,815325453,2979038945],"block":"008089eba5162c5ca78fd5cca084abee8baa"},
{"x":[3191164704,3181766016,3208996304,3224066742,1048938848,1054396944,1064817280,3179927552,3209972256,3202637264,1056427952,1059705104,3206057512,1076053812,1066293780,1050304288,1038474944,3198516384,1057920080,1078283488,1043127168,3217342420,3190047936,1018455296,1063592368,1062039200,1041968416,1061779960,1076683212,1058312936,1050032336,3193628832],"block":"2ab688987a0f87c785886a6987661a617597"},
{"x":[1008470302,1004059852,3168203941,3151574405,3163007122,1015346114,1015030717,3136182763,3157637668,3139284193,3152839987,992368189,3144992256,1005683159,1000249938,1014212321,3161976770,3146183352,3166840089,3089099653,1005344553,1008052505,3165338886,993925304,3145207890,3154347320,992234864,3165399926,1011760066,1003446743,3151528304,994445107],"block":"b81a3b7a1086a3bd2d9775679629c7aa699d"},
{"x":[3280764115,1100604140,1080946016,1131552689,1114256623,3277835128,3262819184,1136341616,1129129795,1116974818,3278083012,1136331256,3289762440,1102927790,3285864575,1137654838,1124457220,1127670530,3267678854,3289663560,3272583300,3261999921,3282811132,3266230304,1134561894,3282510392,1138019342,3247140313,1144552671,3287457790,3285121662,1121374450],"block":"c4d57b6898e5a79ac99456c73a840ed8cd74"},
{"x":[2147483648,0,3196059648,1048576000,3204448256,1056964608,3208642560,1061158912,3212836864,1065353216,3214934016,1067450368,3217031168,1069547520,3219128320,1071644672,3221225472,1073741824,3222274048,1074790400,3223322624,1075838976,3224371200,1076887552,3225419776,1077936128,3226468352,1078984704,3227516928,1080033280,3228565504,1081081856],"block":"803748c837d937d926ea26ea15fb15fb04fc"},
{"x":[3212836864,3221225472,1069547520,1077936128,3229614080,1073741824,3229614080,3204448256,3227516928,0,1082130432,3223322624,3229614080,1073741824,3223322624,1077936128,3229614080,3212836864,3225419776,1080033280,3229614080,1069547520,1069547520,1069547520,3227516928,3212836864,1080033280,1082130432,3227516928,3221225472,3204448256,3225419776],"block":"003806642bfe00bcb0b71168fff3104c732e"},
{"x":[938406053,942093370,987797697,957740745,985473545,3126128231,3095063299,1176256512,3116541035,981966115,3123127452,974916043,3103820710,983423153,979995894,3132250989,969911387,976499237,989578511,3135623816,965347853,3130147562,3129843577,944793715,978384684,3118470857,3131814806,3133061239,956165653,952243717,981871510,990640849],"block":"e2e488888888888888808888888888888888"},
{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"block":"008088888888888888888888888888888888"},
{"x":[2996000925,2978697216,2960371299,849009426,2984897022,2973296896,793743908,2992152548,2977048893,2988793454,847700006,843584593,2983588239,2980158825,2997253139,850589427,2995864289,2981283398,2997550646,843136327,843731556,827898218,2987926054,842231968,832319865,2948068601,2978340755,839834265,2954667496,834656660,838900383,2996436633],"block":"0080efaaf8413b79b84d698c92548a6a5ff0"},
{"x":[1061546411,1041526593,1048011798,1051536501,1054779105,1057493158,1059114459,1060735760,1027991979,1041526591,1048011799,1051536502,1054779104,1057493158,1059114459,1060735759,1027991978,1041526592,1048011797,1051536501,1054779105,1057493157,1059114458,1060735761,1027991980,1041526592,1048011798,1051536501,1054779103,1057493157,1059114459,1060735759],"block":"2fae80776655333221008877655444321111"},
{"x":[1076673334,1057066088,1062726149,1066869711,1069699740,1072529769,1074550812,1075965826,1043118903,1057066088,1062726148,1066869710,1069699741,1072529770,1074550812,1075965826,1043118902,1057066088,1062726149,1066869712,1069699741,1072529770,1074550813,1075965828,1043118902,1057066088,1062726148,1066869712,1069699741,1072529771,1074550811,1075965826],"block":"66b580775545343311018877664533232111"},
{"x":[1087637328,1067386236,1074037906,1077511782,1080985659,1083294983,1085031920,1086768860,1054082896,1067386236,1074037907,1077511782,1080985657,1083294983,1085031921,1086768858,1054082897,1067386236,1074037905,1077511782,1080985657,1083294984,1085031921,1086768860,1054082896,1067386236,1074037906,1077511782,1080985658,1083294983,1085031922,1086768858],"block":"a0ba80776655432322008877655544331211"},
{"x":[1077203558,1057463757,1063388927,1067333657,1070296244,1073258828,1074981620,1076462912,1043649127,1057463755,1063388928,1067333657,1070296244,1073258829,1074981619,1076462912,1043649126,1057463756,1063388928,1067333658,1070296243,1073258828,1074981618,1076462912,1043649125,1057463755,1063388928,1067333658,1070296242,1073258828,1074981619,1076462911],"block":"a7b580776645332221008877664543221110"},
{"x":[1085777638,1065991468,1072009376,1075884553,1078893507,1081902459,1083520924,1085025401,1052223206,1065991469,1072009376,1075884554,1078893507,1081902461,1083520924,1085025400,1052223207,1065991468,1072009375,1075884554,1078893507,1081902461,1083520923,1085025400,1052223206,1065991468,1072009377,1075884553,1078893507,1081902460,1083520924,1085025399],"block":"bdb980776645332311008877565433321110"},
{"x":[1060713227,1040901704,1046970318,1050807466,1053841772,1056876079,1058437497,1059954651,1027158796,1040901704,1046970318,1050807466,1053841772,1056876079,1058437497,1059954651,1027158794,1040901703,1046970318,1050807466,1053841771,1056876078,1058437497,1059954650,1027158796,1040901704,1046970319,1050807466,1053841772,1056876080,1058437496,1059954649],"block":"caad80776655443322108877665544332210"},
{"x":[1091617170,1071194716,1077211638,1081955007,1084414404,1086786089,1089157774,1091024249,1058062738,1071194715,1077211638,1081955007,1084414404,1086786089,1089157772,1091024249,1058062738,1071194715,1077211639,1081955008,1084414403,1086786089,1089157774,1091024249,1058062738,1071194714,1077211637,1081955008,1084414404,1086786090,1089157773,1091024248],"block":"86bc80776655443311118877665544232211"},
{"x":[1058785076,1038723791,1044560129,1049120333,1051672602,1054224872,1056777140,1058147009,1025230644,1038723791,1044560130,1049120334,1051672602,1054224872,1056777140,1058147008,1025230644,1038723790,1044560130,1049120334,1051672601,1054224872,1056777140,1058147009,1025230644,1038723791,1044560129,1049120334,1051672602,1054224873,1056777139,1058147010],"block":"deac80775645442222008877654444222201"},
{"x":[1085833315,1066033227,1072078971,1075933272,1078956144,1081979016,1083566160,1085077597,1052278884,1066033227,1072078972,1075933271,1078956143,1081979015,1083566160,1085077597,1052278883,1066033227,1072078973,1075933271,1078956143,1081979016,1083566161,1085077597,1052278883,1066033226,1072078972,1075933270,1078956144,1081979015,1083566161,1085077597],"block":"c4b980776654443312118877665544331211"},
{"x":[1056417484,1035582745,1041942591,1046000114,1049316819,1051345580,1053374341,1055403103,1022863052,1035582745,1041942593,1046000114,1049316820,1051345580,1053374342,1055403103,1022863053,1035582746,1041942593,1046000114,1049316818,1051345580,1053374343,1055403102,1022863052,1035582744,1041942592,1046000113,1049316818,1051345580,1053374343,1055403104],"block":"bdab80775655433312118877655543331101"},
{"x":[1088092182,1067727375,1074322191,1077909778,1081497368,1083607696,1085401491,1087195285,1054537750,1067727376,1074322190,1077909779,1081497369,1083607696,1085401490,1087195286,1054537750,1067727377,1074322189,1077909779,1081497369,1083607695,1085401490,1087195286,1054537751,1067727376,1074322189,1077909779,1081497368,1083607694,1085401491,1087195285],"block":"d8ba80776555343211008877665543321100"},
{"x":[1083053200,1062543063,1068603828,1073259516,1075828514,1078156357,1080484203,1082471239,1049498767,1062543065,1068603828,1073259516,1075828513,1078156358,1080484203,1082471240,1049498768,1062543063,1068603827,1073259516,1075828514,1078156358,1080484201,1082471239,1049498767,1062543065,1068603829,1073259517,1075828513,1078156357,1080484203,1082471238],"block":"71b880776655443321008877564544331110"},
{"x":[1085723519,1065950880,1071941727,1075837199,1078832622,1081828048,1083476951,1084974664,1052169088,1065950879,1071941728,1075837200,1078832622,1081828046,1083476951,1084974663,1052169087,1065950880,1071941727,1075837200,1078832623,1081828046,1083476952,1084974663,1052169087,1065950879,1071941726,1075837200,1078832624,1081828046,1083476951,1084974663],"block":"b7b980776645343211008877654434331100"},
{"x":[1087156113,1067025325,1073732468,1077090719,1080444291,1082964148,1084640935,1086317721,1053601680,1067025324,1073732469,1077090720,1080444292,1082964147,1084640933,1086317721,1053601682,1067025324,1073732469,1077090720,1080444291,1082964149,1084640933,1086317720,1053601681,1067025326,1073732469,1077090718,1080444290,1082964148,1084640934,1086317720],"block":"65ba80776645442221008877665443231200"},
{"x":[1079285398,1059025136,1065672222,1069155266,1072638312,1074931591,1076673114,1078414637,1045730965,1059025136,1065672222,1069155267,1072638313,1074931590,1076673113,1078414637,1045730966,1059025136,1065672222,1069155267,1072638314,1074931591,1076673114,1078414637,1045730966,1059025135,1065672221,1069155267,1072638313,1074931590,1076673115,1078414637],"block":"a5b680776655343322118877665544331211"},
{"x":[1090747636,1069890413,1076124722,1080433323,1083436178,1085590480,1087744780,1089899082,1057193205,1069890414,1076124721,1080433324,1083436178,1085590480,1087744781,1089899083,1057193204,1069890415,1076124722,1080433324,1083436178,1085590480,1087744780,1089899082,1057193203,1069890414,1076124721,1080433323,1083436178,1085590479,1087744779,1089899083],"block":"1cbc80776655442222008877665544322100"},
{"x":[1091063591,1070364346,1076519666,1080986245,1083791628,1086024918,1088258207,1090491497,1057509159,1070364347,1076519665,1080986244,1083791628,1086024918,1088258208,1090491498,1057509158,1070364346,1076519665,1080986244,1083791629,1086024918,1088258208,1090491498,1057509160,1070364346,1076519666,1080986244,1083791627,1086024919,1088258206,1090491498],"block":"42bc80776555342212018877565544222100"},
{"x":[1073329964,1052461409,1058804349,1062895686,1066170120,1068215789,1070261461,1072307130,1039775531,1052461410,1058804349,1062895686,1066170121,1068215791,1070261459,1072307130,1039775532,1052461410,1058804348,1062895687,1066170122,1068215790,1070261460,1072307129,1039775532,1052461409,1058804348,1062895687,1066170120,1068215791,1070261459,1072307129],"block":"ceb380775545342311008877554543222200"},
{"x":[1084590747,1064849384,1070525762,1074846025,1077558253,1080270485,1082556573,1083912689,1051036315,1064849384,1070525762,1074846025,1077558254,1080270485,1082556573,1083912688,1051036315,1064849385,1070525762,1074846023,1077558254,1080270485,1082556573,1083912689,1051036315,1064849385,1070525761,1074846023,1077558255,1080270486,1082556573,1083912689],"block":"2cb980776654443322118877665434232211"},
{"x":[1066045337,1045419879,1051538302,1056078669,1058791820,1061062001,1063332186,1065477790,1032490905,1045419877,1051538303,1056078667,1058791820,1061062002,1063332185,1065477790,1032490906,1045419877,1051538304,1056078668,1058791821,1061062002,1063332184,1065477791,1032490905,1045419877,1051538302,1056078668,1058791820,1061062002,1063332185,1065477791],"block":"54b080776654343321118877665544331111"},
{"x":[1071962657,1051435930,1057949781,1061699292,1065401012,1067275766,1069150522,1071025279,1038408225,1051435929,1057949781,1061699293,1065401010,1067275767,1069150523,1071025279,1038408225,1051435928,1057949781,1061699293,1065401010,1067275766,1069150522,1071025279,1038408226,1051435929,1057949782,1061699294,1065401011,1067275767,1069150524,1071025280],"block":"27b380776655433322008877564534221100"},
{"x":[1072897064,1052136734,1058533785,1062516899,1065926615,1067918173,1069909729,1071901285,1039342632,1052136734,1058533785,1062516899,1065926615,1067918173,1069909728,1071901286,1039342631,1052136734,1058533784,1062516900,1065926614,1067918171,1069909727,1071901286,1039342632,1052136735,1058533786,1062516900,1065926614,1067918172,1069909728,1071901285],"block":"99b380776655433221018877665543222210"},
{"x":[1079694475,1059331944,1065927895,1069513210,1073098523,1075212832,1077005488,1078798147,1046140043,1059331944,1065927894,1069513210,1073098524,1075212833,1077005490,1078798147,1046140044,1059331945,1065927894,1069513211,1073098524,1075212832,1077005488,1078798147,1046140042,1059331944,1065927896,1069513209,1073098523,1075212833,1077005488,1078798147],"block":"d7b680776645442222008877565544222100"},
{"x":[1066156892,1045587211,1051677748,1056273889,1058917320,1061215391,1063513462,1065582373,1032602460,1045587209,1051677748,1056273889,1058917320,1061215389,1063513461,1065582374,1032602459,1045587211,1051677748,1056273888,1058917319,1061215390,1063513462,1065582374,1032602460,1045587211,1051677746,1056273889,1058917320,1061215389,1063513462,1065582374],"block":"62b080775555433211118877655533331211"},
{"x":[1066992191,1046840158,1052721871,1057350136,1059857031,1062363926,1064870823,1066365468,1033437759,1046840158,1052721872,1057350135,1059857030,1062363927,1064870822,1066365468,1033437760,1046840159,1052721871,1057350135,1059857031,1062363928,1064870821,1066365468,1033437758,1046840158,1052721870,1057350136,1059857032,1062363928,1064870823,1066365467],"block":"c8b080776654442321008877654534221210"},
{"x":[1076152986,1056387047,1062075711,1066414408,1069114349,1071814293,1074128029,1075478000,1042598554,1056387046,1062075711,1066414408,1069114349,1071814292,1074128030,1075478000,1042598554,1056387047,1062075712,1066414407,1069114348,1071814292,1074128029,1075478000,1042598553,1056387046,1062075712,1066414408,1069114349,1071814292,1074128030,1075477999],"block":"26b580776654443222118877664444331111"},
{"x":[1088131962,1067757212,1074347052,1077944588,1081542122,1083635043,1085433811,1087232577,1054577529,1067757212,1074347051,1077944587,1081542122,1083635044,1085433811,1087232578,1054577530,1067757212,1074347051,1077944587,1081542122,1083635044,1085433811,1087232578,1054577530,1067757212,1074347051,1077944587,1081542121,1083635045,1085433812,1087232578],"block":"ddba80776654332311118877665543221111"},
{"x":[1061171768,1041245610,1047543494,1051208689,1054357630,1057235589,1058810061,1060384532,1027617335,1041245610,1047543495,1051208690,1054357631,1057235590,1058810063,1060384532,1027617336,1041245610,1047543494,1051208689,1054357632,1057235590,1058810061,1060384531,1027617336,1041245611,1047543494,1051208689,1054357631,1057235591,1058810063,1060384532],"block":"02ae80776655343322118877665444231111"},
{"x":[1077344273,1057569292,1063564821,1067456783,1070454547,1073452310,1075095951,1076594832,1043789841,1057569294,1063564822,1067456783,1070454548,1073452310,1075095950,1076594832,1043789841,1057569294,1063564821,1067456783,1070454548,1073452310,1075095951,1076594833,1043789840,1057569292,1063564820,1067456782,1070454547,1073452311,1075095950,1076594831],"block":"b8b580776655343311008877665543331110"},
{"x":[1079922854,1059503227,1066070631,1069713042,1073355450,1075369843,1077191047,1079012251,1046368422,1059503228,1066070632,1069713042,1073355451,1075369843,1077191047,1079012252,1046368422,1059503228,1066070632,1069713041,1073355451,1075369843,1077191047,1079012251,1046368422,1059503228,1066070631,1069713042,1073355452,1075369842,1077191047,1079012251],"block":"f3b680776655442222118877665534322210"},
{"x":[1091020626,1070299898,1076465958,1080911055,1083743293,1085965841,1088188389,1090410938,1057466194,1070299899,1076465958,1080911057,1083743292,1085965841,1088188389,1090410937,1057466194,1070299899,1076465959,1080911055,1083743292,1085965841,1088188390,1090410939,1057466195,1070299900,1076465959,1080911057,1083743292,1085965842,1088188388,1090410938],"block":"3dbc80776655433312008877664444232201"},
{"x":[1087464831,1067256863,1073930094,1077360847,1080791599,1083176391,1084891766,1086607143,1053910399,1067256864,1073930095,1077360848,1080791600,1083176391,1084891767,1086607142,1053910399,1067256863,1073930095,1077360847,1080791598,1083176392,1084891767,1086607142,1053910399,1067256863,1073930094,1077360848,1080791600,1083176391,1084891767,1086607142],"block":"8bba80776655432312108877664433331111"},
{"x":[1087700359,1067433509,1074077299,1077566934,1081056567,1083338316,1085083134,1086827952,1054145927,1067433510,1074077301,1077566934,1081056569,1083338317,1085083134,1086827952,1054145927,1067433509,1074077300,1077566935,1081056569,1083338316,1085083134,1086827951,1054145927,1067433509,1074077299,1077566934,1081056568,1083338316,1085083133,1086827952],"block":"a8ba80776655343311008877665543332100"},
{"x":[1087831886,1067532155,1074159506,1077682021,1081204536,1083428742,1085189999,1086951256,1054277454,1067532154,1074159505,1077682020,1081204536,1083428742,1085189999,1086951258,1054277454,1067532154,1074159504,1077682021,1081204536,1083428742,1085189999,1086951256,1054277454,1067532154,1074159505,1077682020,1081204536,1083428742,1085189999,1086951257],"block":"b8ba80776555443322118877665544332210"},
{"x":[1091369609,1070823373,1076902187,1081521775,1084135899,1086445692,1088755486,1090792159,1057815178,1070823374,1076902186,1081521775,1084135897,1086445691,1088755488,1090792160,1057815176,1070823374,1076902187,1081521777,1084135899,1086445691,1088755488,1090792161,1057815177,1070823373,1076902186,1081521775,1084135898,1086445692,1088755486,1090792160],"block":"68bc80776645333312018877665544332111"},
{"x":[1080941287,1060267054,1066707152,1070604170,1074121507,1076070016,1078018525,1079967033,1047386854,1060267052,1066707153,1070604169,1074121507,1076070015,1078018524,1079967034,1047386855,1060267053,1066707151,1070604171,1074121506,1076070015,1078018523,1079967033,1047386855,1060267052,1066707152,1070604171,1074121505,1076070015,1078018523,1079967033],"block":"6fb780776645332221008877664543222100"},
{"x":[1068064928,1048449264,1054062791,1058288779,1061063860,1063838939,1065983618,1067371158,1034510496,1048449263,1054062792,1058288780,1061063859,1063838941,1065983618,1067371158,1034510496,1048449263,1054062792,1058288780,1061063861,1063838939,1065983618,1067371158,1034510497,1048449265,1054062792,1058288780,1061063860,1063838940,1065983619,1067371157],"block":"4bb180776655343322118877665544321211"},
{"x":[1083822185,1063696541,1069565060,1074173532,1076693623,1079213712,1081733802,1083192162,1050267752,1063696541,1069565058,1074173532,1076693621,1079213712,1081733802,1083192162,1050267754,1063696542,1069565059,1074173532,1076693622,1079213711,1081733803,1083192162,1050267753,1063696543,1069565059,1074173532,1076693622,1079213711,1081733802,1083192161],"block":"cfb880776655433322118877665544332211"},
{"x":[1086858684,1066802253,1073360683,1076830468,1080109685,1082759665,1084399273,1086038879,1053304252,1066802252,1073360682,1076830469,1080109683,1082759665,1084399273,1086038881,1053304253,1066802254,1073360682,1076830469,1080109683,1082759666,1084399273,1086038881,1053304252,1066802252,1073360683,1076830468,1080109684,1082759665,1084399273,1086038879],"block":"41ba80776645432311018877665434331110"},
{"x":[1074084156,1053283802,1059489675,1063855146,1066786915,1068969650,1071152387,1073335120,1040529725,1053283801,1059489676,1063855144,1066786916,1068969650,1071152386,1073335120,1040529725,1053283803,1059489674,1063855145,1066786915,1068969649,1071152387,1073335119,1040529724,1053283802,1059489674,1063855145,1066786917,1068969649,1071152386,1073335121],"block":"2ab480776655443311118877665533331101"},
{"x":[1067273630,1047262316,1053073669,1057596393,1060173650,1062750905,1065328161,1066629316,1033719199,1047262317,1053073669,1057596394,1060173650,1062750905,1065328162,1066629315,1033719198,1047262318,1053073670,1057596393,1060173650,1062750905,1065328161,1066629316,1033719197,1047262316,1053073671,1057596393,1060173649,1062750906,1065328162,1066629316],"block":"eab080776655333311118877565543231111"},
{"x":[1083596243,1063357629,1069282633,1073975832,1076439438,1078903042,1081366647,1082980343,1050041811,1063357627,1069282631,1073975833,1076439437,1078903042,1081366647,1082980341,1050041810,1063357628,1069282633,1073975833,1076439437,1078903042,1081366647,1082980341,1050041811,1063357628,1069282632,1073975833,1076439438,1078903042,1081366647,1082980341],"block":"b3b880775555433311108877665534331111"},
{"x":[1087691774,1067427070,1074071936,1077559422,1081046910,1083332416,1085076158,1086819902,1054137342,1067427071,1074071936,1077559423,1081046910,1083332415,1085076158,1086819901,1054137342,1067427069,1074071934,1077559422,1081046909,1083332414,1085076158,1086819902,1054137342,1067427070,1074071934,1077559422,1081046910,1083332416,1085076159,1086819903],"block":"a7ba80776555443222118877655544221201"},
{"x":[1089154544,1068524147,1074986165,1078839345,1082411479,1084338069,1086264658,1088191249,1055600111,1068524149,1074986167,1078839346,1082411479,1084338070,1086264659,1088191248,1055600112,1068524148,1074986166,1078839345,1082411480,1084338070,1086264658,1088191250,1055600111,1068524148,1074986167,1078839346,1082411478,1084338070,1086264658,1088191250],"block":"59bb80776655342222008877555544222101"},
{"x":[1073707086,1052744249,1059040049,1063225668,1066382251,1068475062,1070567872,1072660681,1040152653,1052744251,1059040050,1063225669,1066382252,1068475062,1070567872,1072660682,1040152655,1052744250,1059040049,1063225668,1066382252,1068475063,1070567871,1072660680,1040152653,1052744249,1059040050,1063225668,1066382253,1068475062,1070567870,1072660682],"block":"fcb380776655442221118877555534222100"},
{"x":[1083477298,1063179210,1069133949,1073871755,1076305624,1078739492,1081173360,1082868832,1049922866,1063179212,1069133950,1073871756,1076305624,1078739493,1081173361,1082868832,1049922865,1063179210,1069133951,1073871756,1076305623,1078739494,1081173361,1082868831,1049922867,1063179212,1069133951,1073871756,1076305624,1078739494,1081173360,1082868832],"block":"a4b880776655442312008877665544222100"},
{"x":[1086592773,1066602820,1073028294,1076597795,1079810534,1082576852,1084183220,1085789589,1053038342,1066602821,1073028293,1076597796,1079810535,1082576852,1084183220,1085789588,1053038342,1066602820,1073028294,1076597796,1079810533,1082576851,1084183220,1085789589,1053038341,1066602820,1073028294,1076597795,1079810534,1082576851,1084183221,1085789590],"block":"21ba80776655433222008877665533321201"},
{"x":[1087678355,1067417006,1074063548,1077547681,1081031813,1083323188,1085065256,1086807322,1054123923,1067417006,1074063548,1077547680,1081031813,1083323189,1085065255,1086807321,1054123923,1067417006,1074063549,1077547681,1081031813,1083323190,1085065256,1086807322,1054123922,1067417005,1074063548,1077547681,1081031812,1083323189,1085065255,1086807323],"block":"a5ba80775655442311008877665544332201"},
{"x":[1086098875,1066232396,1072410921,1076165636,1079254899,1082237298,1083781927,1085326559,1052544444,1066232396,1072410921,1076165636,1079254898,1082237298,1083781928,1085326559,1052544444,1066232396,1072410922,1076165636,1079254899,1082237296,1083781928,1085326559,1052544442,1066232395,1072410922,1076165636,1079254899,1082237298,1083781928,1085326558],"block":"e4b980776644333212008877664434221110"},
{"x":[1088126871,1067753393,1074343871,1077940132,1081536394,1083631544,1085429675,1087227806,1054572439,1067753394,1074343871,1077940131,1081536394,1083631544,1085429675,1087227807,1054572439,1067753393,1074343871,1077940132,1081536394,1083631544,1085429676,1087227806,1054572439,1067753393,1074343870,1077940132,1081536395,1083631544,1085429675,1087227806],"block":"dcba80776655443311008877665534331100"},
{"x":[1054397578,1034067817,1040680149,1044232697,1047785243,1049956895,1051733168,1053509441,1020843147,1034067815,1040680149,1044232696,1047785244,1049956894,1051733168,1053509441,1020843146,1034067816,1040680149,1044232698,1047785243,1049956895,1051733168,1053509441,1020843146,1034067816,1040680149,1044232698,1047785243,1049956895,1051733168,1053509440],"block":"c7aa80776655443322118877665544332211"},
{"x":[1090261086,1069354055,1075677754,1079807569,1083033910,1085098816,1087163724,1089228632,1056706654,1069354054,1075677756,1079807570,1083033910,1085098818,1087163723,1089228631,1056706654,1069354055,1075677755,1079807570,1083033909,1085098817,1087163724,1089228631,1056706653,1069354055,1075677755,1079807570,1083033909,1085098817,1087163724,1089228632],"block":"e1bb80776655432322118877655543222211"},
{"x":[1082687402,1061994367,1068146579,1072619371,1075416991,1077653387,1079889780,1082126174,1049132969,1061994366,1068146579,1072619370,1075416991,1077653386,1079889779,1082126176,1049132970,1061994367,1068146579,1072619369,1075416992,1077653386,1079889779,1082126175,1049132969,1061994367,1068146580,1072619370,1075416990,1077653387,1079889781,1082126175],"block":"44b880776654343222118877665544231210"},
{"x":[1091532042,1071067023,1077105229,1081806034,1084318635,1086669038,1089019441,1090944441,1057977611,1071067023,1077105229,1081806035,1084318634,1086669038,1089019439,1090944442,1057977609,1071067023,1077105228,1081806034,1084318634,1086669039,1089019440,1090944441,1057977609,1071067022,1077105228,1081806035,1084318635,1086669039,1089019440,1090944441],"block":"7cbc80776655442321118877664444232210"},
{"x":[1090678081,1069786081,1076037778,1080311602,1083357929,1085494842,1087631755,1089768666,1057123650,1069786081,1076037778,1080311601,1083357929,1085494840,1087631754,1089768666,1057123649,1069786082,1076037777,1080311602,1083357928,1085494841,1087631754,1089768666,1057123649,1069786082,1076037776,1080311601,1083357929,1085494841,1087631753,1089768667],"block":"13bc80776655443221118877665544332201"},
{"x":[1052426866,1032589782,1038709518,1042508324,1045568193,1048602030,1050131965,1051661898,1018872435,1032589782,1038709518,1042508323,1045568191,1048602029,1050131966,1051661900,1018872434,1032589782,1038709518,1042508323,1045568192,1048602030,1050131965,1051661899,1018872434,1032589782,1038709518,1042508323,1045568191,1048602030,1050131966,1051661899],"block":"d6a980776655433311018877665544331100"},
{"x":[1086568539,1066584644,1072998002,1076576592,1079783269,1082560191,1084163531,1085766869,1053014107,1066584644,1072998002,1076576591,1079783270,1082560191,1084163529,1085766868,1053014107,1066584645,1072998003,1076576592,1079783270,1082560191,1084163529,1085766870,1053014107,1066584643,1072998001,1076576592,1079783271,1082560190,1084163530,1085766870],"block":"1eba80776655442221018877665534322201"},
{"x":[1082259560,1061352605,1067611778,1071870646,1074935668,1077065104,1079194537,1081323970,1048705127,1061352603,1067611778,1071870646,1074935669,1077065103,1079194536,1081323970,1048705129,1061352604,1067611778,1071870646,1074935669,1077065102,1079194537,1081323971,1048705129,1061352605,1067611778,1071870646,1074935669,1077065103,1079194536,1081323972],"block":"10b880776655443222118877665544332201"},
{"x":[1076933587,1057261279,1063051464,1067097433,1069992524,1072887617,1074762267,1076209815,1043379156,1057261277,1063051465,1067097433,1069992526,1072887618,1074762267,1076209814,1043379155,1057261277,1063051464,1067097433,1069992524,1072887618,1074762266,1076209813,1043379154,1057261279,1063051464,1067097433,1069992524,1072887618,1074762266,1076209815],"block":"86b580776655443322108877665543332200"},
{"x":[1088932925,1068357933,1074847654,1078645430,1082286818,1084185706,1086084595,1087983480,1055378494,1068357935,1074847655,1078645429,1082286817,1084185707,1086084593,1087983481,1055378492,1068357935,1074847653,1078645428,1082286818,1084185707,1086084595,1087983482,1055378493,1068357934,1074847654,1078645428,1082286817,1084185705,1086084594,1087983482],"block":"3ebb80776655442311018877665544322201"},
{"x":[1091305461,1070727151,1076822002,1081409518,1084063733,1086357489,1088651245,1090732022,1057751029,1070727152,1076822001,1081409516,1084063732,1086357488,1088651247,1090732023,1057751029,1070727151,1076822002,1081409517,1084063731,1086357489,1088651247,1090732022,1057751029,1070727152,1076822003,1081409517,1084063732,1086357488,1088651246,1090732022],"block":"60bc80776655433312008877665544332100"},
{"x":[1049981818,1029713208,1035653208,1040368906,1042817513,1045266120,1047714725,1049369665,1016427386,1029713207,1035653208,1040368907,1042817513,1045266120,1047714726,1049369666,1016427387,1029713207,1035653209,1040368907,1042817513,1045266120,1047714726,1049369666,1016427386,1029713208,1035653209,1040368908,1042817514,1045266121,1047714726,1049369666],"block":"aca880776655443322118877664534232211"},
{"x":[1060624712,1040835318,1046859674,1050730015,1053742194,1056754371,1058365578,1059871667,1027070280,1040835318,1046859674,1050730015,1053742193,1056754370,1058365579,1059871669,1027070281,1040835318,1046859674,1050730015,1053742193,1056754371,1058365578,1059871668,1027070280,1040835319,1046859675,1050730015,1053742194,1056754371,1058365578,1059871667],"block":"bfad80776655433322018877665534332110"},
{"x":[1080739015,1060115350,1066580732,1070427183,1074007729,1075930953,1077854178,1079777402,1047184583,1060115350,1066580732,1070427182,1074007728,1075930954,1077854179,1079777403,1047184583,1060115349,1066580732,1070427181,1074007728,1075930952,1077854179,1079777402,1047184582,1060115349,1066580733,1070427181,1074007727,1075930954,1077854178,1079777404],"block":"56b780776655433311118877665544221100"},
{"x":[1077344829,1057569709,1063565517,1067457269,1070455172,1073453075,1075096402,1076595352,1043790397,1057569710,1063565515,1067457270,1070455172,1073453075,1075096403,1076595353,1043790397,1057569710,1063565517,1067457268,1070455174,1073453075,1075096401,1076595352,1043790397,1057569710,1063565516,1067457268,1070455174,1073453076,1075096403,1076595354],"block":"b8b580776655343321118877665434231100"},
{"x":[1087486459,1067273084,1073943613,1077379772,1080815929,1083191261,1084909339,1086627418,1053932027,1067273084,1073943612,1077379771,1080815931,1083191260,1084909340,1086627419,1053932026,1067273084,1073943612,1077379773,1080815930,1083191261,1084909340,1086627419,1053932028,1067273083,1073943613,1077379771,1080815929,1083191260,1084909339,1086627419],"block":"8eba80776645442212118877665543332111"},
{"x":[1084961472,1065379344,1070989169,1075170409,1077975320,1080780231,1082857788,1084260244,1051407040,1065379344,1070989167,1075170408,1077975319,1080780232,1082857789,1084260245,1051407039,1065379344,1070989169,1075170408,1077975319,1080780232,1082857789,1084260244,1051407040,1065379344,1070989168,1075170408,1077975319,1080780232,1082857787,1084260244],"block":"5ab980775554442311008877665544222100"},
{"x":[1089859028,1069052511,1075426468,1079455770,1082807751,1084822402,1086837052,1088851702,1056304596,1069052512,1075426468,1079455770,1082807752,1084822402,1086837051,1088851703,1056304597,1069052511,1075426468,1079455770,1082807752,1084822402,1086837053,1088851704,1056304596,1069052511,1075426469,1079455771,1082807751,1084822402,1086837053,1088851702],"block":"afbb80776655342212018877664543221210"},
{"x":[1067776032,1048015919,1053701673,1058035996,1060738853,1063441709,1065748891,1067100318,1034221600,1048015921,1053701671,1058035996,1060738851,1063441708,1065748891,1067100318,1034221600,1048015920,1053701671,1058035995,1060738853,1063441709,1065748890,1067100319,1034221600,1048015920,1053701673,1058035996,1060738853,1063441708,1065748889,1067100317],"block":"28b180776655332221018877665534332111"},
{"x":[1075184017,1054933595,1060864501,1065566559,1068024259,1070481960,1072939660,1074569592,1041629585,1054933593,1060864501,1065566558,1068024259,1070481960,1072939660,1074569591,1041629584,1054933594,1060864502,1065566560,1068024259,1070481960,1072939659,1074569592,1041629584,1054933595,1060864502,1065566560,1068024259,1070481958,1072939659,1074569593],"block":"b0b480776645442221008877664544322101"},
{"x":[1083413761,1063083907,1069054528,1073816161,1076234145,1078652129,1081070114,1082809266,1049859328,1063083906,1069054529,1073816160,1076234145,1078652129,1081070114,1082809264,1049859330,1063083905,1069054529,1073816161,1076234146,1078652130,1081070114,1082809266,1049859329,1063083905,1069054529,1073816162,1076234145,1078652129,1081070114,1082809266],"block":"9db880776655342311008877664544331101"},
{"x":[1068167276,1048589393,1054190726,1058378334,1061179002,1063979667,1066066777,1067467109,1034612843,1048589392,1054190726,1058378333,1061179002,1063979668,1066066776,1067467110,1034612844,1048589393,1054190727,1058378335,1061179003,1063979669,1066066776,1067467109,1034612844,1048589393,1054190727,1058378334,1061179001,1063979668,1066066776,1067467109],"block":"58b180776645332311008877665543331100"},
{"x":[1086068178,1066209374,1072372550,1076138777,1079220364,1082216192,1083756986,1085297780,1052513746,1066209374,1072372549,1076138775,1079220363,1082216192,1083756987,1085297780,1052513747,1066209374,1072372550,1076138777,1079220364,1082216191,1083756986,1085297781,1052513746,1066209374,1072372550,1076138777,1079220365,1082216192,1083756987,1085297782],"block":"e1b980776644443322018877664534331101"},
{"x":[1088905269,1068337192,1074830370,1078621231,1082271263,1084166692,1086062122,1087957555,1055350836,1068337193,1074830369,1078621230,1082271261,1084166693,1086062123,1087957553,1055350837,1068337192,1074830369,1078621231,1082271263,1084166692,1086062124,1087957553,1055350838,1068337192,1074830369,1078621230,1082271263,1084166691,1086062122,1087957553],"block":"3bbb80776655333312108877665534332211"},
{"x":[1079512414,1059195397,1065814107,1069353906,1072893706,1075087664,1076857563,1078627464,1045957983,1059195399,1065814108,1069353907,1072893706,1075087665,1076857563,1078627465,1045957982,1059195399,1065814107,1069353906,1072893706,1075087666,1076857563,1078627464,1045957982,1059195398,1065814106,1069353905,1072893707,1075087666,1076857563,1078627464],"block":"c0b680776655442322118877655534222210"},
{"x":[1079212651,1058970577,1065626754,1069091614,1072556472,1074881578,1076614007,1078346435,1045658219,1058970576,1065626754,1069091614,1072556472,1074881578,1076614007,1078346437,1045658219,1058970576,1065626754,1069091614,1072556471,1074881577,1076614006,1078346436,1045658220,1058970576,1065626754,1069091613,1072556473,1074881579,1076614008,1078346436],"block":"9cb680776655443221118877665534221110"},
{"x":[1085667274,1065908696,1071871419,1075787984,1078769347,1081750709,1083431253,1084921933,1052112841,1065908695,1071871420,1075787985,1078769346,1081750711,1083431251,1084921933,1052112843,1065908696,1071871420,1075787984,1078769346,1081750709,1083431252,1084921932,1052112842,1065908697,1071871421,1075787986,1078769347,1081750710,1083431253,1084921932],"block":"b0b980776655443321118877664544321211"},
{"x":[1084847364,1065234310,1070846532,1075070564,1077846948,1080623335,1082765074,1084153268,1051292932,1065234309,1070846534,1075070563,1077846948,1080623334,1082765075,1084153267,1051292932,1065234309,1070846532,1075070563,1077846948,1080623333,1082765075,1084153268,1051292931,1065234309,1070846533,1075070565,1077846949,1080623334,1082765075,1084153269],"block":"4cb980776655443222008877664534222201"},
{"x":[1089693180,1068928125,1075322813,1079310652,1082714462,1084708380,1086702301,1088696220,1056138747,1068928125,1075322814,1079310653,1082714462,1084708382,1086702302,1088696220,1056138748,1068928124,1075322815,1079310651,1082714462,1084708382,1086702302,1088696219,1056138748,1068928125,1075322814,1079310651,1082714462,1084708380,1086702302,1088696221],"block":"9bbb80775655332311118877665533321101"},
{"x":[1083938659,1063871252,1069710653,1074275448,1076824655,1079373863,1081923073,1083301357,1050384228,1063871252,1069710652,1074275447,1076824655,1079373865,1081923073,1083301357,1050384227,1063871252,1069710651,1074275446,1076824656,1079373865,1081923072,1083301357,1050384228,1063871251,1069710652,1074275447,1076824656,1079373865,1081923073,1083301357],"block":"ddb880776554342321008877665534221100"},
{"x":[1083667186,1063464043,1069371310,1074037907,1076519248,1079000589,1081481930,1083046851,1050112755,1063464043,1069371311,1074037908,1076519249,1079000589,1081481929,1083046850,1050112754,1063464044,1069371311,1074037907,1076519249,1079000589,1081481928,1083046850,1050112755,1063464042,1069371310,1074037908,1076519248,1079000590,1081481928,1083046851],"block":"bcb880776655343321118877665543232211"},
{"x":[1082760756,1062104398,1068238274,1072747740,1075499513,1077754247,1080008981,1082197072,1049206324,1062104398,1068238272,1072747738,1075499515,1077754247,1080008981,1082197073,1049206324,1062104399,1068238272,1072747739,1075499514,1077754248,1080008979,1082197074,1049206324,1062104397,1068238272,1072747739,1075499514,1077754248,1080008981,1082197074],"block":"4db880776655443322018877665544332201"},
{"x":[1084856344,1065247780,1070857758,1075078420,1077857051,1080635680,1082772371,1084161687,1051301912,1065247779,1070857757,1075078421,1077857051,1080635680,1082772372,1084161686,1051301912,1065247780,1070857758,1075078421,1077857052,1080635681,1082772371,1084161685,1051301912,1065247781,1070857758,1075078422,1077857050,1080635681,1082772371,1084161686],"block":"4db980776655343322108877664544332111"},
{"x":[1090873043,1070078523,1076281481,1080652785,1083577260,1085762913,1087948567,1090134219,1057318611,1070078525,1076281479,1080652785,1083577260,1085762913,1087948567,1090134220,1057318610,1070078525,1076281480,1080652784,1083577261,1085762914,1087948567,1090134221,1057318611,1070078525,1076281480,1080652785,1083577262,1085762913,1087948567,1090134220],"block":"2bbc80776655443322018877665534332211"},
{"x":[1077660812,1057806697,1063960494,1067733754,1070810654,1073814687,1075353138,1076891587,1044106381,1057806698,1063960495,1067733754,1070810654,1073814688,1075353138,1076891586,1044106380,1057806697,1063960494,1067733754,1070810653,1073814688,1075353138,1076891586,1044106380,1057806697,1063960495,1067733755,1070810655,1073814689,1075353138,1076891588],"block":"deb580776655443322118877665534232201"},
{"x":[1085218815,1065572352,1071310847,1075395582,1078264831,1081134078,1083066879,1084501503,1051664383,1065572352,1071310847,1075395583,1078264831,1081134078,1083066880,1084501503,1051664383,1065572352,1071310847,1075395583,1078264830,1081134079,1083066880,1084501504,1051664383,1065572350,1071310847,1075395582,1078264830,1081134080,1083066880,1084501503],"block":"79b980776655443312018877665544231111"},
{"x":[1075977162,1056123311,1061855932,1066260561,1068916547,1071572534,1073985171,1075313165,1042422730,1056123311,1061855932,1066260562,1068916547,1071572534,1073985172,1075313165,1042422730,1056123311,1061855932,1066260561,1068916547,1071572534,1073985171,1075313165,1042422730,1056123311,1061855931,1066260560,1068916547,1071572533,1073985172,1075313165],"block":"11b580776655443322118877665444332211"},
{"x":[1080272599,1059765538,1066289222,1070019067,1073745370,1075610293,1077475215,1079340138,1046718168,1059765537,1066289221,1070019068,1073745369,1075610291,1077475214,1079340139,1046718168,1059765537,1066289222,1070019068,1073745369,1075610292,1077475215,1079340138,1046718166,1059765538,1066289222,1070019068,1073745369,1075610292,1077475214,1079340138],"block":"1db780776655332211008877665533232200"},
{"x":[1054073434,1033824707,1040477560,1043949072,1047420582,1049734046,1051469802,1053205556,1020519002,1033824709,1040477560,1043949072,1047420580,1049734046,1051469800,1053205556,1020519002,1033824709,1040477560,1043949071,1047420581,1049734047,1051469801,1053205556,1020519002,1033824709,1040477561,1043949072,1047420580,1049734045,1051469802,1053205557],"block":"9faa80676654432211008866564444321200"},
{"x":[1087518655,1067297231,1073963736,1077407943,1080852152,1083213394,1084935498,1086657603,1053964223,1067297232,1073963735,1077407943,1080852151,1083213395,1084935499,1086657603,1053964222,1067297230,1073963734,1077407944,1080852151,1083213395,1084935500,1086657603,1053964223,1067297231,1073963735,1077407944,1080852152,1083213396,1084935498,1086657604],"block":"92ba80776545333312008877664533232100"},
{"x":[1070150282,1050076647,1056669484,1060113466,1063409883,1066029759,1067677968,1069326177,1036595850,1050076647,1056669483,1060113466,1063409884,1066029759,1067677968,1069326177,1036595850,1050076647,1056669485,1060113464,1063409883,1066029758,1067677967,1069326178,1036595851,1050076649,1056669484,1060113466,1063409883,1066029760,1067677968,1069326177],"block":"4ab280776654443322018877664443232211"},
{"x":[1082028334,1061082339,1067386557,1071555336,1074732970,1076817361,1078901748,1080986140,1048473902,1061082339,1067386558,1071555335,1074732971,1076817360,1078901749,1080986139,1048473902,1061082338,1067386557,1071555336,1074732970,1076817361,1078901749,1080986138,1048473902,1061082339,1067386556,1071555336,1074732970,1076817361,1078901750,1080986138],"block":"f4b780776655332212108877655533221110"},
{"x":[1080411466,1059869688,1066376015,1070140578,1073823483,1075705764,1077588044,1079470324,1046857033,1059869688,1066376013,1070140576,1073823482,1075705763,1077588044,1079470324,1046857033,1059869687,1066376013,1070140576,1073823482,1075705763,1077588044,1079470325,1046857034,1059869688,1066376014,1070140578,1073823481,1075705763,1077588045,1079470325],"block":"2eb780776554332211118877664543221111"},
{"x":[1088959532,1068377889,1074864284,1078668710,1082301786,1084203998,1086106212,1088008426,1055405099,1068377889,1074864285,1078668710,1082301785,1084203998,1086106212,1088008424,1055405100,1068377889,1074864283,1078668711,1082301785,1084203998,1086106212,1088008424,1055405099,1068377890,1074864284,1078668710,1082301785,1084203997,1086106211,1088008425],"block":"42bb80776655433311108877655544332111"},
{"x":[1091616662,1071193952,1077211003,1081954117,1084413832,1086785390,1089156948,1091023774,1058062229,1071193953,1077211005,1081954117,1084413832,1086785389,1089156949,1091023774,1058062230,1071193953,1077211005,1081954118,1084413832,1086785389,1089156947,1091023773,1058062231,1071193952,1077211005,1081954119,1084413832,1086785391,1089156949,1091023772],"block":"86bc80775655443321008877555544231110"},
{"x":[1085008298,1065414464,1071047700,1075211380,1078027999,1080844619,1082895834,1084304144,1051453867,1065414463,1071047701,1075211380,1078027999,1080844619,1082895834,1084304144,1051453866,1065414465,1071047700,1075211382,1078028000,1080844617,1082895835,1084304143,1051453866,1065414463,1071047700,1075211381,1078027999,1080844618,1082895833,1084304142],"block":"5fb980676645343211108877665544222110"}]}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,481 @@
{"cases":[
{"format":"fp16","max_cells":4096,"ring":0,"resident":0,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":8920528},
{"format":"fp16","max_cells":4096,"ring":0,"resident":0,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":9969104},
{"format":"fp16","max_cells":4096,"ring":0,"resident":1000,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":8920528},
{"format":"fp16","max_cells":4096,"ring":0,"resident":1000,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":9969104},
{"format":"fp16","max_cells":4096,"ring":0,"resident":20480,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":8920528},
{"format":"fp16","max_cells":4096,"ring":0,"resident":20480,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":9969104},
{"format":"fp16","max_cells":4096,"ring":0,"resident":65536,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":8920528},
{"format":"fp16","max_cells":4096,"ring":0,"resident":65536,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":9969104},
{"format":"fp16","max_cells":4096,"ring":256,"resident":0,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":8920528},
{"format":"fp16","max_cells":4096,"ring":256,"resident":0,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":9969104},
{"format":"fp16","max_cells":4096,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":531920},
{"format":"fp16","max_cells":4096,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":1580496},
{"format":"fp16","max_cells":4096,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":531920},
{"format":"fp16","max_cells":4096,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":1580496},
{"format":"fp16","max_cells":4096,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":531920},
{"format":"fp16","max_cells":4096,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":1580496},
{"format":"fp16","max_cells":4096,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":8920528},
{"format":"fp16","max_cells":4096,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":9969104},
{"format":"fp16","max_cells":4096,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":8920528},
{"format":"fp16","max_cells":4096,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":9969104},
{"format":"fp16","max_cells":4096,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":8920528},
{"format":"fp16","max_cells":4096,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":9969104},
{"format":"fp16","max_cells":4096,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":8920528},
{"format":"fp16","max_cells":4096,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":9969104},
{"format":"fp16","max_cells":32768,"ring":0,"resident":0,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":71339472},
{"format":"fp16","max_cells":32768,"ring":0,"resident":0,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":79728080},
{"format":"fp16","max_cells":32768,"ring":0,"resident":1000,"rope":0,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":46276208},
{"format":"fp16","max_cells":32768,"ring":0,"resident":1000,"rope":1,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":54664816},
{"format":"fp16","max_cells":32768,"ring":0,"resident":20480,"rope":0,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":46276208},
{"format":"fp16","max_cells":32768,"ring":0,"resident":20480,"rope":1,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":54664816},
{"format":"fp16","max_cells":32768,"ring":0,"resident":65536,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":71339472},
{"format":"fp16","max_cells":32768,"ring":0,"resident":65536,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":79728080},
{"format":"fp16","max_cells":32768,"ring":256,"resident":0,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":71339472},
{"format":"fp16","max_cells":32768,"ring":256,"resident":0,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":79728080},
{"format":"fp16","max_cells":32768,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":560592},
{"format":"fp16","max_cells":32768,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":8949200},
{"format":"fp16","max_cells":32768,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":560592},
{"format":"fp16","max_cells":32768,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":8949200},
{"format":"fp16","max_cells":32768,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":560592},
{"format":"fp16","max_cells":32768,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":8949200},
{"format":"fp16","max_cells":32768,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":71339472},
{"format":"fp16","max_cells":32768,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":79728080},
{"format":"fp16","max_cells":32768,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":71339472},
{"format":"fp16","max_cells":32768,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":79728080},
{"format":"fp16","max_cells":32768,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":71339472},
{"format":"fp16","max_cells":32768,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":79728080},
{"format":"fp16","max_cells":32768,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":71339472},
{"format":"fp16","max_cells":32768,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":79728080},
{"format":"fp16","max_cells":262144,"ring":0,"resident":0,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":570691024},
{"format":"fp16","max_cells":262144,"ring":0,"resident":0,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":637799888},
{"format":"fp16","max_cells":262144,"ring":0,"resident":1000,"rope":0,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":75865712},
{"format":"fp16","max_cells":262144,"ring":0,"resident":1000,"rope":1,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":142974576},
{"format":"fp16","max_cells":262144,"ring":0,"resident":20480,"rope":0,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":75865712},
{"format":"fp16","max_cells":262144,"ring":0,"resident":20480,"rope":1,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":142974576},
{"format":"fp16","max_cells":262144,"ring":0,"resident":65536,"rope":0,"mode":1,"pages":65536,"slots":16384,"pooled_rows":65538,"state_bytes":168365680},
{"format":"fp16","max_cells":262144,"ring":0,"resident":65536,"rope":1,"mode":1,"pages":65536,"slots":16384,"pooled_rows":65538,"state_bytes":235474544},
{"format":"fp16","max_cells":262144,"ring":256,"resident":0,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":570691024},
{"format":"fp16","max_cells":262144,"ring":256,"resident":0,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":637799888},
{"format":"fp16","max_cells":262144,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":789968},
{"format":"fp16","max_cells":262144,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":67898832},
{"format":"fp16","max_cells":262144,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":789968},
{"format":"fp16","max_cells":262144,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":67898832},
{"format":"fp16","max_cells":262144,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":789968},
{"format":"fp16","max_cells":262144,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":67898832},
{"format":"fp16","max_cells":262144,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":570691024},
{"format":"fp16","max_cells":262144,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":637799888},
{"format":"fp16","max_cells":262144,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":570691024},
{"format":"fp16","max_cells":262144,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":637799888},
{"format":"fp16","max_cells":262144,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":570691024},
{"format":"fp16","max_cells":262144,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":637799888},
{"format":"fp16","max_cells":262144,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":570691024},
{"format":"fp16","max_cells":262144,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":637799888},
{"format":"fp16","max_cells":524288,"ring":0,"resident":0,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":1141378512},
{"format":"fp16","max_cells":524288,"ring":0,"resident":0,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":1275596240},
{"format":"fp16","max_cells":524288,"ring":0,"resident":1000,"rope":0,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":109682288},
{"format":"fp16","max_cells":524288,"ring":0,"resident":1000,"rope":1,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":243900016},
{"format":"fp16","max_cells":524288,"ring":0,"resident":20480,"rope":0,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":109682288},
{"format":"fp16","max_cells":524288,"ring":0,"resident":20480,"rope":1,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":243900016},
{"format":"fp16","max_cells":524288,"ring":0,"resident":65536,"rope":0,"mode":1,"pages":131072,"slots":16384,"pooled_rows":131074,"state_bytes":202182256},
{"format":"fp16","max_cells":524288,"ring":0,"resident":65536,"rope":1,"mode":1,"pages":131072,"slots":16384,"pooled_rows":131074,"state_bytes":336399984},
{"format":"fp16","max_cells":524288,"ring":256,"resident":0,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":1141378512},
{"format":"fp16","max_cells":524288,"ring":256,"resident":0,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":1275596240},
{"format":"fp16","max_cells":524288,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":1052112},
{"format":"fp16","max_cells":524288,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":135269840},
{"format":"fp16","max_cells":524288,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":1052112},
{"format":"fp16","max_cells":524288,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":135269840},
{"format":"fp16","max_cells":524288,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":1052112},
{"format":"fp16","max_cells":524288,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":135269840},
{"format":"fp16","max_cells":524288,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":1141378512},
{"format":"fp16","max_cells":524288,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":1275596240},
{"format":"fp16","max_cells":524288,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":1141378512},
{"format":"fp16","max_cells":524288,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":1275596240},
{"format":"fp16","max_cells":524288,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":1141378512},
{"format":"fp16","max_cells":524288,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":1275596240},
{"format":"fp16","max_cells":524288,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":1141378512},
{"format":"fp16","max_cells":524288,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":1275596240},
{"format":"int8","max_cells":4096,"ring":0,"resident":0,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4857360},
{"format":"int8","max_cells":4096,"ring":0,"resident":0,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":5905936},
{"format":"int8","max_cells":4096,"ring":0,"resident":1000,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4857360},
{"format":"int8","max_cells":4096,"ring":0,"resident":1000,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":5905936},
{"format":"int8","max_cells":4096,"ring":0,"resident":20480,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4857360},
{"format":"int8","max_cells":4096,"ring":0,"resident":20480,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":5905936},
{"format":"int8","max_cells":4096,"ring":0,"resident":65536,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4857360},
{"format":"int8","max_cells":4096,"ring":0,"resident":65536,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":5905936},
{"format":"int8","max_cells":4096,"ring":256,"resident":0,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4857360},
{"format":"int8","max_cells":4096,"ring":256,"resident":0,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":5905936},
{"format":"int8","max_cells":4096,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":278032},
{"format":"int8","max_cells":4096,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":1326608},
{"format":"int8","max_cells":4096,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":278032},
{"format":"int8","max_cells":4096,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":1326608},
{"format":"int8","max_cells":4096,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":278032},
{"format":"int8","max_cells":4096,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":1326608},
{"format":"int8","max_cells":4096,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4857360},
{"format":"int8","max_cells":4096,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":5905936},
{"format":"int8","max_cells":4096,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4857360},
{"format":"int8","max_cells":4096,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":5905936},
{"format":"int8","max_cells":4096,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4857360},
{"format":"int8","max_cells":4096,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":5905936},
{"format":"int8","max_cells":4096,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4857360},
{"format":"int8","max_cells":4096,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":5905936},
{"format":"int8","max_cells":32768,"ring":0,"resident":0,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":38833680},
{"format":"int8","max_cells":32768,"ring":0,"resident":0,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":47222288},
{"format":"int8","max_cells":32768,"ring":0,"resident":1000,"rope":0,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":25960112},
{"format":"int8","max_cells":32768,"ring":0,"resident":1000,"rope":1,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":34348720},
{"format":"int8","max_cells":32768,"ring":0,"resident":20480,"rope":0,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":25960112},
{"format":"int8","max_cells":32768,"ring":0,"resident":20480,"rope":1,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":34348720},
{"format":"int8","max_cells":32768,"ring":0,"resident":65536,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":38833680},
{"format":"int8","max_cells":32768,"ring":0,"resident":65536,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":47222288},
{"format":"int8","max_cells":32768,"ring":256,"resident":0,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":38833680},
{"format":"int8","max_cells":32768,"ring":256,"resident":0,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":47222288},
{"format":"int8","max_cells":32768,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":306704},
{"format":"int8","max_cells":32768,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":8695312},
{"format":"int8","max_cells":32768,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":306704},
{"format":"int8","max_cells":32768,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":8695312},
{"format":"int8","max_cells":32768,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":306704},
{"format":"int8","max_cells":32768,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":8695312},
{"format":"int8","max_cells":32768,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":38833680},
{"format":"int8","max_cells":32768,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":47222288},
{"format":"int8","max_cells":32768,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":38833680},
{"format":"int8","max_cells":32768,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":47222288},
{"format":"int8","max_cells":32768,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":38833680},
{"format":"int8","max_cells":32768,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":47222288},
{"format":"int8","max_cells":32768,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":38833680},
{"format":"int8","max_cells":32768,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":47222288},
{"format":"int8","max_cells":262144,"ring":0,"resident":0,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":310644240},
{"format":"int8","max_cells":262144,"ring":0,"resident":0,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":377753104},
{"format":"int8","max_cells":262144,"ring":0,"resident":1000,"rope":0,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":55549616},
{"format":"int8","max_cells":262144,"ring":0,"resident":1000,"rope":1,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":122658480},
{"format":"int8","max_cells":262144,"ring":0,"resident":20480,"rope":0,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":55549616},
{"format":"int8","max_cells":262144,"ring":0,"resident":20480,"rope":1,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":122658480},
{"format":"int8","max_cells":262144,"ring":0,"resident":65536,"rope":0,"mode":1,"pages":65536,"slots":16384,"pooled_rows":65538,"state_bytes":103354032},
{"format":"int8","max_cells":262144,"ring":0,"resident":65536,"rope":1,"mode":1,"pages":65536,"slots":16384,"pooled_rows":65538,"state_bytes":170462896},
{"format":"int8","max_cells":262144,"ring":256,"resident":0,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":310644240},
{"format":"int8","max_cells":262144,"ring":256,"resident":0,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":377753104},
{"format":"int8","max_cells":262144,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":536080},
{"format":"int8","max_cells":262144,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":67644944},
{"format":"int8","max_cells":262144,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":536080},
{"format":"int8","max_cells":262144,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":67644944},
{"format":"int8","max_cells":262144,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":536080},
{"format":"int8","max_cells":262144,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":67644944},
{"format":"int8","max_cells":262144,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":310644240},
{"format":"int8","max_cells":262144,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":377753104},
{"format":"int8","max_cells":262144,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":310644240},
{"format":"int8","max_cells":262144,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":377753104},
{"format":"int8","max_cells":262144,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":310644240},
{"format":"int8","max_cells":262144,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":377753104},
{"format":"int8","max_cells":262144,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":310644240},
{"format":"int8","max_cells":262144,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":377753104},
{"format":"int8","max_cells":524288,"ring":0,"resident":0,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":621284880},
{"format":"int8","max_cells":524288,"ring":0,"resident":0,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":755502608},
{"format":"int8","max_cells":524288,"ring":0,"resident":1000,"rope":0,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":89366192},
{"format":"int8","max_cells":524288,"ring":0,"resident":1000,"rope":1,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":223583920},
{"format":"int8","max_cells":524288,"ring":0,"resident":20480,"rope":0,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":89366192},
{"format":"int8","max_cells":524288,"ring":0,"resident":20480,"rope":1,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":223583920},
{"format":"int8","max_cells":524288,"ring":0,"resident":65536,"rope":0,"mode":1,"pages":131072,"slots":16384,"pooled_rows":131074,"state_bytes":137170608},
{"format":"int8","max_cells":524288,"ring":0,"resident":65536,"rope":1,"mode":1,"pages":131072,"slots":16384,"pooled_rows":131074,"state_bytes":271388336},
{"format":"int8","max_cells":524288,"ring":256,"resident":0,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":621284880},
{"format":"int8","max_cells":524288,"ring":256,"resident":0,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":755502608},
{"format":"int8","max_cells":524288,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":798224},
{"format":"int8","max_cells":524288,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":135015952},
{"format":"int8","max_cells":524288,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":798224},
{"format":"int8","max_cells":524288,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":135015952},
{"format":"int8","max_cells":524288,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":798224},
{"format":"int8","max_cells":524288,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":135015952},
{"format":"int8","max_cells":524288,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":621284880},
{"format":"int8","max_cells":524288,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":755502608},
{"format":"int8","max_cells":524288,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":621284880},
{"format":"int8","max_cells":524288,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":755502608},
{"format":"int8","max_cells":524288,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":621284880},
{"format":"int8","max_cells":524288,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":755502608},
{"format":"int8","max_cells":524288,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":621284880},
{"format":"int8","max_cells":524288,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":755502608},
{"format":"q4_0","max_cells":4096,"ring":0,"resident":0,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2891280},
{"format":"q4_0","max_cells":4096,"ring":0,"resident":0,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3939856},
{"format":"q4_0","max_cells":4096,"ring":0,"resident":1000,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2891280},
{"format":"q4_0","max_cells":4096,"ring":0,"resident":1000,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3939856},
{"format":"q4_0","max_cells":4096,"ring":0,"resident":20480,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2891280},
{"format":"q4_0","max_cells":4096,"ring":0,"resident":20480,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3939856},
{"format":"q4_0","max_cells":4096,"ring":0,"resident":65536,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2891280},
{"format":"q4_0","max_cells":4096,"ring":0,"resident":65536,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3939856},
{"format":"q4_0","max_cells":4096,"ring":256,"resident":0,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2891280},
{"format":"q4_0","max_cells":4096,"ring":256,"resident":0,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3939856},
{"format":"q4_0","max_cells":4096,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":155152},
{"format":"q4_0","max_cells":4096,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":1203728},
{"format":"q4_0","max_cells":4096,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":155152},
{"format":"q4_0","max_cells":4096,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":1203728},
{"format":"q4_0","max_cells":4096,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":155152},
{"format":"q4_0","max_cells":4096,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":1203728},
{"format":"q4_0","max_cells":4096,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2891280},
{"format":"q4_0","max_cells":4096,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3939856},
{"format":"q4_0","max_cells":4096,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2891280},
{"format":"q4_0","max_cells":4096,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3939856},
{"format":"q4_0","max_cells":4096,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2891280},
{"format":"q4_0","max_cells":4096,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3939856},
{"format":"q4_0","max_cells":4096,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2891280},
{"format":"q4_0","max_cells":4096,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3939856},
{"format":"q4_0","max_cells":32768,"ring":0,"resident":0,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":23105040},
{"format":"q4_0","max_cells":32768,"ring":0,"resident":0,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":31493648},
{"format":"q4_0","max_cells":32768,"ring":0,"resident":1000,"rope":0,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":16129712},
{"format":"q4_0","max_cells":32768,"ring":0,"resident":1000,"rope":1,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":24518320},
{"format":"q4_0","max_cells":32768,"ring":0,"resident":20480,"rope":0,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":16129712},
{"format":"q4_0","max_cells":32768,"ring":0,"resident":20480,"rope":1,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":24518320},
{"format":"q4_0","max_cells":32768,"ring":0,"resident":65536,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":23105040},
{"format":"q4_0","max_cells":32768,"ring":0,"resident":65536,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":31493648},
{"format":"q4_0","max_cells":32768,"ring":256,"resident":0,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":23105040},
{"format":"q4_0","max_cells":32768,"ring":256,"resident":0,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":31493648},
{"format":"q4_0","max_cells":32768,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":183824},
{"format":"q4_0","max_cells":32768,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":8572432},
{"format":"q4_0","max_cells":32768,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":183824},
{"format":"q4_0","max_cells":32768,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":8572432},
{"format":"q4_0","max_cells":32768,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":183824},
{"format":"q4_0","max_cells":32768,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":8572432},
{"format":"q4_0","max_cells":32768,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":23105040},
{"format":"q4_0","max_cells":32768,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":31493648},
{"format":"q4_0","max_cells":32768,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":23105040},
{"format":"q4_0","max_cells":32768,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":31493648},
{"format":"q4_0","max_cells":32768,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":23105040},
{"format":"q4_0","max_cells":32768,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":31493648},
{"format":"q4_0","max_cells":32768,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":23105040},
{"format":"q4_0","max_cells":32768,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":31493648},
{"format":"q4_0","max_cells":262144,"ring":0,"resident":0,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":184815120},
{"format":"q4_0","max_cells":262144,"ring":0,"resident":0,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":251923984},
{"format":"q4_0","max_cells":262144,"ring":0,"resident":1000,"rope":0,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":45719216},
{"format":"q4_0","max_cells":262144,"ring":0,"resident":1000,"rope":1,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":112828080},
{"format":"q4_0","max_cells":262144,"ring":0,"resident":20480,"rope":0,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":45719216},
{"format":"q4_0","max_cells":262144,"ring":0,"resident":20480,"rope":1,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":112828080},
{"format":"q4_0","max_cells":262144,"ring":0,"resident":65536,"rope":0,"mode":1,"pages":65536,"slots":16384,"pooled_rows":65538,"state_bytes":71896752},
{"format":"q4_0","max_cells":262144,"ring":0,"resident":65536,"rope":1,"mode":1,"pages":65536,"slots":16384,"pooled_rows":65538,"state_bytes":139005616},
{"format":"q4_0","max_cells":262144,"ring":256,"resident":0,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":184815120},
{"format":"q4_0","max_cells":262144,"ring":256,"resident":0,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":251923984},
{"format":"q4_0","max_cells":262144,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":413200},
{"format":"q4_0","max_cells":262144,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":67522064},
{"format":"q4_0","max_cells":262144,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":413200},
{"format":"q4_0","max_cells":262144,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":67522064},
{"format":"q4_0","max_cells":262144,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":413200},
{"format":"q4_0","max_cells":262144,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":67522064},
{"format":"q4_0","max_cells":262144,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":184815120},
{"format":"q4_0","max_cells":262144,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":251923984},
{"format":"q4_0","max_cells":262144,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":184815120},
{"format":"q4_0","max_cells":262144,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":251923984},
{"format":"q4_0","max_cells":262144,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":184815120},
{"format":"q4_0","max_cells":262144,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":251923984},
{"format":"q4_0","max_cells":262144,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":184815120},
{"format":"q4_0","max_cells":262144,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":251923984},
{"format":"q4_0","max_cells":524288,"ring":0,"resident":0,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":369626640},
{"format":"q4_0","max_cells":524288,"ring":0,"resident":0,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":503844368},
{"format":"q4_0","max_cells":524288,"ring":0,"resident":1000,"rope":0,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":79535792},
{"format":"q4_0","max_cells":524288,"ring":0,"resident":1000,"rope":1,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":213753520},
{"format":"q4_0","max_cells":524288,"ring":0,"resident":20480,"rope":0,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":79535792},
{"format":"q4_0","max_cells":524288,"ring":0,"resident":20480,"rope":1,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":213753520},
{"format":"q4_0","max_cells":524288,"ring":0,"resident":65536,"rope":0,"mode":1,"pages":131072,"slots":16384,"pooled_rows":131074,"state_bytes":105713328},
{"format":"q4_0","max_cells":524288,"ring":0,"resident":65536,"rope":1,"mode":1,"pages":131072,"slots":16384,"pooled_rows":131074,"state_bytes":239931056},
{"format":"q4_0","max_cells":524288,"ring":256,"resident":0,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":369626640},
{"format":"q4_0","max_cells":524288,"ring":256,"resident":0,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":503844368},
{"format":"q4_0","max_cells":524288,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":675344},
{"format":"q4_0","max_cells":524288,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":134893072},
{"format":"q4_0","max_cells":524288,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":675344},
{"format":"q4_0","max_cells":524288,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":134893072},
{"format":"q4_0","max_cells":524288,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":675344},
{"format":"q4_0","max_cells":524288,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":134893072},
{"format":"q4_0","max_cells":524288,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":369626640},
{"format":"q4_0","max_cells":524288,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":503844368},
{"format":"q4_0","max_cells":524288,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":369626640},
{"format":"q4_0","max_cells":524288,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":503844368},
{"format":"q4_0","max_cells":524288,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":369626640},
{"format":"q4_0","max_cells":524288,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":503844368},
{"format":"q4_0","max_cells":524288,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":369626640},
{"format":"q4_0","max_cells":524288,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":503844368},
{"format":"k8v4","max_cells":4096,"ring":0,"resident":0,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3874320},
{"format":"k8v4","max_cells":4096,"ring":0,"resident":0,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4922896},
{"format":"k8v4","max_cells":4096,"ring":0,"resident":1000,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3874320},
{"format":"k8v4","max_cells":4096,"ring":0,"resident":1000,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4922896},
{"format":"k8v4","max_cells":4096,"ring":0,"resident":20480,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3874320},
{"format":"k8v4","max_cells":4096,"ring":0,"resident":20480,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4922896},
{"format":"k8v4","max_cells":4096,"ring":0,"resident":65536,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3874320},
{"format":"k8v4","max_cells":4096,"ring":0,"resident":65536,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4922896},
{"format":"k8v4","max_cells":4096,"ring":256,"resident":0,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4857360},
{"format":"k8v4","max_cells":4096,"ring":256,"resident":0,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":5905936},
{"format":"k8v4","max_cells":4096,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":278032},
{"format":"k8v4","max_cells":4096,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":1326608},
{"format":"k8v4","max_cells":4096,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":278032},
{"format":"k8v4","max_cells":4096,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":1326608},
{"format":"k8v4","max_cells":4096,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":278032},
{"format":"k8v4","max_cells":4096,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":1326608},
{"format":"k8v4","max_cells":4096,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3874320},
{"format":"k8v4","max_cells":4096,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4922896},
{"format":"k8v4","max_cells":4096,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3874320},
{"format":"k8v4","max_cells":4096,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4922896},
{"format":"k8v4","max_cells":4096,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3874320},
{"format":"k8v4","max_cells":4096,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4922896},
{"format":"k8v4","max_cells":4096,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3874320},
{"format":"k8v4","max_cells":4096,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":4922896},
{"format":"k8v4","max_cells":32768,"ring":0,"resident":0,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":30969360},
{"format":"k8v4","max_cells":32768,"ring":0,"resident":0,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":39357968},
{"format":"k8v4","max_cells":32768,"ring":0,"resident":1000,"rope":0,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":21044912},
{"format":"k8v4","max_cells":32768,"ring":0,"resident":1000,"rope":1,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":29433520},
{"format":"k8v4","max_cells":32768,"ring":0,"resident":20480,"rope":0,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":21044912},
{"format":"k8v4","max_cells":32768,"ring":0,"resident":20480,"rope":1,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":29433520},
{"format":"k8v4","max_cells":32768,"ring":0,"resident":65536,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":30969360},
{"format":"k8v4","max_cells":32768,"ring":0,"resident":65536,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":39357968},
{"format":"k8v4","max_cells":32768,"ring":256,"resident":0,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":38833680},
{"format":"k8v4","max_cells":32768,"ring":256,"resident":0,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":47222288},
{"format":"k8v4","max_cells":32768,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":306704},
{"format":"k8v4","max_cells":32768,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":8695312},
{"format":"k8v4","max_cells":32768,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":306704},
{"format":"k8v4","max_cells":32768,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":8695312},
{"format":"k8v4","max_cells":32768,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":306704},
{"format":"k8v4","max_cells":32768,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":8695312},
{"format":"k8v4","max_cells":32768,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":30969360},
{"format":"k8v4","max_cells":32768,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":39357968},
{"format":"k8v4","max_cells":32768,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":30969360},
{"format":"k8v4","max_cells":32768,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":39357968},
{"format":"k8v4","max_cells":32768,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":30969360},
{"format":"k8v4","max_cells":32768,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":39357968},
{"format":"k8v4","max_cells":32768,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":30969360},
{"format":"k8v4","max_cells":32768,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":39357968},
{"format":"k8v4","max_cells":262144,"ring":0,"resident":0,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":247729680},
{"format":"k8v4","max_cells":262144,"ring":0,"resident":0,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":314838544},
{"format":"k8v4","max_cells":262144,"ring":0,"resident":1000,"rope":0,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":50634416},
{"format":"k8v4","max_cells":262144,"ring":0,"resident":1000,"rope":1,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":117743280},
{"format":"k8v4","max_cells":262144,"ring":0,"resident":20480,"rope":0,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":50634416},
{"format":"k8v4","max_cells":262144,"ring":0,"resident":20480,"rope":1,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":117743280},
{"format":"k8v4","max_cells":262144,"ring":0,"resident":65536,"rope":0,"mode":1,"pages":65536,"slots":16384,"pooled_rows":65538,"state_bytes":87625392},
{"format":"k8v4","max_cells":262144,"ring":0,"resident":65536,"rope":1,"mode":1,"pages":65536,"slots":16384,"pooled_rows":65538,"state_bytes":154734256},
{"format":"k8v4","max_cells":262144,"ring":256,"resident":0,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":310644240},
{"format":"k8v4","max_cells":262144,"ring":256,"resident":0,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":377753104},
{"format":"k8v4","max_cells":262144,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":536080},
{"format":"k8v4","max_cells":262144,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":67644944},
{"format":"k8v4","max_cells":262144,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":536080},
{"format":"k8v4","max_cells":262144,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":67644944},
{"format":"k8v4","max_cells":262144,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":536080},
{"format":"k8v4","max_cells":262144,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":67644944},
{"format":"k8v4","max_cells":262144,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":247729680},
{"format":"k8v4","max_cells":262144,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":314838544},
{"format":"k8v4","max_cells":262144,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":247729680},
{"format":"k8v4","max_cells":262144,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":314838544},
{"format":"k8v4","max_cells":262144,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":247729680},
{"format":"k8v4","max_cells":262144,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":314838544},
{"format":"k8v4","max_cells":262144,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":247729680},
{"format":"k8v4","max_cells":262144,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":314838544},
{"format":"k8v4","max_cells":524288,"ring":0,"resident":0,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":495455760},
{"format":"k8v4","max_cells":524288,"ring":0,"resident":0,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":629673488},
{"format":"k8v4","max_cells":524288,"ring":0,"resident":1000,"rope":0,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":84450992},
{"format":"k8v4","max_cells":524288,"ring":0,"resident":1000,"rope":1,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":218668720},
{"format":"k8v4","max_cells":524288,"ring":0,"resident":20480,"rope":0,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":84450992},
{"format":"k8v4","max_cells":524288,"ring":0,"resident":20480,"rope":1,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":218668720},
{"format":"k8v4","max_cells":524288,"ring":0,"resident":65536,"rope":0,"mode":1,"pages":131072,"slots":16384,"pooled_rows":131074,"state_bytes":121441968},
{"format":"k8v4","max_cells":524288,"ring":0,"resident":65536,"rope":1,"mode":1,"pages":131072,"slots":16384,"pooled_rows":131074,"state_bytes":255659696},
{"format":"k8v4","max_cells":524288,"ring":256,"resident":0,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":621284880},
{"format":"k8v4","max_cells":524288,"ring":256,"resident":0,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":755502608},
{"format":"k8v4","max_cells":524288,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":798224},
{"format":"k8v4","max_cells":524288,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":135015952},
{"format":"k8v4","max_cells":524288,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":798224},
{"format":"k8v4","max_cells":524288,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":135015952},
{"format":"k8v4","max_cells":524288,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":798224},
{"format":"k8v4","max_cells":524288,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":135015952},
{"format":"k8v4","max_cells":524288,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":495455760},
{"format":"k8v4","max_cells":524288,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":629673488},
{"format":"k8v4","max_cells":524288,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":495455760},
{"format":"k8v4","max_cells":524288,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":629673488},
{"format":"k8v4","max_cells":524288,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":495455760},
{"format":"k8v4","max_cells":524288,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":629673488},
{"format":"k8v4","max_cells":524288,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":495455760},
{"format":"k8v4","max_cells":524288,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":629673488},
{"format":"int8-keyless","max_cells":4096,"ring":0,"resident":0,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2694672},
{"format":"int8-keyless","max_cells":4096,"ring":0,"resident":0,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3743248},
{"format":"int8-keyless","max_cells":4096,"ring":0,"resident":1000,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2694672},
{"format":"int8-keyless","max_cells":4096,"ring":0,"resident":1000,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3743248},
{"format":"int8-keyless","max_cells":4096,"ring":0,"resident":20480,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2694672},
{"format":"int8-keyless","max_cells":4096,"ring":0,"resident":20480,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3743248},
{"format":"int8-keyless","max_cells":4096,"ring":0,"resident":65536,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2694672},
{"format":"int8-keyless","max_cells":4096,"ring":0,"resident":65536,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3743248},
{"format":"int8-keyless","max_cells":4096,"ring":256,"resident":0,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2694672},
{"format":"int8-keyless","max_cells":4096,"ring":256,"resident":0,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3743248},
{"format":"int8-keyless","max_cells":4096,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":142864},
{"format":"int8-keyless","max_cells":4096,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":1191440},
{"format":"int8-keyless","max_cells":4096,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":142864},
{"format":"int8-keyless","max_cells":4096,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":1191440},
{"format":"int8-keyless","max_cells":4096,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":142864},
{"format":"int8-keyless","max_cells":4096,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":1024,"slots":64,"pooled_rows":2,"state_bytes":1191440},
{"format":"int8-keyless","max_cells":4096,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2694672},
{"format":"int8-keyless","max_cells":4096,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3743248},
{"format":"int8-keyless","max_cells":4096,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2694672},
{"format":"int8-keyless","max_cells":4096,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3743248},
{"format":"int8-keyless","max_cells":4096,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2694672},
{"format":"int8-keyless","max_cells":4096,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3743248},
{"format":"int8-keyless","max_cells":4096,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":2694672},
{"format":"int8-keyless","max_cells":4096,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":1024,"slots":1024,"pooled_rows":1026,"state_bytes":3743248},
{"format":"int8-keyless","max_cells":32768,"ring":0,"resident":0,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":21532176},
{"format":"int8-keyless","max_cells":32768,"ring":0,"resident":0,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":29920784},
{"format":"int8-keyless","max_cells":32768,"ring":0,"resident":1000,"rope":0,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":15146672},
{"format":"int8-keyless","max_cells":32768,"ring":0,"resident":1000,"rope":1,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":23535280},
{"format":"int8-keyless","max_cells":32768,"ring":0,"resident":20480,"rope":0,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":15146672},
{"format":"int8-keyless","max_cells":32768,"ring":0,"resident":20480,"rope":1,"mode":1,"pages":8192,"slots":5120,"pooled_rows":8194,"state_bytes":23535280},
{"format":"int8-keyless","max_cells":32768,"ring":0,"resident":65536,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":21532176},
{"format":"int8-keyless","max_cells":32768,"ring":0,"resident":65536,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":29920784},
{"format":"int8-keyless","max_cells":32768,"ring":256,"resident":0,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":21532176},
{"format":"int8-keyless","max_cells":32768,"ring":256,"resident":0,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":29920784},
{"format":"int8-keyless","max_cells":32768,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":171536},
{"format":"int8-keyless","max_cells":32768,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":8560144},
{"format":"int8-keyless","max_cells":32768,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":171536},
{"format":"int8-keyless","max_cells":32768,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":8560144},
{"format":"int8-keyless","max_cells":32768,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":171536},
{"format":"int8-keyless","max_cells":32768,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":8192,"slots":64,"pooled_rows":2,"state_bytes":8560144},
{"format":"int8-keyless","max_cells":32768,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":21532176},
{"format":"int8-keyless","max_cells":32768,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":29920784},
{"format":"int8-keyless","max_cells":32768,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":21532176},
{"format":"int8-keyless","max_cells":32768,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":29920784},
{"format":"int8-keyless","max_cells":32768,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":21532176},
{"format":"int8-keyless","max_cells":32768,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":29920784},
{"format":"int8-keyless","max_cells":32768,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":21532176},
{"format":"int8-keyless","max_cells":32768,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":8192,"slots":8192,"pooled_rows":8194,"state_bytes":29920784},
{"format":"int8-keyless","max_cells":262144,"ring":0,"resident":0,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":172232208},
{"format":"int8-keyless","max_cells":262144,"ring":0,"resident":0,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":239341072},
{"format":"int8-keyless","max_cells":262144,"ring":0,"resident":1000,"rope":0,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":44736176},
{"format":"int8-keyless","max_cells":262144,"ring":0,"resident":1000,"rope":1,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":111845040},
{"format":"int8-keyless","max_cells":262144,"ring":0,"resident":20480,"rope":0,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":44736176},
{"format":"int8-keyless","max_cells":262144,"ring":0,"resident":20480,"rope":1,"mode":1,"pages":65536,"slots":5120,"pooled_rows":65538,"state_bytes":111845040},
{"format":"int8-keyless","max_cells":262144,"ring":0,"resident":65536,"rope":0,"mode":1,"pages":65536,"slots":16384,"pooled_rows":65538,"state_bytes":68751024},
{"format":"int8-keyless","max_cells":262144,"ring":0,"resident":65536,"rope":1,"mode":1,"pages":65536,"slots":16384,"pooled_rows":65538,"state_bytes":135859888},
{"format":"int8-keyless","max_cells":262144,"ring":256,"resident":0,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":172232208},
{"format":"int8-keyless","max_cells":262144,"ring":256,"resident":0,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":239341072},
{"format":"int8-keyless","max_cells":262144,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":400912},
{"format":"int8-keyless","max_cells":262144,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":67509776},
{"format":"int8-keyless","max_cells":262144,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":400912},
{"format":"int8-keyless","max_cells":262144,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":67509776},
{"format":"int8-keyless","max_cells":262144,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":400912},
{"format":"int8-keyless","max_cells":262144,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":65536,"slots":64,"pooled_rows":2,"state_bytes":67509776},
{"format":"int8-keyless","max_cells":262144,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":172232208},
{"format":"int8-keyless","max_cells":262144,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":239341072},
{"format":"int8-keyless","max_cells":262144,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":172232208},
{"format":"int8-keyless","max_cells":262144,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":239341072},
{"format":"int8-keyless","max_cells":262144,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":172232208},
{"format":"int8-keyless","max_cells":262144,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":239341072},
{"format":"int8-keyless","max_cells":262144,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":172232208},
{"format":"int8-keyless","max_cells":262144,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":65536,"slots":65536,"pooled_rows":65538,"state_bytes":239341072},
{"format":"int8-keyless","max_cells":524288,"ring":0,"resident":0,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":344460816},
{"format":"int8-keyless","max_cells":524288,"ring":0,"resident":0,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":478678544},
{"format":"int8-keyless","max_cells":524288,"ring":0,"resident":1000,"rope":0,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":78552752},
{"format":"int8-keyless","max_cells":524288,"ring":0,"resident":1000,"rope":1,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":212770480},
{"format":"int8-keyless","max_cells":524288,"ring":0,"resident":20480,"rope":0,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":78552752},
{"format":"int8-keyless","max_cells":524288,"ring":0,"resident":20480,"rope":1,"mode":1,"pages":131072,"slots":5120,"pooled_rows":131074,"state_bytes":212770480},
{"format":"int8-keyless","max_cells":524288,"ring":0,"resident":65536,"rope":0,"mode":1,"pages":131072,"slots":16384,"pooled_rows":131074,"state_bytes":102567600},
{"format":"int8-keyless","max_cells":524288,"ring":0,"resident":65536,"rope":1,"mode":1,"pages":131072,"slots":16384,"pooled_rows":131074,"state_bytes":236785328},
{"format":"int8-keyless","max_cells":524288,"ring":256,"resident":0,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":344460816},
{"format":"int8-keyless","max_cells":524288,"ring":256,"resident":0,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":478678544},
{"format":"int8-keyless","max_cells":524288,"ring":256,"resident":1000,"rope":0,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":663056},
{"format":"int8-keyless","max_cells":524288,"ring":256,"resident":1000,"rope":1,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":134880784},
{"format":"int8-keyless","max_cells":524288,"ring":256,"resident":20480,"rope":0,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":663056},
{"format":"int8-keyless","max_cells":524288,"ring":256,"resident":20480,"rope":1,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":134880784},
{"format":"int8-keyless","max_cells":524288,"ring":256,"resident":65536,"rope":0,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":663056},
{"format":"int8-keyless","max_cells":524288,"ring":256,"resident":65536,"rope":1,"mode":2,"pages":131072,"slots":64,"pooled_rows":2,"state_bytes":134880784},
{"format":"int8-keyless","max_cells":524288,"ring":-1,"resident":0,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":344460816},
{"format":"int8-keyless","max_cells":524288,"ring":-1,"resident":0,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":478678544},
{"format":"int8-keyless","max_cells":524288,"ring":-1,"resident":1000,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":344460816},
{"format":"int8-keyless","max_cells":524288,"ring":-1,"resident":1000,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":478678544},
{"format":"int8-keyless","max_cells":524288,"ring":-1,"resident":20480,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":344460816},
{"format":"int8-keyless","max_cells":524288,"ring":-1,"resident":20480,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":478678544},
{"format":"int8-keyless","max_cells":524288,"ring":-1,"resident":65536,"rope":0,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":344460816},
{"format":"int8-keyless","max_cells":524288,"ring":-1,"resident":65536,"rope":1,"mode":0,"pages":131072,"slots":131072,"pooled_rows":131074,"state_bytes":478678544}],"resident_min":20480,"map_bytes_5120":102464}
+144
View File
@@ -0,0 +1,144 @@
//! Golden tests: the Rust references against fixtures produced by the Original's own host code
//! (`oracle/gen_kv_golden.sh`; the reference functions are extracted verbatim from `engine/strata`).
use leleka_experimental_ref::{
fwht, kv_q8,
layout::{self, KvFormat, QsaShapes, StreamFormat},
q4_0::{self, BlockQ4_0, Contraction},
};
use serde_json::Value;
fn load(name: &str) -> Value {
let path = format!("{}/tests/fixtures/{name}", env!("CARGO_MANIFEST_DIR"));
serde_json::from_str(&std::fs::read_to_string(path).expect("fixture")).expect("json")
}
fn floats<const N: usize>(v: &Value) -> [f32; N] {
let a = v.as_array().expect("array");
assert_eq!(a.len(), N);
let mut out = [0.0; N];
for (o, x) in out.iter_mut().zip(a) {
*o = f32::from_bits(x.as_u64().expect("bits") as u32);
}
out
}
fn hex(s: &str) -> Vec<u8> {
(0..s.len()).step_by(2).map(|i| u8::from_str_radix(&s[i..i + 2], 16).unwrap()).collect()
}
/// Two elements of the largest magnitude with opposite sign: the Original's host reference and its CUDA
/// kernel resolve the tie differently (documented in `q4_0`).
fn has_opposite_sign_tie(x: &[f32; 32]) -> bool {
let amax = x.iter().fold(0.0f32, |m, v| m.max(v.abs()));
x.contains(&amax) && x.iter().any(|v| *v == -amax)
}
#[test]
fn fwht_rows_are_bit_identical_to_the_host_reference() {
let g = load("kv_golden_separate.json");
let rows = g["fwht"].as_array().unwrap();
assert_eq!(rows.len(), 24);
for (i, row) in rows.iter().enumerate() {
let input: [f32; 256] = floats(&row["in"]);
let want: [f32; 256] = floats(&row["out"]);
let mut host = input;
fwht::fwht256_host_reference(&mut host);
assert_eq!(host.map(f32::to_bits), want.map(f32::to_bits), "host order row {i}");
let mut kernel = [0.0; 256];
fwht::fwht256(&input, &mut kernel);
assert_eq!(kernel.map(f32::to_bits), want.map(f32::to_bits), "kernel order row {i}");
assert_eq!(
fwht::fwht256_warp_model(&input).map(f32::to_bits),
want.map(f32::to_bits),
"warp model row {i}"
);
}
}
fn check_q4(fixture: &str, c: Contraction) -> (usize, usize) {
let g = load(fixture);
let groups = g["q4"].as_array().unwrap();
assert_eq!(groups.len(), 576);
let (mut kernel_compared, mut ties) = (0, 0);
for (i, e) in groups.iter().enumerate() {
let x: [f32; 32] = floats(&e["x"]);
let want = BlockQ4_0::from_bytes(&hex(e["block"].as_str().unwrap()));
assert_eq!(q4_0::quantize_group_host_reference_with(&x, c), want, "host reference, group {i}");
if has_opposite_sign_tie(&x) {
ties += 1;
continue;
}
assert_eq!(q4_0::quantize_group(&x, c), want, "kernel semantics, group {i}");
kernel_compared += 1;
}
(kernel_compared, ties)
}
#[test]
fn q4_0_blocks_match_the_host_reference_separate_operations() {
let (compared, ties) = check_q4("kv_golden_separate.json", Contraction::Separate);
assert!(compared > 350 && ties > 0, "{compared} {ties}");
}
#[test]
fn q4_0_blocks_match_a_fused_multiply_add_build() {
let (compared, _) = check_q4("kv_golden_fused.json", Contraction::Fused);
assert!(compared > 350);
// the fused build really differs from the separate one on the boundary groups
let s = load("kv_golden_separate.json");
let f = load("kv_golden_fused.json");
let differ = s["q4"]
.as_array()
.unwrap()
.iter()
.zip(f["q4"].as_array().unwrap())
.filter(|(a, b)| a["block"] != b["block"])
.count();
assert!(differ > 40, "{differ}");
}
#[test]
fn int8_k_groups_match_the_hybrid_parity_host_reference() {
let g = load("kv_golden_separate.json");
let groups = g["q8"].as_array().unwrap();
assert_eq!(groups.len(), 96);
for (i, e) in groups.iter().enumerate() {
let x: [f32; 64] = floats(&e["x"]);
let (codes, scale) = kv_q8::quantize_group(&x);
assert_eq!(u64::from(scale), e["scale"].as_u64().unwrap(), "scale {i}");
let want: Vec<i8> = e["codes"].as_array().unwrap().iter().map(|c| c.as_i64().unwrap() as i8).collect();
assert_eq!(codes.to_vec(), want, "codes {i}");
}
}
#[test]
fn layout_sizes_match_the_original_functions() {
let g = load("kv_golden_separate.json");
let s = QsaShapes::real();
assert_eq!(g["per_cell"]["q8"].as_u64(), Some(kv_q8::bytes_per_cell(2, 256)));
assert_eq!(g["per_cell"]["q4"].as_u64(), Some(q4_0::bytes_per_cell(2, 256)));
for (key, fmt) in [
("f16", StreamFormat::F16),
("int8", StreamFormat::Int8),
("q4", StreamFormat::Q4),
("value_int8", StreamFormat::ValueInt8),
] {
assert_eq!(g["block_bytes"][key].as_u64(), Some(layout::kv_block_bytes(&s, fmt)), "{key}");
}
let mut checked = 0;
for e in g["pool_bytes"].as_array().unwrap() {
let fmt = match e["format"].as_str().unwrap() {
"fp16" => KvFormat::Fp16,
"int8" => KvFormat::Int8,
"q4_0" => KvFormat::Q4_0,
"k8v4" => KvFormat::K8V4,
"int8-keyless" => KvFormat::Int8Keyless,
other => panic!("{other}"),
};
let pages = e["pages"].as_u64().unwrap();
assert_eq!(layout::kv_pool_bytes(fmt, &s, pages), e["bytes"].as_u64().unwrap(), "{fmt:?} {pages}");
checked += 1;
}
assert_eq!(checked, 25);
}
@@ -0,0 +1,93 @@
//! Drift guard for the six CUDA ports: every line of every `__device__` / `__global__` function body of the
//! Original (`engine/strata/src/kernels/cuda/*.cu`) must still appear, whitespace-normalised, in the checked-in
//! port (`crates/cuda-driver/src/experimental_*.cu`). Signatures, host wrappers and error handling are the
//! documented deviations; kernel bodies are not allowed to differ.
use std::collections::HashSet;
fn norm(line: &str) -> String {
line.split_whitespace().collect::<Vec<_>>().join(" ")
}
/// Normalised lines of the bodies of all device functions (text between the first `{` after the
/// `__global__` / `__device__` marker and its matching `}`), signatures excluded.
fn device_bodies(source: &str) -> Vec<String> {
let mut out = Vec::new();
let bytes: Vec<char> = source.chars().collect();
let text: String = bytes.iter().collect();
let mut search = 0;
while search < text.len() {
let rest = &text[search..];
let hit = ["__global__", "__device__"]
.iter()
.filter_map(|m| rest.find(m).map(|i| (i, m.len())))
.min();
let Some((i, len)) = hit else { break };
let from = search + i + len;
// a declaration like `__device__ int x;` has `;` before any `{`
let after = &text[from..];
let (brace, semi) = (after.find('{'), after.find(';'));
match (brace, semi) {
(Some(b), Some(s)) if s < b => {
search = from + s;
continue;
}
(Some(b), _) => {
let mut depth = 0i32;
let mut end = None;
for (k, ch) in after[b..].char_indices() {
match ch {
'{' => depth += 1,
'}' => {
depth -= 1;
if depth == 0 {
end = Some(b + k);
break;
}
}
_ => {}
}
}
let end = end.expect("unbalanced braces");
for line in after[b + 1..end].lines() {
let l = norm(line);
if l.len() >= 6 && !l.starts_with("//") {
out.push(l);
}
}
search = from + end;
}
_ => break,
}
}
out
}
fn check(name: &str, original: &str, port: &str) {
let have: HashSet<String> = port.lines().map(norm).collect();
let flat = norm(port);
let bodies = device_bodies(original);
assert!(bodies.len() > 5, "{name}: found no device bodies");
let missing: Vec<&String> = bodies.iter().filter(|l| !have.contains(*l) && !flat.contains(l.as_str())).collect();
assert!(missing.is_empty(), "{name}: {} original kernel-body lines are not in the port:\n{}", missing.len(), missing.iter().map(|l| l.as_str()).collect::<Vec<_>>().join("\n"));
println!("{name}: {} kernel-body lines all present", bodies.len());
}
macro_rules! pair {
($test:ident, $name:literal, $orig:literal, $port:literal) => {
#[test]
fn $test() {
check(
$name,
include_str!(concat!("../../../engine/strata/src/kernels/cuda/", $orig)),
include_str!(concat!("../../cuda-driver/src/", $port)),
);
}
};
}
pair!(kv_q4_bodies_are_literal, "kv_q4", "kv_q4.cu", "experimental_kv_q4.cu");
pair!(kv_q8_bodies_are_literal, "kv_q8", "kv_q8.cu", "experimental_kv_q8.cu");
pair!(kv_stream_bodies_are_literal, "kv_stream", "kv_stream.cu", "experimental_kv_stream.cu");
pair!(keyless_bodies_are_literal, "keyless", "keyless.cu", "experimental_keyless.cu");
pair!(qsa_attn_bodies_are_literal, "qsa_attn", "qsa_decode_attn.cu", "experimental_qsa_attn.cu");
pair!(cvec_bodies_are_literal, "cvec", "cvec.cu", "experimental_cvec.cu");
@@ -0,0 +1,131 @@
//! The second-GPU expert tier against the Original's decision code (`oracle/gen_remote_golden.sh` extracts the
//! selection, slot sizing, claim bookkeeping, grouping, RemoteMeta packing and result scatter of
//! `remote_experts.cpp` verbatim and runs them on the host).
mod common;
use common::fixture;
use leleka_experimental_ref::remote_experts::{ExpertSizes, H, RemoteError, RemoteMeta, plan_open, dispatch, scatter};
use serde_json::Value;
const LAYERS: usize = 6;
const EXPERTS: usize = 24;
fn ints(v: &Value) -> Vec<i64> {
v.as_array().unwrap().iter().map(|x| x.as_i64().unwrap()).collect()
}
fn sizes_of(c: &Value) -> ExpertSizes {
ExpertSizes {
native: c["native"].as_i64() == Some(1),
max_blob: c["max_blob"].as_u64().unwrap(),
blob_bytes: c["blobs"].as_array().unwrap().iter().map(|x| x.as_u64().unwrap()).collect(),
}
}
fn open_case(c: &Value) -> (leleka_experimental_ref::remote_experts::RemotePlan, Vec<u8>) {
let primary: Vec<u8> = ints(&c["primary"]).iter().map(|&x| x as u8).collect();
let mut claimed: Vec<u8> = ints(&c["claimed_in"]).iter().map(|&x| x as u8).collect();
let ranked: Vec<(i32, i32)> = c["ranked"].as_array().unwrap().iter().map(|p| (p[0].as_i64().unwrap() as i32, p[1].as_i64().unwrap() as i32)).collect();
let has = |l: i32, e: i32| primary[l as usize * EXPERTS + e as usize] != 0;
let plan = plan_open(1, 2, u64::MAX / 2, c["slots"].as_i64().unwrap() as i32, LAYERS as i64, EXPERTS as i64, &ranked, &has, &mut claimed, &sizes_of(c)).unwrap();
(plan, claimed)
}
#[test]
fn selection_sizing_and_claims_match_open() {
let g = fixture("remote_golden.json");
let cases = g["open"].as_array().unwrap();
assert_eq!(cases.len(), 40);
for (n, c) in cases.iter().enumerate() {
let (plan, claimed) = open_case(c);
let want: Vec<(i32, i32)> = c["selected"].as_array().unwrap().iter().map(|p| (p[0].as_i64().unwrap() as i32, p[1].as_i64().unwrap() as i32)).collect();
assert_eq!(plan.selected, want, "case {n}: selected");
assert_eq!(plan.needed_bytes, c["needed"].as_u64().unwrap(), "case {n}: needed");
assert_eq!(plan.layers_present.iter().map(|&x| i64::from(x)).collect::<Vec<_>>(), ints(&c["layers_present"]), "case {n}: layers");
assert_eq!(claimed.iter().map(|&x| i64::from(x)).collect::<Vec<_>>(), ints(&c["claimed_out"]), "case {n}: claimed");
}
}
#[test]
fn memory_check_is_inclusive_and_refusal_keeps_claims() {
let g = fixture("remote_golden.json");
let c = &g["open"][3];
let (plan, _) = open_case(c);
let primary: Vec<u8> = ints(&c["primary"]).iter().map(|&x| x as u8).collect();
let ranked: Vec<(i32, i32)> = c["ranked"].as_array().unwrap().iter().map(|p| (p[0].as_i64().unwrap() as i32, p[1].as_i64().unwrap() as i32)).collect();
let has = |l: i32, e: i32| primary[l as usize * EXPERTS + e as usize] != 0;
let before: Vec<u8> = ints(&c["claimed_in"]).iter().map(|&x| x as u8).collect();
let mut claimed = before.clone();
let free = plan.needed_bytes + (512 << 20);
let slots = c["slots"].as_i64().unwrap() as i32;
let err = plan_open(1, 2, free - 1, slots, LAYERS as i64, EXPERTS as i64, &ranked, &has, &mut claimed, &sizes_of(c)).unwrap_err();
assert_eq!(err, RemoteError::SlotsLeaveLessThanReserve { needed: plan.needed_bytes, free: free - 1 });
assert_eq!(claimed, before);
assert!(plan_open(1, 2, free, slots, LAYERS as i64, EXPERTS as i64, &ranked, &has, &mut claimed, &sizes_of(c)).is_ok());
}
#[test]
fn grouping_meta_and_scatter_match_begin_and_finish() {
let g = fixture("remote_golden.json");
let opens = g["open"].as_array().unwrap();
let plans: Vec<_> = opens.iter().map(|c| open_case(c).0).collect();
let (mut launched, mut refused, mut groups_seen) = (0, 0, 0);
for (n, c) in g["begin"].as_array().unwrap().iter().enumerate() {
let tier = c["tier"].as_u64().unwrap() as usize;
let plan = &plans[tier];
let primary: Vec<u8> = ints(&opens[tier]["primary"]).iter().map(|&x| x as u8).collect();
let pres: Vec<i32> = primary.iter().map(|&h| if h != 0 { 1 } else { -1 }).collect();
let ids: Vec<i32> = ints(&c["ids"]).iter().map(|&x| x as i32).collect();
let kind: Vec<i32> = ints(&c["kind"]).iter().map(|&x| x as i32).collect();
let (n_tok, k) = (c["n_tok"].as_i64().unwrap(), c["k"].as_i64().unwrap());
let got = dispatch(
plan,
c["layer"].as_i64().unwrap(),
&ids,
n_tok,
k,
(c["use_kind"].as_i64() == Some(1)).then_some(&kind[..]),
(c["use_primary"].as_i64() == Some(1)).then_some(&pres[..]),
);
if c["ok"].as_i64() != Some(1) {
assert_eq!(got, Err(RemoteError::InvalidDispatch), "case {n}");
refused += 1;
continue;
}
let d = got.unwrap_or_else(|e| panic!("case {n}: {e}"));
let want = |key: &str| -> Vec<i64> { ints(&c[key]) };
assert_eq!(d.owned.iter().map(|&x| i64::from(x)).collect::<Vec<_>>(), want("owned")[..d.owned.len()], "case {n}: owned");
assert_eq!(d.groups.iter().map(|x| i64::from(x.expert)).collect::<Vec<_>>(), want("group_id"), "case {n}: groups");
assert_eq!(d.start.iter().map(|&x| i64::from(x)).collect::<Vec<_>>(), want("start"), "case {n}: start");
assert_eq!(d.dst.iter().map(|&x| i64::from(x)).collect::<Vec<_>>(), want("dst"), "case {n}: dst");
assert_eq!(d.tok.iter().map(|&x| i64::from(x)).collect::<Vec<_>>(), want("tok"), "case {n}: tok");
assert_eq!(d.original_row.iter().map(|&x| i64::from(x)).collect::<Vec<_>>(), want("original_row"), "case {n}: rows");
assert_eq!(d.computed, c["computed"].as_u64().unwrap(), "case {n}: computed");
if d.groups.is_empty() {
continue;
}
launched += 1;
groups_seen += d.groups.len();
// device pointers: the harness hands slot s the address 0x1_0000_0000 + s * 0x20_0000
let ptrs: Vec<u64> = c["ptr"].as_array().unwrap().iter().map(|x| x.as_u64().unwrap()).collect();
let img = RemoteMeta::to_bytes(&d, &|slot| 0x1_0000_0000 + slot as u64 * 0x20_0000);
assert_eq!(ptrs, d.groups.iter().map(|x| 0x1_0000_0000 + x.slot as u64 * 0x20_0000).collect::<Vec<_>>(), "case {n}: ptr");
assert_eq!(img.iter().map(|&b| i64::from(b)).collect::<Vec<_>>(), want("meta"), "case {n}: meta image");
// scatter with the real row width
let h = H;
let compact: Vec<f32> = (0..d.dst.len() * h).map(|i| ((i / h) as f32 + 1.0) + ((i % h) as f32 * 0.0001f32)).collect();
let mut out = vec![-1.0f32; (n_tok * k) as usize * h];
scatter(&mut out, &compact, &d.original_row, h);
let rows = c["scatter_rows"].as_array().unwrap();
assert_eq!(rows.len(), (n_tok * k) as usize);
for (r, sig) in rows.iter().enumerate() {
for (j, at) in [0, h / 2, h - 1].into_iter().enumerate() {
let want = sig[j].as_f64().unwrap();
let got = f64::from(out[r * h + at]);
assert!((got - want).abs() <= want.abs() * 1e-6 + 1e-9, "case {n} row {r}[{at}]: {got} vs {want}");
}
}
}
assert!(launched > 80 && refused >= 5 && groups_seen > 150, "fixture too thin: {launched} {refused} {groups_seen}");
}
@@ -0,0 +1,50 @@
//! The KV streaming planner against `layer.cpp`'s own functions (`oracle/gen_stream_golden.sh` extracts them
//! verbatim and drives them over a grid of formats, contexts, rings and `--kv-resident` values).
mod common;
use common::fixture;
use leleka_experimental_ref::{
kv_stream::{self, PlanSwitches, StreamMode},
layout::{KvFormat, QsaShapes},
};
#[test]
fn planner_and_state_bytes_match_layer_cpp_over_the_whole_grid() {
let g = fixture("stream_plan_golden.json");
assert_eq!(g["resident_min"].as_i64(), Some(kv_stream::KV_RESIDENT_MIN));
assert_eq!(g["map_bytes_5120"].as_u64(), Some(kv_stream::map_bytes(5120)));
let s = QsaShapes::real();
let mut n = 0;
let mut modes = [0usize; 3];
for c in g["cases"].as_array().unwrap() {
let format = match c["format"].as_str().unwrap() {
"fp16" => KvFormat::Fp16,
"int8" => KvFormat::Int8,
"q4_0" => KvFormat::Q4_0,
"k8v4" => KvFormat::K8V4,
"int8-keyless" => KvFormat::Int8Keyless,
other => panic!("{other}"),
};
let (max_cells, ring, resident) = (
c["max_cells"].as_i64().unwrap(),
c["ring"].as_i64().unwrap(),
c["resident"].as_i64().unwrap(),
);
let sw = PlanSwitches::default();
let plan = kv_stream::kv_plan(&s, max_cells, ring, resident, sw);
let ctx = format!("{format:?} {max_cells} ring {ring} resident {resident}");
assert_eq!(plan.mode as i64, c["mode"].as_i64().unwrap(), "{ctx}");
assert_eq!(plan.pages, c["pages"].as_i64().unwrap(), "{ctx}");
assert_eq!(plan.slots, c["slots"].as_i64().unwrap(), "{ctx}");
assert_eq!(plan.pooled_rows, c["pooled_rows"].as_i64().unwrap(), "{ctx}");
let bytes = kv_stream::qsa_state_bytes(&s, format, max_cells, c["rope"].as_i64() == Some(1), ring, resident, sw);
assert_eq!(bytes, c["state_bytes"].as_u64().unwrap(), "{ctx}");
modes[plan.mode as usize] += 1;
n += 1;
}
assert_eq!(n, 5 * 4 * 3 * 4 * 2);
// the grid exercises all three modes
assert!(modes.iter().all(|m| *m > 0), "{modes:?}");
assert_eq!(StreamMode::Streamed as i32, 1);
}
+1
View File
@@ -12,6 +12,7 @@ leleka-backend-api = { path = "../backend-api" }
leleka-tokenizer = { path = "../tokenizer" }
leleka-model-format = { path = "../model-format" }
leleka-quant-core = { path = "../quant-core" }
leleka-experimental-ref = { path = "../experimental-ref" }
leleka-sampler-ref = { path = "../sampler-ref" }
leleka-context = { path = "../context" }
leleka-cuda-driver = { path = "../cuda-driver", features = ["cuda-driver"] }
+52
View File
@@ -2,6 +2,7 @@
//! CUDA owners and borrowed buffers remain ordinary locals on that thread.
#[path = "backend_original_prompt.rs"]
pub(crate) mod original_prompt;
use crate::experimental::{self as experimental_modes, ExperimentalConfig};
use crate::model_binding::kar_expert_source::KarExpertSource;
pub use crate::model_binding::kar_expert_source::{
KarArchiveRef, KarExpertLevels, KarExpertSourceConfig,
@@ -93,6 +94,10 @@ pub struct NativeBackendConfig {
/// runtime level 2..=5 instead of the GGUF/MMQ expert path. Operator
/// supplied and SHA-256 pinned; exclusive with the optimized owners.
pub kar_expert_source: Option<KarExpertSourceConfig>,
/// EXPERIMENTAL Strata modes (Q4_0 / K8V4 / rotated KV, keyless V-only, KV streaming, control vectors).
/// `Default` is all-off and changes nothing; an enabled mode is admitted, digest-mixed and probed, and is
/// refused at Load until the forward pass consumes it (`experimental::FORWARD_CONSUMER_WIRED`).
pub experimental: ExperimentalConfig,
}
/// Operator-owned immutable metadata; no file path or policy enters RPCs.
@@ -928,6 +933,11 @@ fn serve_load(
let (instance, serial, observer, execution, optimized) = identity_and_observer;
let identity = (instance, serial);
validate_load(&model, &requested).map_err(|e| load_failure(LoadPhase::Config, e))?;
// Experimental modes: validate the combination with the Original's selection rules and refuse cheaply,
// before any model byte is read, while nothing in the forward pass consumes them.
let experimental_plan = experimental_modes::plan(&config.experimental)
.and_then(|plan| experimental_modes::ensure_consumed(&plan).map(|()| plan))
.map_err(|e| load_failure(LoadPhase::Config, experimental_error(e)))?;
if matches!(
execution,
EvaluationExecution::ExperimentalResidentMmq
@@ -1114,6 +1124,9 @@ fn serve_load(
Some(source) => kar_expert_mode_digest(&mode_identity_digest, source.identity_digest()),
None => mode_identity_digest,
};
// An experimental mode changes model outputs, so it changes the mode (all-off leaves the digest alone).
let mode_identity_digest =
experimental_modes::mode_digest(&mode_identity_digest, &config.experimental);
if shared.shutdown.load(Ordering::Acquire) {
return Err(load_failure(
LoadPhase::Cancellation,
@@ -1204,6 +1217,11 @@ fn serve_load(
// unpinned or does not load on this device.
probe_kar_level_decode(context.as_ref()).map_err(|e| load_failure(LoadPhase::Context, e))?;
}
if let Some(plan) = experimental_plan.as_ref() {
// Fail at Load, not at the first token, if an experimental PTX is unpinned or does not load.
probe_experimental(context.as_ref(), &config.experimental, plan)
.map_err(|e| load_failure(LoadPhase::Context, e))?;
}
let output = if queued_owners {
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
{ OutputStage::load_compact(&binding, context.as_ref()) }
@@ -1995,6 +2013,40 @@ fn kar_expert_mode_digest(bound_digest: &str, identity: &[u8; 32]) -> String {
}
result
}
fn experimental_error(error: experimental_modes::ExperimentalError) -> BackendError {
match error {
experimental_modes::ExperimentalError::Invalid(message) => invalid(message),
experimental_modes::ExperimentalError::Unsupported(message) => unsupported(message),
}
}
#[cfg(all(target_os = "linux", target_pointer_width = "64"))]
fn probe_experimental(
context: &leleka_cuda_driver::Context<'_>,
config: &ExperimentalConfig,
plan: &experimental_modes::Plan,
) -> Result<(), BackendError> {
use leleka_cuda_driver::experimental::ExperimentalError;
for program in &plan.programs {
leleka_cuda_driver::experimental_gpu::Experimental::open(context, *program, &config.opt_in)
.and_then(|opened| opened.close())
.map_err(|error| match error {
ExperimentalError::Unpinned(_) => unsupported("experimental PTX is not pinned"),
ExperimentalError::NotEnabled(_) | ExperimentalError::Invalid(_) => {
invalid("experimental program is not enabled for this configuration")
}
ExperimentalError::Driver(_) => unavailable("experimental program failed to load"),
})?;
}
Ok(())
}
#[cfg(not(all(target_os = "linux", target_pointer_width = "64")))]
fn probe_experimental(
_: &leleka_cuda_driver::Context<'_>,
_: &ExperimentalConfig,
_: &experimental_modes::Plan,
) -> Result<(), BackendError> {
Err(unsupported("experimental modes require Linux CUDA"))
}
#[cfg(all(target_os = "linux", target_pointer_width = "64"))]
fn probe_kar_level_decode(context: &leleka_cuda_driver::Context<'_>) -> Result<(), BackendError> {
leleka_cuda_driver::kar_decode_levels_gpu::KarDecodeLevels::open(context)
+449
View File
@@ -0,0 +1,449 @@
//! Operator-side admission of the EXPERIMENTAL Strata modes (Q4_0 / K8V4 / rotated-INT8 KV, keyless V-only KV,
//! KV streaming, control vectors). Pure: validation, program selection, the execution-mode digest and the
//! control-vector file loader. The Linux-only device probe lives in `backend.rs`.
//!
//! Everything is OFF by default: [`ExperimentalConfig::default`] enables nothing and changes nothing (no digest
//! mixing, no probe, no refusal). A mode is only ever reached by naming it in `ExperimentalConfig::opt_in`.
//!
//! STATUS: the closed CUDA programs behind these modes are uncompiled and unpinned (every PTX pin is zero), and
//! the forward pass does not yet consume the experimental cell formats or the control-vector hook, so
//! [`ensure_consumed`] refuses any enabled mode at Load rather than let an opt-in silently do nothing.
use leleka_cuda_driver::experimental::{Mode, OptIn, Program};
use leleka_experimental_ref::{
cvec::{CvecError, CvecOptions, CvecTables, load_control_vectors},
layout::{KvFormat, KvRequest, KvSelectionError, QsaShapes, kv_pool_bytes, select_format},
};
use sha2::{Digest, Sha256};
use std::path::PathBuf;
/// The operator's experimental switches. `Default` is all-off.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ExperimentalConfig {
pub opt_in: OptIn,
/// `--kv-resident N` cells kept in VRAM; non-zero only with [`Mode::KvStreamed`].
pub kv_resident: i64,
/// `--control-vector` files and scales; non-empty only with [`Mode::ControlVectors`].
pub control_vectors: Vec<(PathBuf, f32)>,
pub control_vector_options: CvecOptions,
}
impl ExperimentalConfig {
pub fn is_off(&self) -> bool {
self.opt_in.is_empty()
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ExperimentalError {
/// The combination or value is wrong (an operator error).
Invalid(&'static str),
/// Valid in the Original but not available in this build / on this host.
Unsupported(&'static str),
}
impl std::fmt::Display for ExperimentalError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let (Self::Invalid(m) | Self::Unsupported(m)) = self;
f.write_str(m)
}
}
impl std::error::Error for ExperimentalError {}
/// What an enabled configuration asks the engine to do.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Plan {
/// The KV storage format, when any KV mode (or streaming) is enabled.
pub format: Option<KvFormat>,
/// Closed programs the modes need, in probe order.
pub programs: Vec<Program>,
pub streamed: bool,
pub control_vectors: bool,
}
fn selection_error(e: KvSelectionError) -> ExperimentalError {
ExperimentalError::Invalid(match e {
KvSelectionError::UnknownFormat => "--kv must be fp16, int8, q4_0 or k8v4",
KvSelectionError::KeylessRequiresPlainInt8 => {
"keyless requires INT8, no Hadamard rotation, one GPU stage and no diagnostic dumps"
}
KvSelectionError::NegativeResident => "--kv-resident must be >= 0",
KvSelectionError::K8V4NotStreamable => {
"--kv k8v4 does not support --kv-resident streaming (yet)"
}
})
}
/// Validate the combination with the Original's own selection rules and derive the plan. `Ok(None)` for the
/// all-off default (and the default must also carry no stray values).
pub fn plan(config: &ExperimentalConfig) -> Result<Option<Plan>, ExperimentalError> {
let on = |m| config.opt_in.is_enabled(m);
if config.is_off() {
if config.kv_resident != 0 || !config.control_vectors.is_empty() {
return Err(ExperimentalError::Invalid(
"--kv-resident / --control-vector need their experimental mode enabled explicitly",
));
}
return Ok(None);
}
let (q4, k8, rot, keyless, streamed, cvec) = (
on(Mode::KvQ40),
on(Mode::KvK8V4),
on(Mode::KvRotatedInt8),
on(Mode::KeylessVOnly),
on(Mode::KvStreamed),
on(Mode::ControlVectors),
);
if q4 && k8 {
return Err(ExperimentalError::Invalid(
"kv-q4_0 and kv-k8v4 are exclusive",
));
}
if rot && (q4 || k8) {
return Err(ExperimentalError::Invalid(
"kv-int8-rotated is exclusive with kv-q4_0 and kv-k8v4 (those rotate by themselves)",
));
}
if streamed != (config.kv_resident > 0) {
return Err(ExperimentalError::Invalid(
"kv-streamed needs --kv-resident > 0, and --kv-resident > 0 needs kv-streamed",
));
}
if cvec == config.control_vectors.is_empty() {
return Err(ExperimentalError::Invalid(
"control-vectors needs at least one --control-vector file, and the files need the mode",
));
}
let kv_mode = q4 || k8 || rot || keyless || streamed;
let format = if kv_mode {
let kv = if q4 {
"q4_0"
} else if k8 {
"k8v4"
} else {
"int8"
};
Some(
select_format(&KvRequest {
kv,
kv_rot: rot,
keyless_routing: keyless,
kv_resident: config.kv_resident,
gpu_stages: false,
diagnostic_dumps: false,
})
.map_err(selection_error)?,
)
} else {
None
};
let mut programs = Vec::new();
let mut need = |p: Program| {
if !programs.contains(&p) {
programs.push(p);
}
};
match format {
Some(KvFormat::Q4_0) => {
need(Program::KvQ4);
need(Program::QsaAttn);
}
Some(KvFormat::K8V4) => {
need(Program::KvQ4);
need(Program::KvQ8);
need(Program::QsaAttn);
}
Some(KvFormat::Int8Rotated) => {
need(Program::KvQ4);
need(Program::KvQ8);
}
Some(KvFormat::Int8Keyless) => {
need(Program::Keyless);
need(Program::KvQ8);
need(Program::QsaAttn);
}
_ => {}
}
if streamed {
need(Program::KvStream);
}
if cvec {
need(Program::Cvec);
}
Ok(Some(Plan {
format,
programs,
streamed,
control_vectors: cvec,
}))
}
/// Pool bytes of one QSA layer for `pages` pages in the plan's format (`kv_pool_bytes` of `layer.cpp`).
pub fn pool_bytes(plan: &Plan, pages: u64) -> Option<u64> {
plan.format
.map(|f| kv_pool_bytes(f, &QsaShapes::real(), pages))
}
/// The execution-mode digest with the experimental identity mixed in: an experimental mode changes model
/// outputs, so it changes the mode. All-off leaves the digest untouched.
pub fn mode_digest(bound_digest: &str, config: &ExperimentalConfig) -> String {
if config.is_off() {
return bound_digest.to_string();
}
let mut digest = Sha256::new();
digest.update(b"leleka-experimental-mode-v1\n");
digest.update(bound_digest.as_bytes());
digest.update(b"\n");
digest.update(config.opt_in.digest_text().as_bytes());
digest.update(b"\nresident=");
digest.update(config.kv_resident.to_le_bytes());
for (path, scale) in &config.control_vectors {
digest.update(b"\ncvec=");
digest.update(path.as_os_str().as_encoded_bytes());
digest.update(scale.to_bits().to_le_bytes());
}
let mut result = String::from("sha256:");
for value in digest.finalize() {
use std::fmt::Write;
let _ = write!(result, "{value:02x}");
}
result
}
/// Bytes read from one control-vector file at most (a direction per layer: 48 x 2560 x 4 is under 1 MiB).
pub const MAX_CONTROL_VECTOR_FILE_BYTES: u64 = 64 << 20;
/// Read and validate the control-vector files with the Original's loader, so a bad file fails at Load.
pub fn load_control_vector_tables(
config: &ExperimentalConfig,
n_layers: i64,
n_embd: i64,
hc: i64,
) -> Result<CvecTables, ExperimentalError> {
use std::io::Read;
let mut files = Vec::new();
for (path, scale) in &config.control_vectors {
let file = std::fs::File::open(path)
.map_err(|_| ExperimentalError::Invalid("control-vector file cannot be opened"))?;
let mut bytes = Vec::new();
file.take(MAX_CONTROL_VECTOR_FILE_BYTES + 1)
.read_to_end(&mut bytes)
.map_err(|_| ExperimentalError::Invalid("control-vector file cannot be read"))?;
if bytes.len() as u64 > MAX_CONTROL_VECTOR_FILE_BYTES {
return Err(ExperimentalError::Invalid(
"control-vector file is too large",
));
}
files.push((path.display().to_string(), bytes, *scale));
}
load_control_vectors(&files, n_layers, n_embd, hc, &config.control_vector_options).map_err(
|e| match e {
CvecError::UnsupportedEmbd => {
ExperimentalError::Unsupported("control vector: unsupported n_embd")
}
_ => ExperimentalError::Invalid("control-vector file or options rejected"),
},
)
}
/// Whether the forward pass applies the experimental cell formats and the control-vector hook. Until it does,
/// an enabled mode must not run as if it had taken effect.
pub const FORWARD_CONSUMER_WIRED: bool = false;
pub fn ensure_consumed(plan: &Option<Plan>) -> Result<(), ExperimentalError> {
match plan {
Some(_) if !FORWARD_CONSUMER_WIRED => Err(ExperimentalError::Unsupported(
"experimental modes are admitted but the forward pass does not consume them yet",
)),
_ => Ok(()),
}
}
#[cfg(test)]
mod tests {
use super::*;
fn cfg(modes: &[Mode], resident: i64) -> ExperimentalConfig {
let mut opt_in = OptIn::default();
for m in modes {
opt_in = opt_in.with(*m);
}
ExperimentalConfig {
opt_in,
kv_resident: resident,
..Default::default()
}
}
#[test]
fn default_is_off_and_changes_nothing() {
let c = ExperimentalConfig::default();
assert!(c.is_off());
assert_eq!(plan(&c), Ok(None));
assert_eq!(mode_digest("sha256:abc", &c), "sha256:abc");
assert_eq!(ensure_consumed(&None), Ok(()));
// stray values without their mode are refused, not ignored
assert!(
plan(&ExperimentalConfig {
kv_resident: 8,
..Default::default()
})
.is_err()
);
assert!(
plan(&ExperimentalConfig {
control_vectors: vec![("a".into(), 1.0)],
..Default::default()
})
.is_err()
);
}
#[test]
fn each_mode_selects_the_originals_format_and_programs() {
let p = plan(&cfg(&[Mode::KvQ40], 0)).unwrap().unwrap();
assert_eq!(p.format, Some(KvFormat::Q4_0));
assert_eq!(p.programs, [Program::KvQ4, Program::QsaAttn]);
let p = plan(&cfg(&[Mode::KvK8V4], 0)).unwrap().unwrap();
assert_eq!(p.format, Some(KvFormat::K8V4));
assert_eq!(p.programs, [Program::KvQ4, Program::KvQ8, Program::QsaAttn]);
let p = plan(&cfg(&[Mode::KvRotatedInt8], 0)).unwrap().unwrap();
assert_eq!(p.format, Some(KvFormat::Int8Rotated));
let p = plan(&cfg(&[Mode::KeylessVOnly], 0)).unwrap().unwrap();
assert_eq!(p.format, Some(KvFormat::Int8Keyless));
assert_eq!(
p.programs,
[Program::Keyless, Program::KvQ8, Program::QsaAttn]
);
let p = plan(&cfg(&[Mode::KvQ40, Mode::KvStreamed], 20_480))
.unwrap()
.unwrap();
assert!(p.streamed);
assert_eq!(
p.programs,
[Program::KvQ4, Program::QsaAttn, Program::KvStream]
);
let mut c = cfg(&[Mode::ControlVectors], 0);
c.control_vectors.push(("v.gguf".into(), 1.0));
let p = plan(&c).unwrap().unwrap();
assert_eq!(
(p.format, p.programs.as_slice()),
(None, &[Program::Cvec][..])
);
}
#[test]
fn exclusions_follow_the_originals_selection_rules() {
let bad = |modes: &[Mode], resident| plan(&cfg(modes, resident)).unwrap_err();
assert!(
bad(&[Mode::KvQ40, Mode::KvK8V4], 0)
.to_string()
.contains("exclusive")
);
assert!(
bad(&[Mode::KvRotatedInt8, Mode::KvQ40], 0)
.to_string()
.contains("exclusive")
);
assert!(
bad(&[Mode::KeylessVOnly, Mode::KvQ40], 0)
.to_string()
.contains("keyless requires INT8")
);
assert!(
bad(&[Mode::KeylessVOnly, Mode::KvRotatedInt8], 0)
.to_string()
.contains("keyless requires INT8")
);
assert!(
bad(&[Mode::KvK8V4, Mode::KvStreamed], 4096)
.to_string()
.contains("k8v4 does not support")
);
assert!(
bad(&[Mode::KvStreamed], 0)
.to_string()
.contains("kv-streamed needs")
);
assert!(
bad(&[Mode::KvQ40], 4096)
.to_string()
.contains("kv-streamed needs")
);
assert!(
bad(&[Mode::ControlVectors], 0)
.to_string()
.contains("control-vectors needs")
);
// keyless streams (the Original's V-only stream format)
assert!(
plan(&cfg(&[Mode::KeylessVOnly, Mode::KvStreamed], 20_480))
.unwrap()
.is_some()
);
}
#[test]
fn pool_bytes_use_the_originals_per_cell_sizes() {
let p = plan(&cfg(&[Mode::KvQ40], 0)).unwrap().unwrap();
assert_eq!(pool_bytes(&p, 100), Some(100 * 4 * 576 + 64));
let p = plan(&cfg(&[Mode::KvK8V4], 0)).unwrap().unwrap();
assert_eq!(pool_bytes(&p, 100), Some(100 * 4 * 816 + 64));
let p = plan(&cfg(&[Mode::KeylessVOnly], 0)).unwrap().unwrap();
assert_eq!(pool_bytes(&p, 100), Some(100 * 4 * 528 + 64));
}
#[test]
fn digest_binds_modes_values_and_files() {
let a = mode_digest("sha256:abc", &cfg(&[Mode::KvQ40], 0));
let b = mode_digest("sha256:abc", &cfg(&[Mode::KvK8V4], 0));
let c = mode_digest("sha256:abd", &cfg(&[Mode::KvQ40], 0));
let d = mode_digest("sha256:abc", &cfg(&[Mode::KvQ40, Mode::KvStreamed], 4096));
let e = mode_digest("sha256:abc", &cfg(&[Mode::KvQ40, Mode::KvStreamed], 8192));
let mut all = vec![a.clone(), b, c, d, e];
all.sort();
all.dedup();
assert_eq!(all.len(), 5);
assert!(a.starts_with("sha256:") && a.len() == 7 + 64 && a != "sha256:abc");
let mut f1 = cfg(&[Mode::ControlVectors], 0);
f1.control_vectors.push(("a.gguf".into(), 1.0));
let mut f2 = f1.clone();
f2.control_vectors[0].1 = 0.5;
assert_ne!(mode_digest("x", &f1), mode_digest("x", &f2));
}
#[test]
fn an_enabled_mode_is_refused_until_the_forward_pass_consumes_it() {
let p = plan(&cfg(&[Mode::KvQ40], 0)).unwrap();
assert!(matches!(
ensure_consumed(&p),
Err(ExperimentalError::Unsupported(_))
));
}
#[test]
fn control_vector_files_are_validated_at_load() {
let mut c = cfg(&[Mode::ControlVectors], 0);
c.control_vectors
.push((PathBuf::from("/nonexistent/leleka-cvec.gguf"), 1.0));
assert_eq!(
load_control_vector_tables(&c, 6, 40, 4),
Err(ExperimentalError::Invalid(
"control-vector file cannot be opened"
))
);
// a real (tiny, invalid) file is rejected by the Original's GGUF checks
let dir = std::env::temp_dir().join(format!("leleka-cvec-{}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
let path = dir.join("bad.gguf");
std::fs::write(&path, b"not a gguf").unwrap();
c.control_vectors[0].0 = path;
assert_eq!(
load_control_vector_tables(&c, 6, 40, 4),
Err(ExperimentalError::Invalid(
"control-vector file or options rejected"
))
);
std::fs::remove_dir_all(&dir).ok();
}
}
+1
View File
@@ -3,6 +3,7 @@
pub mod backend;
pub use leleka_context::{context_policy, memory_plan, rope_scaling};
pub mod conversation;
pub mod experimental;
pub use backend::spawn_backend_observed_native_integer_iq3_windowed256_retained_gr;
pub use backend::spawn_backend_observed_native_resident_mmq;
@@ -0,0 +1,222 @@
{
"schema": 1,
"note": "Additions for the experimental Strata modes. None of these six .cu files has been compiled; PINS in experimental.rs are all zero and admit_ptx refuses every asset until Root builds the PTX and freezes the digests. Flags follow engine/strata/CMakeLists.txt: none of the six Original TUs is in the --use_fast_math list (native_* only) and the strata_kernels target adds no other CUDA flag besides CUDA_STANDARD 17, so the build is precise (no --use_fast_math) with default -fmad contraction.",
"assets": [
{
"cu": "crates/cuda-driver/src/experimental_kv_q4.cu",
"cu_pin": {
"sha256": "4b2ed68008f3aa87adf1445c608baee4439a0ca41213ac2e280a70e88448b420",
"bytes": 16598
},
"ptx": "crates/cuda-driver/src/experimental_kv_q4.ptx",
"flags": [
"-ptx",
"-O3",
"-arch=sm_120",
"-std=c++17"
],
"policy": "EXPERIMENTAL, off by default (OptIn). FWHT-256 + Q4_0 append (step/batched) + gather; Original kv_q4.cu precise (default flags, not in the fast-math list); K8V4's Q4_0 V half and rotated INT8's FWHT",
"direct_original_headers": [],
"original": "engine/strata/src/kernels/cuda/kv_q4.cu",
"rust_consumers": {
"experimental.rs": {
"sha256": "efdff8bf38d53c7b3825316a86169a56c8d3ca166e39a2ed889872de52c15981",
"bytes": 36646
},
"experimental_gpu.rs": {
"sha256": "8ef8c9a74092e2b273c9caa49a6af7d190f844d139ffc89a61f038690d2131b4",
"bytes": 32785
}
},
"rust_fields_to_fill": {
"experimental.rs": [
"PINS[0].source_sha256",
"PINS[0].ptx_sha256"
]
},
"encoding": "concat_include_str",
"seal_sha256": null,
"seal_length": null
},
{
"cu": "crates/cuda-driver/src/experimental_kv_q8.cu",
"cu_pin": {
"sha256": "93a45694250c1c9abecb372940ba52e158887bcbea58133215910e26a96a7174",
"bytes": 12008
},
"ptx": "crates/cuda-driver/src/experimental_kv_q8.ptx",
"flags": [
"-ptx",
"-O3",
"-arch=sm_120",
"-std=c++17"
],
"policy": "EXPERIMENTAL, off by default (OptIn). INT8 append (K+V, K8V4 K half, V-only) + gather; Original kv_q8.cu precise",
"direct_original_headers": [],
"original": "engine/strata/src/kernels/cuda/kv_q8.cu",
"rust_consumers": {
"experimental.rs": {
"sha256": "efdff8bf38d53c7b3825316a86169a56c8d3ca166e39a2ed889872de52c15981",
"bytes": 36646
},
"experimental_gpu.rs": {
"sha256": "8ef8c9a74092e2b273c9caa49a6af7d190f844d139ffc89a61f038690d2131b4",
"bytes": 32785
}
},
"rust_fields_to_fill": {
"experimental.rs": [
"PINS[1].source_sha256",
"PINS[1].ptx_sha256"
]
},
"encoding": "concat_include_str",
"seal_sha256": null,
"seal_length": null
},
{
"cu": "crates/cuda-driver/src/experimental_kv_stream.cu",
"cu_pin": {
"sha256": "ab873bf939f5235023dd92d706c8814ab78f955ab15e1293b8e0b96caa5cc153",
"bytes": 11751
},
"ptx": "crates/cuda-driver/src/experimental_kv_stream.ptx",
"flags": [
"-ptx",
"-O3",
"-arch=sm_120",
"-std=c++17"
],
"policy": "EXPERIMENTAL, off by default (OptIn). CLOCK residency resolver, block copy, ring table, u4 copy; Original kv_stream.cu precise; integer only",
"direct_original_headers": [],
"original": "engine/strata/src/kernels/cuda/kv_stream.cu",
"rust_consumers": {
"experimental.rs": {
"sha256": "efdff8bf38d53c7b3825316a86169a56c8d3ca166e39a2ed889872de52c15981",
"bytes": 36646
},
"experimental_gpu.rs": {
"sha256": "8ef8c9a74092e2b273c9caa49a6af7d190f844d139ffc89a61f038690d2131b4",
"bytes": 32785
}
},
"rust_fields_to_fill": {
"experimental.rs": [
"PINS[2].source_sha256",
"PINS[2].ptx_sha256"
]
},
"encoding": "concat_include_str",
"seal_sha256": null,
"seal_length": null
},
{
"cu": "crates/cuda-driver/src/experimental_keyless.cu",
"cu_pin": {
"sha256": "77c50e5baff842e31f0d71624a5706f46ed74a56cdfc5e4211086d2ef08671c5",
"bytes": 1987
},
"ptx": "crates/cuda-driver/src/experimental_keyless.ptx",
"flags": [
"-ptx",
"-O3",
"-arch=sm_120",
"-std=c++17"
],
"policy": "EXPERIMENTAL, off by default (OptIn). per-head query routing (fmaf-ordered 256x256); Original keyless.cu precise",
"direct_original_headers": [],
"original": "engine/strata/src/kernels/cuda/keyless.cu",
"rust_consumers": {
"experimental.rs": {
"sha256": "efdff8bf38d53c7b3825316a86169a56c8d3ca166e39a2ed889872de52c15981",
"bytes": 36646
},
"experimental_gpu.rs": {
"sha256": "8ef8c9a74092e2b273c9caa49a6af7d190f844d139ffc89a61f038690d2131b4",
"bytes": 32785
}
},
"rust_fields_to_fill": {
"experimental.rs": [
"PINS[3].source_sha256",
"PINS[3].ptx_sha256"
]
},
"encoding": "concat_include_str",
"seal_sha256": null,
"seal_length": null
},
{
"cu": "crates/cuda-driver/src/experimental_qsa_attn.cu",
"cu_pin": {
"sha256": "c65d991ad9fe700101ce012a80c94fc7de582117fae357c5eea8954370195d8f",
"bytes": 17458
},
"ptx": "crates/cuda-driver/src/experimental_qsa_attn.ptx",
"flags": [
"-ptx",
"-O3",
"-arch=sm_120",
"-std=c++17"
],
"policy": "EXPERIMENTAL, off by default (OptIn). experimental attention modes 2/3/4 + merge; Original qsa_decode_attn.cu precise (expf/exp2f exact, not in the fast-math list)",
"direct_original_headers": [],
"original": "engine/strata/src/kernels/cuda/qsa_decode_attn.cu",
"rust_consumers": {
"experimental.rs": {
"sha256": "efdff8bf38d53c7b3825316a86169a56c8d3ca166e39a2ed889872de52c15981",
"bytes": 36646
},
"experimental_gpu.rs": {
"sha256": "8ef8c9a74092e2b273c9caa49a6af7d190f844d139ffc89a61f038690d2131b4",
"bytes": 32785
}
},
"rust_fields_to_fill": {
"experimental.rs": [
"PINS[4].source_sha256",
"PINS[4].ptx_sha256"
]
},
"encoding": "concat_include_str",
"seal_sha256": null,
"seal_length": null
},
{
"cu": "crates/cuda-driver/src/experimental_cvec.cu",
"cu_pin": {
"sha256": "d4fe221b11569db73247644bb79118b34d040b49c14897e0bac158dcd4ca356e",
"bytes": 4783
},
"ptx": "crates/cuda-driver/src/experimental_cvec.ptx",
"flags": [
"-ptx",
"-O3",
"-arch=sm_120",
"-std=c++17"
],
"policy": "EXPERIMENTAL, off by default (OptIn). control-vector apply; Original cvec.cu default flags (its own __expf in sigmoidf_ is explicit in the source)",
"direct_original_headers": [],
"original": "engine/strata/src/kernels/cuda/cvec.cu",
"rust_consumers": {
"experimental.rs": {
"sha256": "efdff8bf38d53c7b3825316a86169a56c8d3ca166e39a2ed889872de52c15981",
"bytes": 36646
},
"experimental_gpu.rs": {
"sha256": "8ef8c9a74092e2b273c9caa49a6af7d190f844d139ffc89a61f038690d2131b4",
"bytes": 32785
}
},
"rust_fields_to_fill": {
"experimental.rs": [
"PINS[5].source_sha256",
"PINS[5].ptx_sha256"
]
},
"encoding": "concat_include_str",
"seal_sha256": null,
"seal_length": null
}
]
}
@@ -0,0 +1,49 @@
# Experimental Strata modes: Rust port status (2026-10-14)
Branch `claude/port-experimental` (based on `claude/port-main`). Everything here is **experimental and off by
default**: `OptIn::default()` enables nothing, every closed program refuses to open without an enabled mode, and
every PTX pin is zero, so nothing reaches the driver until Root builds the PTX and freezes the digests.
## What exists
| Item | Rust reference (`crates/experimental-ref`) | CUDA program (`crates/cuda-driver/src/experimental_*.cu`) |
| --- | --- | --- |
| Q4_0 / K8V4 / rotated-INT8 KV, FWHT-256 | `fwht`, `q4_0`, `kv_q8`, `layout`, `cache` | `kv_q4` (FWHT, Q4_0 append step/batch, gather), `kv_q8` (INT8 append/gather, K8V4 K half, V-only) |
| Keyless V-only cache, query routing | `keyless` (artifact parser, fmaf routing, RoPE keys), `attn` | `keyless`, `qsa_attn` (modes 2/3/4 + merge) |
| Control vectors | `cvec` (GGUF parse, tables, apply twin) | `cvec` |
| KV streaming / ring | `kv_stream` (planner arithmetic, CLOCK resolver oracle) | `kv_stream` (reset, resolve, copy, ring table, u4 copy) |
| Remote experts (second GPU tier) | `remote_experts` (selection, 512 MiB admission, grouping, RemoteMeta 1608 B, scatter) | none: reuses the existing grouped expert kernels |
| Seal plan | `docs/cuda-seal-plan-additions-experimental.json` (`oracle/gen_seal_additions.py`) | flags `-ptx -O3 -arch=sm_120 -std=c++17`, precise math |
Rust driver: `cuda-driver/src/experimental.rs` (modes, opt-in, pins, entry signatures, geometry, admission; pure),
`experimental_gpu.rs` (Linux facade, a bounds-, alias- and signature-checked launch builder, one drain per sequence),
`experimental_gpu_smoke.rs` (`#[ignore]`d). Runtime: `leleka-runtime/src/experimental.rs` + `NativeBackendConfig::experimental`.
## Verification (no nvcc, no GPU)
* Golden fixtures are produced by compiling the Original's own host C++ (extracted verbatim with awk) on the dev
machine: KV formats (Separate and Fused FMA contraction), streaming plan (480 cases) and CLOCK resolver, control
vector loader (19 cases), remote-experts selection/grouping/meta/scatter (40 + 200 cases).
* The literal `.cu` text is executed by a thread-per-CUDA-thread CPU emulation (`oracle/emu`) and compared bit for
bit with the Rust references (`tests/emulated_kernels.rs`); `tests/literal_port.rs` guards that every Original
kernel-body line is still present in each port.
* `experimental.rs` cross-checks every entry's parameter kinds and `__launch_bounds__` against the `.cu` text.
* `cargo check --target x86_64-unknown-linux-gnu --all-targets -p leleka-cuda-driver --features cuda-driver -p leleka-runtime` is clean of new warnings.
## Open items (honest)
1. None of the six `.cu` files has been compiled or run. Root: build PTX, freeze `experimental::PINS`, run
`cargo test -p leleka-cuda-driver --features cuda-driver -- --ignored experimental_gpu`.
2. nvcc FMA contraction decides Q4_0 bytes (Separate vs Fused models are both fixtures); the Q4 smoke reports which
model the device matches. `cvec` uses the fast `__expf` exactly as the Original: its pending-write path is not a
bit claim.
3. Streaming host tier: the facade copies from `DeviceBuffer`s; real pinned, mapped host memory (zero-copy) is not
bound. Miss order of the resolve kernel is nondeterministic on device; the smoke checks invariants, not order.
4. The forward pass does not consume the new cell formats, the keyless artifact, the streaming plan or the cvec hook
(the runtime's QSA path is a different, INT8-resident layout). `experimental::ensure_consumed` therefore refuses
any enabled mode at Load instead of letting an opt-in silently do nothing; flip `FORWARD_CONSUMER_WIRED` only
with the consumer.
5. Remote experts: the second CUDA context, pinned zero-copy staging and the launches of the existing grouped
expert kernels need two devices. Selection, admission, grouping, metadata and scatter are tested; `experimental_routed`
/ `experimental_experts` prefill patches are not ported.
6. Host write-through (`host_*`/`stage_*` mapped pointers of the append kernels) is passed as null.