The Two-Word Catalyst: How "Do some test runs!" Drove a Performance Breakthrough

In the middle of a marathon engineering session optimizing the cuzk SNARK proving engine for Filecoin's PoRep (Proof of Replication) protocol, the user issued a message so brief it barely registers as a sentence: "Do some test runs!" ([msg 2089]). At first glance, this appears to be nothing more than a casual instruction — a simple nudge to validate the freshly committed Phase 7 per-partition dispatch architecture. Yet this two-word message was the fulcrum on which the entire session pivoted. It transformed the conversation from implementation mode into discovery mode, and in doing so, it unearthed the critical performance bottleneck that would define the next phase of the project.

The Context: A Monumental Implementation

To understand the weight carried by this short message, one must appreciate what preceded it. The agent had just completed and committed Phase 7 — a fundamental architectural overhaul of the cuzk proving engine's core dispatch logic ([msg 2086]). This was no small refactor: 578 lines of new code across four files, introducing a per-partition pipeline that treated each of the 10 PoRep partitions as an independent work unit flowing through the engine's synthesis and GPU stages. The commit message promised dramatic improvements: "Expected steady-state: 42.8s/proof → ~30s/proof (GPU-limited), ~100% GPU utilization, zero cross-sector GPU idle gaps."

The agent had been deep in implementation for dozens of messages — editing Rust structs, refactoring dispatch logic, adding semaphore-gated worker pools, modifying GPU worker routing, and ensuring compilation. The summary at [msg 2088] laid out the changes in meticulous detail. Everything was ready. The code compiled cleanly. The commit was made. But no one had actually run it yet.

The Message: A Deliberate Shift

The user's message — "Do some test runs!" — is remarkable precisely because of its brevity. It contains no technical detail, no specification of what tests to run, no performance targets, no configuration parameters. It is pure imperative: stop building, start measuring.

This reflects a deliberate engineering judgment. The user understood that the implementation, however elegant on paper, was untested. The Phase 7 architecture made strong claims about performance — per-partition GPU calls with num_circuits=1 reducing b_g2_msm from 25 seconds to 0.4 seconds, cross-sector pipelining eliminating GPU idle gaps, throughput improvements from 42.8s/proof toward 30s/proof. These were hypotheses, not facts. The only way to validate them was to run real benchmarks on real hardware with real C1 test data.

The user also implicitly trusted the agent to know how to test. The message assumes that the agent has access to the test infrastructure — the cuzk-bench binary, the C1 test data at /data/32gbench/c1.json, the existing TOML config files in /tmp/, and the daemon binary. It assumes the agent understands the benchmark workflow: start the daemon, submit batch proof requests, collect timing data, analyze results. These assumptions were correct, as the agent immediately proceeded to inventory the available tools.

What the Message Does Not Say

Equally instructive is what the message doesn't say. The user did not ask "does it compile?" — that was already confirmed. They did not ask for a code review or a diff analysis. They did not ask "what are the expected numbers?" or "should we run a smoke test first?" The message cuts straight to the empirical question: does this thing actually work, and how well?

This reflects a testing philosophy that values early, empirical validation over theoretical perfection. The Phase 7 implementation could have been scrutinized for edge cases, race conditions, or memory leaks. Instead, the user chose to put it under load immediately — to let the hardware reveal the truth.

The Cascade of Discovery

The agent's response to this two-word instruction set off a chain reaction of discovery that consumed the next 30+ messages and ultimately defined Phase 8.

First, the agent surveyed the landscape. It listed available config files — 20 TOML configurations from previous experiments — and confirmed the existence of the test data and binaries (<msg id=2090-2091>). It rebuilt the bench binary (which predated Phase 7) and checked the available commands.

Then came the Phase 7 config. The agent created /tmp/cuzk-phase7.toml with partition_workers=20, started the daemon, and waited for SRS preloading to complete (<msg id=2096-2105>).

The single-proof test returned 72.8 seconds total, with 38.8 seconds of GPU prove time ([msg 2106]). The agent immediately checked the daemon logs and confirmed the core mechanism was working: all 10 partitions were being synthesized and GPU-proved individually, each GPU call taking ~3.3-3.9 seconds, and the final 1920-byte proof was assembled correctly. The Phase 7 pipeline was flowing.

But the numbers told a more complex story. The agent extracted the full TIMELINE data and manually reconstructed the execution sequence ([msg 2109]). The first GPU call (partition 4) took 5.8 seconds instead of the expected ~3.5 seconds because 8 remaining synthesis workers were still contending for CPU during the b_g2_msm computation. After synthesis completed, subsequent GPU calls were clean at 3.3-4.0 seconds. The cold-start penalty was real, but the steady-state behavior was promising.

The multi-proof throughput tests with 5 proofs at concurrency 3 yielded ~50.7 seconds per proof wall-clock ([msg 2110]). At concurrency 2, it was ~45-50 seconds per proof ([msg 2111]). These were improvements over the Phase 6 baseline, but far from the ~30s/proof target.

The Discovery That Changed Everything

The agent then performed the analysis that would define the next phase. Using awk to parse the TIMELINE events, it computed precise inter-partition GPU gaps ([msg 2115]). The result: 64.3% GPU efficiency. The GPU was idle for 251.9 seconds out of 705 total seconds across all benchmarks.

The gap analysis revealed two classes of idle time:

  1. Eight large gaps (>500ms) — dominated by a 125.9-second gap after the first proof (cold start), followed by 54.1s, 32.9s, and 29.3s cross-sector stalls where synthesis hadn't started early enough for the next sector.
  2. Many small gaps (200-1000ms) — the per-partition overhead between consecutive GPU calls. The user, observing the "jumpy" GPU utilization, immediately identified the next frontier: "looks like gpu use is pretty jumpy, generally high, but maybe there is some per-job overhead that could be cut? Or we could run two gpu-workers interlocked, one preparing to fire cuda code when the other one is actively running?" ([msg 2112]). This observation directly inspired the Phase 8 dual-GPU-worker interlock design.

The Deeper Significance

The message "Do some test runs!" is a case study in the power of empirical validation in systems engineering. It represents the moment when theory meets reality — when the elegant architecture described in c2-optimization-proposal-7.md collides with the messy physics of actual hardware.

The agent's subsequent deep-dive into the GPU gaps revealed something the design document had not anticipated: the static std::mutex in generate_groth16_proofs_c holds for the entire ~3.5-second function call, but only ~2.1 seconds is actual CUDA kernel execution. The remaining ~1.3 seconds is CPU-side work (proof serialization, b_g2_msm computation, mutex contention, malloc_trim) that could theoretically overlap with another partition's GPU time. This insight — only discoverable through measurement — became the foundation for Phase 8.

Without the user's push to test, this bottleneck might have remained hidden indefinitely. The code compiled, the logic was sound, and the architecture was elegant. Only by running it — by measuring the gaps, parsing the timestamps, and confronting the 64.3% GPU efficiency number — could the team see what was really happening.

Conclusion

"Do some test runs!" is not a message rich in technical content. It contains no algorithms, no data structures, no performance models. But as a decision point in the engineering process, it is arguably the most important message in this segment. It marks the transition from building to measuring, from theory to evidence, from assumption to discovery. The tests it triggered revealed a hidden bottleneck that no code review could have caught, and that bottleneck became the entire focus of Phase 8. In two words, the user redirected the project toward its next breakthrough.