amduat-api/notes/Unified ASL + TGK + PEL Architecture.md
2026-01-17 00:19:49 +01:00

174 lines
6.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Absolutely — heres a textual/diagrammatic draft of the **overall architecture** for the unified ASL + TGK + PEL system with federation, SIMD/shard acceleration, and deterministic replay. Ill describe the components and their connections clearly so it can later be converted to a visual diagram.
---
# Unified ASL + TGK + PEL Architecture (Federated, Deterministic, SIMD/Shard Accelerated)
---
## 1. Components Overview
```
+-------------------------------------------------------------+
| FEDERATION LAYER |
| |
| +------------------+ +------------------+ |
| | Peer Node 1 |<---->| Peer Node 2 | |
| | | | | |
| | logseq & snapshots| | logseq & snapshots| |
| +------------------+ +------------------+ |
+-------------------------------------------------------------+
```
**Notes**:
* Federation layer manages **artifact and PER propagation**.
* Each peer node maintains **last applied logseq**, **snapshot provenance**, and **tombstones**.
* Deterministic replay across nodes guaranteed by **logseq + canonical ID ordering**.
---
## 2. Node-Level Architecture
```
+-------------------------------------------------------------+
| NODE LAYER |
| |
| +--------------------+ |
| | PEL Program Layer | <-- DAG execution, deterministic |
| | (PEL DAG + Inputs) | |
| +--------------------+ |
| | |
| v |
| +--------------------+ |
| | Execution Plan DAG | <-- maps PEL DAG nodes to |
| | (Operators) | SegmentScan, IndexFilter, ... |
| +--------------------+ |
| | |
| v |
| +--------------------+ |
| | Shard / SIMD Buffers| <--- ASL/TGK segments mapped in |
| | Artifact & TGK Data | memory, aligned for SIMD |
| +--------------------+ |
| | |
| v |
| +--------------------+ |
| | Index Operators | <-- SegmentScan, IndexFilter, Merge|
| | (TGKTraversal, etc) | TombstoneShadow, Projection |
| +--------------------+ |
| | |
| v |
| +--------------------+ |
| | Output / Projection | <-- final results, PER artifacts |
| +--------------------+ |
+-------------------------------------------------------------+
```
---
## 3. Data Flow
1. **PEL DAG Inputs** → loaded as ASL artifacts or PERs.
2. **PEL DAG Execution** → produces PER artifacts.
3. **PER + raw artifacts** → mapped into **shard-local SIMD buffers**.
4. **Execution plan operators** applied:
* SegmentScan → IndexFilter → Merge
* TGKTraversal → Projection / Aggregation
* TombstoneShadow ensures snapshot safety
5. **Output** → deterministic, snapshot-bounded results.
6. **Propagation** → federation layer transmits new artifacts/PERs to peers.
---
## 4. Shard & SIMD Acceleration
```
Shard 0 Shard 1 Shard 2
+---------+ +---------+ +---------+
| Buffers | | Buffers | | Buffers |
| SIMD | | SIMD | | SIMD |
+---------+ +---------+ +---------+
\ | /
\ | /
\ | /
\ | /
+-------+-------+
|
Merge
|
Output
```
* Each shard processes a **subset of the artifact/TGK edge space**.
* SIMD filters applied **per shard**.
* Merge ensures **deterministic global order**.
---
## 5. Snapshot & Provenance Integration
```
+-------------------------+
| ZFS Snapshots / Logs |
| ASL & TGK Storage |
| Shard-local Mapping |
+-------------------------+
|
v
+-------------------------+
| Snapshot-safe Operators |
| (SegmentScan, TombstoneShadow, TGKTraversal)
+-------------------------+
|
v
+-------------------------+
| Provenance Table |
| (logseq, canonical IDs) |
+-------------------------+
```
* Snapshot limits all reads.
* Provenance table ensures **deterministic replay and auditing**.
---
## 6. Federation Synchronization Flow
```
+------------------+ +------------------+
| Node A | | Node B |
| PER/Artifact log | ---> delta ---> | PER/Artifact log |
| Snapshot state | | Snapshot state |
| Shard buffers | | Shard buffers |
+------------------+ +------------------+
| ^
| |
+-----------------------------+
| Deterministic Replay |
+-----------------------------+
```
* Each node applies **incoming logs deterministically**.
* Shard mapping may differ, but merge ensures **canonical global ordering**.
* PEL program replay is deterministic based on input artifacts and snapshot.
---
## 7. Summary
* **PEL DAGs** feed deterministic execution plans.
* **ASL/TGK segments** stored in shard-local SIMD-aligned buffers.
* **Operators** are applied in a **snapshot-bounded, deterministic manner**.
* **Tombstones** and shadowing preserve provenance.
* **Federation layer** ensures deterministic cross-node propagation and replay.
* **PER artifacts** integrate seamlessly into the execution plan.
* The architecture scales to **billions of artifacts and TGK edges**.
---
If you want, I can **next produce a single unified “full system specification” document**, merging **ASL-CORE, ASL-STORE-INDEX, ENC-ASL-TGK-INDEX, PEL integration, execution plan, SIMD/shard acceleration, and federation rules** into a master reference.
Do you want me to draft that next?