(Figure) Linux Kernel 5.9 Code Statistics: 10.5% is AMD Radeon graphics driver.

On the eve of the release of Linux Kernel 5.9, themedia Phoronix used cloc (source code line counting tool) to count near-official version 5.9. Statistics show that there are approximately 20.49 million lines of kernel code in Linux 5.9 Git, plus 3.58 million lines of code comments and 3.72 million blank lines. Linux 5.9 has approximately 27.81 million rows distributed across approximately 59,000 source files.

(Figure) Linux Kernel 5.9 Code Statistics: 10.5% is AMD Radeon graphics driver.

There was a time when AMDGPU kernel graphics drivers occupied more than 2 million lines of code, the largest branch of the kernel driver tree. In Linux 5.9, it has 2.16 million lines of code, in addition to 247,000 comments and 109,000 blank lines. The number of AMD DRM driver codes, including AMDKFD, PowerPlay, DC, is 2.51 million lines.

Most AMDGPU-driven code is so large because of the automatically generated header files registered by the GPU. In fact, in Linux Kernel 5.9, there are 1.79 million simple header files for AMDGPU. Of the 2.71 million lines of code, 366,000 are actual C-lines.

(Figure) Linux Kernel 5.9 Code Statistics: 10.5% is AMD Radeon graphics driver.

To compare the size of the GPU driver, Intel’s “i915” kernel drive has only 209,000 lines of code, 392,000 lines of annotations, and 48,000 blank lines. The open source NVIDIA “Nouveau” drive has only 149,000 lines, 2.56 lines of annotations, and 199,000 blank lines.

(Figure) Linux Kernel 5.9 Code Statistics: 10.5% is AMD Radeon graphics driver.