examples/cuda-fanout: Day-4 v4 stack landed (byte-clean, -12% vs v3); daemon flips to v3 --window-w 4

Day-4 task per fox: stack v3 windowed-G ladder (Day-3) with v2 Montgomery
batch inversion (Day-2). Idea: Day-3 cut scalar_mul, residual ModInv now
matters — which is what Day-2 needed to win.

Result:
- v4 (--window-w 4 --batch-inv) lands byte-identical vs coincurve at
  n in {32, 1000, 10000, 100000, 1000000}.
- 3090-ai best-of-3 @ n=1M: v1 7.86 / v3 13.83 / v4 12.16 Mkeys/s.
- v4 regresses -12% vs v3 because v2's Phase B/D walks run one thread
  per block (3906 active threads at n=1M; 3090 has ~125k concurrent
  thread budget). v3's per-thread ModInv saturates 1M parallel threads
  on 82 SMs — the threading model beats the smaller field-mult count.
- HARD-RULE triggered: v4 < 1.10x v3 → no v4 promotion.

Daemon flip per task brief option A:
- start-daemon now takes optional extra-args; register-daemon!,
  maybe-register-daemon! pass them through.
- *secp-daemon-extra-args* = '("--window-w" "4") activates v3 in the
  spawned secp256k1 daemon. cuda-shake-fanout and cuda-bignum-cgbn
  spawn unchanged.

Deployed:
- 3090-ai: rebuilt secp256k1-batch-mul, restarted via /tmp/launch.sh.
  Worker log shows [v3-window-w4] on smoke at n=16 and n=200.
- ai.foxhop.net (4090): same. sm_89, libgmp at ~/local/gmp.

Smoke test: small BSCP request to each worker over TCP, byte-identical
vs coincurve. Both PASS.

Catalog (CATALOG.md, www/bend.html): promoted v3 throughput to
13.83 Mkeys/s @ n=1M, recorded v4 regression and warp-scan Phase B/D
as Day-5+ refactor.

Progress doc: plans/form-A-day4-progress.md.
This commit is contained in:
russell@unturf.com 2026-06-05 19:07:00 -04:00
parent 3e0ca555b5
commit 3a8c66a148
No known key found for this signature in database
5 changed files with 223 additions and 16 deletions

View file

@ -143,7 +143,7 @@ make gpu-worker LUMBDA=asm # smallest footprint</code></pre>
<td><code>cuda-secp256k1-batched-mul</code></td>
<td>live</td>
<td>RTX 3090</td>
<td>v1 7.87 Mkeys/s @ n=1M; <strong>v3 (windowed-G w=4) 13.60 Mkeys/s @ n=1M</strong> &mdash; 1.73&times; v1, ~309&times; coincurve CPU. Day-4 v3 + Montgomery batch inv stacking is the next step toward FixedPaul's 6.5 Gkeys/s on 4090</td>
<td>v1 7.86 Mkeys/s @ n=1M; <strong>v3 (windowed-G w=4) 13.83 Mkeys/s @ n=1M</strong> &mdash; 1.76&times; v1, ~309&times; coincurve CPU. Day-4 v4 (v3 ladder + Montgomery batch inv) regressed -12% vs v3 due to v2's serial-per-block Phase B/D walks; warp-scan Phase B/D refactor needed before v4 wins. Daemon default now ships <code>--window-w 4</code></td>
<td><code>BSCP</code> binary: scalars + base-point &rarr; <code>BSCR</code> points</td>
</tr>
<tr>