interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / crates / crumbs / src / conformance.rs

59 lines · 2015 bytes Raw Blame History
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Drake Stapleton (AIEN / aien-dev)
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//! Crumb v1 conformance vectors for other implementations (e.g. Omega's reader).
17
18use crate::gen::{self, registry};
19use std::path::Path;
20
21/// Write one visible crumb per family (seed 7) plus an expected-values file.
22pub fn write_vectors(dir: &Path) -> i32 {
23 if std::fs::create_dir_all(dir).is_err() {
24 return 1;
25 }
26 let mut index = String::new();
27 for f in &registry().families {
28 let g = gen::generate(f, 7);
29 let name = format!("v{:03}.crb", f.id);
30 if std::fs::write(dir.join(&name), g.visible.to_bytes()).is_err() {
31 return 1;
32 }
33 let mut line = format!(
34 "{name} ok enc={} in={}x{} out={}x{} n={}",
35 g.visible.encoding as u8,
36 g.visible.in_arity,
37 g.visible.in_lane_bytes,
38 g.visible.out_arity,
39 g.visible.out_lane_bytes,
40 g.visible.examples.len()
41 );
42 for (i, o) in g.visible.values() {
43 line.push_str(" |");
44 for v in i {
45 line.push_str(&format!(" {v}"));
46 }
47 line.push_str(" ->");
48 for v in o {
49 line.push_str(&format!(" {v}"));
50 }
51 }
52 index.push_str(&line);
53 index.push('\n');
54 }
55 if std::fs::write(dir.join("expected.txt"), index).is_err() {
56 return 1;
57 }
58 0
59}