Podcast

Performance Optimization and Software/Hardware Co-design across PyTorch, CUDA, and NVIDIA GPUs

Chris Fregly, AI performance engineer, startup founder, and investorEpisode 363 · 1:25:50 · Mar 2026 · 675 viewsHosted by Demetrios Brinkmann
Thumbnail for Performance Optimization and Software/Hardware Co-design across PyTorch, CUDA, and NVIDIA GPUs Watch on YouTube
TL;DR
  1. 1

    Chris Fregly argues that software engineers will remain necessary because quickly generating a personal application is very different from bringing software into production.

  2. 2

    The book AI Systems Performance Engineering connects hardware, software frameworks such as PyTorch and CUDA, and algorithms so engineers can reason about performance across the stack.

  3. 3

    GPU systems require active management of memory movement, temperature, failures, networking, and hardware-specific behavior, especially on newer systems such as Grace Blackwell.

Summary

Chris Fregly discusses the ideas behind his O'Reilly book AI Systems Performance Engineering and the GitHub material that accompanies it. He explains why hardware, software, and algorithms need to be designed together, using examples from PyTorch, CUDA, transformer workloads, flash attention, and NVIDIA GPU systems. Much of the conversation covers practical problems that are easy to miss at the application layer: memory bandwidth, arithmetic intensity, GPU throttling, chip failures, networking choices, and differences between generations such as Hopper and Blackwell. Fregly also describes using coding agents to inspect and optimize kernels, while comparing Codex and Claude Code for larger codebases. He is frank about poor documentation, undocumented or difficult-to-find hardware behavior, and the need to reverse-engineer systems when working with AMD or Trainium hardware. The discussion also touches on throwaway applications, personal AI workflows, warm GPU standbys, inference infrastructure, and the value of sharing techniques through community groups.

Key ideas
01:17

Personal throwaway applications do not remove the need for software engineers

Demetrios Brinkmann describes building small, private tools that run locally or use improvised storage such as Notion. Chris Fregly agrees that these applications can be faster to rebuild than maintain. He draws a firm boundary between a personal tool and production software. Production brings backups, testing, operations, deployment, and many other responsibilities. Fregly recalls a project where he discarded two weeks of work and started again because the new version was cleaner and faster to maintain. He says that generated code can make experimentation cheap, while the work of operating reliable software still requires engineering judgment.

11:51

The book connects hardware, software, and algorithms through co-design

Fregly says his third O'Reilly book grew from years spent learning different parts of large-scale systems at Netflix, Databricks, AWS, and earlier startups. He gathered material from many sources because NVIDIA documentation often explains hardware through narrow or unrelated examples. The book brings together PyTorch, CUDA, GPU hardware, and algorithms. He calls this combination co-design. His aim is to make GPU performance concepts accessible to far more engineers than the small group that currently understands all three areas. The book takes a bottoms-up approach and includes material on systems, CUDA, training, inference, and the GitHub repository.

22:48

Mechanical sympathy requires understanding how the hardware executes the algorithm

Fregly uses the term mechanical sympathy for understanding the environment where software runs. For GPU work, that means knowing the hardware rather than treating it as an opaque accelerator. He explains that NVIDIA works with researchers to move operations common to transformers into hardware abstractions. Arithmetic intensity describes how much data movement an algorithm needs for each unit of computation. Moving data into the chip is often slower than computing once the data reaches registers. Attention is expensive partly because of its roughly quadratic relationship to sequence length, so memory placement and movement strongly affect performance.

29:41

Large GPU systems add networking, power, cooling, and failure problems

The conversation moves from individual GPUs to systems such as the NVL72 Grace Blackwell configuration, which places 72 GPUs in one rack. Fregly describes the power, weight, cooling, and interconnect requirements of these systems. NVIDIA's acquisition of Mellanox gave it networking and InfiniBand expertise, while cloud providers such as AWS may add their own networking layers. He says these departures from NVIDIA's reference architecture create extra integration work, including custom interfaces and framework forks. GPU failures are another operational concern. Fregly stresses new clusters to find defective or overheating devices, and he says roughly 60% to 70% of the time a new cluster must be replaced after something goes wrong.

34:00

GPU benchmarking has to account for heat, throttling, and manufacturing variation

Fregly says GPUs are designed to run hot and can throttle quickly. He locks the clock speed during benchmarks so temperature does not change the result or cause the device to fail. He attributes failures to both aggressive performance targets and manufacturing defects that occur when millions of chips are produced. Consumer-sized systems can also lack instructions found in larger devices because they cannot keep the hardware cool enough. These differences make a machine such as a small Grace Blackwell system a poor way to learn every aspect of CUDA programming. Cloud operators use pre-warmed standby capacity, as in SageMaker HyperPod, so failed GPUs can be replaced without restarting a long training job from an old checkpoint.

54:22

Coding agents can help with GPU optimization when their reference material is specific

Fregly says the book and its repository were partly designed for coding assistants. Models have limited training data for CUDA kernel tuning because much of the relevant code is closed, compiled into binaries, or held inside specialist teams. He converted the book into chapter-based Markdown and uses repository search to give an agent focused context. He has also built MCP tools and an AI systems optimizer that checks clusters and examines whether tensor cores are working as expected. For other hardware, he studies highly tuned libraries, compiled output, and assembly patterns to infer how the system works. He describes this as a practical substitute for having a hardware specialist beside him.

01:00:56

Codex and Claude Code make different trade-offs on large technical tasks

Fregly prefers Codex for larger codebases because it reads more of the repository and completes tasks with less back-and-forth, although it is slower. Demetrios Brinkmann says Claude Code often needs manual validation and follow-up instructions. Fregly describes Codex as more willing to work independently, while Claude Code feels more suited to a user who stays involved throughout the process. They also discuss context compaction. Fregly says that clearing the context window can improve performance because a large accumulated history may make the model less effective. He says Codex appears to compact context at selected points rather than waiting until the window is nearly full.

01:10:12

Specialized kernel work exposes the limits of current model training data

Fregly explains that GPU kernels use separate pipelines for CUDA cores, tensor cores, and specialized tensor memory. Efficient kernels overlap computation with data movement so memory latency is hidden. Hardware generations can change these trade-offs. He says Blackwell moved resources away from one pipeline toward another, which can hurt code that depends on the older balance. He also describes companies building reasoning systems for CUDA kernel optimization and sharing their findings with major AI labs. Fregly questions giving away this performance data because it may be one of those companies' strongest advantages. He wants access to the hidden reasoning and token data produced during these optimization tasks, especially when he is paying for the computation.

"Every single cluster that I get on, like on new cluster, the first thing I do is put it through sort of a... warm-up period."Chris Fregly34:48
Who should watch
  • You are building or operating GPU training and inference systems and need to understand where performance problems come from below the model API.
  • You write PyTorch or CUDA code and want practical context on memory movement, kernel tuning, GPU generations, and benchmarking.
  • You use coding agents for systems work and want to compare autonomous repository work with a more interactive workflow.