interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

GB10 arithmetic fusion: keep one measured producer-consumer chain in registers or shared memory

Open · #603 · open 2026-10-20 18:06 UTC

Imported from GitHub aien-dev/omega-mv#603, by drakestapleton

drakestapleton wrote on 2026-10-20 18:06 UTC

Governing correction: cached 35B baseline before fusion

Drake's correction, 2026-10-24. The serving target is Qwen3.6-35B-A3B: 40 layers, 256 routed experts, and vocabulary 248,320. Pin the actual serving source, binary/archive, checkpoint, row count, sampling mode and runtime flags before deriving bytes or launch counts.

Serving-speed order: (1) measure and qualify cached scratch on the live 35B path, (2) measure fusion against that qualified baseline, (3) implement and qualify the 8-bit output head. Omega #704/#705 are a parallel planning-tool lane and do not block these direct measurements.

This issue consumes the qualified cached-scratch measurement from #604's baseline arm; it does not wait for completion of #604's later persistent-execution experiment. Recompute the selected 35B chain's bytes, launches and resource demands from its actual execution path. The older 30B/48-layer calculation in CUDApp#18 is historical and must not be reused for 35B.

Preserve already-enabled 35B optimizations and numerical behavior in the comparison. Implement and qualify the owned successor and owned tests in seeded .om; retained comparison algorithms must also meet the current replacement policy.


Problem

Workflow fusion is not arithmetic kernel fusion. src/runtime/rx_fusion.h combines verified action fragments; it does not prove intermediate tensors stay on-chip. Eliminate a demonstrated write/read boundary within one inference computation.

Dependencies and boundaries

Depends on #602. Reuse src/omega_blackwell_codegen.c, src/omega_gpu_matmul_api.c and the current model's execution path. #580 retains ownership of general engine scheduling; #555 retains attention tiling; #569 retains arena allocation. Existing q/k/v and gate/up fusion documented in #328 must not be reimplemented.

Deliver

  1. Pick one hot producer-consumer chain from the baseline (for example a supported activation epilogue), after checking current kernels for existing fusion. Document the exact eliminated intermediate and all consumers.
  2. Emit an opt-in fused native kernel that retains the intermediate in registers/shared memory. Preserve dependency order and the incumbent rounding/reduction contract; do not silently introduce FMA or reassociation.
  3. Keep the original kernel path as a differential reference. Preserve completion, error, bounds and output-validation behavior; coordinate recorded-buffer lifetimes with #562/#569.
  4. Compare unfused and fused versions at identical shapes, weights and precision. Measure actual or explicitly estimated external traffic, registers, shared memory, spills, launch count and end-to-end latency. Include cases near resource limits.

Acceptance

  • Correctness passes the existing numerical gate, including representative tails and boundary shapes.
  • Receipt demonstrates which store/load boundary disappeared; fewer launches alone is insufficient evidence of less DRAM traffic.
  • Resource growth and occupancy tradeoffs are reported; spill regressions are visible.
  • Repeated whole-workload comparison determines whether the candidate improves the intended regime. Freeze promotion criteria before scored runs; keep incumbent if it loses.
  • No claim that fewer workflow nodes guarantees on-chip residency.

Scope and evidence

Use Omega's existing native GB10 codegen/session/engine; no replacement executor or CUDA dependency is implied. Recheck current source, active PRs, repository instructions and execution plan before implementation. Coordinate shared-file ownership. Existing model precision, arithmetic contracts and qualification thresholds remain fixed for the comparison; any changed numerical contract is a separately qualified candidate. Use the existing GPU lock and scheduling protocol; do not interrupt live workloads. Pin source, model, hardware, workload and commands in receipts. Hardware results remain NOT_RUN until actually measured.

Specialization before fusion (2026-10-20)

