Expand description
Qualia-native compute universe fabric (Track B2).
This is not a generic GPU scheduler. Universes U0/U1/U2 map to QualiaDB primitives:
- Graph–tensor duality —
NQuingraph andTensor10DSOA share one resident substrate (U1 pin). - Phase-8 bifurcation — lock-free SPSC rings between U0 (LLM), Sentinel, and U1 (tensor).
- Sentinel governance —
DenyRollbackon the control ring before the next token matmul. - 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§
- Attention
Route Mask - U1 output: sparse attention routing bitmask for U0 matmul (10D kNN filter).
- Compute
Request Epoch - Context
Inject Ring - Fixed-capacity SPSC context ring (producer U1, consumer U0).
- Context
Inject Token - Lightweight pointer pushed U1→U0 (48 B
NQuinstays in SOA; ring carries index + hash). - Graph
Tensor Substrate - Resident graph↔tensor SOA visible to U1 (write/search), U0 (read/inject), U2 (render).
- Speculative
Verify Result - Result of speculative verification of a
TopologyDraftBatch. - Topology
Draft Batch - Draft batch pushed U1→U0 for parallel verify (no draft-model weights).
- Topology
Draft Ring - Universe
Fabric - Qualia fabric: ledger orchestration + shared substrate + Phase-8 context ring.
Enums§
- Phase8
Channel - Phase-8 bifurcation ring (see
llm_agent.rsLogitStream / ControlStream + U1 inject). - Qualia
Primitive - 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
indexof 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 withsubject_hash, optionalTopologyDraftMapperfor token ids, then push onto the draft ring.Nonewhen 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;
falsewhen 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
TopologyDraftBatchagainst target model greedy predictions or logit argmax tokens.