interplane.Get Omega
Read in your language

physics-mv

FORGE: request-bound machine realization, providers and verification for AienOS. Host, simulated and GB10 hardware paths have separate evidence.

Brought by drakestapleton

branch main Branches Tags History

physics-mv / docs / FORGE_SUBSTRATE_V2_SPEC.md

502 lines · 32821 bytes Raw Blame History Source

FORGE SUBSTRATE V2

Status: DRAFT. Depends on ARCH-0018 "Substrate-Neutral Physical Realization" (PROPOSED, aien-spark/aien-architecture docs/adr/0018-substrate-neutral-physical-realization.md). Nothing here is binding until ARCH-0018 is accepted by the operator and this document is merged. Workstream gate: AR1 (FORGE substrate-neutral descriptor contract) of ARCH-0018 §12. Reference code: forge/v2/forge_substrate_v2.{h,c}, forge/v2/forge_sha256.h. Tests: tests/test_forge_v2_kat.c, tests/run_forge_v2_gates.sh. Golden vectors: docs/forge-v2-golden-vectors.md (produced by the test binary; never hand-edited).


1. Purpose and non-goals

FORGE realizes semantic operations on physical devices. FORGE v1 ("FORGE MACHINE DESCRIPTOR V1", physics PR #13) describes exactly one device: the GB10 GPU of the first qualified Machine, as a fixed 208-byte record whose field vocabulary is vendor-specific (pci_*, rm_compute_class, vbios_version, ...).

FORGE SUBSTRATE V2 defines a substrate-neutral description of a Machine and of every physical substrate attached to it, plus the records that let a non-exact substrate be used without weakening what "correct" means: a semantic result contract, a numerical realization profile, a calibration artifact, execution evidence with an explicit provenance class, and a pointer-free cross-machine reference.

Goals:

Non-goals:

2. Wire format

All integers are little-endian and fixed-width (same byte order as v1). There are no floating-point values anywhere in canonical bytes; fractions are fixed-point integers (ppm, ppb, milli-units).

2.1 Object framing

Every top-level object is:

OffsetSizeFieldValue
04magicASCII FGV2 (46 47 56 32)
42kindu16, object kind (below)
62versionu16, 2 for every object in this document
84body_lenu32, bytes after the header
12body_lenbodysequence of TLV fields

Each TLV field is tag u32 | len u32 | value[len]. A value is exactly one of: u32 (len 4), i32 (len 4, two's complement), u64 (len 8), i64 (len 8), digest (len 32), or one nested object (a complete framed object, len = its total size). Composite concepts (an envelope, a shape) are groups of adjacent tags, not packed structs, so every field has one unambiguous width.

The magic prefix guarantees a V2 object can never be confused with the unframed 208-byte v1 stream.

kindObject
0x0001ForgeMachineDescriptorV2
0x0002ForgeSubstrateDescriptor
0x0003SemanticResultContract
0x0004NumericalRealizationProfile
0x0005CalibrationArtifact
0x0006ForgeExecutionEvidenceV2
0x0007Cross-machine reference

2.2 Canonical form

2.3 Identity digest

digest(object) = SHA-256(header || body) of the canonical bytes. A digest is **derived, never stored inside the bytes it covers** (so CalibrationArtifact's "digest" is computed, not a field). Digests are 32 raw bytes, shown as lowercase hex. The SHA-256 is the pinned root sha256_clean.c (sha256_compute), reused through the declaration-only forge/v2/forge_sha256.h; it is not modified and not duplicated.

Identity never includes physical addresses, process pointers, PCI BDF or other bus locations, driver / firmware / VBIOS version strings, measured (boot-volatile) memory sizes, or timestamps. Those are evidence. There are no strings in canonical bytes; a name enters only as a digest. One deliberate exception: the CalibrationArtifact carries its calibration epoch_s, and its digest is bound into realization identity (§7), so recalibration produces a new realization identity. That is intended.

2.4 Tag tables

Values are listed in canonical (tag) order. Type d32 is a 32-byte digest.

ForgeMachineDescriptorV2 (kind 1)

TagTypeFieldRule
0x0101d32machine_identitynon-zero; stable identity of the Machine (e.g. owner-enrolled key digest)
0x0102d32authority_domainnon-zero; the Aienux authority domain that governs it
0x0110u64memory_nominal_bytesdeclared nominal capacity, not measured MemTotal
0x0111u32memory_numa_domains
0x0112u32memory_coherencyUNIFIED 1, NONCOHERENT 2, DISCRETE 3
0x0120u32interconnect_topologySINGLE_PACKAGE 1, SHARED_BUS 2, SWITCHED 3, MESH 4, REMOTE 5
0x0121u32interconnect_links
0x0130u32transport_classON_PACKAGE 1, PCIE 2, USB 3, ETHERNET 4, RDMA_ETHERNET 5, BOARD_TO_BOARD 6, REMOTE_MACHINE 7
0x0131u32transport_bandwidth_mbpscost metadata
0x0132u32transport_latency_nscost metadata
0x0140nested substrate, repeatedsubstrates1..8, ascending unique substrate_identity; any classes (no per-Machine digital requirement)

ForgeSubstrateDescriptor (kind 2)

TagTypeFieldRule
0x0201d32substrate_identitynon-zero
0x0202u32substrate_class§5.2
0x0203u64operation_familiesnon-zero mask, §5.3
0x0210–0x0213u32input_repr, input_bits, output_repr, output_bitsrepr 1..8 (§5.3), bits 1..128
0x0220u32state_modelSTATELESS 1, VOLATILE 2, PERSISTENT_WEIGHTS 3, DYNAMICAL 4
0x0221u32sync_modelCLOCKED 1, ASYNC_EVENT 2, BATCH_BARRIER 3, FREE_RUNNING 4
0x0230u32memory_modelSHARED_COHERENT 1, DEVICE_LOCAL 2, IN_MEMORY_COMPUTE 3, NONE 4
0x0231u64memory_capacity_bytesdeclared nominal
0x0240nested profilenumericalNumericalRealizationProfile (§6.3)
0x0250u32calibration_required0 or 1
0x0251u32calibration_method_maskbit 1 << method; 0 iff not required
0x0252u64calibration_max_window_s> 0 iff required
0x0253u32calibration_min_fixtures> 0 iff required
0x0260u32error_kindbest achievable kind (§6.1)
0x0261u32error_rel_ppbguaranteed relative bound
0x0262u64error_absguaranteed absolute bound, output LSB units
0x0263u32fault_detect_maskdevice-reported fault classes
0x0270–0x0273u64,u64,u64,u32timing: min_latency_ns, setup_ns, conversion_ns, deterministic (0/1)
0x0280–0x0283u32,u32,u64,u32limits: max_rows, max_cols, max_state_bytes, max_concurrent (≥1)
0x0290u32evidence_capabilitiesDURATION, ENERGY, TEMPERATURE, MEASURED_ERROR, REPEATS, HW_STATUS, FAULT (bits 0..6)
0x02F0d32 optlegacy_v1_descriptor_digestonly on DIGITAL_CPU/DIGITAL_GPU (§4)

SemanticResultContract (kind 3)

TagTypeFieldRule
0x0301u32operation_familyexactly one known bit
0x0302d32reference_oracle_digestidentity of the oracle that defines "correct"; non-zero
0x0310u32shape_rank1..4
0x0311–0x0314u32shape_dim[0..3]dims < rank non-zero, dims ≥ rank zero
0x0320u32error_kind§6.1
0x0321u32error_rel_ppb
0x0322u64error_abs
0x0323u32error_normELEMENTWISE_MAX 1, L2_RELATIVE 2
0x0330u32confidence_ppm1..1 000 000; exact and bounded-deterministic require 1 000 000
0x0331u32min_samples≥ 1; stochastic kinds ≥ 2
0x0340u32allowed_nondeterminismREDUCTION_ORDER 1, ROUNDING 2, STOCHASTIC_NOISE 4, TIMING 8

NumericalRealizationProfile (kind 4)

TagTypeField
0x0401u32dynamic_range_mdb (dB × 1000)
0x0402u32resolution_bits (1..128)
0x0403u32repeatability_ppb
0x0404u32drift_ppb_per_hour
0x0405u32temperature_ppb_per_k
0x0406u64settling_ns
0x0407u64sample_rate_hz
0x0408u64calibration_validity_s (0 = no calibration; must be ≤ substrate max window)

CalibrationArtifact (kind 5)

TagTypeField
0x0501d32substrate_id
0x0502d32calibration_id
0x0503u32method: REFERENCE_FIXTURE_SWEEP 1, SELF_TEST 2, FACTORY_TABLE 3, SIMULATED_MODEL 4
0x0504u64epoch_s
0x0505u64validity_window_s (> 0, no overflow with epoch)
0x0510–0x0513i32,i32,u32,u32operating envelope: temp_min_mc, temp_max_mc, supply_min_uv, supply_max_uv
0x0520–0x0522i64,i64,u32transfer: gain_ppb, offset_lsb, linearity_ppb
0x0530–0x0532u32noise: rms_ppb, peak_ppb, samples
0x0540–0x0542u32,u32,u64drift: ppb_per_hour, temp_ppb_per_k, observed_span_s
0x0550u32fixture_count (≥ 1)
0x0551d32fixtures_digest (reference fixtures)
0x0560d32evidence_root

ForgeExecutionEvidenceV2 (kind 6) — see §8. Cross-machine reference (kind 7) — see §9.

3. Versioning

4. V1 compatibility

5. Machine/substrate model

5.1 Machine

A Machine (ForgeMachineDescriptorV2) is: machine identity, memory topology, interconnect topology, transport, authority domain, and one or more attached substrates of any class. A Machine need not carry a digital substrate: an external analog compute node on the Fabric whose only substrate is analog is a valid Machine (golden vector §9, analog_only_machine_roundtrip_strict). The digital fallback is a property of the eligible set for a semantic operation, not of any one Machine descriptor (§10).

machine_identity is the stable name; the descriptor digest describes the Machine's current declared configuration. Changing transport metadata changes the descriptor digest but not machine_identity, and not any realization identity (§12).

5.2 Substrate classes

Frozen numeric ids. No vendor, product, architecture or driver name appears in any class, field or enum.

IdClass
0x0000invalid
0x0001DIGITAL_CPU
0x0002DIGITAL_GPU
0x0010ANALOG_IN_MEMORY
0x0020NEUROMORPHIC_SPIKING
0x0030FPGA_CGRA_DATAFLOW
0x0040OPTICAL_PHOTONIC
0x8000–0xFFFFFUTURE_RESERVED (assigned only by a later revision of this spec; refused until then)

All unlisted ids are unassigned and refused.

5.3 Substrate descriptor

A ForgeSubstrateDescriptor states: substrate identity; class; supported operation families (MATVEC, MATMUL, CONV, ELEMENTWISE, REDUCTION, SPIKE_INTEGRATE, TRANSFORM, SAMPLE, GENERAL); input/output representation (DIGITAL_INT, DIGITAL_FLOAT, FIXED_POINT, ANALOG_VOLTAGE, ANALOG_CURRENT, SPIKE_TRAIN, OPTICAL_INTENSITY, OPTICAL_PHASE) with bit widths; state model; synchronization model; memory model; numerical model (a nested NumericalRealizationProfile); calibration requirements; error model; timing model; resource limits; evidence capabilities. Capacities are declared nominal values; measured values go in evidence.

5.4 Relationship to Omega

Omega's capability query (CqNeed, rx_capq.h) is already substrate-neutral. The one hardware-naming type on omega main is enum { RX_COG_HW_CPU_P, RX_COG_HW_CPU_E, RX_COG_HW_GPU } (rx_route.h:61); it is hashed into the routing registry digest. AG_REAL_HARDWARE (rx_graph.h) is the existing placeholder realization kind. Replacing RX_COG_HW_* with substrate-neutral requirements is an Omega change after R16 closes (ARCH-0018 §15); V2 supplies the vocabulary but does not edit Omega.

6. Numeric/error model

6.1 SemanticResultContract

Owned by Omega semantically; FORGE carries its canonical form and digest. Fields: operation family, reference oracle digest, expected shape, acceptable error, confidence requirement, minimum samples, allowed nondeterminism.

acceptable_error kinds:

IdKindBound ruleNondeterminism
1EXACTrel = abs = 0no ROUNDING, no STOCHASTIC_NOISE; confidence 1 000 000 ppm
2BOUNDED_DETERMINISTICat least one of rel/abs non-zerono STOCHASTIC_NOISE; confidence 1 000 000 ppm
3BOUNDED_STOCHASTICat least one of rel/abs non-zeroSTOCHASTIC_NOISE required; min_samples ≥ 2
4MEASURED_DISTRIBUTIONbounds optionalSTOCHASTIC_NOISE required; min_samples ≥ 2

Bounds are integers only: error_rel_ppb (parts per billion) and error_abs (absolute, in output LSB units). Acceptance per element: |result − reference| ≤ error_abs + error_rel_ppb × |reference| / 10⁹, measured in error_norm.

6.2 Eligibility against a contract

A substrate is eligible for a contract only if all hold: it is not faulted; it supports the operation family; its best error_kind is no looser than the contract's (so an EXACT contract can never be realized on a weaker substrate); if the substrate is non-exact and the contract states bounds, both substrate bounds are within the contract bounds; and, if it needs calibration, the calibration check passes (§7).

6.3 NumericalRealizationProfile

Dynamic range, resolution bits, repeatability, drift rate, temperature sensitivity, settling time (ns), sample rate, calibration validity window. All fixed-point integers.

6.4 Omega anchors (AR2)

7. Calibration model

8. Evidence model

ForgeExecutionEvidenceV2 (kind 6) is new and additive. v1 ForgeExecutionEvidence (forge_types.h) is untouched; historical receipts stay historical and are never rewritten.

TagTypeField
0x0601d32realization_identity
0x0602d32machine_identity
0x0603d32substrate_identity
0x0604d32semantic_contract_digest
0x0605d32 optcalibration_digest
0x0606d32input_identity
0x0607d32output_identity
0x0610u64execution_epoch_s
0x0611u64execution_duration_ns
0x0612u64conversion_duration_ns
0x0620u64energy_nj
0x0621u32energy_source: NOT_MEASURED 0 (then energy_nj must be 0), MEASURED 1, ESTIMATED 2
0x0630i32temperature_mc
0x0631u32supply_uv
0x0640u32measured_error_rel_ppb
0x0641u64measured_error_abs
0x0642u32confidence_ppm
0x0650–0x0654u32,u32,u64,u64,u32repeated runs: runs, passes (≤ runs), mean_ns, spread_ns, error_spread_ppb
0x0660u32hardware_status
0x0661u32fault_state: NONE 0, TRANSIENT 1, PERSISTENT 2, UNAVAILABLE 3
0x0670u32provenance_class: PHYSICAL 1, SIMULATED_DEVELOPMENT 2 — mandatory

9. Cross-machine reference form

Kind 7. Never a pointer, address, file descriptor or handle number.

TagTypeFieldRule
0x0701d32program_digest
0x0702d32semantic_object_id
0x0703d32ir_referencecontent digest of the IR bytes
0x0710u64ir_size
0x0711u64range_offsetoffset + length must not overflow and must be ≤ ir_size
0x0712u64range_length> 0
0x0720u32target_kindMACHINE 1, SUBSTRATE 2
0x0721d32target_digestmachine or substrate descriptor digest
0x0730u64generationfull 64-bit capability generation; non-zero
0x0740u64rightsREAD 1, EXECUTE_PURE 2, CONFIGURE_REVERSIBLE 4, CONFIGURE_IRREVERSIBLE 8

generation matches Omega EffectPayload.capability_generation (OMEGA_EFFECT_VERSION 0x02, src/omega_types.h, merged in omega#71). A 32-bit generation (a 4-byte 0x0730 value) is refused with its own error FORGE_V2_ERR_GENERATION_32, mirroring Omega's refusal of the 176-byte v1 effect payload (OMEGA_EFFECT_LEGACY_V1_LEN). Omega's effect wire form is big-endian; FORGE V2 carries the generation as a u64 value, little-endian like the rest of V2, not Omega's wire bytes.

The v1 ir_payload pointer is an in-process detail: its value is never hashed and never appears in V2.

10. Failure behavior

11. Authority boundary

12. Fabric implications

13. Acceptance tests (AR1..AR4 mapped)

Run tests/run_forge_v2_gates.sh (host-only; no hardware; binaries in build/). Check names below are the exact strings the test prints.

GateARCH-0018 requirementCovered here byStatus
AR1V2 descriptor and evidence encodings with KATsfrozen_v2_machine_descriptor_digest, frozen_semantic_result_contract_digest, frozen_calibration_artifact_digest, frozen_execution_evidence_v2_digest, frozen_cross_machine_ref_digest, golden_vector_doc_matches_binary_outputcovered
AR1v1 KAT digest wrapped and reproducedv1_kat_stream_digest_reproduced, v1_digest_wrapped_in_digital_gpu_substrate, v2_bytes_carry_no_v1_fieldscovered
AR1strict decoderoundtrip_*_strict, unknown_tag_rejected_strict, unknown_tag_skipped_lenient_same_digest, out_of_order_tags_rejected, missing_required_field_rejected, unknown_enum_bits_rejected, truncated_object_rejected, duplicate_substrate_identity_rejected, substrates_out_of_identity_order_rejected, zero_substrates_rejected, reserved_substrate_class_rejected, legacy_v1_digest_only_on_digital_substratecovered
AR1stale calibration refusedstale_calibration_rejected, missing_calibration_rejected, calibration_from_future_rejected, calibration_window_capped_by_substrate, calibration_for_other_substrate_rejected, out_of_envelope_conditions_rejectedcovered
AR1v1 generation refusedv1_32bit_generation_refused, legacy_version_1_object_refused, stale_generation_high_bits_refusedcovered
AR1SIMULATED_DEVELOPMENT provenance explicitevidence_encode_without_provenance_refused, evidence_decode_missing_provenance_refused, evidence_decode_zero_provenance_refused, simulated_provenance_explicit_in_kat_evidencecovered
AR2analog simulation provider with digital oracle parityforge/analog-sim/forge_analog_sim.{h,c}, tests/test_forge_analog_sim.c, tests/run_forge_analog_sim_gates.sh, receipt evidence/AR2/; anchors in §6.4covered by physics #21 (d52759d), simulated only (SIMULATED_DEVELOPMENT); not by this V2 gate script
AR3staleness ⇒ ineligible; uncertainty propagates into the contract check; evidence completefresh_calibration_eligible, stale_calibration_rejected, substrate_bound_looser_than_contract_rejected, stochastic_substrate_not_eligible_for_exact_contract, recalibration_changes_realization_identitypartial (data model + eligibility; no live evidence completeness audit)
AR4first physical analog operation; clean digital fallback (a digital realization of the same contract exists somewhere in the eligible set, on any Machine); faulted device cannot corrupt World; no authority bypass; no vendor identityfaulted_substrate_excluded, digital_fallback_eligible_for_bounded_and_exact, analog_only_machine_roundtrip_strict, eligible_set_analog_only_has_no_digital_fallback, digital_candidate_for_other_contract_not_a_fallback, eligible_set_digital_on_other_machine_is_fallback, irreversible_config_without_right_refused, irreversible_config_with_right_and_generation_allowed, authorize_pure_current_generation, reference_range_overflow_refused, no_vendor_names_in_v2_identifierspreconditions only; no physical device exists and none is claimed

Also enforced by the gate script: build with gcc -O2 -Wall -Wextra -Werror -std=c11 (build_gcc_O2_Wall_Wextra_Werror_std_c11), no hardware includes / no heap in V2 code (no_hardware_access_no_heap_in_v2), and the R16 loop-inventory heuristics (r16_loop_inventory_heuristics_clean: no endless loops; no identifiers built from sleep, poll, recv, heartbeat, tick, dispatch, schedule, orchestrate, turn, pulse, yield or epoll).

14. Open questions

  1. physical effect class. Omega RC_EFFECT_CLASSES (rx_contract.h:175) has a physical bit with no CQ_FX_* counterpart. V2 maps hardware configuration onto CQ_FX_EXTERNAL_WRITE / CQ_FX_EXTERNAL_IRREVERSIBLE; should Omega add a distinct CQ_FX_PHYSICAL?
  2. Error-model richness. V2 declares a guaranteed (rel, abs) bound plus a numerical profile. ARCH-0018 §3.3 also names bias, quantization step and saturation range. Add explicit tags, or keep them inside the calibration transfer/noise groups?
  3. ULP bounds. ARCH-0018 lists ULP as a unit. V2 has only relative (ppb) and absolute (LSB) bounds. A ULP bound needs a declared float format; defer until a float contract is needed.
  4. Machine identity source. machine_identity is opaque here. Should it be the owner-enrolled key digest (TRUST-1), and how is it re-derived on a Machine rebuild? Answered by M20 (omega src/runtime/aien_machine_id.h): machine_identity carries the canonical AIEN MachineId, SHA-256("AIENOS-MACHINE-ID-V1\0" || root), where the root is the owner-enrolled key digest when the Machine has one, else the opaque bytes provisioned once. A rebuild that keeps the root keeps the identity. FORGE encoding and the golden vectors are unchanged.
  5. Calibration clock. epoch_s and execution_epoch_s assume one authority clock per Machine. Cross-machine calibration comparison needs a Fabric time source or a monotonic counter instead of seconds.
  6. Omega empirical model. omega#60's cost model has no substrate axis and its observations have no error field; AR5 needs both. The shape of that change belongs to Omega after R16.
  7. Evidence receipts. Digest-named JSON receipts for V2 evidence do not exist yet; their JSON projection of the canonical bytes is unspecified.
  8. Verification secret. v1's AEGIS verification token is a plain prefix hash with a compiled-in constant, not an HMAC. V2 defines no token; AEGIS admission for V2 should not inherit the v1 construction.
  9. Remote fallback. The fallback digital realization may live on a different Machine; Fabric placement cost applies.