LPsLux Proposals
Precompiles
LP-5625

GPU-Residency Invariant

Final

The rule that no chain-local hot path leaves GPU memory — residency classes, arena layout, service scheduling, precompile and certificate services, and the full optimization stack that makes it real

LP-5625: GPU-Residency Invariant

Abstract

The QuasarGPU substrate ships with an architectural contract that an audit must enforce as an invariant, not a goal. This LP names that invariant, classifies every chain-state object by where it must live, and documents the full optimization stack required to make it real.

The invariant: No chain-local hot path leaves GPU memory.

CPU/host is allowed only for asynchronous external I/O — network ingress, cold-state page service, attestation handshake, watchdog, crash recovery, operator control plane. Everything else lives in GPU memory: mempool, access prediction, DAG/frontier scheduling, EVM fibers, Block-STM, precompiles, receipts, roots, cert lanes, DEX matching, compliance gates, audit commitments.

The CPU touches reality. The GPU runs the chain.

The residency invariant is hard-enforceable via residency-class tagging, ForbiddenHot CPU-handler counters, and CI assertions.

Chain coverage

All nine chains are GPU-native under the strict definition — state and canonical transition logic both on GPU. CPU supplies only packets, cold pages, time, attestation, and watchdog.

ChainVMRepoCUDAMetalWGSLCPU↔GPU determinism
P-ChainPlatformVMluxcpp/platformvm✓✓✓byte-equal
C-ChainEVM (cevm)luxcpp/cevm✓✓—byte-equal
X-ChainXVMluxfi/xvm✓✓✓byte-equal
Q-ChainQuantumVMluxcpp/lattice + cevm/quasar✓✓✓byte-equal
Z-ChainZKVMcevm/quasar Groth16✓✓partialbyte-equal
A-ChainAIVMluxfi/aivm✓✓✓byte-equal
B-ChainBridgeVMluxfi/bridgevm✓✓✓byte-equal
M-ChainMPCVMluxfi/mpcvm✓✓✓byte-equal
F-ChainFHEVMluxcpp/fhe + luxfi/fhevm✓✓✓byte-equal

WGSL "—" on C-Chain reflects the EVM bytecode interpreter targeting CUDA and Metal first; WGSL "partial" on Z-Chain reflects Groth16 pairing arithmetic shipping on CUDA and Metal with the WebGPU port pending.

Coverage of the CPU reference oracle

LLVM source-based coverage on the five newest VMs plus the cevm/quasar substrate. The CPU reference oracle is the security-critical byte-equivalence target.

ChainVMLine %Branch % (oracle)Tests
P-ChainPlatformVM97.52% (TOTAL) / 99.25% (oracle)90.07%53/53
C-ChainEVM (cevm)95.78% (TOTAL) / 96.51% (mm)58.46% (TOTAL)59/59
X-ChainXVM97.48%92.46%44/44 + 7 determinism + 6 Metal
A-ChainAIVM98.71%94.71%45/45
B-ChainBridgeVM98.17%90.53%42/42
M-ChainMPCVM97.90%90.32%41/41

Aggregate line coverage is ≥ 96% across the five new VMs (mean 97.96%, excluding cevm). The oracle clears 90% branch on every VM where it is the dominant translation unit. Branch gaps below 90% on whole-VM totals are itemized per VM as physically unreachable defences: hash-table linear-probe fallthrough behind arena-cap invariants, GPU driver allocation-failure paths, and switch-default arms over enum types. Bugs caught and fixed during this push — rotl64 UB at n = 0, a keccak_f1600 clang -O3 miscompile, WGSL pointer and reserved-keyword issues, and MPCVM WGSL struct-stride drift — are recorded in each VM's coverage roll-up.

GPU kernel sources (.metal, .cu, .wgsl) are not instrumentable by llvm-cov: neither metal-cc, nvcc, nor wgpu-native emit LLVM coverage maps. The CPU reference oracle is therefore the byte-equivalence ground truth, and every GPU run is asserted byte-for-byte against it via each VM's determinism test.

Nine-chain certificate binding

The Quasar substrate wires every chain's transition root into QuasarRoundDescriptor; a single QuasarCert binds the canonical state of all nine chains via

certificate_subject = keccak(... || P || C || X || Q || Z || A || B || M || F || ...)

in fixed canonical order. Five wave-tick services — PlatformVMTransition, XVMTransition, AIVMTransition, BridgeVMTransition, MPCVMTransition — reserve work-queue addresses for per-VM ingress; the substrate passes through them with descriptor-direct writes.

What the nine-chain binding ships:

  • QuasarRoundDescriptor extended with five 32-byte chain transition roots (xchain_execution_root, achain_state_root, bchain_state_root, mchain_state_root, fchain_state_root). P, Q, and Z remain from the earlier cert-subject hardening; C reuses parent_block_hash, because the cevm round is C.
  • compute_certificate_subject extended to an 11 × 32-byte hash input in canonical P, C, X, Q, Z, A, B, M, F + parent_state + parent_execution order. Both host (quasar_sig.hpp) and device (quasar_wave.metal) layouts updated; descriptor sizeof = 480 bytes.
  • QuasarRoundResult echoes all nine roots plus certificate_subject_echo, so downstream consumers reconstruct the cert subject from the result alone; sizeof = 672 bytes.
  • ServiceId::Count bumped to 17 with five new transition services reserved at indices 12–16.
  • A nine-chain integration test (quasar_9chain_integration_test.mm) proves: the subject keccak input matches the canonical 11-segment reference byte-for-byte; flipping any single bit in any of the nine chain roots produces a different subject (cert binding holds); swapping two roots also produces a different subject (canonical order matters); the engine echoes all nine roots back into the result; and a tampered descriptor's recompute diverges from the engine's echo.

