Architecture: loose coupling to origin for a performance-tuned miner #1
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Purpose
This repo is a private fork of Quantus-Network/quantus-miner. We do not submit PRs to origin. We do evaluate every origin release for inclusion here. The perf workstreams tracked under the
perflabel all have to be built so that:This issue records the rules the workstreams follow. Individual workstreams: see the
perflabel. Each one references this issue.Branch model
origin-main: a read-only mirror of originmain, fast-forwarded only. Never committed to directly.main: lair. Containsorigin-mainplus our changes.git merge origin-mainintomain, reviewed as one PR here. Divergent files show up in that diff and nowhere else, so the review is the list of places we have to think.Where our changes are allowed to live
Origin already provides the seam we need: the
MinerEnginetrait incrates/engine-cpu/src/lib.rs.WorkerPooland the QUIC loop only ever seeArc<dyn MinerEngine>. Everything perf-related goes behind that trait.crates/pow-core,crates/quic-transport, protocol message types incrates/miner-servicecrates/engine-gpu(origin's wgpu engine)// lair:so they are recognisable in a merge diff. Default: leave it alone and put the change in a new module or crate.crates/miner-serviceengine resolution (resolve_gpu_configuration) andcrates/miner-cliflagscrates/engine-cuda, benchmark harness)Consequence: our miner must stay a drop-in replacement for an origin miner against an origin node. Every new behaviour is opt-in via flag or auto-detected with a fallback to origin behaviour.
Correctness gate
The PoW is consensus. Every kernel we ship must be bit-exact against
pow_core(which is origin's, which wrapsqpow_math). Origin already hascrates/engine-gpu/examples/gpu_cpu_parity.rsand the component tests incrates/engine-gpu/src/tests.rs. Ours reuse those, parameterised by engine, and a workstream is not mergeable here until parity passes on the fleet GPUs. Hash constants must come fromqp-poseidon-constantsat build time, not be hand-copied (see #3), so a change to the hash at origin is a dependency bump for us.Measurement gate
No perf change merges on an estimate. #2 defines the protocol: same host, same power limit, same batch size, before and after, numbers in the closing comment (per
architecture/generic.md, "close the tracking issue with a comment carrying the actual measured numbers").Node coupling
quantus/chainis the lair counterpart of origin's node. Preference order:quantus/chainwith the same branch model.Scoping on the node side: quantus/chain#1.
What we deliberately do not do
engine-gpu. Patch stacks rot; a separate crate does not.Audit summary (2026-09-03, v4.0.2, target host 2x RTX 5090)
Multi-GPU works as-is: one worker thread per card, round-robin assignment at
crates/engine-gpu/src/lib.rs(ASSIGNED_GPU_DEVICE), independent submission streams. Perf left on the table, in order of expected payoff:Workstreams
In suggested order. #2 first because nothing else can be judged without it; #4 and #6 next because they are flag-sized and give the baseline the larger ones must beat.
engine-gpuengine-cudanative kernelGains are not additive: #3 makes #5 and #7 irrelevant on NVIDIA hosts, which then serve only as the fallback engine. Each issue closes with its measured number.
CI and deployment workstreams (added 2026-09-03)
Deployment follows
mainof each fork, built as one fat binary carrying native code for every card in the fleet, with continuous post-deploy measurement. These sit alongside the perf table above and #8 is a prerequisite for anything reaching a host.sm_86,sm_89,sm_120pluscompute_120PTX) with the CUDA 13.0 toolkit on thecuda-13.0runner; deploy-on-main with rollback and validate; miner assets and sudoers role move here. Carries the measured fleet driver table..github/workflowsdeleted, recurringgit rmon mergeminer_build_info, per-device and per-job efficiency metrics, recording rules and a "Performance by build" dashboard row, regression rule.github/workflowsdeletionfetch/deploy-node/deploy-miner; keep monitoring, GPU power/textfile units, edge role; cut-over sequenceMerge checklist for every
origin-mainmerge PR, collected from the above:git rm -r .github/workflowsif the merge resurrects any of it.ci.ymlgates green.mainon the reference card.validatemode first when the merge touchesengine-gpu,miner-serviceorquic-transport.Operating policy and deadline (set 2026-09-03)
Goal by 2026-09-09 (expected mainnet): a CUDA miner binary that outperforms origin's wgpu build by a significant margin, measured per #2 and #9. Whether non-mining workloads leave the GPU hosts once mining has value is a separate call made closer to that date.
Until then (Planck testnet, tokens valueless):
mainbuildmainbuilddeploymatrix in #8 therefore ships to benjy and quadbrat only for now. Beast stays in the matrix commented out with itsgpu_devices: "2"so enabling it on the day is a one-line change.Readiness state:
origin-mainexists on both forks (miner atcb6deb9= v4.0.2, chain at1f43947),RSYNC_SSH_KEYis set on both, all three hosts verified on 580 drivers with a CUDA 13.0 ceiling.Goal check (2026-09-03)
The deadline goal was a CUDA binary that beats origin's wgpu build by a significant margin, measured. #16 delivers 2.06x on the 4090 (297.7 vs 144.4 MH/s at 250 W) and 1.59x on the 3060, bit-exact, deployed to both mining hosts from
mainby this repo's own workflow with rollback and a kernel assertion in validate. The 5090 number is pending a manual bench dispatch on beast when inference can be paused.Order of remaining work, revised by measurement:
Power limits are the last knob, after the software is squeezed, and only expected to move the number modestly.
State of play (2026-09-14)
Several statements above are stale; this comment is the current reading.
The repository is public and publishes release binaries (#28, first tag
v4.0.2-lair.1). The purpose has widened from a fleet advantage to an open miner that independent operators can run against the closed pool binaries: on 2026-09-13 one reward preimage authored ~62% of blocks in the exporter's window. The branch model and the no-PRs-to-origin rule are unchanged; origin's own CUDA engine (v4.2.0,--cuda-gpu) measured 944 MH/s on a 5090 against our 1104 (#27), so there is nothing to take from it yet.All three hosts mine since the mainnet call on 2026-09-09 (#20); beast's inference is off. The "beast does not mine" policy above is history.
Perf, measured, per card at the power caps: 5090 283 (wgpu) -> 1104 MH/s, 4090 144 -> 716, 3060 37 -> 141. The steps: #16 native CUDA (2x), #17 deferred carries, #22 per-arch carry path (+20% sm_120), #23 fused-PTX arithmetic (+54..66%), #26 whole-grid batches, early reject, nonce direction (+3%). Memory clock lock on all hosts (lair/quantus#10; +2% on the 5090, +13% on the 4090).
Workstream table, resolved: #2, #3, #4, #6, #9 closed with numbers earlier; #5 and #7 closed today as superseded by the CUDA engine; #8 closed as complete. Open: #25 (ptxas anomaly, a standing warning: every kernel change passes exhaustive parity on all three architectures before merge), #27 (the remaining ~10% to the fastest closed binary: a loop-structured
permutewith one continuous carry chain per round; the tensor-core idea #24 was measured and rejected).Correction to the audit's "no algorithmic slack": still true for the hash, but the closed kernels showed slack in how the arithmetic is scheduled, and the largest single gain of the whole effort (#23) came from there.