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 duality — NQuin 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 governance — DenyRollback on the control ring before the next token matmul.
  4. VramLedger pins — Full / Eco / Reserve per universe; U0 KV protected in Reserve.

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

Structs§

AttentionRouteMask
U1 output: sparse attention routing bitmask for U0 matmul (10D kNN filter).
ComputeRequestEpoch
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).
SpeculativeVerifyResult
Result of speculative verification of a TopologyDraftBatch.
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). Read KV attention-mask word index of the published mask.
attention_mask_seq
Sequence counter for the attention-mask publication channel.
attention_route_mask
Current published attention route mask.
begin_request_epoch
build_attention_route_mask
B3.2a — kNN hits → sparse attention bitmask (zero-heap). Build a route mask from tensor-search hits — sets one KV bit per hit slot.
context_inject_ring
Global context-injection ring.
extrapolate_topology_draft
Extrapolate γ concept hashes from kNN trajectory (B3.1b); optional TopologyDraftMapper (B3.1c).
extrapolate_topology_draft_mapped
Core draft extrapolation: kNN search over the resident substrate (GPU path when gpu-runtime), XOR concept hashes with subject_hash, optional TopologyDraftMapper for token ids, then push onto the draft ring. None when the substrate is empty or no hits.
load_query_tensor
Load the last published query tensor.
pop_tensor_context
U0 decode loop pulls injected graph context (non-blocking). Pop the next pending context token.
pop_topology_draft
Pop the next topology draft batch from the global ring.
publish_attention_route_mask
Publish U1 route mask snapshot (producer / tests). Publish a new attention route mask and bump the sequence counter.
publish_decode_hint
U0 publishes the active decode position for the U1 producer (non-blocking). Publish a decode-step hint (token id + step) for the speculative-decode consumer.
publish_query_tensor
U0 publishes the 10D query anchor U1 should search around. Publish the active query tensor and its subject hash for cross-universe consumers.
push_tensor_context
Record a tensor kNN hit for async U0 consumption (continuous RAG path). Push a context token onto the inject ring; false when full.
push_tensor_search_hits
B2.4 producer hook: push kNN indices from visit_tensor_search / tensor_search_into. Push kNN hit indices into the search-hits channel (drains to the attention-mask ring).
query_subject_hash
Subject hash of the last published query tensor.
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
Signal the producer loop to exit (native only).
topology_draft_ring
Global topology-draft ring.
verify_topology_draft
Verify a speculative TopologyDraftBatch against target model greedy predictions or logit argmax tokens.