For the selected chain, split inputs into static facts (model/version, dimensions, dtype/layout, hardware target, numerical contract) and dynamic values (current activations and variable context). Use existing native code generation and preparation/cache facilities to resolve static dispatch, address/layout calculations and reusable packing once where valid. Do not bake dynamic values into the program or claim fixed weights eliminate activation-dependent arithmetic.

  • Compare incumbent, specialization-only, and specialization-plus-fusion arms so eliminated setup work is distinguished from eliminated intermediate traffic.
  • Cache identity includes all specialization assumptions; changed assumptions force regeneration or the existing qualified generic path. Exercise at least one invalidation case.
  • Report cold generation/packing cost, code/cache footprint, warm savings and measured reuse break-even. Bound variant growth.
  • Reuse only deterministic, validated artifacts; include lookup and validation cost in #583's ledger.

Background: CMU staged computation / partial evaluation, https://www.cs.cmu.edu/~fox/staged.html .

TURING integration

Feed qualified candidates and measurements into #522's numerical execution-method selection and #583's cost ledger. No LLM deliberation is required for ranking the finite eligible set. Include selection/preparation/transfer/validation overhead and uncertainty; compare CPU or cached selection with GPU scoring only when worthwhile. Preserve #522's offline-first qualification gate. This changes execution strategy, not the model's underlying semantic inference.

drakestapleton wrote on 2026-10-24 17:48 UTC

Concrete producer-consumer candidate from the current serving code

Read-only source audit of core main 9204c6f99c9b7e8a1b488e109f8010e51a8c4c86. Reuse this issue's arithmetic-fusion owner and #602's ledger; do not create a duplicate fusion programme.

The actual HTTP prefill defaults select whole-prompt plus device router/combine. In run_dev, the gate|up GEMM already includes SwiGLU (Layout::SwigluNat), writes BF16 b.act, then a separate quant call reads that full intermediate to produce FP8 values/scales for down projection. Existing q/k/v and gate/up fusion must not be reimplemented.

Candidate A: BF16-rounded SwiGLU directly to the quantized consumer layout

Let M be prompt rows, K selected experts/token, I expert width, L layers, and G=MK. The materialized BF16 activation write+read is D_act=4LGI bytes per prompt. At the pinned OWN-30B shape M=2048, K=8, I=768, L=48, this is 2,415,919,104 bytes (2.25 GiB) of logical intermediate traffic and L separate quant launches. The reusable activation scratch is only 2GI=24 MiB, not L times that amount. D_act/273 GB/s is an ideal shared-memory traffic scale of 8.85 ms, not a measured speedup; cache residency, spills and other compute can change the realized benefit.

The fused producer must preserve the existing BF16 rounding point before scale selection/FP8 quantization, scale block geometry, row/expert ordering, padding, zero/extreme handling and quantization format. It must not silently quantize the higher-precision accumulator. A 128-value scale group may cross current epilogue ownership; demonstrate how the whole group is reduced without races, extra global staging or unacceptable register/shared-memory pressure.

Candidate B: exact residual-plus-norm pass fusion, if the profile selects it instead

run_dev lines 390-412 performs residual add then RMSNorm in separate host traversals. RMSNorm sums squared f32 inputs in ordered f64, casts the final scale to f32, then multiplies. Computing that f64 sum while storing each rounded f32 residual can remove one subsequent x read without changing the order or rounding. For the post-attention pairs this removes 4LMH logical bytes: 0.75 GiB at L=48, M=2048, H=2048. A separate same-contract experiment can fuse the MoE residual with the next layer's norm.

Moving all norms to the GPU is not automatically equivalent: f64 accumulation is part of this incumbent. Device router/combine are already present, while host routing-plan creation and boundary copies remain. Preserve total_cmp descending/expert-index ascending tie order, selected-slot summation and error behavior if that boundary is changed. Unified physical RAM does not eliminate host/device ownership, synchronization or memory-system contention.

Acceptance additions to #603

  • Select one candidate only after the same qualified serving path is profiled. Keep specialization-only and fusion arms distinct.
  • Prove the intermediate store/load disappears in emitted/native code; separately count logical bytes, available physical counters, launches, fences and host work.
  • Differential-test exact incumbent outputs, expert IDs, scale bytes and quantized bytes, including ties, tails, padding, zero, extreme values and deliberate wrong-scale/wrong-order mutants. A new numeric profile is a separate candidate, not parity.
  • Measure register/shared-memory use, spills, occupancy and full-request TTFT on short/medium/2048-row prompts. Do not promote on a standalone kernel or reduced launch count alone.
  • Keep the old path as reference, bounded scratch and cancellation/error semantics. Deliver through existing seeded .om codegen/runtime migration owners; no new permanent legacy wrapper or hidden alternate engine.
  • Hardware qualification and performance are NOT_RUN in this audit.