1. Residency classes — every object carries a tag

enum class ResidencyClass : uint8_t {
    DeviceHot,      // must stay in GPU memory on the fast path
    DeviceWarm,     // GPU-resident cache, refillable from canonical source
    HostCold,       // cold canonical source-of-truth; async page-in only
    HostControl,    // host metadata / control plane only
    ForbiddenHot,   // SHOULD NEVER appear on the fast-path flamegraph
};

DeviceHot — must never leave GPU memory during a round

ObjectOwner
QuasarRoundDescriptor working copyQuasarGPU adapter
QuasarRoundResult working copyQuasarGPU adapter
Device rings (12+ services)QuasarGPU adapter
Tx blobs after ingressQuasarGPU adapter
Decoded txs / VerifiedTxQuasarGPU adapter
Sender recovery outputsQuasarGPU adapter
Fee / nonce admission stateQuasarGPU adapter
Lane hints (StmLaneHint)QuasarSTM
DAG nodes / unresolved-parent countersQuasarGPU adapter
EVM fiber frames + stacks + memory arenasGPU-native EVM
Block-STM read/write setsQuasarSTM
MVCC version arenaQuasarSTM
Hot account / storage cacheQuasarSTM
Precompile inputs / outputsthis LP §12
Receipt / log materialQuasarGPU adapter
Root construction materialthis LP §22
Cert lane artifactsQuasar consensus
Quorum stake accumulatorsQuasar consensus
DEX order / match / settlement buffersDEX precompile
Compliance precompile state snapshotsthis LP §15

DeviceWarm — GPU-resident cache, refillable

code cache / ABI selector profiles
historical access profiles
hot state windows
validator-set cache
stake table cache
ZK verifying keys
Pulsar public parameters
market metadata
risk / compliance rule tables

HostCold — cold canonical state

archival state (SSD / LSM)
cold trie nodes
full receipt archive
historical logs
full audit export
operator snapshots

HostControl — allowed on host

watchdog status
kernel launch counters
device health
configuration load
attestation handshake (initial)
network socket ownership when no GPUDirect RDMA

ForbiddenHot — must NOT appear on the fast path

If any of these run on host on the round path, the design has failed:

host-side tx sorting
host-side DAG construction
host-side Block-STM validate / repair
host-side precompile execution
host-side keccak root construction
host-side quorum accumulation
host-side DEX matching
host-side compliance decision
host-side receipt construction
host-side gas accounting

CI gate: a counter forbidden_hot_invocations increments on every ForbiddenHot call site; CI fails if the counter advances during a fast-path test.

2. Memory layout — offset arenas, no pointer soup

using DevOffset = uint32_t;

template <typename T>
struct DevSlice {
    DevOffset offset;
    uint32_t  count;
};

struct ArenaHeader {
    uint32_t capacity;
    uint32_t bump;
    uint32_t high_watermark;
    uint32_t gc_epoch;
};

18 canonical arenas:

TxBlobArena        DecodedTxArena    CalldataArena    CodeArena
FiberFrameArena    FiberStackArena   FiberMemoryArena JournalArena
ReadSetArena       WriteSetArena     VersionArena     ReceiptArena
LogArena           RootArena         PrecompileArena  CertArena
DexArena           AuditArena

Rules:

  • No dynamic allocation on the hot path. Bump allocation plus epoch GC only.
  • Offsets are device-portable across Metal and CUDA.
  • Arenas are RDMA-friendly — consecutive layout, no linked-list walks.
  • High-watermark telemetry per arena gates the round.

3. Rings carry descriptors, not payloads

struct WorkItem {
    ServiceId service;
    DevOffset object_offset;
    uint32_t  object_count;
    uint32_t  priority;
    uint32_t  flags;
};

Payloads live in arenas. Rings carry only (offset, length, type). Cache-friendly, small ring traffic, trivially RDMA-able.

Optimization checklist:

  • Power-of-two capacity (mask trick).
  • Head and tail on cache-line-separate slots.
  • SPSC where possible; MPSC only with priority buckets.
  • Overflow and backpressure counters in RingHeader.
  • Device-side priority buckets per service.
  • No host polling of service internals.

4. Wave scheduler — adaptive service pressure

struct ServicePressure {
    uint32_t queue_depth;
    uint32_t deadline_weight;
    uint32_t dependency_weight;
    uint32_t stall_count;
    uint32_t hotness;
};

Per-tick budget:

budget(service) = base
                + queue_depth_weight
                + deadline_weight
                + unblock_weight
                - stall_penalty

Near a deadline:

  • Increase Commit, Root, QuasarCert, QuorumOut.
  • Decrease Decode, MempoolAdmission.
  • Freeze the candidate frontier — no new admissions.
  • Continue only repairs that block the commit horizon.

The substrate uses a fixed gid → service mapping. v0.42 lands adaptive budgets; v0.43 adds work-stealing across services.

5. CUDA — persistent kernels, graphs, cooperative groups

FeatureUse
Persistent kernelThe Quasar wave scheduler runs as a persistent CTA grid
CUDA GraphsStable-topology wave batches captured once, replayed many times
Cooperative GroupsIntra-kernel service-barrier synchronization
Stream prioritiesCert / Commit / Root urgency bumps
Pinned / registered host memoryCold fallback only
GPUDirect RDMANIC → GPU rings on InfiniBand-equipped clusters
GPUDirect StorageCold-state page-in where available

