All checks were successful
wai-quantum WebGPU member / member · DX12 and Vulkan (cbio-windows) (pull_request) Successful in 12m16s
joule-code conformance gate / joule-moq-ingest, every target (pull_request) Successful in 1m33s
standards workspaces build + test / which workspaces this change touches (pull_request) Successful in 6s
joule-code conformance gate / joule-moq-relay, every target (pull_request) Successful in 2m18s
wai cross-architecture byte-equality / does this change touch it (pull_request) Successful in 6s
wai cross-architecture byte-equality / linux-aarch64 (pull_request) Has been skipped
wai cross-architecture byte-equality / linux-x86_64 (pull_request) Has been skipped
wai cross-architecture byte-equality / macos-arm64 (reference) (pull_request) Has been skipped
WAI conformance / does this change touch it (pull_request) Successful in 6s
WAI energy receipts / does this change touch it (pull_request) Successful in 6s
WAI HTTP delivery / WAI HTTP · does this change touch it (pull_request) Successful in 6s
WAI neural decoders end-to-end / does this change touch it (pull_request) Successful in 6s
WAI neural decoders end-to-end / synthetic fixtures → Rust decode → reference (±4) (pull_request) Has been skipped
WAI JPEG-AI whole decode (pinned inputs, required) / does this change touch it (pull_request) Successful in 8s
WAI JPEG-AI whole decode (pinned inputs, required) / fetch pinned JPEG-AI inputs → whole decode + pixel hash, required (pull_request) Has been skipped
WAI neural sink gates / does this change touch it (pull_request) Successful in 6s
wai-ops-gpu integer operators on GPUs / does this change touch it (pull_request) Successful in 7s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 21s
wai-quantum command line / does this change touch it (pull_request) Successful in 5s
wai-quantum command line / command line · linux (pull_request) Has been skipped
wai-quantum command line / command line · macos (pull_request) Has been skipped
wai-pack / wai-pack · does this change touch it (pull_request) Successful in 7s
wai-quantum dataflow member / does this change touch it (pull_request) Successful in 5s
wai-quantum dataflow member / member · dataflow device, simulated (pci 1e52:b140) (pull_request) Has been skipped
wai-quantum dataflow member / member · dataflow device, simulated (pci 1e52:401e) (pull_request) Has been skipped
wai-quantum dataflow member / member · dataflow device absent (macos) (pull_request) Has been skipped
wai-quantum CUDA member / does this change touch it (pull_request) Successful in 7s
wai-quantum CUDA member / member · CUDA (jetson-hub) (pull_request) Has been skipped
wai-quantum CUDA member / member · CUDA absent (linux) (pull_request) Has been skipped
wai-quantum signal processor / does this change touch it (pull_request) Successful in 6s
wai-quantum signal processor / processor and member · signal processor, emulated (pull_request) Has been skipped
wai-quantum FPGA member / does this change touch it (pull_request) Successful in 6s
wai-quantum FPGA member / member · FPGA datapath, simulated (macos) (pull_request) Has been skipped
wai-quantum FPGA member / member · FPGA simulation absent (linux) (pull_request) Has been skipped
wai-quantum Metal member / does this change touch it (pull_request) Successful in 5s
wai-quantum Metal member / member · Metal (macos) (pull_request) Has been skipped
wai-quantum HIP member / does this change touch it (pull_request) Successful in 7s
wai-quantum Metal member / member · Metal absent (linux) (pull_request) Has been skipped
wai-quantum HIP member / member · HIP (framework-128gb) (pull_request) Has been skipped
wai-quantum HIP member / member · HIP absent (linux-arm64) (pull_request) Has been skipped
wai-quantum npu-cores member / does this change touch it (pull_request) Successful in 6s
wai-quantum neural-processor member / does this change touch it (pull_request) Successful in 6s
wai-quantum npu-cores member / member · npu-cores, neural processor (framework-128gb silicon) (pull_request) Has been skipped
wai-quantum npu-cores member / member · npu-cores absent (linux-arm64) (pull_request) Has been skipped
wai-quantum neural-processor member / member · neural processor (macos) (pull_request) Has been skipped
wai-quantum neural-processor member / member · neural processor absent (linux) (pull_request) Has been skipped
wai-quantum-qpu / does this change touch it (pull_request) Successful in 5s
wai-quantum OpenCL member / does this change touch it (pull_request) Successful in 7s
wai-quantum-qpu / clients against their contracts (linux) (pull_request) Has been skipped
wai-quantum OpenCL member / member · OpenCL GPU and CPU (jetson-hub) (pull_request) Has been skipped
wai-quantum OpenCL member / member · OpenCL GPU (framework-128gb) (pull_request) Has been skipped
wai-quantum OpenCL member / member · OpenCL GPU (macos) (pull_request) Has been skipped
wai-quantum OpenCL member / member · OpenCL absent (linux) (pull_request) Has been skipped
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Successful in 49s
wai-quantum matrix-extension member / does this change touch it (pull_request) Successful in 5s
wai-quantum matrix-extension member / member · matrix extension, emulated (aarch64 Linux) (pull_request) Has been skipped
wai-quantum matrix-extension member / member · matrix extension absent (macos) (pull_request) Has been skipped
wai-quantum service / does this change touch it (pull_request) Successful in 7s
wai-quantum service / service · linux (pull_request) Has been skipped
wai-quantum service / service · macos (pull_request) Has been skipped
wai-quantum tensor-engine member / does this change touch it (pull_request) Successful in 6s
wai-quantum studio and desktop / does this change touch it (pull_request) Successful in 8s
wai-quantum tensor-engine member / member · tensor engine, the kernel toolchain's simulator (linux) (pull_request) Has been skipped
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Has been skipped
repository checks / lockfiles, advisories, tests in CI, workflow hygiene, spec and section references, public text (pull_request) Successful in 2m24s
wai-quantum portable tensor program / does this change touch it (pull_request) Successful in 6s
wai-quantum portable tensor program / tensor program · CPU, mutants, GPU builds (pull_request) Has been skipped
wai-quantum portable tensor program / tensor program · GPUs (jetson-hub) (pull_request) Has been skipped
wai-quantum portable tensor program / tensor program · integrated GPU (framework-128gb) (pull_request) Has been skipped
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Has been skipped
wai-quantum CPU vector units / does this change touch it (pull_request) Successful in 6s
wai-quantum CPU vector units / member · vector unit, rvv 1024-bit (riscv64, emulated) (pull_request) Has been skipped
wai-quantum CPU vector units / member · vector unit, sve 128-bit (aarch64, emulated) (pull_request) Has been skipped
wai-quantum CPU vector units / member · vector unit, rvv 128-bit (riscv64, emulated) (pull_request) Has been skipped
wai-quantum CPU vector units / member · vector unit, sve 2048-bit (aarch64, emulated) (pull_request) Has been skipped
wai-quantum CPU vector units / member · vector unit, avx2 (x86_64 silicon) (pull_request) Has been skipped
wai-quantum CPU vector units / member · vector unit, sve 512-bit (aarch64, emulated) (pull_request) Has been skipped
wai-quantum CPU vector units / member · vector units, avx2 and avx512 (framework-128gb silicon) (pull_request) Has been skipped
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Has been skipped
WAI mbt2018_mean integer decode (regenerated vectors) / does this change touch it (pull_request) Successful in 6s
wai-quantum WebGPU member / does this change touch it (pull_request) Successful in 8s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Has been skipped
wai-quantum WebGPU member / shader checks · browser build · wasip2 inertness · MSRV (pull_request) Has been skipped
wai-quantum WebGPU member / member · software Vulkan (linux) (pull_request) Has been skipped
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Has been skipped
wai-web wasm32 / does this change touch it (pull_request) Successful in 7s
wai-quantum WebGPU member / member · discrete GPU, Vulkan (jetson-hub) (pull_request) Has been skipped
wai-quantum WebGPU member / member · integrated GPU, Vulkan (framework-128gb) (pull_request) Has been skipped
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Has been skipped
WAI energy receipts / energy receipts · macos (pull_request) Successful in 6m38s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 11m12s
wai-pack / wai-pack · macos (pull_request) Successful in 3m10s
wai-ops-gpu integer operators on GPUs / Metal GPU and browser WebGPU (macos) (pull_request) Successful in 8m12s
wai-quantum studio and desktop / desktop app · macos (pull_request) Successful in 2m46s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 19m23s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 16s
WAI conformance / delivery telemetry · CMCD and CMSD against an independent library (pull_request) Successful in 17s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 27s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 1m48s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Successful in 5m11s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 7m54s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 15m46s
WAI HTTP delivery / HTTP corpus · falsify patches 0/3 (pull_request) Successful in 5m25s
WAI HTTP delivery / HTTP corpus · falsify patches 1/3 (pull_request) Successful in 6m3s
WAI HTTP delivery / HTTP corpus · falsify patches 2/3 (pull_request) Successful in 5m32s
WAI HTTP delivery / HTTP corpus · every patch and mutation in exactly one shard (pull_request) Successful in 5s
WAI HTTP delivery / HTTP corpus · falsify mutations 0/3 (pull_request) Successful in 31m43s
WAI HTTP delivery / HTTP corpus · verified both ways, and the differential (pull_request) Successful in 2m10s
WAI HTTP delivery / cache rules · controls and labelled caches (pull_request) Successful in 1m9s
WAI HTTP delivery / HTTP corpus · falsify mutations 1/3 (pull_request) Successful in 31m23s
wai-pack / wai-pack · linux-arm64 (pull_request) Successful in 1m39s
wai-pack / wai-pack · the floor through a media prober (pull_request) Successful in 18s
wai-pack / wai-pack · dependency licences (pull_request) Successful in 1m21s
WAI HTTP delivery / HTTP corpus · falsify mutations 2/3 (pull_request) Successful in 31m36s
wai-pack / wai-pack · independent verifier (Python) (pull_request) Successful in 7m1s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 1h2m52s
joule-code conformance gate / Build + round-trip C1-C4 vectors (pull_request) Successful in 3m39s
joule-moq-room room service / joule-moq-room · does this change touch it (pull_request) Successful in 6s
joule-moq-web browser client / joule-moq-web · does this change touch it (pull_request) Successful in 6s
wai-quantum on every processor / emulated · aarch64-unknown-linux-gnu (pull_request) Successful in 1m2s
joule-moq-room room service / joule-moq-room, every target (pull_request) Successful in 1m42s
wai-quantum on every processor / emulated · armv7-unknown-linux-gnueabihf (pull_request) Successful in 1m6s
wai-quantum on every processor / emulated · loongarch64-unknown-linux-gnu (pull_request) Successful in 1m44s
wai-quantum on every processor / emulated · powerpc64-unknown-linux-gnu (pull_request) Successful in 2m26s
wai-quantum on every processor / emulated · powerpc64le-unknown-linux-gnu (pull_request) Successful in 4m10s
wai-quantum on every processor / emulated · riscv64gc-unknown-linux-gnu (pull_request) Successful in 2m33s
joule-moq-web browser client / joule-moq-web · browser end-to-end (macos) (pull_request) Successful in 10m46s
wai-quantum on every processor / emulated · s390x-unknown-linux-gnu (pull_request) Successful in 2m33s
wai-quantum on every processor / emulated · sparc64-unknown-linux-gnu (pull_request) Successful in 4m33s
wai-quantum on every processor / emulated · i686-unknown-linux-gnu (pull_request) Successful in 2m40s
wai-web reach builds / wai-web reach · does this change touch it (pull_request) Successful in 6s
WAI conformance / quantum core and corpus under wasm32-wasip2 (wasmtime) (pull_request) Successful in 2m22s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 35s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 9m43s
WAI neural sink gates / model-free refusals of the neural sink (pull_request) Successful in 1m43s
wai-ops-gpu integer operators on GPUs / builds · no adapter is not a pass (linux) (pull_request) Successful in 2m58s
wai-pack / wai-pack · linux (pull_request) Successful in 1m36s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 19m48s
wai-quantum studio and desktop / studio · browser (pull_request) Successful in 2m48s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 4m53s
wai-web reach builds / wai-web reach builds · the package of record, every output as recorded (pull_request) Successful in 2m50s
wai-web reach builds / wai-web reach builds · this tree's wai-web, every rung on its engine line (pull_request) Successful in 4m49s
Six files conflicted; both sides kept in each: - claim-conformance: main's span vectors stay where main published them, and this train's fabric-record vectors follow them, so main's 615 vectors are an unchanged prefix of the 636. vectors.json regenerated with `wai_claim_vectors gen`; it verifies, and claim_verify.py passes all 636. - jwp-receipts.md: a claim's two optional-member exceptions, the hybrid pq-signatures members and a measurement claim's `fabrics`. - wai-ops-gpu: both modules (`semantics`, `splat`); the workflow header names both suites. - CHANGELOG: this train's sections above Train C's, newest first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
288 lines
18 KiB
Rust
288 lines
18 KiB
Rust
//! Every committed integer-decoder vector whose decode reaches the fast kernels
|
|
//! (int_hyper, int_mlicpp, int_audio, int_splat, int_world one and two agents, the
|
|
//! neural-keyframe video, the int_synth corpus), plus the real-footage video,
|
|
//! decoded under the scalar reference kernels AND under each fast-kernel policy
|
|
//! (serial, explicit multi-threaded tilings, automatic): the outputs must be
|
|
//! byte-identical to each other and must reproduce the vector's frozen hash. The
|
|
//! plain `int_video` vector (block motion compensation + rANS, no learned layer)
|
|
//! never reaches the kernels and is left to `tests/int_video.rs` and the
|
|
//! `byte-exact-conformance` goldens. This is the whole-decoder half of the
|
|
//! fast-vs-reference equivalence check; the per-kernel half (randomised shapes and
|
|
//! operand ranges, element by element) lives beside each kernel. CI runs both
|
|
//! halves on every platform leg of `wai-conformance`, with overflow checks on and
|
|
//! off.
|
|
#![cfg(all(feature = "neural_int", feature = "video_int", feature = "audio_int", feature = "world_int", feature = "splat_int"))]
|
|
|
|
use std::path::{Path, PathBuf};
|
|
|
|
use serde_json::Value;
|
|
|
|
use wai::int_kernels::{with_policy, Policy};
|
|
|
|
#[path = "support/sha256_sidecar.rs"]
|
|
mod sha256_sidecar;
|
|
|
|
const RGB8: &str = "RGB8: rows top to bottom, pixels left to right, R, G, B bytes";
|
|
|
|
const POLICIES: [Policy; 5] = [Policy::reference(), Policy::fast(1), Policy::fast(2), Policy::fast(5), Policy::fast(0)];
|
|
|
|
fn vroot() -> PathBuf {
|
|
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/vectors")
|
|
}
|
|
fn jload(p: &Path) -> serde_json::Value {
|
|
serde_json::from_slice(&std::fs::read(p).unwrap_or_else(|e| panic!("read {}: {e}", p.display()))).unwrap()
|
|
}
|
|
|
|
/// Decode under every policy; all outputs must be identical. Returns the output.
|
|
fn same_under_every_policy<T: PartialEq + std::fmt::Debug>(what: &str, f: impl Fn() -> T) -> T {
|
|
let want = with_policy(POLICIES[0], &f);
|
|
for p in &POLICIES[1..] {
|
|
let got = with_policy(*p, &f);
|
|
assert!(got == want, "{what}: output under {p:?} differs from the reference kernels");
|
|
}
|
|
want
|
|
}
|
|
|
|
#[test]
|
|
fn int_hyper_tiny_conditional_codec() {
|
|
use wai::int_hyper_synth::{decode_conditional_checked, fnv1a, CondBitstream, CondEntropy, IntModel};
|
|
let d = vroot().join("int_hyper");
|
|
let want = jload(&d.join("tiny.json"))["rgb_hash"].as_str().unwrap().to_string();
|
|
let ent = CondEntropy::from_value(&jload(&d.join("tiny_entropy.json")));
|
|
let bs = CondBitstream::from_value(&jload(&d.join("tiny_bitstream.json")));
|
|
let g_s = IntModel::from_bytes(&std::fs::read(d.join("tiny_g_s.bin")).unwrap()).unwrap();
|
|
let h_s = IntModel::from_bytes(&std::fs::read(d.join("tiny_h_s.bin")).unwrap()).unwrap();
|
|
let (rgb, _, _) = same_under_every_policy("int_hyper tiny", || decode_conditional_checked(&g_s, &h_s, &ent, &bs.stream()).unwrap());
|
|
assert_eq!(format!("{:016x}", fnv1a(&rgb)), want);
|
|
sha256_sidecar::one(&d, "tiny", RGB8, &rgb);
|
|
}
|
|
|
|
#[test]
|
|
fn int_mlicpp_conformance_vector() {
|
|
use wai::int_hyper_synth::fnv1a;
|
|
use wai::int_mlicpp::{decode, IntMlicModel};
|
|
let d = vroot().join("int_mlicpp");
|
|
let model = IntMlicModel::from_bundle(&std::fs::read(d.join("model.wmb")).unwrap()).unwrap();
|
|
let env = wai::container::Wai::from_bytes(&std::fs::read(d.join("stream.wai")).unwrap()).unwrap();
|
|
let img = same_under_every_policy("int_mlicpp", || decode(&model, &env.payload).unwrap());
|
|
assert_eq!(format!("{:016x}", fnv1a(&img.rgb)), jload(&d.join("expected.json"))["rgb_fnv1a"].as_str().unwrap());
|
|
}
|
|
|
|
#[test]
|
|
fn int_audio_clip() {
|
|
use wai::int_audio::{decode, pcm_fnv1a, AudioModel};
|
|
let d = vroot().join("int_audio");
|
|
let model = AudioModel::from_bytes(&std::fs::read(d.join("audio_model.bin")).unwrap()).unwrap();
|
|
let bs = jload(&d.join("audio_bitstream.json"));
|
|
let pcm = same_under_every_policy("int_audio", || decode(&model, &bs).unwrap());
|
|
assert_eq!(format!("{:016x}", pcm_fnv1a(&pcm)), jload(&d.join("audio.json"))["pcm_fnv1a"].as_str().unwrap());
|
|
let s16le: Vec<u8> = pcm.iter().flat_map(|s| s.to_le_bytes()).collect();
|
|
sha256_sidecar::one(&d, "audio", "PCM: signed 16-bit little-endian samples in output order, channels interleaved", &s16le);
|
|
}
|
|
|
|
#[test]
|
|
fn int_splat_cloud() {
|
|
use wai::int_hyper_synth::IntModel;
|
|
use wai::int_splat::decode;
|
|
let d = vroot().join("int_splat");
|
|
let gs = IntModel::from_bytes(&std::fs::read(d.join("splat_gs.bin")).unwrap()).unwrap();
|
|
let bs = jload(&d.join("splat.json"));
|
|
let attr = same_under_every_policy("int_splat", || decode(&gs, &bs).unwrap().attr);
|
|
let hash = wai::int_hyper_synth::fnv1a(&attr);
|
|
assert_eq!(format!("{hash:016x}"), bs["attr_hash"].as_str().unwrap());
|
|
sha256_sidecar::one(&d, "splat", "DecodedSplat::attr: the decoded attribute tensor's bytes in decoder output order", &attr);
|
|
}
|
|
|
|
#[test]
|
|
fn int_world_clips() {
|
|
use wai::int_hyper_synth::IntModel;
|
|
use wai::int_world::{decode, decode_planes, ACTIONS};
|
|
// single agent
|
|
let d = vroot().join("int_world");
|
|
let t = IntModel::from_bytes(&std::fs::read(d.join("world_T.bin")).unwrap()).unwrap();
|
|
let gs = IntModel::from_bytes(&std::fs::read(d.join("world_gs.bin")).unwrap()).unwrap();
|
|
let j = jload(&d.join("world.json"));
|
|
let (c, lat) = (j["c"].as_u64().unwrap() as usize, j["lat"].as_u64().unwrap() as usize);
|
|
let z0: Vec<i64> = j["z0"].as_array().unwrap().iter().map(|v| v.as_i64().unwrap()).collect();
|
|
let actions: Vec<usize> = j["actions"].as_array().unwrap().iter().map(|v| v.as_u64().unwrap() as usize).collect();
|
|
let frames = same_under_every_policy("int_world", || decode(&t, &gs, &z0, &actions, c, lat).map(|c| c.frames).map_err(|r| r.kind)).expect("the committed clip renders");
|
|
let clip = wai::int_world::WorldClip { frames, frame_px: 0 };
|
|
assert_eq!(format!("{:016x}", clip.clip_hash()), j["clip_hash"].as_str().unwrap());
|
|
sha256_sidecar::frames(&d, "world", RGB8, &clip.frames);
|
|
|
|
// two agents
|
|
let d = vroot().join("int_world2");
|
|
let t = IntModel::from_bytes(&std::fs::read(d.join("world2_T.bin")).unwrap()).unwrap();
|
|
let gs = IntModel::from_bytes(&std::fs::read(d.join("world2_gs.bin")).unwrap()).unwrap();
|
|
let j = jload(&d.join("world2.json"));
|
|
let (c, lat) = (j["c"].as_u64().unwrap() as usize, j["lat"].as_u64().unwrap() as usize);
|
|
let one = 1i64 << j["afrac"].as_u64().unwrap();
|
|
let z0: Vec<i64> = j["z0"].as_array().unwrap().iter().map(|v| v.as_i64().unwrap()).collect();
|
|
let rows: Vec<Vec<i64>> = j["pairs"]
|
|
.as_array()
|
|
.unwrap()
|
|
.iter()
|
|
.map(|p| {
|
|
let (a, b) = (ACTIONS[p[0].as_u64().unwrap() as usize], ACTIONS[p[1].as_u64().unwrap() as usize]);
|
|
vec![a.0 * one, a.1 * one, b.0 * one, b.1 * one]
|
|
})
|
|
.collect();
|
|
let frames = same_under_every_policy("int_world2", || decode_planes(&t, &gs, &z0, &rows, c, lat).map(|c| c.frames).map_err(|r| r.kind)).expect("the committed clip renders");
|
|
let want = j["frame_hashes"].as_array().unwrap();
|
|
assert_eq!(frames.len(), want.len());
|
|
for (f, w) in frames.iter().zip(want) {
|
|
assert_eq!(format!("{:016x}", wai::int_hyper_synth::fnv1a(f)), w.as_str().unwrap());
|
|
}
|
|
sha256_sidecar::frames(&d, "world2", RGB8, &frames);
|
|
}
|
|
|
|
#[test]
|
|
fn int_video_neural_keyframe_and_real_footage() {
|
|
use wai::int_hyper_synth::{decode_conditional_checked, CondBitstream, CondEntropy, IntModel};
|
|
use wai::int_video::{decode, decode_pframes, fnv1a};
|
|
let (ih, iv) = (vroot().join("int_hyper"), vroot().join("int_video"));
|
|
let g_s = IntModel::from_json(&jload(&ih.join("tiny_g_s.json")));
|
|
let h_s = IntModel::from_json(&jload(&ih.join("tiny_h_s.json")));
|
|
let ent = CondEntropy::from_value(&jload(&ih.join("tiny_entropy.json")));
|
|
let bs = CondBitstream::from_value(&jload(&ih.join("tiny_bitstream.json")));
|
|
let vbs = jload(&iv.join("video_nk_bitstream.json"));
|
|
let frames = same_under_every_policy("neural-keyframe video", || {
|
|
let (f0, h, w) = decode_conditional_checked(&g_s, &h_s, &ent, &bs.stream()).unwrap();
|
|
decode_pframes(&f0, h, w, &vbs).unwrap().frames
|
|
});
|
|
let want = jload(&iv.join("video_nk.json"));
|
|
let want = want["frame_hashes"].as_array().unwrap();
|
|
assert_eq!(frames.len(), want.len(), "neural-keyframe video: frame count");
|
|
for (f, w) in frames.iter().zip(want) {
|
|
assert_eq!(format!("{:016x}", fnv1a(f)), w.as_str().unwrap());
|
|
}
|
|
sha256_sidecar::frames(&iv, "video_nk", RGB8, &frames);
|
|
// integer block-MC only (no learned kernels) — unaffected, checked for completeness
|
|
let rbs = jload(&iv.join("video_real_bitstream.json"));
|
|
let frames = same_under_every_policy("real-footage video", || decode(&rbs).unwrap().frames);
|
|
let want = jload(&iv.join("video_real.json"));
|
|
let want = want["frame_hashes"].as_array().unwrap();
|
|
assert_eq!(frames.len(), want.len(), "real-footage video: frame count");
|
|
for (f, w) in frames.iter().zip(want) {
|
|
assert_eq!(format!("{:016x}", fnv1a(f)), w.as_str().unwrap());
|
|
}
|
|
sha256_sidecar::frames(&iv, "video_real", RGB8, &frames);
|
|
// The plain block-motion clip (wai.video.int_motion), for completeness.
|
|
let pbs = jload(&iv.join("int_video_bitstream.json"));
|
|
let frames = decode(&pbs).unwrap().frames;
|
|
let want = jload(&iv.join("int_video.json"));
|
|
for (f, w) in frames.iter().zip(want["frame_hashes"].as_array().unwrap()) {
|
|
assert_eq!(format!("{:016x}", fnv1a(f)), w.as_str().unwrap());
|
|
}
|
|
sha256_sidecar::frames(&iv, "int_video", RGB8, &frames);
|
|
}
|
|
|
|
#[test]
|
|
fn neural_conformance_int_synth_corpus() {
|
|
use wai::int_synth::decode_from_spec;
|
|
let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../neural-conformance");
|
|
let manifest = jload(&dir.join("expected_hashes.json"));
|
|
let mut n = 0;
|
|
for (name, spec) in manifest.as_object().unwrap() {
|
|
let vd = dir.join("vectors").join(name);
|
|
let payload = std::fs::read(vd.join("latent.bin")).unwrap();
|
|
let model = std::fs::read(vd.join("int_synth.json")).unwrap();
|
|
let rgb = same_under_every_policy(name, || decode_from_spec(&payload, &model).unwrap().rgb);
|
|
let mut h = blake3::Hasher::new();
|
|
h.update(b"wai:int-synth-rgb\x01");
|
|
h.update(&rgb);
|
|
let got: String = h.finalize().as_bytes().iter().map(|b| format!("{b:02x}")).collect();
|
|
assert_eq!(got, spec["rgb_hash"].as_str().unwrap(), "{name}");
|
|
sha256_sidecar::one(&dir, name, RGB8, &rgb);
|
|
if let Ok(r) = std::fs::read(vd.join("ref_rgb.bin")) {
|
|
assert_eq!(rgb, r, "{name}: must equal the python integer-forward reference");
|
|
}
|
|
n += 1;
|
|
}
|
|
assert!(n >= 4, "expected the four committed int_synth vectors, found {n}");
|
|
}
|
|
|
|
/// SPEC §7 *Digests*: every committed vector or corpus that states a digest of the
|
|
/// decoded output of a capability that decodes against a parameter set states its
|
|
/// SHA-256, in a `sha256.json` sidecar that names the buffer it covers. The test
|
|
/// enumerates every `wai/*-conformance/` directory and every `tests/vectors/`
|
|
/// directory: each has a sidecar, or is listed below with the reason it has none.
|
|
#[test]
|
|
fn every_decoded_output_states_a_sha256() {
|
|
const NATIVE: &str = "a WAI-native capability that decodes against no parameter set: its state and \
|
|
rendered-output digests are the algorithm its extension names (SPEC §7 *Digests*)";
|
|
let excluded: &[(&str, &str)] = &[
|
|
("audio-conformance", NATIVE), ("avatar-conformance", NATIVE), ("feed-conformance", NATIVE),
|
|
("film-conformance", NATIVE), ("haptic-conformance", NATIVE), ("score-conformance", NATIVE),
|
|
("volumetric-conformance", NATIVE), ("world-conformance", NATIVE),
|
|
("quantum-conformance", NATIVE), ("quantum-ops-conformance", NATIVE),
|
|
("claim-conformance", "receipt claims: receipt content, no decoded output"),
|
|
("jwp-conformance", "JWP delivery receipts: receipt content, no decoded output"),
|
|
("oer-conformance", "OER/2 receipts: receipt content, no decoded output"),
|
|
("pack-conformance", "encode/expected.json states the SHA-256 of every decoded frame (RGB8); the rest are policies, refusals, conversions and scene cuts, with no decoded output"),
|
|
("pin-conformance", "parameter-set pins: every digest there is a SHA-256 of a parameter set"),
|
|
("wgsl-conformance", "WGSL's integer semantics: every case states its result word in full, never a digest of decoded output"),
|
|
("ops-conformance", "integer operators: every operator, stage and graph vector, the lower_* decodes of the sets under sets/ among them, states its output integers in full or its refusal code, never a digest of them; certificates/ states each lowered set's SHA-256 (a parameter-set identity) and holds the lowered graphs as bytes, compared byte for byte; the output digests a capability decoded through its lowering reproduces (integer-operators §14.4) are stated by that capability's own corpus"),
|
|
("signer-conformance", "key logs, grants and statuses: signed documents, no decoded output"),
|
|
("edge-conformance", "derivation records of a deriving edge: each replicate-tier output is recomputed and compared byte for byte by its verifier, and every output is named by its content hash in the record"),
|
|
("live-conformance", "the corpora of the live, provenance and delivery extensions, one directory each (live-conformance/README.md lists its extension, generator and verifier): signed records, commitments and statements authored in code from fixed seeds and recomputed byte for byte by each corpus's verifier; payloads are opaque test bytes no case decodes, and a picture a corpus generates is named in it by the SHA-256 of its RGB8 samples; aggregate/vdaf-22/ holds the Prio3 test vectors of draft-irtf-cfrg-vdaf-22 as published, field elements and seeds with no decoded output, each file pinned by its SHA-256 in tests/telemetry_aggregate.rs; nothing decoded against a parameter set but splat/'s wai.splat.int_codec objects, whose decoded attribute tensors are stated by their SHA-256 (splat-exact §3.3's attribute digest) in its vectors.json and its commitments, as the frames they render are, and dred/'s payloads and streams, decoded under the weights file it names by SHA-256, whose decoded integers and feature rows are stated by their SHA-256 in its vectors.json"),
|
|
("http-conformance", "objects and head proofs for transport: no case decodes a payload, and the component a fetch case picks is stated by its SHA-256"),
|
|
("cache-conformance", "cache rules: a driver, its controls and their reports, with no objects of its own"),
|
|
("byte-exact-conformance", "goldens over tests/vectors, whose sidecars state the SHA-256"),
|
|
("int-payload-conformance", "refusal fixtures and the index of the payloads under tests/vectors, whose sidecars state the SHA-256"),
|
|
("staged-conformance", "each case.json states the SHA-256 of every stage-0 buffer and of every unit's stage (SPEC §7 Digests)"),
|
|
("staged-measure-conformance", "each fixture's expect.json and goldens.json state the SHA-256 of every unit's output at every stage (SPEC §7 Digests)"),
|
|
("telemetry-conformance", "advisory observations and their CMCD and CMSD strings: no decoded output"),
|
|
("pq-conformance", "hybrid signatures: signed group receipts, claims, records and key logs, and the ACVP and composite-draft vectors their signatures are held to, as published: signed content, no decoded output"),
|
|
("vectors/int_mlicpp", "expected.json states rgb_sha256 (RGB8)"),
|
|
("vectors/jpegai", "inputs only; the decoded pixels' SHA-256 is pinned by the JPEG AI e2e job"),
|
|
("vectors/staged_bounds", "bases and a layer that declare outputs past a sink's cost limit, refused before any symbol is decoded, and inert envelopes; the one base decoded is wai.video.int_motion at keyframe 0, which decodes against no parameter set"),
|
|
];
|
|
let wai = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("..");
|
|
let mut dirs: Vec<(String, PathBuf)> = Vec::new();
|
|
for e in std::fs::read_dir(&wai).unwrap().flatten() {
|
|
let n = e.file_name().to_string_lossy().into_owned();
|
|
if n.ends_with("-conformance") && e.path().is_dir() {
|
|
dirs.push((n, e.path()));
|
|
}
|
|
}
|
|
for e in std::fs::read_dir(vroot()).unwrap().flatten() {
|
|
if e.path().is_dir() {
|
|
dirs.push((format!("vectors/{}", e.file_name().to_string_lossy()), e.path()));
|
|
}
|
|
}
|
|
dirs.sort();
|
|
let mut with_sidecar = 0;
|
|
for (name, path) in &dirs {
|
|
if let Some((_, why)) = excluded.iter().find(|(n, _)| n == name) {
|
|
assert!(!why.is_empty(), "{name}: an exclusion names its reason");
|
|
continue;
|
|
}
|
|
let side = path.join("sha256.json");
|
|
let doc = jload(&side);
|
|
let entries = doc.as_object().unwrap_or_else(|| panic!("{}: an object", side.display()));
|
|
assert!(!entries.is_empty(), "{}: no entries", side.display());
|
|
for (k, e) in entries {
|
|
assert!(e["buffer"].as_str().is_some_and(|b| !b.is_empty()), "{name}/{k}: names its buffer");
|
|
let mut digests = 0;
|
|
for (field, v) in e.as_object().unwrap() {
|
|
if !field.ends_with("sha256") {
|
|
continue;
|
|
}
|
|
let all: Vec<&Value> = match v { Value::Array(a) => a.iter().collect(), other => vec![other] };
|
|
for d in all {
|
|
let d = d.as_str().unwrap_or_default();
|
|
assert!(d.len() == 64 && d.bytes().all(|b| b.is_ascii_digit() || (b'a'..=b'f').contains(&b)),
|
|
"{name}/{k}/{field}: {d} is not 64 lowercase hexadecimal digits");
|
|
digests += 1;
|
|
}
|
|
}
|
|
assert!(digests > 0, "{name}/{k}: states a SHA-256");
|
|
}
|
|
with_sidecar += 1;
|
|
}
|
|
for (n, _) in excluded {
|
|
assert!(dirs.iter().any(|(d, _)| d == n), "exclusion {n} names no directory");
|
|
}
|
|
assert!(with_sidecar > 0);
|
|
}
|