108_designs / CX3_Quest2_development_plan.md
Samonte's picture
Upload folder using huggingface_hub
b4b9425 verified
|
Raw History Blame Contribute Delete
42.9 kB

CX3 β†’ ChipForge Quest 2 (quest_002_npu): development plan

Prepared Mon 2026-11-02 and revised the same day after a requirements audit (Appendix E). Hotkey rabi3-h1. The challenge closes Mon 2026-11-16 10:06 UTC.

Sources. The official challenge package (npu_v2.0.md, cf-stack.schema.json, template/, platform-fabric.json, memory_menu.json; package zip sha256 7f2111a9d97c480f760aba3f0b19acf12d79f7c6bd635dae418ca185dfd60da9), the evaluator release inside it (chipforge_npu_v2_0_evaluator.zip, sha256 9f0400c62f739a182bc7f8240ccfe90fc37f4d0782ee0f944bff21ea91e59aec), the public API (/api/v1/public/snapshot, /api/v1/public/rules) and the CX3 docs (doc/cx3_architecture.md, doc/quest2_port.md). "Β§" refers to sections of npu_v2.0.md. Paths such as rtl/… and sw/… are in the cx3 repo.


0. Summary

  • Goal. One submission (the only one this hotkey gets) that passes every gate and scores S > 8.0, the current score to beat. It needs margin: from the second winner on, a new winner must beat the previous one by more than 20 %.
  • Where CX3 stands. The engine is verified and fast on DeiT, but the bundle would be refused at intake. The stack also lacks the C runtime, the semantics program and the FP32 β†’ int8 compiler path the evaluator requires. A planning model (section 3.2) puts CX3 as it is at roughly S β‰ˆ 5–10, so performance work is needed as well.
  • Critical path. Compliance shell β†’ NPU running inside the evaluator SoC β†’ compiler, quantiser and semantics for all 7 models β†’ weights in on-chip SRAM + fused blocks β†’ split dot units β†’ full local evaluation β†’ submit by Fri 11-13 (latest Sun 11-15 06:00 UTC).
  • Submission gate. Two local cf-check-docker --full runs PASSED, local S β‰₯ 9.7 (higher if someone wins first), and a full evaluation that finishes in ≀ 90 minutes on a 16-core machine (section 9).

1. Constraints that shape the plan

Area Constraint Source
Timeline Opened Mon 11-02 10:06 UTC; submissions accepted from Tue 11-03 10:06 UTC; closes Mon 11-16 10:06 UTC API snapshot, rules
Attempts 1 submission per hotkey; 60-minute cooldown; zip ≀ 50 MB rules
Bar Score to beat 8.0; from the 2nd winner on, > previous winner Γ— 1.20; two validators must agree within 0.1 % rules
Rewards 24 h probation, then 48 h paid on a 3-place ladder (ratio 0.35); a winner's design is revealed to registered neurons 18 h after it wins rules, reveals
Score S = P Γ— min(1, 50 mmΒ² / A)^Β½; P = geometric mean of 14 ratios (7 models Γ— SingleStream and Offline) against half the Coral ceiling Β§15
Evaluation window Each batch has a 125-minute evaluation window; a run that had the full window and still timed out scores 0 rules, ChipForge_SN108/README.md
Compile box 1 CPU, 2 GiB in total (compiler tree and outputs included), 1,800 CPU-s hang guard, no network; three byte-identical compiles, also across AVX2 and AVX-512 machines; only the compiler directory is visible Β§9
Semantics Python 3.12 + numpy, integer-only, no BLAS in the authoritative path, stateless per record; one record ≀ 4 MiB Β§11
Track C Every deployed weight or bias integer = clamp(round(w / s) + zp) of the checkpoint after the allowed folds (BN, slice, transpose, LayerNorm fold, attention-scale fold) Β§12, cf-paramap.schema.json
RTL Verilator 5.038 -Wall (warnings fatal) and Yosys 0.56; no initial, attributes, tool macros, library cells, latches or loops; ≀ 1,000,000 GE of a module's own logic Β§4.3, Β§7.2, Β§13.1
Clock period_ps β‰₯ max(1,869, Nangate45 STA Γ— 12 / 22.105 = Γ— 0.543) Β§5, platform-fabric.json
Memory On-chip SRAM only from the 57 cf_sram_* macros (junk at power-up); about 2.1 mmΒ² per MiB at 28 nm (1RW, nominal) Β§6.2, physical/target/calibration.json
Machine The local checker needs Linux + Docker, 16 cores / 64 GB recommended. The Vast container can't run Docker Β§17

2. Gap list: CX3 bundle against the rules

