[ABI][LD][Proofs][Docs] M1 groundwork: arena-safety proof + .vbundle contract; embedder lane (M1.5) accepted
- proofs/arena_plan.lean: memory.vplan arena safety (8 theorems + 4 computational examples, 0 sorryAx): no overlap, checked index bounds, no use-before-write, overlap-rejection completeness. - abi::arena: validator mirroring the proof, checked offset arithmetic (invariant #2), explicit error per violation class; 8 tests. - abi::bundle: .vbundle manifest (ABI_VERSION=1, source+packer fingerprints, backend target; incompatible ABI rejected explicitly), checked memory.vplan/graph.vplan parsing, arena-validated compile(); 7 tests. - ld::bundle: read-only load_bundle_plans(dir) over manifest + plan/*.vplan; 3 tests (good bundle, missing file, ABI mismatch). - abi::vplan: encoder-lane opcodes (layer_norm, flash_full_attn, gelu_erf, mean_pool_l2norm) + wire name mapping for all 22 opcodes, roundtrip test. - Docs: utility-encoder scope carve-out (dense decoder LMs out, small fully-resident encoders in), embedder-lane wire proposal + characteristic parity vs vetta-semantics (cosine vs oracle, internal bit-exact goldens), 16-primitive kernel set, M1.5 milestone; README/AGENTS aligned (65 tests, 42 theorems across 4 proof files). - review/: tandem exchange with the strata-ctl coder (their request + observations, our formal reply: embedder accepted, M0 dir cleanup done). Verified live: RUSTFLAGS="-D warnings" cargo test --workspace = 65/65 PASS; lean proofs/{slab_ring_dma,bus_lifecycle,serve_session,arena_plan}.lean green, standard axioms only.
This commit is contained in:
1 parent
7b50f1c07c
commit
fb92662106
13 files changed
+1235
-16
No files matched your search
@@ -25,6 +25,11 @@ pub enum VplanOp {
|
||||
MoeReduce,
|
||||
VitFlashAttnWmma,
|
||||
GpuPenaltiesTopk,
|
||||
// Encoder lane (M1.5 embedder, docs/ARCHITECTURE.md §4)
|
||||
LayerNorm,
|
||||
FlashFullAttn,
|
||||
GeluErf,
|
||||
MeanPoolL2norm,
|
||||
// Restricted control flow
|
||||
/// Repeat the enclosed layer body for each model layer.
|
||||
LoopLayer,
|
||||
@@ -37,6 +42,63 @@ impl VplanOp {
|
||||
pub fn is_control(self) -> bool {
|
||||
matches!(self, Self::LoopLayer | Self::BranchB)
|
||||
}
|
||||
|
||||
/// Canonical wire name (as written in `graph.vplan`).
|
||||
pub fn name(self) -> &'static str {
|
||||
match self {
|
||||
Self::EmbedBf16 => "embed_bf16",
|
||||
Self::RmsNorm => "rms_norm",
|
||||
Self::QuantizeXG64 => "quantize_x_g64",
|
||||
Self::GemmQ8G64T16 => "gemm_q8_g64_t16",
|
||||
Self::GemmQ4G64T16 => "gemm_q4_g64_t16",
|
||||
Self::GemmNvfp4Mxfp8 => "gemm_nvfp4_mxfp8",
|
||||
Self::RopeKvWrite => "rope_kv_write",
|
||||
Self::FlashGqaWmma => "flash_gqa_wmma",
|
||||
Self::GdnChunkwiseWy => "gdn_chunkwise_wy",
|
||||
Self::GdnRecurrentStep => "gdn_recurrent_step",
|
||||
Self::MoeRouteBucket => "moe_route_bucket",
|
||||
Self::MoeW13Wmma => "moe_w13_wmma",
|
||||
Self::MoeW2Wmma => "moe_w2_wmma",
|
||||
Self::MoeReduce => "moe_reduce",
|
||||
Self::VitFlashAttnWmma => "vit_flash_attn_wmma",
|
||||
Self::GpuPenaltiesTopk => "gpu_penalties_topk",
|
||||
Self::LayerNorm => "layer_norm",
|
||||
Self::FlashFullAttn => "flash_full_attn",
|
||||
Self::GeluErf => "gelu_erf",
|
||||
Self::MeanPoolL2norm => "mean_pool_l2norm",
|
||||
Self::LoopLayer => "loop_layer",
|
||||
Self::BranchB => "branch_b",
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a wire name; unknown opcodes are rejected explicitly (never silent).
|
||||
pub fn from_name(s: &str) -> Option<Self> {
|
||||
Some(match s {
|
||||
"embed_bf16" => Self::EmbedBf16,
|
||||
"rms_norm" => Self::RmsNorm,
|
||||
"quantize_x_g64" => Self::QuantizeXG64,
|
||||
"gemm_q8_g64_t16" => Self::GemmQ8G64T16,
|
||||
"gemm_q4_g64_t16" => Self::GemmQ4G64T16,
|
||||
"gemm_nvfp4_mxfp8" => Self::GemmNvfp4Mxfp8,
|
||||
"rope_kv_write" => Self::RopeKvWrite,
|
||||
"flash_gqa_wmma" => Self::FlashGqaWmma,
|
||||
"gdn_chunkwise_wy" => Self::GdnChunkwiseWy,
|
||||
"gdn_recurrent_step" => Self::GdnRecurrentStep,
|
||||
"moe_route_bucket" => Self::MoeRouteBucket,
|
||||
"moe_w13_wmma" => Self::MoeW13Wmma,
|
||||
"moe_w2_wmma" => Self::MoeW2Wmma,
|
||||
"moe_reduce" => Self::MoeReduce,
|
||||
"vit_flash_attn_wmma" => Self::VitFlashAttnWmma,
|
||||
"gpu_penalties_topk" => Self::GpuPenaltiesTopk,
|
||||
"layer_norm" => Self::LayerNorm,
|
||||
"flash_full_attn" => Self::FlashFullAttn,
|
||||
"gelu_erf" => Self::GeluErf,
|
||||
"mean_pool_l2norm" => Self::MeanPoolL2norm,
|
||||
"loop_layer" => Self::LoopLayer,
|
||||
"branch_b" => Self::BranchB,
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -50,4 +112,21 @@ mod tests {
|
||||
assert!(!VplanOp::GemmQ8G64T16.is_control());
|
||||
assert!(!VplanOp::GdnChunkwiseWy.is_control());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn name_roundtrip_all_opcodes() {
|
||||
let all = [
|
||||
VplanOp::EmbedBf16, VplanOp::RmsNorm, VplanOp::QuantizeXG64,
|
||||
VplanOp::GemmQ8G64T16, VplanOp::GemmQ4G64T16, VplanOp::GemmNvfp4Mxfp8,
|
||||
VplanOp::RopeKvWrite, VplanOp::FlashGqaWmma, VplanOp::GdnChunkwiseWy,
|
||||
VplanOp::GdnRecurrentStep, VplanOp::MoeRouteBucket, VplanOp::MoeW13Wmma,
|
||||
VplanOp::MoeW2Wmma, VplanOp::MoeReduce, VplanOp::VitFlashAttnWmma,
|
||||
VplanOp::GpuPenaltiesTopk, VplanOp::LayerNorm, VplanOp::FlashFullAttn,
|
||||
VplanOp::GeluErf, VplanOp::MeanPoolL2norm, VplanOp::LoopLayer, VplanOp::BranchB,
|
||||
];
|
||||
for op in all {
|
||||
assert_eq!(VplanOp::from_name(op.name()), Some(op));
|
||||
}
|
||||
assert_eq!(VplanOp::from_name("bogus"), None);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user