Graph rule: capture for stable topology — same services, same memory pools, same stream graph. Do not graph a fully dynamic topology.

6. Metal — bounded waves and indirect commands

FeatureUse
Bounded wave ticksHost re-launches the quasar_wave kernel; relaunch is fairness
MTLSharedEventHost/device sync for round boundaries
MTLIndirectCommandBufferGPU-authored work where useful
Argument buffersService descriptor tables
MTLBuffer offset arenasAll 18 arenas are offset views
No persistent hot-spinning kernelEmpirically broken on Apple Silicon — starvation observed at v0.29
No CPU semantic phase decisionsHost writes closing_flag and reads the result; nothing else

7. Networking — direct GPU ingress

Target: NIC → GPU event_ingress_ring via GPUDirect RDMA. Fallback: NIC → host pinned batch → GPU ring.

struct IngressEnvelope {
    uint16_t kind;       // tx, vote, cert, state page, order
    uint16_t flags;
    uint32_t len;
    uint64_t source_id;
    uint64_t seq;
    Hash     payload_hash;
    DevOffset payload_offset;     // into TxBlobArena
};

Rings carry envelopes; payloads land in the corresponding arena.

Traffic classes, one ring each:

TC0  cert / votes
TC1  orderflow
TC2  state pages
TC3  tx gossip
TC4  audit / archive

Optimizations: batch small txs into MTU / jumbo / RDMA writes; per-TC quotas; device-side dedup; device-side replay window; device-side source quotas.

8. Cold-state page faults — never stall the wave

struct StateRequest {
    Hash      key;
    StateKind kind;          // Account, Storage, Code, TrieNode
    uint32_t  fiber_id;
    uint32_t  priority;
    uint64_t  deadline_ns;
};

Fault flow:

  1. A fiber misses → emit StateRequest, mark SuspendedState, schedule other work.
  2. The host services the request via LSM / cache / disk and posts a StatePage.
  3. StateResp inserts into the DeviceWarm cache and wakes fibers.

State cache:

  • GPU cuckoo or hash table for hot key → value.
  • Bloom or quotient filter for known-missing keys.
  • Two tiers: hot exact keys plus a page/block cache.
  • Admission policy by lane hotness.
  • Prefetch predicted access sets before exec.
  • Pin market, compliance, and validator hot state per epoch.
  • Evict by epoch, hotness, and size.

Page granularity — page by locality, not by individual trie node:

account page                 contract storage prefix page
market page                  validator / stake page
code page                    precompile state page

Multi-GPU / RDMA: store consecutive versions per key or page (VersionBlock layout) so one fetch returns all likely-visible versions.

9. EVM fibers — struct-of-arrays, not array-of-structs

Per-fiber SoA:

pc[]              gas[]              status[]
contract[]        caller[]           value[]
stack_offset[]    memory_offset[]    journal_offset[]
read_set_offset[] write_set_offset[]

Large fields go in arenas. The per-fiber stack alone (256-bit × 64 entries × 4096 fibers ≈ 13.6 MB) is acceptable; full receipt bodies are not.

Opcode grouping — group by execution behaviour, not numeric order:

GroupOpcodes
ALU (no state, no suspend)ADD, SUB, MUL, DIV, …, AND/OR/XOR
Memory (local arena)MLOAD, MSTORE, MSTORE8, MCOPY
Hash (Keccak service)KECCAK256
Env (round constants)CHAINID, BASEFEE, COINBASE, …
State (may suspend)SLOAD, BALANCE, EXTCODE*
Call/Create (frame push/suspend)CALL, DELEGATECALL, STATICCALL, CREATE/CREATE2
Log (receipt arena)LOG0..LOG4
Precompileforwarded to the Precompile service (§12)

Superinstructions — fuse common patterns:

PUSH + PUSH + SLOAD             → fused storage load
CALLDATALOAD + AND/SHR selector → fused dispatch
MLOAD/MSTORE ABI copy           → memcpy_abi
ERC20 balance slot calculation  → erc20_slot
mapping slot keccak             → mapping_slot
LOG append                      → log_append

Each must produce identical gas and exception behaviour, validated against the cevm CPU reference.

10. Gas — device-local, deterministic

struct GasState {
    uint64_t remaining;
    uint64_t refund;
    uint64_t memory_words;
};

Optimizations:

  • Precompute static gas per basic block (compile-time analysis).
  • Separate dynamic gas hooks — memory expansion, SLOAD warm/cold.
  • Batch memory-expansion calculation.
  • Fail fast on a gas-impossible upper bound.
  • Gas snapshots in fiber checkpoints.
  • The host never recomputes gas on the fast path.

11. Keccak — one batched service

Keccak appears everywhere: tx hash, sender recovery, mapping slots, code hash, receipt root, state root, certificate subject, audit root.

struct HashJob {
    HashJobKind kind;
    DevOffset   input_offset;
    uint32_t    input_len;
    DevOffset   output_offset;
};
  • Inline tiny fixed-size keccak paths in hot opcodes.
  • Separate variable-length calldata hashing service.
  • Reuse sponge state for trie and root chains where correct.
  • Cache code_hash and selector profiles.
  • Deduplicate repeated mapping-slot hashes.

12. Precompiles — every precompile is a GPU service

struct PrecompileCall {
    uint32_t  tx_id;
    uint32_t  fiber_id;
    uint16_t  precompile_id;
    uint16_t  flags;
    DevOffset input_offset;
    uint32_t  input_len;
    DevOffset output_offset;
    uint32_t  output_capacity;
    uint64_t  gas_budget;
};

