liveBook · Manning

GPU kernel

As explained in LLMs in Production

A kernel is a small program or function executed on a parallel processor to perform a computational operation.

A GPU kernel is a small program or function that runs on a parallel processor to perform a computation. In deep learning, optimized kernels coordinate threads, registers, and shared memory so operations use the chip efficiently. section 6.1.1

Kernel tuning selects and orders suitable implementations from optimized libraries rather than relying on arbitrary code execution. The best choice depends on the GPU, input and filter sizes, tensor layout, batch size, and neural-network architecture. section 6.1.1

Practical implications:

  • Benchmark multiple kernel choices because the fastest implementation varies with hardware and tensor shapes. section 6.1.1
  • Treat tuning as part of model compilation and deployment optimization, not merely as a code-level change. section 6.1.1
Figure 6.2 An example of an unoptimized network compared to the same network optimized using graph optimization. CBR is a NVIDIA fused layer kernel that simply stands for Convolution, Bias, and ReLU. See the following NVIDIA blog post for reference: https://mng.bz/PNvw.
figure

Visualizes graph optimization by contrasting an unoptimized network with fused convolution, bias, and ReLU kernel operations. section 6.1.1

How LLMs in Production covers it

How deep it goes
Explains kernel selection and tuning factors, but stops short of implementation code or detailed hardware execution mechanics.
Examples
Uses convolution algorithms and fused convolution-bias-ReLU operations to illustrate alternative kernels and graph optimization.
What it assumes
Assumes basic familiarity with GPUs, neural networks, and computational operations; defines kernels in plain language.
What you can do after
Evaluate/understand how hardware and tensor characteristics influence kernel selection and deployed model performance.
How it connects
Connects kernels with kernel tuning, model compilation, graph optimization, convolution, tensor layout, and batch size.

Also explained in

Compare how 3 books explain GPU kernel →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of LLMs in Production. The section links point to the parts of the book it draws on.