# Gap Fixed in
G1 cf-stack.json fails the schema: division edge-vision (must be dev-vision), no M_DW/N_M, rtl_dir, licences, compiler.build, runtime.dir + campaign_abi, semantics_dir; extra fields design, rtl, compiler.language Phase 1
G2 npu ports: no irq_o, 32-bit master addresses (need 40), 4-bit master IDs (need 6), 128-bit configuration slave (the slot's is 32-bit), parameters DW/P instead of M_DW/N_M Phase 1 (done)
G3 Refused RTL: `ifndef SYNTHESIS (cx2_npu.sv:237, cx2_conv.sv:99), initial $fatal, 25 (* … *) attributes, modules named FA_X1, HA_X1, BUF_X1, XOR2_X1, sky130_fd_sc_hd__* in cx2_cells.sv, $display trace blocks Phase 1
G4 No C runtime (campaign ABI 2) Phases 1–2
G5 No cf-semantics/1 program Phases 1–3
G6 Compiler CLI isn't the evaluator's; it expects QDQ int8 ONNX instead of FP32 + calibration; onnxruntime sits in the emitted-byte path Phase 3
G7 72 KiB double-banked flop weight file (2 Γ— L Γ— KC Γ— 1024 bits) plus its select logic inside cx2_conv: likely over the 1M GE per-module limit Phase 1 (measure), Phase 5 P1 (fix)
G8 2,000 ps needs Nangate45 STA ≀ 3.68 ns with the evaluator's flow; the old plan assumed 6.0 ns Phase 1
G9 Operators missing for the panel: YOLOX decode (Sigmoid, Exp, ScatterND), SPP 9/13 max-pools, Focus; DeepLabV3 AveragePool, Resize and probably dilation; SSDLite's two outputs; EfficientNet's Pad and shape subgraphs Phase 4
G10 Speed: layer-by-layer DRAM traffic, 128-wide dots on narrow layers, fixed cost per pass Phase 5

3. Targets

3.1 Per-model targets (SingleStream cycles at 2,000 ps)

The score is a geometric mean, so these tiers are a balanced plan, not hard limits per model. Offline throughput is assumed to track SingleStream.

Model Baseline L_b Floor tier: ratio β†’ cycles Plan tier: ratio β†’ cycles CX3 today
MobileNetV2 1.500 ms 4Γ— β†’ 187,500 6Γ— β†’ 125,000 est. 1–2Γ—
EfficientNet-Lite0 2.470 ms 5Γ— β†’ 247,000 7Γ— β†’ 176,400 est. 2–4Γ—
SSDLite-MobileNetV2 8.450 ms 8Γ— β†’ 528,100 10Γ— β†’ 422,500 est. 3–7Γ—
ResNet-50 24.15 ms 8Γ— β†’ 1,509,400 10Γ— β†’ 1,207,500 est. 5–10Γ—
YOLOX-S leaky 67.0 ms 7Γ— β†’ 4,785,700 9Γ— β†’ 3,722,200 est. 5–9Γ—
DeiT-tiny 43.75 ms 30Γ— β†’ 729,200 35Γ— β†’ 625,000 measured 26.8Γ— (817,004 cycles)
DeepLabV3-MobileNetV2 388.5 ms 30Γ— β†’ 6,475,000 40Γ— β†’ 4,856,300 est. 23–44Γ—
S β‰ˆ 9.7 β‰ˆ 12.7 β‰ˆ 5–10

3.2 Planning model

quest2_tools/scenario.py models each MAC layer as max(compute, DRAM traffic) + a fixed cost per pass, with DRAM at 64 B/cycle and a 2,000 ps clock. It ignores input re-reads per output-channel group, non-MAC passes and stalls. Against CX3's measured DeiT (817,004 cycles vs 424,000 modelled) it is about 1.9Γ— optimistic, so read each S as the range [S / 1.9, S].

Scenario MNv2 EffNet SSDLite ResNet YOLOX DeiT DeepLab S (model) S (Γ· 1.9)
A: CX3 today (weights and activations via DRAM, 128-wide dots, 4,096 MAC/cycle) 2.3 3.6 6.5 10.0 9.3 51.6 44.4 10.2 5.4
B: A + weights in on-chip SRAM + fused blocks 3.9 5.6 9.8 10.8 9.6 54.4 57.4 13.2 6.9
C: B + 64-wide split dots, 2Γ— depthwise rate 6.1 8.3 14.9 11.6 10.0 67.6 75.3 17.2 9.0
D: C + 8,192-MAC array 11.0 14.8 27.2 21.0 18.7 133.6 140.2 31.7 16.7
  • A is not safe and B is borderline.
  • C is the first scenario whose pessimistic end clears 8.
  • D is the answer if a competitor wins first and the bar moves to 1.2 Γ— their score.
  • Measure after every step. The real optimism factor should shrink as DRAM re-reads disappear.

4. Architecture decisions (lock on day 1)

ID Decision Why
D1 Keep the CX3 engine (cx2_dots, conv, out, win, rd, wr, dw, dec) and its bit-exact suites; wrap it in the official slot Verified; time is short
D2 Fabric M_DW = 1024, N_M = 2 (CX3's native P = 2, DW = 1024) Ingress area is only 0.0085 mmΒ²; the floor is 1,869 ps for every fabric
D3 One SoC clock, declared from measured STA (start at 2,000 ps; 1,869 ps if STA ≀ 3.44 ns). No extra clock domains in v2.0 Domains are PROPOSAL and add crossing-check risk
D4 Weights live in cf_sram_* macros, preloaded during the untimed prepare phase; DRAM streaming stays as the fallback when a model's weights don't fit (ResNet-50, large variants) Biggest single speed lever; variants need the fallback
D5 Activations in an on-chip buffer with fused inverted-residual blocks; tensors that don't fit spill to DRAM in row tiles MobileNet-family traffic drops from 13.5 to 1.8 MB per inference
D6 Input normalisation as a per-channel 256-entry table on the NPU, never folded into weights Track C
D7 Calibration by progressive integer simulation: quantise layer k, run it exactly in integers on the calibration images, measure layer k+1's input range. Integer-valued matrices through float64 BLAS are exact in any summation order (all sums < 2⁡³), so this is deterministic on any CPU and fast enough for the 1-CPU box §9.4 determinism; 1,800 CPU-s budget
D8 Semantics: the stock prims.run_semprog for every op it covers; a custom numpy-integer program only for the rest (DeiT softmax and LayerNorm unless CX3 adopts the rnorm algorithm of prims/row.py; YOLOX decode if tables aren't enough). Custom code calls prims.gemm.matmul_nt, the evaluator's own exact integer GEMM Less code to keep bit-exact
D9 Output types: classification logits requantised to int16 at one output scale (the last layer has per-channel weight scales, so its raw int32 accumulators can't share one affine decode); YOLOX predictions as int32 at scale 2⁻¹⁢ (2.9 MB, under the 4 MiB limit); SSDLite scores and deltas int16/int32; DeepLab logits int16 int8 outputs cost accuracy: argmax ties, coarse boxes, lost low scores
D10 Weights are deployed in the payload in a plain C-order layout per layer, which cf-semprog constants can describe (offset, stored shape, transpose, slice). During prepare the NPU re-lays them into its own format: into weight SRAM (P1), or into a DRAM buffer for weights that stay streamed The semantics must read the same payload bytes the hardware loads (Β§11 binding), and Track C maps those bytes back to the checkpoint. CX3's current interleaved weight image can't be described that way

5. Phases

Each phase lists tasks and an exit test. RTL, compiler and runtime work run in parallel where the dependencies allow.

Phase 0 β€” Setup (Mon 11-02 β†’ Tue 11-03)

  • 0.1 Dev machine: Linux x86-64, Docker (cgroup v2), β‰₯ 16 cores / 64 GB, SSD state directory; gVisor (runsc) optional (validators use it).
  • 0.2 Evaluator: unzip the package and the evaluator, cf-evaluator/v2/deploy/load_images.sh pull (Appendix D).
  • 0.3 Template baseline: cf-check-docker cf-miner/template --workloads public-tiny-cnn β†’ PASSED. Record its cycles (reference: about 2.39 M cycles per query).
  • 0.4 Miner side in ChipForge_SN108/:
    • create .venv and install requirements.txt + -e .;
    • write .env (MINER_WALLET_NAME=rabi3, MINER_HOTKEY=rabi3-h1, MINER_WALLET_DIR, CHALLENGE_API_URL=https://api.chipforge.io);
    • confirm the hotkey is registered on netuid 108 and miner_cli.py status works.
  • 0.5 Leaderboard watch, daily: curl -s https://api.chipforge.io/api/v1/public/snapshot | jq '{score_to_beat, server_winner, submissions}'.
  • 0.6 Branch q2 in the cx3 repo and create the package skeleton (Appendix B).

Exit: the template passes locally; miner_cli.py status shows quest_002_npu.

Phase 1 β€” Compliance shell (Tue 11-03 β†’ Thu 11-05)

Goal: the CX3 RTL inside a package that passes intake, lint, the SoC build and the public-tiny-cnn run, with the NPU idle (template CPU runtime).

Status (Mon 11-02). The package is in /workspace/cx3_q2 (zip /workspace/cx3_q2.zip; RTL changes as /workspace/cx3_q2_rtl.patch for the cx3 repo). It passes quest2_tools/precheck.py (0 problems; the original bundle gives 52), its port list is identical to the template's, and the zip is reproducible. Open: 1.5–1.7 and the exit test need Verilator 5.038, Yosys 0.56, OpenSTA and Docker, which can't be installed on this machine. Found on the way: CX3's configuration slave was 128-bit (the Quest 1 window); the slot's is 32-bit (fixed in cx2_slave.sv).

  • 1.1 cf-stack.json as in Appendix B, validated against schema/cf-stack.schema.json. Every name in accelerator.params becomes a Verilog parameter of npu, so declare all of them (waive unused ones with lint_off UNUSEDPARAM and a reason).
  • 1.2 rtl/npu.sv (irq_o tied low until Phase 2):
    • copy the port list from template/rtl/npu.sv exactly;
    • parameters M_DW, N_M plus your own; map P = N_M, DW = M_DW;
    • 40-bit master addresses, 6-bit master IDs, irq_o;
    • the slave decodes the full 32-bit host address (base 0x3000_0000) and answers OKAY to every address the runtime uses. An error response ends the run.
  • 1.3 Remove refused constructs (also dropped: the Quest 1 hand-built variants cx2_dots, CX2_HAND_DOTS, CX2_HAND_RQ, which the evaluator never selects):
    • delete the `ifndef SYNTHESIS blocks and initial $fatal (move parameter checks to the compiler);
    • remove all (* … *) attributes;
    • rewrite the cx2_cells.sv cell modules as plain RTL (assign {co, s} = a + b + ci;) under non-reserved names;
    • delete the $display blocks;
    • drop cx2_cg (use cf_icg if you ever gate clocks).
  • 1.4 rtl/files.f lists every .sv; .svh files only through `include from listed files; no paths outside rtl/.
  • 1.5 Lint:
    • verilator --lint-only -Wall -Wno-EOFNEWLINE clean, with inline waivers that state a reason;
    • yosys -p "hierarchy -check -top npu; proc; check -assert" clean (no latches, no loops).
  • 1.6 Size check: Nangate45 synthesis per module, GE = area / 0.798 Β΅mΒ². List every module whose own logic is > 600k GE. Expect cx2_conv (weight file + select); its fix is P1.
  • 1.7 Clock: STA of npu with the evaluator's Nangate45 recipe and the port budgets in platform/gen/npu_io_budget.json; register every port. Declare period_ps = max(1,869, ⌈STA Γ— 0.543 Γ— 1.03βŒ‰).
  • 1.8 Runtime, semantics and compiler: the template ones for now. Move CX3's compiler under compiler/, because the compile box only sees that directory.
  • 1.9 SPDX headers + the licences entry; LICENSE, NOTICE, README.md.
  • 1.10 package.sh (quest2_tools/package.sh, with quest2_tools/precheck.py):
    • zip from inside the stack root (cf-stack.json at the archive root);
    • keep the executable bit on compiler/compile and compiler/build;
    • regular files only (no symlinks); no __pycache__, .pyc or binaries;
    • path components use [A-Za-z0-9_.+-], are ≀ 128 characters and don't start with -; paths ≀ 255 bytes, depth ≀ 32, unique ignoring case;
    • zip < 50 MB; print the sha256.

Exit: cf-check-docker cx3_q2.zip --workloads public-tiny-cnn β†’ PASSED with CX3 instantiated.

Phase 2 β€” NPU inside the evaluator SoC (Wed 11-04 β†’ Sat 11-07)

Goal: public-tiny-cnn's MAC layers run on CX3, bit-exact with the semantics.

  • 2.1 Address model:
    • NPU addresses are DRAM physical offsets (host address βˆ’ host_dram_base 0x4000_0000);
    • never touch the first 64 KiB;
    • the program and weight image is a read-only placement at a fixed address β‰₯ 0x10000;
    • scratch space is a buffer;
    • inputs and records come from ABI pointers (they move in relocation runs) and are passed to the NPU for every query.
  • 2.2 Register map (Appendix C): add IN/OUT bases, IRQ, preload control and performance counters to CX3's PROG / START / RELOC.
  • 2.3 Runtime (runtime/runtime.c, campaign ABI 2):
    • cf_runtime_init: programs the NPU and preloads weights.
    • cf_runtime_query: writes the IN/OUT bases and starts the NPU, then waits (cf_npu_wait, or WFI + irq_o). It returns only once every output write is durable (all B responses in).
    • cf_runtime_record: returns the record buffer.
    • Handles any number of queries: the four N = 8 models get an extra correctness run of 9–12 queries, with query q + 8 delivered after query q's capture.
    • Builds with -Wall -Wextra -Werror and no C library. Avoid struct copies and large zero-initialisers (GCC may turn them into memcpy/memset calls), or define those two functions yourself.
    • .rodata, .data, .bss and the 4 KiB stack share the 64 KiB data TCM, which the NPU can't read; tables go in DRAM.
    • Clear mstatus.MIE before returning.
  • 2.4 Window discipline:
    • In SingleStream the NPU must be idle when a query returns. A write first presented while the gate is closed, over an input or a captured record, scores βˆ’1.
    • Never wait on NPU traffic outside a window (NO_PROGRESS).
    • No input-derived data may outlive its query (no response cache): every activation buffer is rewritten for each query.
  • 2.5 Compiler output: campaign.json, model.c, footprint.json and the semprog program, with requantisation tflite_double_rounding (CX3's TFLM arithmetic).
  • 2.6 Bus rules:
    • INCR bursts of 1–256 beats, never crossing 4 KiB;
    • VALID low at the reset edges;
    • tolerate long holds on AR/AW/W outside windows.
  • 2.7 Calibrate CX3's own DRAM model (tb/axi_dram_mp.sv plusargs) against one evaluator run, so the fast testbench predicts evaluator cycles.

Exit: public-tiny-cnn PASSED (Gate A, randomised initialisation, relocation) with every MAC layer on the NPU; cycles per query recorded.

Phase 3 β€” Compiler, quantiser, semantics (Wed 11-04 β†’ Mon 11-09)

  • 3.1 compiler/compile implements --model --workload --stack [--calib] [--tuning] --out. It reads the input contract and output names from workload.json; never hard-code model names. --calib is only passed when the workload has calibration data: without it, fall back deterministically (for example fixed pseudo-random uint8 images) instead of failing.
  • 3.2 ONNX import (onnx 1.18) with static shapes. Constant-fold the shape subgraphs (Shape, Gather, Ceil, Concat, Unsqueeze, ConstantOfShape, Equal, Where, Expand) in numpy integers.
  • 3.3 Graph rewrites: the patterns in Phase 4's table.
  • 3.4 Quantiser (D7):
    • Weights: per-channel symmetric int8, using the Track C formula; scale from max|w| or an MSE search over the given weights.
    • Biases: int32 = RNE(b / (s_wΒ·s_x)), with zero-point unfolding.
    • Activations: scales and zero points from progressive integer calibration with percentile/MSE clipping, snapped to a fixed grid.
    • Wider types: int16 where Phase 6 asks for it.
  • 3.5 Track C:
    • emit cf-paramap/1 for every deployed weight and bias (ln_fold, graph_scale, slice for DeiT);
    • list every mapped payload file in semantics.json payload.reads;
    • every float Conv/Gemm/MatMul weight, Linear bias and LayerNorm gamma/beta the evaluator extracts must be consumed by an entry;
    • MAC constants that aren't model parameters (for example pooling done as a depthwise convolution) are declared as structural;
    • validate with v2/pipeline/numerics/tracks.py.
  • 3.6 Semantics (D8):
    • Use the semprog ops conv2d (with dilation, leaky, table), depthwise_conv2d, fully_connected, add, pools, mean_hw, pad, concat, lut, mul, rescale, resize_nearest, slice, transpose, rnorm.
    • Compare prims/row.py rnorm with CX3's softmax and LayerNorm.
    • Otherwise ship a custom program in payload/numerics/: numpy integers, no BLAS, stateless per record.
  • 3.7 Determinism:
    • two clean builds of the compiler give identical trees (REBUILD_NOT_REPRODUCIBLE);
    • three identical compiles per model;
    • repeat on an AVX-512 and an AVX2 machine;
    • PYTHONHASHSEED=0, sorted iteration, no clocks or unseeded randomness.
  • 3.8 Box budget per model: peak memory < 1.5 GiB, CPU < 600 s, /tmp < 256 MiB, output < 512 MiB and < 4,096 files.

Exit: all 7 slot workloads compile in the box (--workloads slotN-… --no-variants), Track C passes, and the semantics run within their limits.

Phase 4 β€” Operator coverage (Thu 11-05 β†’ Tue 11-10)

Family Operators and patterns Mapping on CX3 Notes
all Sensor prefix (Cast, Transpose, Mul, Sub, Div); uint8 NHWC input Input pass: per-channel table β†’ CX3 layout, on-chip EfficientNet (0.5 / 0.5), DeepLab (127.5 / 127.5) and YOLOX (none) use the same mechanism
all Outputs in the declared dtype and layout The writer emits the record layout directly into the record buffer D9
MobileNetV2 Conv 1Γ—1, depthwise 3Γ—3 s1/s2, stem 3Γ—3 s2, Clip, Add, GlobalAveragePool, Gemm Existing; stem via im2col (K = 27)
EfficientNet-Lite0 + depthwise 5Γ—5, Pad (asymmetric "SAME"), shape subgraph Pad β†’ conv window padding; shape subgraph constant-folded 5Γ—5 depthwise exists in CX3
SSDLite + many small head convs; Reshape, Transpose, Concat into 2 outputs Layout by placement; two output tensors scores [3234, 81], box_deltas [3234, 4]
ResNet-50 7Γ—7 s2 stem, 1Γ—1 / 3Γ—3, Relu, Add, MaxPool 3Γ—3 s2, Gemm Stem via im2col (K = 147); Add fused into the third conv
YOLOX-S Focus (4 Slices + Concat β†’ 12 channels), 3Γ—3 / 1Γ—1, LeakyRelu (0.1), Concat, Resize nearest Γ—2, MaxPool 5 / 9 / 13 (SPP), decode (Sigmoid, Exp, grid add, Mul, ScatterND, Transpose) Focus folded into the first conv; SPP 9 = 5∘5 and 13 = 5∘5∘5 (exact for max); decode as an output-stage pass with tables into int32 The decode's anchor count changes with input size (variants)
DeiT-tiny Patch conv 16Γ—16 s16, Gemm / MatMul, LayerNorm, Softmax, Erf-GELU, Split / Squeeze / Transpose, Gather (class token), Concat, Where / Equal / Expand Existing transformer modes; GELU table; ln_fold and graph_scale Head dimension 64 (see P3)
DeepLabV3 Depthwise 3Γ—3 at 65Γ—65 (output stride 8: check the dilations attribute), global AveragePool, Resize 1Γ—1 β†’ 65Γ—65, Concat, Relu / Clip Dilated windows; global pool; Resize as a broadcast 513Γ—513 input; largest tensor 6.3 MB

Exit: every operator of the 7 families runs on the NPU (host-fallback list empty or negligible), and local runs with variants pass on 3 seeds.

Phase 5 β€” Performance (Sat 11-07 β†’ Wed 11-11)

Do these in order. Measure each in CX3's own testbench (fast), then confirm with cf-check per slot.

Step Change Expected effect (planning model)
P1 Weight SRAM: about 10 MiB of cf_sram_1rw_16384x128 (40 Γ— 256 KiB β‰ˆ 21 mmΒ² at 28 nm). Bank it so a weight-file refill runs β‰₯ 8Γ— faster than from DRAM: each 128-bit macro port gives 16 B/cycle, so 40 macros give up to 640 B/cycle. DMA preload in prepare; DRAM streaming fallback. Shrink or restructure the flop weight file (G7) With P2: S 10.2 β†’ 13.2
P2 Activation SRAM (2–4 MiB) + fused inverted-residual blocks; tensors ≀ 1 MiB stay on-chip; larger ones tiled by rows (YOLOX 320/160 stages, DeepLab's 513 input) MobileNet-family DRAM traffic 210k β†’ 28k cycles
P3 Split dot units (128 β†’ 2 Γ— 64 or 4 Γ— 32 across extra pixels or heads); im2col for stems; depthwise β‰₯ 1.5k MAC/cycle S 13.2 β†’ 17.2
P4 Fixed cost per pass: prefetch the next descriptor and its weights from SRAM, issue back to back; target < 50 idle cycles between passes MobileNetV2 has 53 passes inside a 125k-cycle target
P5 Offline: start query q+1 while q drains (Offline only); for weight-streamed models, run 2 / 4 / 8 queries per weight load Offline ratios β‰₯ SingleStream ratios
P6 Only if the simulation-time and GE budgets allow: L = 32 β†’ 8,192 MAC/cycle S 17.2 β†’ 31.7
P7 Clock 2,000 β†’ 1,869 ps if STA ≀ 3.44 ns +7 % on every ratio

After every step, check:

  • per-module GE (< 1M own logic);
  • SRAM ISSUE_INTERVAL / READ_LATENCY against the macro's 28 nm timing at the declared clock. For a 256 KiB macro (16 banks of 1024Γ—128) the projection is a 0.86 ns cycle and 1.12 ns access, so N = L = 1 fits at 2,000 ps;
  • the macro simulation rules: one request per ISSUE_INTERVAL (a request while busy stops the simulation), rdata_o captured exactly READ_LATENCY cycles later, no read and write of one address in the same cycle (1R1W/2RW);
  • the preload fits the prepare bound (4 Γ— the model's latency ceiling for SingleStream, 9 Γ— for Offline);
  • area ≀ 45 mmΒ² nominal;
  • Verilator speed (the full evaluation must stay ≀ 90 min).

The weights must be loaded during prepare so the first SingleStream query isn't slower. The score uses the slowest of the hidden inputs.

Phase 6 β€” Accuracy (in parallel with Phases 3–5)

  • 6.1 Harness: FP32 (onnxruntime) against your semantics on the quality split and the calibration images, scored with the evaluator's metrics (v2/pipeline/workloads/metrics/): top-1, COCO mAP, mIoU. Compare with the reference int8 per-item results in policy/data/workloads/quality/.
  • 6.2 Model-specific fixes:
    • MobileNetV2 / EfficientNet-Lite0: per-channel weights everywhere (per-tensor collapses the depthwise layers); ReLU6 outputs as uint8 over [0, 6]; logits per D9.
    • ResNet-50: exact rescaling at every residual Add.
    • YOLOX-S:
      • int32 output at 2⁻¹⁢;
      • decode in β‰₯ 16-bit fixed point (the metric keeps detections down to object Γ— class score β‰₯ 0.001, then NMS 0.45, top 100, mAP over IoU 0.5–0.95);
      • shared scales for each Concat's inputs;
      • the LeakyReLU slope in the requantiser.
    • DeiT-tiny:
      • int16 residual stream;
      • LayerNorm statistics in int32/int64 with an rsqrt of β‰₯ 16 bits;
      • softmax with max subtraction, an exp table and a β‰₯ 16-bit sum and reciprocal;
      • GELU as an exact 256-entry table;
      • a zero point after GELU.
  • 6.3 Gate A fuzzing: random inputs plus edge patterns (all 0, all 255, stripes) through RTL and semantics, per model and per random variant shape.
  • 6.4 Hidden-variant health: NRMSE of every output against FP32 ≀ 0.5 (rule); aim for ≀ 0.1.

Exit:

  • Classification on the 32-image quality split: within one image of the int8 reference. To pass outright, FP32 needs 17/32 for MobileNetV2 and DeiT, and 22/32 for EfficientNet-Lite0 and ResNet-50.
  • mAP and mIoU within 0.01 of the int8 reference.
  • Gate A clean under fuzzing.

Phase 7 β€” Full local validation (Tue 11-10 β†’ Thu 11-12)

  • 7.1 cf-check-docker cx3_q2.zip --state ~/cf-full --full --json full-1.json, then again with a second seed.
  • 7.2 Read the report:
    • S, and P per model for SingleStream and Offline;
    • eligibility, Gate A, Gate B, variants, Track C;
    • physical: area, STA floor, per-module split;
    • energy (reported only);
    • wall time, which must be ≀ 90 min on 16 cores.
  • 7.3 Compile determinism on a second machine with a different SIMD width.
  • 7.4 Gate-level lockstep: simulate the synthesised netlist against the RTL with random initial state (CX3's build_gl.sh flow). A mismatch leaves the official evaluation unscored (GATE_LEVEL_MISMATCH), so no record.
  • 7.5 Read each run's energy lower bound. Below 3 W keeps the design eligible if the announced v2.1 power cap starts during the quest.
  • 7.6 Fix and re-run; freeze when two consecutive full runs pass.

Phase 8 β€” Submission (Thu 11-12 β†’ Fri 11-13; latest Sun 11-15 06:00 UTC)

  • 8.1 Go/no-go (section 9).
  • 8.2 Freeze: tag the repo, build the zip, record its sha256, and re-run the quick check on that exact zip.
  • 8.3 miner_cli.py submit cx3_q2.zip --dry_run, then ./submit_solution.sh (--check_status).
  • 8.4 Watch miner_cli.py status. After the batch closes, fetch miner_cli.py logs <submission_id>.
  • 8.5 If it becomes a record: 24 h probation, then 48 h paid. The design is revealed 18 h after it wins.
  • 8.6 Release files (Β§16, PROPOSAL, not scored): RIGHTS.json signed by the hotkey, THIRD_PARTY.json, regs.json, tests/, documents under CC-BY-4.0. The evaluator doesn't define their formats, so ask the ChipForge team before a nomination.

6. Schedule

Date (UTC) Work Milestone
Mon 11-02 Phase 0
Tue 11-03 Phase 1 (manifest, wrapper, cleanup); Phase 3 starts Submissions open 10:06
Wed 11-04 Phase 1 (lint, GE, STA); Phase 2 starts
Thu 11-05 Phases 2 and 3 M1 compliance shell PASSED
Fri 11-06 Phases 2 and 3; Phase 4 starts
Sat 11-07 Phase 2 exit; P1 starts M2 public-tiny-cnn on the NPU, Gate A clean
Sun 11-08 Phases 3, 4, 5
Mon 11-09 Phase 3 exit; Phases 4, 5 M3 all 7 models compile and pass Gate A on the NPU
Tue 11-10 Phase 4 exit; P2, P3; first full run
Wed 11-11 P3, P4, P5; accuracy fixes M4 floor-tier cycles on β‰₯ 5 of 7 models
Thu 11-12 Phase 7 runs and fixes M5 full local PASSED, S β‰₯ 9.7, ≀ 90 min
Fri 11-13 Go/no-go, submit M6 submitted
Sat 11-14 – Sun 11-15 Contingency; latest submission Sun 06:00 UTC
Mon 11-16 10:06 Challenge closes

7. Test and measurement

Level Tool When
Engine units CX3 suites tests/test_{chain,pack,ew,dwl,avg,split,win,q2,cat,batch,tfm}.py, with random reset and relocation Every RTL change
Model cycles CX3 tb_npu + calibrated DRAM model, per model Every performance change
Integration cf-check-docker … --workloads slotN-… --no-variants Daily, per model
Variants cf-check-docker … --workloads slotN-… --variants, 3 seeds From Phase 4
Full cf-check-docker … --full, 2 seeds From Phase 7
Physical Per-module GE, Nangate45 STA, 28 nm area Every change that adds logic or SRAM

Scoreboard (update daily, one row per model):

Model SS cycles Offline q/s r_SS r_Off DRAM MB / query MAC utilisation Host-fallback ops Gate A Accuracy vs FP32 / int8 ref
MobileNetV2
EfficientNet-Lite0
SSDLite-MobileNetV2
ResNet-50
YOLOX-S leaky
DeiT-tiny
DeepLabV3-MobileNetV2

8. Risks

Risk Likelihood / impact Mitigation
14 days is tight for the full stack High / High Cut list (section 10); compliance and correctness before speed; daily milestones
Full evaluation longer than the 125-minute window β†’ scores 0 Medium / High Measure wall time from Phase 7 (earlier with a 3-model run); watch array size and Verilator cost; SRAM macros instead of flop arrays
A module over 1M GE β†’ refused Medium / High Phase 1 measurement; weight file to SRAM (P1); split wide multiplexers into submodules
Clock overclaim Medium / High Declare from STA with a 3 % margin
Compile output differs on another CPU Medium / High D7; test on AVX2 and AVX-512
Track C violation Medium / High Local tracks.py check on every compile
Gate A mismatch on variants or edge inputs Medium / High Shape-generic compiler; random-shape fuzzing
YOLOX or DeiT accuracy Medium / Medium D9 output types; Phase 6 fixes
βˆ’1 penalties (NPU writes outside the window, placement dependence, batch-dependent semantics, published weights) Low / Very high Runtime rules in 2.4; ABI pointers only; stateless semantics; compile only from the given model
NO_PROGRESS on long on-chip runs Low / High Keep each query < 10 M cycles, or keep DMA activity visible
A competitor wins first (bar β†’ 1.2 Γ— their score) High / Medium Daily leaderboard check; plan tier S β‰ˆ 12.7; P6 if the bar moves
No Docker on the Vast container Certain / Medium Use a separate 16-core / 64 GB Linux machine
Netlist and RTL disagree (X propagation, simulation/synthesis mismatch) β†’ unscored Low / High Task 7.4; reset everything that reaches an output
v2.1 3 W power cap starts during the quest Low / High Task 7.5; gate idle logic with cf_icg if the bound is close
A variant arrives without calibration data Medium / High Deterministic fallback in task 3.1

9. Go/no-go checklist (all must hold)

  • Two local --full runs PASSED and eligible, with different seeds.
  • Local S β‰₯ max(9.7, 1.15 Γ— the required score at that moment). The required score is 8.0 before any winner and 1.2 Γ— the score to beat after one.
  • Full evaluation wall time ≀ 90 min on a 16-core / 64 GB machine.
  • Variants passed on 3 seeds.
  • Compile output byte-identical on two machines with different SIMD widths.
  • Physical:
    • no module above 800k GE of own logic;
    • declared clock β‰₯ STA floor Γ— 1.03;
    • area ≀ 45 mmΒ² nominal.
  • Zip < 50 MB, --dry_run OK, sha256 recorded, hotkey registered.
  • No host-fallback operator on any panel model's critical path.
  • Gate-level lockstep clean (7.4); energy lower bound < 3 W on every run (7.5).

If the gate can't be met by Sun 11-15, still submit the best compliant build before the close. The slot has no value after the quest, and the official evaluation logs are useful for the next one.


10. Cut list (drop from the top when late)

  1. P6 (8,192-MAC array)
  2. P7 (1,869 ps clock)
  3. P5 (Offline overlap)
  4. P4 (fixed cost per pass)

Everything else (Phases 1–4, P1–P3, Phases 6–7) is required for S > 8.


Appendix A β€” Panel model facts (evaluator inventories, policy/data/workloads/models/)

Model Input GMAC int8 weights Largest tensor MAC mix Special ops Output L_b Offline N Ceiling
MobileNetV2 224Γ—224Γ—3 0.30 3.47 MB 1.20 MB 89 % 1Γ—1, 7 % depthwise Clip, Add, GAP, Gemm logits [1, 1000] 1.500 ms 24 3.00 ms
EfficientNet-Lite0 224Γ—224Γ—3 0.39 4.61 MB 1.23 MB 88 % 1Γ—1, 9 % depthwise (3Γ—3, 5Γ—5) Pad Γ—5, shape subgraph, Clip, Add logits [1, 1000] 2.470 ms 24 4.94 ms
SSDLite-MobileNetV2 320Γ—320Γ—3 0.75 4.18 MB 2.46 MB 6 % depthwise Head Reshape / Transpose / Concat scores [3234, 81] + box_deltas [3234, 4] 8.450 ms 24 16.9 ms
ResNet-50 224Γ—224Γ—3 4.09 25.50 MB 0.80 MB 52 % 1Γ—1, 45 % 3Γ—3 Relu, Add, MaxPool, GAP, Gemm logits [1, 1000] 24.15 ms 8 48.3 ms
YOLOX-S leaky 640Γ—640Γ—3 13.34 8.94 MB 3.28 MB 79 % 3Γ—3, 21 % 1Γ—1 Focus, LeakyRelu Γ—74, Concat Γ—29, Resize, SPP, decode predictions [8400, 85] 67.0 ms 8 134 ms
DeiT-tiny 224Γ—224Γ—3 1.25 5.65 MB 0.15 MB 83 % linear, 14 % attention LayerNorm Γ—25, Softmax Γ—12, Erf Γ—12 logits [1, 1000] 43.75 ms 8 87.5 ms
DeepLabV3-MobileNetV2 513Γ—513Γ—3 8.83 2.08 MB 6.34 MB 4 % depthwise AveragePool, Resize, Concat, probably dilation logits [21, 65, 65] 388.5 ms 8 777 ms

Weight reuse (MACs per weight byte):

  • MobileNetV2: 2.9 of its 3.5 MB sit in layers with reuse ≀ 49 (the 7Γ—7 stages and the classifier). Streaming them costs about 45k cycles.
  • ResNet-50: 16.5 of its 25.5 MB sit in layer4 and the classifier (reuse ≀ 49). Streaming them costs about 257k cycles, more than those layers' compute.

Appendix B β€” Package layout and manifest

cf-stack.json
rtl/files.f  rtl/npu.sv  rtl/cx3_*.sv
compiler/build  compiler/compile  compiler/cx3c/…      (everything the compile needs; the box sees only compiler/)
runtime/runtime.c  runtime/cx3_drv.h
numerics/README.md                                     (semantics are emitted into payload/numerics/)
LICENSE  NOTICE  README.md
{
 "schema": "cf-stack/1",
 "division": "dev-vision",
 "track": "C",
 "clock": {"soc": {"period_ps": 2000}},
 "host": {"core": "cf-rv32imc-zicsr", "params": {}},
 "accelerator": {"top": "npu", "rtl_dir": "rtl",
                 "params": {"M_DW": 1024, "N_M": 2, "L": 16, "KC": 18, "NRQ": 16, "PEAK_MACS_PER_CYCLE": 4096}},
 "fabric": {"npu_master_data_bits": 1024, "npu_masters": 2},
 "memory": {"dram": {"device": "LPDDR4X-4266", "channels": 4, "channel_width_bits": 16, "capacity_mib": 8192},
            "onchip": []},
 "compiler": {"entry": "compiler/compile", "build": "compiler/build"},
 "runtime": {"dir": "runtime", "campaign_abi": 2},
 "numerics": {"semantics_dir": "numerics", "formats": ["int8", "int16", "int32"]},
 "licences": [{"path": ".", "spdx": "Apache-2.0"}]
}

period_ps follows task 1.7. memory.onchip gets one entry per SRAM macro from P1/P2.


Appendix C β€” Register map (draft)

Keep CX3's existing registers (PROG at 0x20, START, RELOC at 0x40) and add:

Offset Name Access Purpose
0x00 ID RO Magic + version
0x04 CTRL RW bit 0 START (self-clearing), bit 1 SOFT_RESET, bit 2 IRQ_EN
0x08 STATUS RO bit 0 BUSY, bit 1 DONE, bit 2 WRITES_DURABLE, bit 3 ERROR
0x0C IRQ W1C Clears DONE and drops irq_o
0x80 / 0x84 IN_BASE lo / hi RW 40-bit input address for this query
0x88 / 0x8C OUT_BASE lo / hi RW 40-bit record address
0x90 / 0x94 SCRATCH_BASE lo / hi RW Activation spill buffer
0xA0 / 0xA4 PRELOAD_SRC lo / hi RW Weight image in DRAM
0xA8 PRELOAD_LEN RW Bytes to copy into weight SRAM
0xAC PRELOAD_CTRL RW Start / done
0xC0–0xDC PERF RO 64-bit counters: busy cycles, MAC-active cycles, DRAM bytes read, DRAM bytes written

Answer OKAY to every access in this window. Error responses end the run.


Appendix D β€” Commands

# Challenge package and evaluator
curl -L -o q2.zip https://api.chipforge.io/api/v1/challenges/quest_002_npu/download
sha256sum q2.zip                       # 7f2111a9d97c480f760aba3f0b19acf12d79f7c6bd635dae418ca185dfd60da9 on 2026-11-02
unzip q2.zip -d q2
unzip q2/chipforge_npu_v2_0_evaluator.zip -d cf-evaluator
unzip q2/chipforge_npu_v2_miner_package.zip -d cf-miner
cf-evaluator/v2/deploy/load_images.sh pull

# Local checks (--json must name a new file every run)
CK=cf-evaluator/v2/pipeline/orchestrator/checker/cf-check-docker
$CK cx3_q2.zip --state ~/cf-state --workloads public-tiny-cnn --json quick-1.json
$CK cx3_q2.zip --state ~/cf-state --workloads slot1-mobilenetv2 --no-variants --json slot1-1.json
$CK cx3_q2.zip --state ~/cf-full --full --json full-1.json

# Planning model (scripts next to this plan)
python3 -I quest2_tools/scenario.py cf-evaluator/policy/data/workloads/models
python3 -I quest2_tools/profile.py  cf-evaluator/policy/data/workloads/models profile.json

# Leaderboard
curl -s https://api.chipforge.io/api/v1/public/snapshot | jq '{score_to_beat, server_winner, submissions}'

# Submission (from ChipForge_SN108/, .env filled in)
.venv/bin/python python_scripts/miner_cli.py submit /path/to/cx3_q2.zip --dry_run
./submit_solution.sh
.venv/bin/python python_scripts/miner_cli.py logs <submission_id>

Appendix E β€” Requirements traceability

Every requirement of npu_v2.0.md and the subnet rules, mapped to the tasks that meet it. "Open" means the task exists but the result can only come from measurement.

Β§ Requirement Plan Status
2 Archive: cf-stack.json at the root, regular files, path rules, no binaries, every file licensed from the allowlist, numerics/ present 1.9, 1.10, App. B Covered
3 Manifest matches the schema; M_DW/N_M equal the fabric; every integer param is passed as -G, so npu declares it 1.1, App. B Covered
4.1 Exact slot ports; 40-bit master addresses; 6-bit IDs; irq_o 1.2 Covered
4.2 AXI4: INCR 1–256, no 4 KiB crossing, VALID low at reset, same-ID order, first 64 KiB untouched, OKAY from the slave 1.2, 2.1, 2.6 Covered; CX3 uses one ID per master, so order holds
4.3 Verilator 5.038 -Wall, Yosys 0.56; refused constructs; files.f; no library cells; flops only 1.3–1.5 Covered; RTL scan found only the known violations (G3)
5 Declared clock β‰₯ the 28 nm floor (β‰₯ 1,869 ps); one domain; cf_icg only 1.7, D3 Covered; STA open
6 Menu SRAM only, declared in memory.onchip; ISSUE_INTERVAL/READ_LATENCY timing and simulation rules; junk at power-up; flop memory counts toward the GE limit P1, P2, Phase 5 checks, App. B Covered
7 28 nm area and timing; ≀ 1M GE own logic per module; ≀ 100 mmΒ²; energy reported; v2.1 3 W cap announced 1.6, 1.7, Phase 5 checks, 7.5 Covered; GE and STA open
8 Host memory map; writes only to reserved memory; interrupts and mstatus.MIE; NO_PROGRESS; latency ceilings; prepare bound 2.1–2.4, Phase 5 checks Covered
9 Compiler CLI with optional --calib; box limits; two identical builds; three identical compiles on any CPU 3.1, 3.7, 3.8, D7 Covered
10 campaign.json, placements and buffers; campaign ABI; durable writes before capture; no response cache; relocation; 128 B alignment; Offline N and the 9–12-query continuation run 2.1–2.5, D10 Covered
11 Integer-only semantics bound to the payload bytes; ≀ 4 MiB records; stateless; Gate A; Gate B; variants compile, bit-exact, NRMSE ≀ 0.5 3.6, D8, D9, D10, Phase 4, Phase 6 Covered
12 Track C: exact weight and bias integers, allowed transforms only, payload.reads, every extracted tensor consumed, structural constants declared 3.4, 3.5, D6 Covered
13 No refused construct; no βˆ’1 behaviour (window, placement, batch-dependent semantics, published weights) 1.3, 2.1, 2.4, 3.6 Covered
14 7 models; uint8 NHWC input read from workload.json; no hard-coded model names 3.1, Phase 4 Covered
15 Full panel scored; S > 8.0 with margin Section 3, section 9 Open (measured in Phase 7)
16 Release files (PROPOSAL, not scored) 8.6 Noted; formats unpublished
17 Local checker passes Phases 0, 7 Covered; needs a Docker machine
Subnet 1 submission per hotkey; evaluation within the 125-minute window (timeout = 0); +20 % from the 2nd winner; two validators agree Sections 1, 9; 7.2 Covered; wall time open