struct PrecompileResult {
    uint32_t tx_id;
    uint32_t fiber_id;
    uint16_t status;
    uint16_t flags;
    uint32_t output_len;
    uint64_t gas_used;
};

A fiber suspends on CALL precompile and wakes when the result arrives.

Per-precompile classes. No mixed-precompile kernel — branch divergence kills throughput.

ClassExamples
Cryptosecp256k1/ecrecover, sha256, ripemd160
Hashkeccak (separate service, §11)
Elliptic curvebn256 add / mul / pairing
BLS / PQ certBLS aggregate, Pulsar share, Groth16
DEX / matchingOrderAppend, BatchAuction, ContinuousLimit, OMASettlement
Compliance / riskComplianceCheck, RiskLimits, KYCEligibility
Oracle / attestationTEE quote, price feed, deadline
ZK verifyHalo2, Plonky2, Risc0
AI / model marketInference attestation, model provenance

13. Crypto precompile optimizations

secp256k1 / ecrecover

  • Batch normalize inputs.
  • Reject invalid v/r/s early.
  • Batch modular inversion (Montgomery's trick).
  • Window tables in __constant__ or threadgroup memory.
  • Recovered addresses written to an arena.

BLS12-381

  • Batch subgroup checks.
  • Batch pairing verification.
  • Aggregate public keys; cache pubkeys in DeviceWarm.
  • Precompute committee pubkey tables per epoch.

Pulsar

  • Cache public parameters in DeviceWarm.
  • Batch NTT and polynomial operations.
  • Bind the subject in GPU memory; no per-share host parse.

MLDSAGroth16 (Z-Chain rollup)

  • The GPU lane verifies the Groth16 proof, not raw per-validator ML-DSA signatures.
  • The verifying key is resident in DeviceWarm.
  • Batch pairings.
  • public_input_hash = H(certificate_subject || pchain_root || zchain_root || validator_set_root).

14. ZK proof verification — DeviceWarm VK, batched pairings

  • Fixed verifying key resident per epoch.
  • Public-input hashing on GPU.
  • Batch pairing precomputation.
  • Proof format canonicalized at ingress; malformed proofs rejected early.
  • For fixed-size proof systems (Groth16 = 192 B) keep a dedicated slot; the general cert artifact ABI stays (offset, len) for forward compatibility.

15. Compliance — GPU-native, never a CPU callback

For a regulated venue, compliance cannot be a CPU callback.

GPU-resident compliance state:

KYC identity commitment            jurisdiction flags
accreditation / investor status    sanctions snapshot commitment
venue permissions                  asset transfer restrictions
position / risk limits             disclosure / audit policy

Precompile:

ComplianceCheck(account, asset, venue, action, amount, jurisdiction)
  → { allowed | denied, reason_code, audit_commitment, gas_used }

Privacy: keep raw identity data committed or encrypted; the GPU operates over compact eligibility commitments.

16. DEX precompile optimization

Most orderflow on a co-located regulated venue is not arbitrary Solidity. Use GPU-native DEX precompiles:

OrderAppend         OrderCancel
BatchAuction        ContinuousLimitBook
RiskCheck           MarginUpdate
FeeAccumulate       OMASettlement
AuditCommit

Batch auction as a reducer:

1. append order events during the batch
2. at the boundary: deterministic match
3. settle net account deltas
4. emit audit root

This avoids hot-key SSTORE contention on every order event.

Order book layout (SoA):

market_id → price level pages → order queue offsets
account_id → balance / margin lane
price[]  qty[]  side[]  account[]  timestamp_seq[]  flags[]

No per-order pointer nodes.

17. Semantic reducers

Many "transactions" should be reducers, not writes.

enum class ReducerKind : uint8_t {
    Add, Sub, Append,
    BalanceDelta, FeeAccumulate,
    OrderAppend, OrderCancel, AuctionMatch,
    AuditAppend,
};

Commit rule:

  1. Collect reducer ops per lane.
  2. Sort by canonical order.
  3. Apply deterministic reduction.
  4. Emit one final state write.

This avoids Block-STM conflict storms on fee counters, audit logs, order books, batch settlement, and liquidity accounting.

18. State lanes and hot-lane promotion

lane_id = H(contract, storage_domain, account, market, asset, nonce_lane);

enum class LaneClass : uint8_t {
    Owned, Shared, HotShared, Reducer, Serialized, Unknown,
};

Policy:

  • Owned → fast path, no cross-tx validation.
  • Reducer → semantic reducer.
  • Shared → MVCC.
  • HotShared → split, reducer, or serialized precompile.
  • Serialized → one-at-a-time lane queue.
  • Unknown → conservative Block-STM.

The scheduler updates lane class continuously from telemetry.

19. Block-STM tiered validation

Tier 0  no writes / read-only fast path
Tier 1  lane-clock validation
Tier 2  key-level MVCC visible-version
Tier 3  semantic validation
Tier 4  repair

Avoid running exact MVCC validation for txs that touched only unchanged owned lanes. Batch validation jobs by read-set length to reduce branch divergence.

20. Repair — bounded, prioritized, checkpointed

max_fast_repairs              = 3
max_total_repairs             = 8
hot-lane escalation threshold = 16

Priority:

  1. Earlier canonical order first.
  2. Unblocks many descendants first.
  3. Near commit horizon first.
  4. Higher fee only after safety priorities.

Checkpoint rollback: roll back to before the invalid read; preserve the decoded tx, calldata, code cache, and unaffected reads.

Telemetry:

repair_amplification     p99_incarnation
full_reexec_count        checkpoint_rollback_count
hot_lane_escalations

Target repair_amplification < 1.01 on a normal DEX workload.

21. Commit server — fibers emit intents, the server commits

Fibers emit:

read intent       write intent
reducer intent    receipt intent       log intent

The commit service owns mutation of:

MVCC version chains    lane clocks
receipt chains         root material      commit horizon

This avoids fiber CAS storms on global metadata.

Commit batching:

  • Commit by canonical index range.
  • Commit by lane shard.
  • Commit by reducer lane.
  • Commit by horizon cut.

22. Root construction — separate roots for separate purposes

state_root            commits to MVCC final state
receipts_root         commits to the receipt arena
execution_root        commits to ordering / RW set / gas / status / logs
mode_root             Nova linear-prefix root or Nebula causal-cut root
audit_root            selective-disclosure commitment for a regulated venue
certificate_subject   binding for QuasarCert lanes

execution_root commits to:

tx order / DAG frontier      read/write commitments
gas used / status            logs hash
precompile outputs           conflict/repair metadata

Construction:

  • Dirty-key collection (incremental).
  • Sort and dedup dirty keys on GPU.
  • Batch leaf hashing.
  • Batch internal-node hashing.
  • Incremental root update from the prior round.

23. Receipts and logs — compact arena, async export

compact receipt format in GPU memory
logs stored as offset / len
bloom built on GPU
receipt root from compact material
archive export async (host pulls from the GPU/SSD pipeline)

The fast path never copies full receipt bodies to the host.

24. Data availability — sign roots, not raw events

For billion-event throughput, do NOT globally replicate every raw event synchronously. Layered:

raw event blobs               (per-validator, ephemeral)
compressed event root         (signed)
execution root                (signed; cert subject input)
settlement root               (signed)
audit root                    (signed; selective disclosure)
selective disclosure data     (privileged readers only)

Availability comes from erasure-coded blobs, co-located DA nodes, a regulatory archive lane, and selective replay.

25. Confidential compute — TEE binding

  • Attest once per epoch, binary, or policy — not per transaction.
  • Bind the measurement root into certificate_subject.
  • Never bounce plaintext through the host.
  • Decrypt only inside the confidential boundary.
confidential_attestation_root = H(
    cpu_tee_measurement,
    gpu_measurement,
    quasar_gpu_binary_hash,
    precompile_binary_hash,
    market_policy_root)

Bind into certificate_subject, audit_root, and the DEX batch root.

26. Memory safety and privacy hygiene

GPU memory contains sensitive orderflow.

  • Zero freed confidential arenas at the epoch boundary.
  • Per-lane encryption domains where feasible.
  • No debug dumps of plaintext orderflow.
  • No host-readable mapped buffers for private lanes.
  • Explicit redaction path for telemetry.

Telemetry exposes counts, latencies, roots, and reason codes — never raw orders, identities, unmasked accounts, or sensitive compliance facts.

27. Certificate lane optimization

struct CertArtifact {
    QuasarCertLane lane;
    Hash subject;
    DevOffset artifact_offset;
    uint32_t  artifact_len;
    Hash public_inputs_hash;
};

Per-lane optimization:

  • BLS: cache pubkeys, batch verify, aggregate bitmaps.
  • Pulsar: cache ceremony parameters, batch polynomial ops.
  • MLDSAGroth16: cache the verifying key, batch pairing verify.

Invariant: all lanes bind the same certificate_subject.

28. Multi-GPU sharding

Shard by:

state lane          market
account range       precompile type
cert lane           root construction stage

Avoid sharding by random tx index — it causes cross-GPU state chatter.

Typical 8-GPU topology:

GPU 0  ingress / decode / admission
GPU 1  DEX / private orderflow / compliance
GPU 2  EVM fibers shard A
GPU 3  EVM fibers shard B
GPU 4  STM commit / root
GPU 5  cert lanes
GPU 6  audit / DA compression
GPU 7  replay verifier / hot spare

Cross-GPU communication:

  • NVLink / NVSwitch intra-node.
  • GPUDirect RDMA over InfiniBand inter-node.
  • NCCL only for true collectives — reductions, broadcasts.
  • Custom RDMA rings for adversarial consensus messages.

29. Workload-class scheduling

simple transfer              ERC20 transfer
DEX order append             DEX match / settle
compliance check             AMM swap
contract deploy              router call
ZK verify                    cert vote
cold-state heavy             unknown arbitrary EVM

Policy:

simple/owned lane    → fast path
DEX append           → reducer
compliance           → precompile batch
ZK / cert            → crypto service
unknown EVM          → isolated fiber batch
cold-state heavy     → lower priority unless near deadline

30. Unknown-contract profiling

struct ContractProfile {
    Hash     code_hash;
    uint32_t selector;
    Hash     predicted_lanes_root;
    uint16_t confidence;
    uint16_t observed_conflict_rate;
    uint32_t avg_gas;
    uint32_t cold_miss_rate;
};

First execution samples the access set. Promote to a known class when stable; demote on access instability, high conflict, frequent revert, or cold-state-heavy behaviour.

31. Compiler / JIT tiers

Tier 0  fiber VM interpreter
Tier 1  superinstructions
Tier 2  selector-specific traces
Tier 3  contract-specific GPU JIT / AOT
Tier 4  native precompile

Promote on a hot selector plus a stable access set, low divergence, and high volume.

32. Revert and journal

struct JournalSegment {
    uint32_t  tx_id;
    uint32_t  depth;
    DevOffset start_offset;
    DevOffset end_offset;
};
  • Subcall: push a journal checkpoint.
  • Revert: discard the segment.
  • Success: merge the segment upward.
  • Never mutate MVCC canonical versions inside subcalls — emit speculative write intents only.

33. CREATE / CREATE2

compute address on GPU
hash initcode on GPU
code deposit into CodeArena
dedup identical code hashes
delay code availability until commit
track CREATE2 address conflicts as lane conflicts

Create lane:

lane = H(deployer, nonce_or_salt, initcode_hash)

34. SELFDESTRUCT, TLOAD, TSTORE

  • SELFDESTRUCT: journal only; resolved in commit order; the lane is marked destructive.
  • TLOAD / TSTORE: tx-local transient arena; no global MVCC unless cross-frame semantics require it.

Never let destructive semantics bypass STM.

35. Access-list optimization (ConflictSpec)

Merge from all sources into a ConflictSpec:

EIP-2930 access lists       historical profile
ABI selector                simulation cache
contract profile            DEX / precompile known lanes
user-declared spec          learned predictor

ConflictSpec drives frontier refraction and lane prefetch.

36. Bloom filters

Device-side filters for fast negative checks:

hot state presence              code cache presence
known lane predictor            duplicate tx
duplicate vote / cert artifact  spent nonce
known-invalid signature

37. Deduplication

Dedup on GPU:

same tx hash / order id          same vote artifact
same cert lane artifact          same state request
same code hash                   same precompile input
same keccak job

For DEX orderflow, dedup cancels and replaces by (account, order_id).

38. Deadline-aware execution

Services read:

deadline_ns        current_tick_budget
commit_pressure    cert_pressure

Policy:

early     admit / explore / execute broadly
mid       prioritize high-score frontiers
late      freeze admission; repair only commit-horizon blockers
          root / certify
imminent  emit the best valid prefix or cut

The GPU makes the decision. The host supplies clock and deadline only.

39. Proposal search — GPU-native block building

Candidate score:

score = fees + app rewards + auction surplus
      - conflict_cost - cold_state_cost - repair_cost
      - deadline_risk - compliance_risk

Run multiple candidate frontiers in parallel:

high fee candidate         low conflict candidate
DEX-priority candidate     cert-fast candidate

Pick the best certifiable result before the deadline.

40. Security hardening

Replay protection — bind everything to:

chain_id      epoch        round       mode
validator root              P/Q/Z roots
attestation root            parent roots

Determinism: no nondeterministic atomic ordering affecting roots, no floating-point consensus math, no hash-table iteration order, no unordered reducer output, no race-dependent version-chain insertion.

Side channels — for regulated or private lanes:

  • Constant-ish proof-verification paths where feasible.
  • Batch padding for private orderflow.
  • Traffic shaping for sensitive lanes.
  • Delayed reveal.
  • No host-visible plaintext.

41. Observability without secrets

Metrics exposed:

wave_tick_count               service_queue_depths
service_budget_allocations    lane_fast_valid_rate
conflict_rate                 repair_amplification
cold_miss_rate                precompile_batch_sizes
root_latency                  cert_lane_latency
GPU memory pressure           arena high-watermarks
RDMA ingress latency

Never expose private order contents, identities, or unmasked accounts.

42. Test matrix — CI-enforced residency invariant

Residency tests

test_precompile_call_does_not_invoke_cpu_handler
test_keccak_roots_produced_on_gpu
test_receipt_root_produced_on_gpu
test_quorum_status_produced_on_gpu
test_block_stm_repair_scheduled_on_gpu
test_state_miss_suspends_fiber_no_host_fallback

Mechanism: forbidden_hot_invocations increments on every ForbiddenHot call site; CI fails on any increment during fast-path tests.

Fault tests

cold page delayed              duplicate RDMA packet
invalid cert artifact          bad Groth16 public input
stale P-chain validator root   wrong Q-chain ceremony root
wrong Z-chain VK root          hot-lane conflict storm
out-of-memory arena pressure

Equivalence tests — cross-backend determinism

CPU reference == Metal == CUDA
  same state_root
  same receipts_root
  same execution_root
  same certificate_subject

43. Roadmap

VersionTheme
v0.42GPU-residency audit: ResidencyClass tags, ForbiddenHot counters, precompile fast-path assertions
v0.43Precompile service ABI: PrecompileCall/Result, fiber suspend/resume, batched precompile queues
v0.44Crypto precompiles: keccak, ecrecover, BLS, Pulsar, MLDSAGroth16, Groth16 VK cache
v0.45DEX / compliance precompiles: OrderAppend, BatchAuction, RiskCheck, ComplianceGate, OMASettlement, AuditCommit
v0.46Semantic reducers: FeeAccumulate, OrderAppend, BalanceDelta, AuditAppend
v0.47GPU root pipeline: dirty-key gather, receipt root, execution root, mode root, audit root, certificate_subject
v0.48GPUDirect ingress: NIC → GPU rings, fallback pinned path, RDMA sequence/replay checks
v0.49Confidential mode binding: attestation root, policy root, no plaintext host buffers, certificate_subject binding
v0.50Multi-GPU service sharding: lane ownership, cross-GPU rings, cert lane GPU, root GPU, EVM shard GPUs

44. The thesis

QuasarGPU reaches minimum latency when all chain-local state transitions, including EVM precompiles and consensus-adjacent certificate work, execute against device-resident arenas, with the host reduced to asynchronous ingress, cold-page service, attestation, and watchdog control.

The slogan stays right:

The CPU touches reality. The GPU runs the chain.

45. Performance — measured

GPU acceleration measured against the CPU reference on Apple M1 Max (32-core integrated GPU, 10.4 TFLOPS FP32, 64 GB unified memory).

Acceleration ships on 9 of 9 chains. BLS pairing is fully on-device on Metal (CUDA builds; WGSL carries the full Fp tower); 2,746+ vectors are byte-equal against the blst oracle. Production binaries are clear of blst symbols, CI-asserted, with blst pinned to a test-only oracle.

Three production workloads beat CPU end-to-end at the Phase-2 crossover (F-Chain NTT 23.6×, B-Chain BLS 9.5×, C-Chain BLS 9.2×). Phase-3 adds correctness-complete on-device pairing across all stages of the BLS12-381 tower (Fp / Fp2 / Fp6 / Fp12 + G2 + Miller + final_exp + e(P,Q)), plus AI/ML inference byte-equal CPU ↔ Metal across 1,000 inputs, plus composite confidential attestation byte-equal C++ ↔ Go.

Headline by chain (representative workload, Phase-1 → Phase-2):

ChainVMPhase-1 vs CPUPhase-2 vs CPUImprovement
FFHEVM NTT N=4096 B=12823.6×23.6×1.0×
FFHEVM NTT N=4096 B=329.0×9.0×1.0×
FFHEVM NTT N=8192 B=1286.2×6.2×1.0×
Ccevm BLS aggregate same-msg, n=10241.0× (host blst flat)9.24×9.24×
Ccevm Groth16 batched, n=16 (synthetic VK)1.0×25×25×
BBridgeVM strict-mode BLS pairing (1k–10k msgs)0.05× (opaque blob)9.5× mean190×
MMPCVM xlarge ceremony0.010×0.156×15.6×
MMPCVM FROST sign 5-of-70.034×0.142×4.2×
PPlatformVM0.004×0.025×6.5×
Ccevm v1 EVM kernel (V2 ships as fallback)0.47×0.47×1.0×
AAIVM FullRound (M1 dispatch-bound; architecture ready for dGPU)0.06×0.06×1.0×
XXVM (Phase-2 not committed)0.02×0.02×—

The residency invariant is satisfied and accelerated at the architectural level on every chain — state and canonical transition logic on device, four-way byte-equal determinism. Phase-2 lands the in-code milestones from Phase-1:

  • cevm batched pairing (shipped) — verify_bls_aggregate_batch, verify_bls_same_message_batch, verify_groth16_batch, verify_corona_batch. The same-message hot path is 9.24× at n=1024 against a ≥10× target; the residual is blst_p1_uncompress cost. Pairing math itself stays on the canonical host body: the single-CB Metal driver measured 475 ms/pairing on M1 Max versus 510 µs host blst — about 930× slower. Metal at N=1 is structurally bounded, because the serial Fp12 chain does not match the SIMD GPU shape. The residency invariant is intact (the production link graph is blst-symbol-free; the canonical C-ABI body remains the host computation). The state-of-the-art single-pairing path is Linux+CUDA.
  • cevm V2 EVM kernel (shipped) — evm_kernel_v2.metal, 32-threads-per-tx threadgroup dispatcher with V1 fallback at status = 255. Build flag LUX_EVM_KERNEL_V2=ON. SIMD opcode fan-out lands in a later point release.
  • bridgevm batched real BLS pairing (shipped) — bls::pre_verify_inbox shards Miller loops across 10 M1 cores with one final exponentiation. 8.58×–10.35× across 1k/5k/10k messages. Per-pairing Miller compute stays on host; the Metal state-of-the-art path requires N>1 batched-parallel kernel saturation, a Linux+CUDA pivot, or Karabina compressed cyclotomic squarings.
  • platformvm single encoder + buffer pool + workgroup-parallel EpochTransition (shipped) — 6.19×–6.77× Metal speedup on every measured workload size.
  • mpcvm per-slot fan-out + parallel leaf reduction (shipped) — 18.64× Metal speedup on the xlarge ceremony.
  • aivm architectural split (shipped) — locate + writeback, size-sweep determinism harness, dGPU-ready dispatch shape. M1 integrated-GPU dispatch latency dominates; speedup is measurable on discrete CUDA hosts.
  • xvm Phase-2 (pending) — the size-dependent CPU ↔ Metal ↔ WGSL divergence flagged in the XVM benchmarks is unresolved. The four-way determinism contract holds at the pinned harness workload only, until the fix lands.
  • fhe dispatcher (held at Phase-1 numbers) — N=4096 B=128 remains the production CKKS slot at 23.6×. Wiring FHEpke / FHEbinfhe through the threshold dispatcher pulls CKKS / BFV / BGV / TFHE into the same band.

CUDA backends build but were not run on the Apple host; H100 and Ada self-hosted runners report separately. The CPU reference oracle — the byte-equivalence ground truth — clears its release-blocking gate on every chain that ships a Phase-2 GPU engine (cevm 6/6, platformvm 15/15, aivm 47/47, bridgevm 49/49, mpcvm 21/21, fhe primitive parity).

Honest bottom line. The substrate-wide geometric mean lift moved 0.17× (Phase-1) → 0.97× (Phase-3 with the pubkey cache) — a 5.7× improvement that has not yet crossed parity. Three workloads beat CPU end-to-end: F-Chain NTT 23.6×, B-Chain BLS 9.5×, C-Chain BLS 16.51× via the pubkey cache.

46. Audit checklist — enforced

Status of each invariant this LP commits to. "Enforced" means mechanically asserted in CI on every build. "Satisfied" means the code path is proven correct once but not blocked by CI. "Pending" means not yet landed.

The test oracle is non-authoritative: blst may appear only in test targets and never in production link graphs. Items 6 and 7 are the mechanical enforcement of that rule.

#InvariantStatus
1All nine chains GPU-native — state and canonical transition on device✓ enforced (per-VM determinism harness)
2Four-way byte-equal CPU ↔ Metal ↔ CUDA ↔ WGSL on every deterministic primitive✓ enforced where the backend lands (BLS Metal byte-equal blst on 2,746 vectors; WGSL full Fp tower 1,900 vectors including fp6_inv and fp12 mul/sqr/inv/conj/cyclo_sqr; CUDA build-only on the Apple host)
3Cert subject binds nine chain transition roots + attestation root + cert mode✓ enforced (quasar_9chain_integration_test.mm, 7 tests)
4Composite confidential attestation across SEV-SNP / TDX / NRAS + RIM✓ enforced (11 parser + 16 composite tests, byte-equal C++ ↔ Go)
5EVM precompile services route through GPU-resident batched drains✓ enforced (per-id batched entry point; KeccakResidencySession ≥ 0.50 hit rate; transcript_root commits to input‖output‖gas‖status byte-equal CPU ↔ Metal)
6Production build has NO direct blst symbols in hot precompile paths✓ enforced. This is a symbol-routing invariant: the production link graph carries zero blst symbols, with all calls going through the canonical cevm::crypto::bls::* C-ABI. The C-ABI body still computes pairings on host CPU — Metal single-pairing on M1 Max is ~930× slower than host blst, so on-device pairing is not in production. The state-of-the-art on-device path is Linux+CUDA or batched-N kernel saturation.
7Production build has NO vendored blst dependency✓ enforced (blst pinned to a test-only CMake oracle)
8Single fused-kernel pairing (≤ 1 dispatch per pairing)pending — today about 280 dispatches per pairing
9WGSL higher-tower pairing ops on M1✓ enforced (full Fp tower runs on WGSL byte-equal against the CPU oracle; 1,900 vectors across 19 ops, achieved by pushing all multi-limb scratches to var<private> storage and decomposing the upper-tower call tree into single-Fp2-frame leaves so the GPU's per-thread function-call stack budget holds)
10CUDA full kernel coverage on a Linux+CUDA CI runnerpending — Apple host is build-only today
11Brand-neutral API across env / C-ABI / Rust / TS / Python✓ enforced

References

ResourceLocation
lp-0110Quasar consensus and certificate lanes
lp-0130Chain topology
lp-4110BLS12-381
lp-4450Pulsar threshold ML-DSA
lp-4655FHE GPU kernels
lp-5620GPU-native EVM
lp-5622QuasarGPU execution adapter
lp-5623Quasar-native app stack
lp-5624Appchain cloud substrate
lp-5627GPU-native crypto stack
lp-8000Z-Chain ZK verification
lp-9000DEX engine

External:

  • NVIDIA GPUDirect RDMA developer documentation
  • NVIDIA Confidential Compute (H100) developer documentation
  • Apple Metal Shading Language Specification (atomic-order limits)
  • CUDA Cooperative Groups and CUDA Graphs documentation

Copyright (C) Lux Industries Inc. All rights reserved.

On this page

AbstractChain coverageCoverage of the CPU reference oracleNine-chain certificate binding1. Residency classes — every object carries a tagDeviceHot — must never leave GPU memory during a roundDeviceWarm — GPU-resident cache, refillableHostCold — cold canonical stateHostControl — allowed on hostForbiddenHot — must NOT appear on the fast path2. Memory layout — offset arenas, no pointer soup3. Rings carry descriptors, not payloads4. Wave scheduler — adaptive service pressure5. CUDA — persistent kernels, graphs, cooperative groups6. Metal — bounded waves and indirect commands7. Networking — direct GPU ingress8. Cold-state page faults — never stall the wave9. EVM fibers — struct-of-arrays, not array-of-structs10. Gas — device-local, deterministic11. Keccak — one batched service12. Precompiles — every precompile is a GPU service13. Crypto precompile optimizationssecp256k1 / ecrecoverBLS12-381PulsarMLDSAGroth16 (Z-Chain rollup)14. ZK proof verification — DeviceWarm VK, batched pairings15. Compliance — GPU-native, never a CPU callback16. DEX precompile optimization17. Semantic reducers18. State lanes and hot-lane promotion19. Block-STM tiered validation20. Repair — bounded, prioritized, checkpointed21. Commit server — fibers emit intents, the server commits22. Root construction — separate roots for separate purposes23. Receipts and logs — compact arena, async export24. Data availability — sign roots, not raw events25. Confidential compute — TEE binding26. Memory safety and privacy hygiene27. Certificate lane optimization28. Multi-GPU sharding29. Workload-class scheduling30. Unknown-contract profiling31. Compiler / JIT tiers32. Revert and journal33. CREATE / CREATE234. SELFDESTRUCT, TLOAD, TSTORE35. Access-list optimization (ConflictSpec)36. Bloom filters37. Deduplication38. Deadline-aware execution39. Proposal search — GPU-native block building40. Security hardening41. Observability without secrets42. Test matrix — CI-enforced residency invariantResidency testsFault testsEquivalence tests — cross-backend determinism43. Roadmap44. The thesis45. Performance — measured46. Audit checklist — enforcedReferencesCopyright