| # 002 β INTEGRATION SPECIFICATION |
| ## Primordial Compute Stack v0.1 |
| **Created and Developed by Collin D. Weber** |
|
|
| --- |
|
|
| ## Purpose of This Document |
|
|
| This document specifies how the components of the Primordial Compute Stack connect to one another |
| at the interface level. It describes data flows, structural dependencies, and the contract each |
| layer presents to adjacent layers. |
|
|
| This is an integration specification, not an implementation guide. It describes what has been |
| specified and (where applicable) implemented. Where an interface is defined but not yet realized |
| in running code, that is stated explicitly. |
|
|
| --- |
|
|
| ## Interface Architecture |
|
|
| ``` |
| HOST SECURITY AGENT |
| (CyberSec Suite / Layer I-B) |
| β |
| evidence packets |
| (process, network, file, triage) |
| β |
| βΌ |
| hir_bridge.py |
| [evidence β Action packet] |
| β |
| Action dataclass |
| (gates/action.py schema) |
| β |
| βΌ |
| ββββββββββββββββββββββββββ |
| β HIR KERNEL β |
| β (Layer I-A Runtime) β |
| β evaluate(action, env) β |
| β β CycleResult β |
| ββββββββββββββββββββββββββ |
| β |
| ββββββββββββββ΄βββββββββββ |
| β β |
| CycleResult AuditRecord |
| permission_state (audit/log.py) |
| action_taken append-only chain |
| H/I/R scores |
| metrics (B,P,S,U,Rn) |
| β |
| βΌ [if hardware path] |
| ββββββββββββββββββββββββββββ |
| β HIR-SPU Register File β β Layer II maps this interface |
| β (memory-mapped 0x00β0x74)β to silicon |
| β EVALUATE_HIR command β |
| β β PERMISSION_STATE [R] β |
| β β ACTION_TAKEN [R] β |
| ββββββββββββββββββββββββββββ |
| β |
| βΌ [if GPU path β architectural only] |
| ββββββββββββββββββββββββββββ |
| β PCIe evidence stream β β Layer III mapping |
| β N-packet thread blocks β (not implemented) |
| β SIMT warp execution β |
| ββββββββββββββββββββββββββββ |
| β |
| βΌ [if memory path β provisional only] |
| ββββββββββββββββββββββββββββ |
| β HIR Write Gate β β Layer IV spec |
| β Memory lifecycle FSM β (not implemented) |
| β Consolidation / Recall β |
| ββββββββββββββββββββββββββββ |
| ``` |
|
|
| --- |
|
|
| ## Layer I-A β Layer I-B Interface |
|
|
| **Status: defined and runnable.** |
|
|
| The CyberSec Suite produces structured evidence findings. The `hir_bridge.py` module translates |
| these findings into HIR action packets conforming to the `gates/action.py` `Action` dataclass. |
|
|
| **Inbound from CyberSec Suite:** |
| ```python |
| # cybersec_suite/hir_bridge.py |
| Finding( |
| finding_type, # process | network | file_integrity | audit |
| severity, # low | medium | high | critical |
| rule_class, # from triage_rules.json |
| source, # evidence origin |
| details, # dict of raw finding data |
| ) |
| ``` |
|
|
| **Outbound to HIR Kernel:** |
| ```python |
| # gates/action.py |
| Action( |
| action_id, |
| actor, |
| description, |
| source, |
| signed, |
| signature_valid, |
| schema_valid, |
| uncertainty_disclosed, |
| overstated_confidence, |
| declared_scope, |
| violates_scope, |
| violates_invariant, |
| auditable, |
| reversible, |
| consent_required, |
| consent_obtained, |
| targets_human, |
| coercion_risk, |
| domination_pattern, |
| life_first_explained, |
| freshness_seconds, |
| ) |
| ``` |
|
|
| **Bridge translation contract:** severity maps to pressure modifiers via `triage_rules.json`. |
| Critical + destructive remediation maps to `violates_invariant=True` or triggers the |
| `FAIL_CRIT_DESTRUCTIVE` flag in the hardware register (bit 5 of FAILURE_FLAGS at 0x6C). |
| |
| --- |
| |
| ## Layer I-A β Layer II Interface |
| |
| **Status: architectural specification. Hardware not fabricated.** |
| |
| The OS Runtime kernel and the HIR-SPU hardware share the same logical interface β the difference |
| is the execution substrate. The Python `evaluate()` function and the SystemVerilog `hir_spu_top` |
| module implement the same computation. The register file is the hardware expression of the |
| kernel's input/output contract. |
| |
| **Logical equivalence:** |
| |
| | Python (Layer I-A) | Hardware Register (Layer II) | Offset | |
| |--------------------|------------------------------|--------| |
| | `action.schema_valid` (bit) | `ACTION_FLAGS[3]` | 0x08 | |
| | `action.signed` (bit) | `ACTION_FLAGS[1]` | 0x08 | |
| | `action.domination_pattern` (bit) | `ACTION_FLAGS[15]` | 0x08 | |
| | `env.W` | `W_PRESSURE` | 0x20 | |
| | `env.F_pressure` | `F_PRESSURE` | 0x24 | |
| | `env.A_audit` | `A_AUDIT` | 0x28 | |
| | `env.G` | `G_GRIT` | 0x2C | |
| | `diamond.H_score` | `H_SCORE` | 0x44 | |
| | `diamond.I_score` | `I_SCORE` | 0x48 | |
| | `diamond.R_score` | `R_SCORE` | 0x4C | |
| | `metrics.Rn` | `RESONANCE_RN` | 0x60 | |
| | `permission_state` | `PERMISSION_STATE` | 0x64 | |
| | `action_taken` | `ACTION_TAKEN` | 0x68 | |
| | `audit_record.self_hash` | `AUDIT_DIGEST_LOW/HIGH` | 0x70/0x74 | |
|
|
| **Host communication protocol (hardware path):** |
| ``` |
| RESET_STATE |
| LOAD_ACTION β writes ACTION_FLAGS, EVIDENCE_FLAGS |
| LOAD_FINDING_RECORD β writes FINDING_TYPE, FINDING_SEVERITY |
| LOAD_BASELINE_RESULT β writes BASELINE_STATUS |
| LOAD_ENV β writes W_PRESSURE through R_S |
| EVALUATE_TRIAGE |
| EVALUATE_HIR β triggers computation |
| READ_PERMISSION β reads PERMISSION_STATE, ACTION_TAKEN |
| READ_METRICS β reads H/I/R/B/P/S/U/Rn |
| READ_FAILURE_FLAGS β reads FAILURE_FLAGS |
| READ_AUDIT_DIGEST β reads AUDIT_DIGEST_LOW/HIGH |
| COMMIT_STATE β if GREEN/YELLOW permitted |
| ``` |
|
|
| **Fixed-point format:** Q16.16 (signed 32-bit, 16 integer bits, 16 fractional bits). |
| All normalized [0,1] values are represented as integers 0β65536 (0x0000β0x10000). |
|
|
| --- |
|
|
| ## Layer II β Layer III Interface |
|
|
| **Status: architectural mapping only. No CUDA/GPU code exists.** |
|
|
| The GPU mapping (Layer III) is derived from analysis of the Layer II RTL structure. The primary |
| finding is that the `always_comb` block in `hir_spu_top.sv` contains four fully independent |
| computation paths: |
|
|
| | Computation | GPU mapping | Dependency | |
| |-------------|-------------|------------| |
| | H gate scoring | WARP 0 | None β reads only ACTION_FLAGS, EVIDENCE_FLAGS | |
| | I gate scoring | WARP 1 | None β reads only ACTION_FLAGS, BASELINE_STATUS | |
| | R gate scoring | WARP 2 | None β reads only ACTION_FLAGS | |
| | Pressure P | WARP 3 | None β reads only W_PRESSURE, F_PRESSURE | |
| |
| Post-sync dependencies: |
| - B = f(H, I, R) β requires warps 0, 1, 2 to complete |
| - S = f(A_audit, B, P) β requires B and P |
| - U = f(A_audit, B, G, F_int) β requires B |
| - Fidelity = sqrt(H Γ I) β SFU, requires warps 0, 1 |
| - Cohesion = sqrt(R Γ I) β SFU, requires warps 1, 2 |
| - Resonance = sqrt(Fidelity Γ Cohesion) β SFU, requires both above |
|
|
| The 8 FAILURE_FLAGS are independent bit predicates evaluable in 8 parallel CUDA threads before |
| the FSM write-back. |
| |
| **N-packet batch throughput:** One evidence packet per thread block. N packets = N blocks in-flight |
| simultaneously. This is the SIMT data-parallel model. |
| |
| --- |
| |
| ## Layer III β Layer IV Interface |
| |
| **Status: provisional specification only. Neither layer is implemented in code.** |
| |
| The GPU batch compute model and the Resonant Access Memory architecture connect at the retrieval |
| plane. The Recall Score function over a memory population is a natural GPU workload: |
| |
| ``` |
| For each query q: |
| For each memory object Mem_i in population: |
| Recall_i(q) = Sim(q,i) Γ M_i Γ Rec_i Γ Trust_i |
| Return top-k by Recall_i |
| ``` |
| |
| This is structurally equivalent to a similarity search with weighted scoring β amenable to |
| Tensor core acceleration for large memory populations (v1.0 implementation path). |
|
|
| **Write path (memory admission):** |
|
|
| Every `CycleResult` from the HIR Kernel (Layer I-A) or HIR-SPU (Layer II) produces an |
| `AuditRecord`. The AuditRecord fields map directly to the Primordial RAM memory object schema: |
|
|
| | AuditRecord field | RAM schema field | |
| |-------------------|-----------------| |
| | `H_score` | `H_i` | |
| | `I_score` | `I_i` | |
| | `R_score` | `R_i` | |
| | `resonance` | `Rn_i` | |
| | `input_source` | `source` | |
| | `timestamp` | `timestamp` | |
| | `permission_state` | part of `context` | |
| | `self_hash` | `prev_hash` (chain link) | |
|
|
| The RAM Write Gate would therefore receive: Q_i (from schema completeness), P_i (from provenance |
| confidence, mapped from `H_score`), H_i, I_i, R_i directly from the kernel output. |
| |
| This is the natural promotion path from computation result β episodic memory candidate. |
| |
| --- |
| |
| ## Cross-Layer Safety Invariant Continuity |
| |
| The same eight safety invariants from the HIR-SPU hardware are preserved through all layers: |
| |
| | Invariant | I-A (Python) | II (RTL) | IV (RAM spec) | |
| |-----------|-------------|----------|---------------| |
| | Critical destructive lockout | `FAIL_CRIT_DESTRUCTIVE` flag | `failure_flags[5]` bit | MEM-INV-1 (H=0 on schema fail) | |
| | Domination hard stop | `GateResult("R", 0.0, ...)` | `failure_flags[4]` | MEM-INV-2 (permanent quarantine) | |
| | Consent hard stop | `consent_obtained` check | `failure_flags[3]` | MEM-INV-2 coverage | |
| | Schema hard stop | `schema_valid` check | `failure_flags[0]` | MEM-INV-1 | |
| | Audit preservation | AuditLog append-only | `audit_digest` output | MEM-INV-5 (append-only provenance) | |
| | RED = preserve, never erase | `action_taken = halt` | `ACT_HALT` encoding | MEM-INV-3 (quarantine β deletion) | |
|
|
| --- |
|
|
| ## Audit Chain Continuity |
|
|
| The audit chain is a first-class architectural concern across all layers: |
|
|
| - **Layer I-A:** `audit/log.py` β SHA-256 hash-chained `AuditRecord` sequence, append-only |
| - **Layer II:** `AUDIT_DIGEST_LOW/HIGH` registers β digest output for host-side chain extension |
| - **Layer III:** Async DMA to GDDR6 ring buffer β append-only, RED never triggers overwrite |
| - **Layer IV:** `prev_hash` field in memory object schema β chain of custody for every memory object |
|
|
| The chain is architecturally continuous from Python runtime through hardware through GPU through memory. |
| The v0.1 implementation realizes the first link (Layer I-A) in running code. |
|
|