Related already-tracked work: core #676 owns cross-job model/layout reuse; core #624 owns the existing greedy graph token path instead of full-logit readback. Those should not be relabeled new kernel-fusion findings.

did:key:z6MkhL6jkVBvyZTg9eMGkJWKQKjnKA1wbA7ym3PkTXt4M6Jd wrote on 2026-11-18 17:15 UTC

Recovered GitHub comment. Original comment 6392676283

Fusion step (2): the router, measured first, then changed behind a switch (PR #727)

Per the governing order, this is quoted against the qualified cached-scratch baseline from #604 (cached default, 19.823 ms/tok server / 20.3094 ms harness at 1 row, same binary family).

Cost split before any change (receipts/router-20261025T022951Z/COST-SPLIT.md): the router's 1.687 ms per token is one CTA's execution (1,052,672 B at 24.996 GB/s on one SM), not launch latency and not host round-trips. The router's launch slot is 42.1 µs while the other kinds' spans are 2.6–8.3 µs, so all 40 boundaries together are ≤ ~0.33 ms, and the layer dependency forbids fusing them away. There is no host round trip in the served decode step: the record path skips staging and sync_to_cpu, and the expert picks are sorted on the device. The "host sort of the expert picks" in omega_gpu_q36_graph.h is the prefill path (omega_gpu_q36_graph.c:1130-1140), a separate real target for prompts.

The chain, in this issue's terms: producer = the router logits (257 rows × 2048), consumer = the select/epilogue that writes ids, weights and both group tables into the launch buffer. The split form (AIEN_OMEGA_Q36_ROUTER_FUSE=1, default OFF) spreads the logits over ceil(rows/32) = 9 CTAs and keeps the select in one CTA, A→B ordered by the list's existing WAIT_FOR_IDLE + invalidate barrier. Costs: +1 launch per layer, +1.0 KB per layer written to global; bytes avoided: none (this is a parallelism fix for a one-SM kernel, not a traffic fix, and it is reported as such).

Proof so far (host): one-launch codegen byte-identical (all 509 q36_codegen_hash lines unchanged, 18 new split lines); simulator parity bit-identical on ids, weights, x′ and both tables at 30B and 35B, 32×9 and 8×33 CTAs, depth 4/8, norm_topk on/off, 2^64 scale; mutants 1–5 caught through the pair; make test-gpu-router 99+23 and test-gpu-router-q36 111+26 checks PASS. The .om successor is named in the PR under the unfinished-migration rule; the C change is minimal and switch-gated.

Chip measurement: NOT_RUN. The modelled −1.17 ms/token is a hypothesis. A second 35B does not fit next to the live 18091 (the 02:47Z OOM), so the pair needs the live server paused, which is an operator decision. Two commands reproduce it (MEASURE.md); the switch stays OFF until measured.

Attention, for the record: its 111.6 GB/s is an occupancy artefact, not traffic: the grid is splits × 4 CTAs, 8–42 % of 48 SMs at positions 0–1100. Not a fusion target.

did:key:z6MkhL6jkVBvyZTg9eMGkJWKQKjnKA1wbA7ym3PkTXt4M6Jd wrote on 2026-11-18 17:15 UTC

Recovered GitHub comment. Original comment 6393107518

Chip measurement for the router split form (PR #727), exclusive window 2026-10-25T03:14–03:46Z, same binary both arms, 1 row: chip 19.875 → 19.600 ms/step (−0.275 ms, −1.38 %), token ids identical. Measured gain is 0.235× the modelled −1.17 ms. Bytes avoided: 0 (parallelism fix, not traffic); launches removed: −1 per layer (one added). Switch stays OFF. Receipt receipts/router-20261025T022951Z/CHIP-RESULT.md.

Sign in to comment