engine-cuda: loop kernel diagonal from launch parameters (+1.3% loop kernel), multiply-add screening variants #31

Merged
grenade merged 3 commits from perf/int-round-chain into main 2026-09-14 17:01:16 +00:00
Owner

Round 2 of quantus/miner#27, behind the loop-kernel switch. The deployed unrolled kernel is byte-identical throughout (sm_120 21,120 instructions, 110 registers).

  • LAIR_LOOP_PARAM_DIAG (default 1): the twelve diagonal constants ride in MiningUniforms (now 416 bytes) and the loop kernel reads them from the parameter bank. ptxas still issues 13 constant loads per internal round, but the loop kernel's spill falls from 88 to 32 bytes and it shows on the card: beast loop 2135 -> 2162 MH/s (+1.3%), benjy 725 -> 730 (+0.7%), three interleaved rounds, parity 300/300 and 200/200. benjy picks it up through its existing cuda_kernel: loop matrix row; beast and quadbrat keep the unrolled kernel and change nothing.
  • LAIR_MULADD 0..4: five multiply-add formulations kept for screening, 0 the shipped one. Static internal-round body on sm_120: 239 / 260 / 283 / 275 / 265, so nothing changes by default.
  • The kernel comment now itemises where the loop kernel's internal round still exceeds the quanpool kernel's 199 (constant reloads, product carry assembly, EPS-multiply reductions, sum-plus-constant fold, moves), with the no-op experiments recorded so they are not repeated.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ue5ZZm1Hiv5zPnucykKKuF

Round 2 of quantus/miner#27, behind the loop-kernel switch. The deployed unrolled kernel is byte-identical throughout (sm_120 21,120 instructions, 110 registers). - **`LAIR_LOOP_PARAM_DIAG`** (default 1): the twelve diagonal constants ride in `MiningUniforms` (now 416 bytes) and the loop kernel reads them from the parameter bank. ptxas still issues 13 constant loads per internal round, but the loop kernel's spill falls from 88 to 32 bytes and it shows on the card: beast loop 2135 -> 2162 MH/s (+1.3%), benjy 725 -> 730 (+0.7%), three interleaved rounds, parity 300/300 and 200/200. benjy picks it up through its existing `cuda_kernel: loop` matrix row; beast and quadbrat keep the unrolled kernel and change nothing. - **`LAIR_MULADD`** 0..4: five multiply-add formulations kept for screening, 0 the shipped one. Static internal-round body on sm_120: 239 / 260 / 283 / 275 / 265, so nothing changes by default. - The kernel comment now itemises where the loop kernel's internal round still exceeds the quanpool kernel's 199 (constant reloads, product carry assembly, EPS-multiply reductions, sum-plus-constant fold, moves), with the no-op experiments recorded so they are not repeated. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Ue5ZZm1Hiv5zPnucykKKuF
grenade added 3 commits 2026-09-14 16:51:42 +00:00
Static screen on sm_120, loop kernel internal round body: 0 = 239,
1 = 260, 2 = 283, 3 = 275, 4 = 265 instructions.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ue5ZZm1Hiv5zPnucykKKuF
Constant hoisting in C and 32-bit-halves delivery of the diagonal both
compile to byte-identical SASS and are removed. The remaining 40
instructions per round over the quanpool kernel are itemised in the
kernel comment.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ue5ZZm1Hiv5zPnucykKKuF
engine-cuda: loop kernel takes the diagonal from the launch parameters
All checks were successful
ci / fmt (pull_request) Successful in 19s
bench / build (pull_request) Successful in 1m11s
ci / clippy (pull_request) Successful in 1m46s
ci / doc (pull_request) Successful in 1m42s
bench / measure (pull_request) Successful in 2m50s
ci / test (pull_request) Successful in 7m1s
1fea51cfc3
MiningUniforms carries the twelve diagonal constants (416 bytes now) and
the loop kernel reads them there (LAIR_LOOP_PARAM_DIAG=1) instead of from
the __constant__ table. Static: still 13 loads per internal round (ptxas
reloads either way) but spill 88 -> 32 bytes. Measured, three interleaved
rounds, loop kernel only: beast 2135 -> 2162 MH/s (+1.3%), benjy 725 ->
730 (+0.7%); parity 300/300 and 200/200. The unrolled kernel is byte-
identical (21,120 instructions, 110 registers).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ue5ZZm1Hiv5zPnucykKKuF

quantus-bench 1fea51cfc3 on benjy.hanzalova.internal

worker median MH/s spread windows
0 713.90 0.1% 713.2, 713.1, 714.1, 713.9, 713.9

total median: 713.90 MH/s (batch 1000000, 5 x 30s, engine gpu-cuda)

  • gpu 0 NVIDIA GeForce RTX 4090: driver 580.173.02, limit 250 W, draw 250 W, sm 1905 MHz, mem 810 MHz, 58 C
  • parity: OK (25/25 jobs found solutions, all verified against CPU)
    --- resume miner ---
    active
## quantus-bench 1fea51cfc3786036f0cfefbb53368dd23a18f02d on benjy.hanzalova.internal | worker | median MH/s | spread | windows | | --- | --- | --- | --- | | 0 | 713.90 | 0.1% | 713.2, 713.1, 714.1, 713.9, 713.9 | total median: **713.90 MH/s** (batch 1000000, 5 x 30s, engine gpu-cuda) - gpu 0 NVIDIA GeForce RTX 4090: driver 580.173.02, limit 250 W, draw 250 W, sm 1905 MHz, mem 810 MHz, 58 C - parity: OK (25/25 jobs found solutions, all verified against CPU) --- resume miner --- active
grenade merged commit bb92224788 into main 2026-09-14 17:01:16 +00:00
grenade deleted branch perf/int-round-chain 2026-09-14 17:01:16 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blackbeard/miner#31