Skip to main content

Module compute_universe

Module compute_universe 

Source
Expand description

Qualia-native compute universe fabric (Track B2).

This is not a generic GPU scheduler. Universes U0/U1/U2 map to QualiaDB primitives:

  1. Graph–tensor dualityNQuin graph and Tensor10D SOA share one resident substrate (U1 pin).
  2. Phase-8 bifurcation — lock-free SPSC rings between U0 (LLM), Sentinel, and U1 (tensor).
  3. Sentinel governanceDenyRollback on the control ring before the next token matmul.
  4. VramLedger pins — Full / Eco / Reserve per universe; U0 KV protected in Reserve.

One physical wgpu::Device (gpu_context::shared_gpu); logical parallelism via queues + rings.

Structs§

AttentionRouteMask
U1 output: sparse attention routing bitmask for U0 matmul (10D kNN filter).
ContextInjectRing
Fixed-capacity SPSC context ring (producer U1, consumer U0).
ContextInjectToken
Lightweight pointer pushed U1→U0 (48 B NQuin stays in SOA; ring carries index + hash).
GraphTensorSubstrate
Resident graph↔tensor SOA visible to U1 (write/search), U0 (read/inject), U2 (render).
TopologyDraftBatch
Draft batch pushed U1→U0 for parallel verify (no draft-model weights).
TopologyDraftRing
UniverseFabric
Qualia fabric: ledger orchestration + shared substrate + Phase-8 context ring.

Enums§

Phase8Channel
Phase-8 bifurcation ring (see llm_agent.rs LogitStream / ControlStream + U1 inject).
QualiaPrimitive
Qualia engine primitive exploited by a compute universe (not portable DB semantics).

Constants§

ATTENTION_MASK_WORDS
CONTEXT_INJECT_RING_CAP
KV_ATTENTION_MASK_WORDS
KV cache bitmask for fused_attention.wgsl (1024 context slots).
MAX_DRAFT_LEN
TOPOLOGY_DRAFT_RING_CAP

Functions§

attention_kv_mask_u32
Map U1 route mask (tensor indices) → KV slot mask for attention (B3.2b light).
attention_mask_seq
attention_route_mask
build_attention_route_mask
B3.2a — kNN hits → sparse attention bitmask (zero-heap).
context_inject_ring
extrapolate_topology_draft
Extrapolate γ concept hashes from kNN trajectory (B3.1b); optional TopologyDraftMapper (B3.1c).
extrapolate_topology_draft_mapped
load_query_tensor
pop_tensor_context
U0 decode loop pulls injected graph context (non-blocking).
pop_topology_draft
publish_attention_route_mask
Publish U1 route mask snapshot (producer / tests).
publish_decode_hint
U0 publishes the active decode position for the U1 producer (non-blocking).
publish_query_tensor
U0 publishes the 10D query anchor U1 should search around.
push_tensor_context
Record a tensor kNN hit for async U0 consumption (continuous RAG path).
push_tensor_search_hits
B2.4 producer hook: push kNN indices from visit_tensor_search / tensor_search_into.
query_subject_hash
run_tensor_search_producer_cycle
One U1 producer cycle: search resident SOA, push ring, refresh mask, draft topology.
sentinel_allows_topology_draft
Phase-8 Sentinel gate for U1→U0 topology drafts (B3.1d polish).
start_tensor_search_producer
B3.3a — spawn background U1 tensor search producer (idempotent).
stop_tensor_search_producer
topology_draft_ring