A Wild Ride With Claude
More Cross-Correlation Than Anyone Reasonably Could Have Expected
With Claude’s help, I’ve been rewriting The CUDA Handbook at breakneck pace – both the source code and the text of the book were in dire need of updating, and both are in much better shape now.
Coding with Claude is like having a talented Ph.D. computer science candidate who can type really fast: a very good coder tactically, with at-time huge blind spots that must be dealt with intentionally. It is excellent at relatively self-contained coding tasks, but still needs close air support to do a really good job.
Updating the chapter on Normalized Cross Correlation was mostly free beer, though. I had wanted to get rid of the 24-bit multiplies (they were rendered obsolete with Fermi c. 2011), but Claude had the insight that the DP4A instruction (added with Pascal) was a great fit for the workload. It ported the key kernels to use the new instruction and, when we saw that it was no faster, refactored the kernel to use ILP for a 2.4x speedup. The increased parallelism and latency tolerance from this refactor unlocked the latent performance opportunities of DP4A: re-applying DP4A increased performance by another 3x! I’d call a >7x performance improvement a big win, and Claude deserves the bulk of the credit.
More recently, I undertook to rewrite the Scan chapter, and that set us on a journey that’s worth recounting. By the way, the opportunity cost of writing this article is why I haven’t been documenting similar journeys as they occurred. When you can get a month’s worth of work done in a day, pausing to document progress feels like a real cost. But my readers deserve to know at least a little bit about how I’ve been using Claude to update The CUDA Handbook and the accompanying source code.


