In this article
Separate first-shape cuDNN algorithm search from repeated execution, and distinguish deterministic selection from deterministic computation.
An image encoder becomes slow whenever a new image resolution arrives, although repeated requests at the previous resolution were stable. Before blaming the entire inference graph, identify whether a cuDNN convolution is performing algorithm search for a new size combination. This creates a different measurement question from repeated execution of an already selected algorithm.
Identify the convolution path
Confirm that the affected operation actually uses cuDNN convolution. The cuDNN benchmark setting does not describe every attention kernel, matrix multiplication or compiler specialization in a multimodal model. Preserve the relevant tensor dimensions, dtype, layout and backend versions so a change in input resolution can be connected to the operation that selected an algorithm.
Separate search from reuse
PyTorch documents optional benchmarking when a convolution encounters new size parameters. The chosen algorithm is then reused for corresponding parameters during that process. Compare a first encounter with later equivalent encounters, retaining the sequence of shapes. A mixed-resolution trace that averages these populations can conceal whether the cost comes from search or steady execution.
Define the intended workload
A fixed-resolution encoder and a stream of novel resolutions need different experiments. Warm the exact shape set when estimating repeated-shape service, and retain novel-shape encounters when estimating that real arrival pattern. The benchmark recipe’s warmup guidance helps isolate initialization, but warmup must not silently remove work that actual requests regularly trigger. Record which shapes were already visited before timing began.
Distinguish selection from determinism
The benchmark option selects among algorithms using measurements. Noise and hardware can influence the winner across process runs. Disabling it makes selection deterministic under the documented behavior, but deterministic algorithm selection and deterministic algorithm execution are separate properties. The cuDNN deterministic control addresses the latter. Neither setting alone establishes reproducibility of the entire model or its preprocessing pipeline.
Bound the conclusion
Compare equal useful inputs, outputs and backend conditions before choosing a setting for this encoder. Preserve search-inclusive latency separately from repeated execution. Document supported search controls against the installed PyTorch release rather than assuming they apply to every convolution API. A better result for a known shape population does not predict novel shapes, another device or a model dominated by unrelated operators.
Primary references
PyTorch Reproducibility and Convolution Search.
PyTorch cuDNN Backend Controls.
Related reading: A GPU inference benchmark you can trust; GPU benchmarks: median, spread and trial order.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.