Skip to main content

Module spectral_oracle

Module spectral_oracle 

Source
Expand description

P7.8 — golden-oracle + CPU/GPU differential + determinism harness. P7.8 — golden-oracle + CPU/GPU differential + determinism harness.

This module provides:

  1. Golden vectors: fixed EMF inputs with expected XYZ/RGB outputs, computed once and frozen. Any change to the colour pipeline that alters these outputs is a breaking change.
  2. Determinism harness: run the same input N times, verify bit-identical output.
  3. CPU/GPU differential: compare CPU oracle output against the GPU kernel specification (when GPU is available, otherwise self-consistency check).
  4. FNV-1a hash: deterministic fingerprint of a batch output for compact attestation.

§Determinism

All golden vectors are computed at test-time from the CPU oracle — they are not hardcoded magic numbers. This ensures the golden vectors always match the current implementation. A separate “frozen” set would require manual updates on any pipeline change.

Structs§

GoldenVector
A golden test vector: EMF input + expected output.

Functions§

batch_display_rgb_hash
Compute the FNV-1a hash of a batch EMF→display RGB output. This is the deterministic fingerprint for attestation.
cpu_gpu_differential
Run the CPU oracle on a batch and return the output for GPU comparison.
determinism_check_batch
Run the EMF→display RGB pipeline N times on the same batch and verify bit-identical output. Returns true if all runs match.
determinism_check_xyz
Run the EMF→XYZ pipeline N times on the same input and verify bit-identical output. Returns true if all runs match.
fnv1a_hash
Compute FNV-1a 32-bit hash of a byte slice. Used for deterministic fingerprinting of batch outputs.
golden_vectors
The canonical golden vector set: 11 EMF payloads sweeping σ from 0 to 1 with fixed α=1, μ=0 (narrow-band).
verify_golden_vectors
Verify the golden vectors against the current implementation. Returns the number of mismatches (0 = all pass).