AMD Graphics Driver Surpassing 4 Million Lines Of Code In Linux 5.19, NVIDIA Opens Up At 1 Million
Given the NVIDIA open-source kernel driver code announcement from yesterday and also the Linux 5.19 merge window coming up soon with a host of AMDGPU/AMDKFD kernel driver improvements and starting to prepare support for RDNA3, it's time for some fun with numbers around driver sizes.
The open-source AMDGPU/AMDKFD kernel driver code with Linux 5.19 will surpass 4 million lines! (Not that it's any particular useful metric, but more food for thought.) That is the line count within drivers/gpu/drm/amd/ that consists of the AMDGPU DRM kernel driver for GCN 1.2+ GPUs (or GCN 1.0+ unofficially), the AMDKFD compute driver, and related code. Not counted as part of that 4 million figure is the drivers/gpu/radeon/ code for supporting older AMD Radeon graphics cards. (That old Radeon driver for basically pre-GCN cards is 197k lines -- of which about 157k is actual code.)
The AMDGPU driver is ballooning in size in large part due to all the auto-generated header files added with each new GPU / intellectual property block enabled. This results in the modern AMDGPU kernel driver easily being the largest mainline driver within the Linux kernel.
Right now with Linux 5.18 the drivers/gpu/drm/amd/ area comes in at around 3.82 million lines -- 3.29 million lines of code, another 391k lines of comments, and 137k blank lines. But for the upcoming Linux 5.19 merge window, that is shooting up from 3.82 to 4.2 million lines due to all the new RDNA3 enablement code and header files.
With the 4.2 million lines, this morning I was cloc'ing "tags/amd-drm-next-5.19-2022-05-11" at which the AMD driver area is at 3.67 million lines, another 439k lines of comments, and 148k blank lines spanning more 1,932 files within this Direct Rendering Manager area.
So with the latest AMD graphics driver code as of this morning for this code going into the next kernel, it's at 4,265,930 lines ahead of the Linux 5.19 merge window opening in a few weeks.
So the 4 million mark is being passed for the modern AMD kernel graphics driver in Linux 5.19. So then where does the newly-opened NVIDIA open-source kernel graphics modules fit in? Keeping in mind measuring up line counts isn't very effective, the NVIDIA code published yesterday comes in at about 1 million. Keep in mind that the NVIDIA driver is incomplete, the NVIDIA open kernel code only is for Turing GPUs and newer where as AMDGPU goes back to GCN 1.2/1.0, the DRM-Next code is already laying the foundation for RDNA3, and that the AMD open-source code has been maturing for years already compared to NVIDIA's fresh code drop.
But in any case, with the out-of-tree NVIDIA Linux Open GPU Kernel Module sources published yesterday, it comes in at around 1,052,112 lines -- of which 695k lines are detected code.
In NVIDIA's case with this out-of-tree open kernel driver they are also offloading lots of work now to the GPU System Processor (GSP) and boasting larger binary firmware there as a result. In any event, there is no real value to this code size comparison besides satisfying curiosity and trivia... And, of course, these numbers just represent the kernel graphics driver portion and not any of the user-space components like the Mesa OpenGL/Vulkan drivers. So take the numbers as you wish.
The Intel i915 kernel Linux graphics driver area for supporting integrated graphics through DG2/Alchemist Arc Graphics meanwhile comes in at 341k lines as of Linux 5.18 Git (239k as detected code lines, the rest comments and blanks). Or the in-tree open-source NVIDIA "Nouveau" code comes in at around 151k lines of code, 25.6k lines of comments, and 20.3k blank lines.
The open-source AMDGPU/AMDKFD kernel driver code with Linux 5.19 will surpass 4 million lines! (Not that it's any particular useful metric, but more food for thought.) That is the line count within drivers/gpu/drm/amd/ that consists of the AMDGPU DRM kernel driver for GCN 1.2+ GPUs (or GCN 1.0+ unofficially), the AMDKFD compute driver, and related code. Not counted as part of that 4 million figure is the drivers/gpu/radeon/ code for supporting older AMD Radeon graphics cards. (That old Radeon driver for basically pre-GCN cards is 197k lines -- of which about 157k is actual code.)
The AMDGPU driver is ballooning in size in large part due to all the auto-generated header files added with each new GPU / intellectual property block enabled. This results in the modern AMDGPU kernel driver easily being the largest mainline driver within the Linux kernel.
Right now with Linux 5.18 the drivers/gpu/drm/amd/ area comes in at around 3.82 million lines -- 3.29 million lines of code, another 391k lines of comments, and 137k blank lines. But for the upcoming Linux 5.19 merge window, that is shooting up from 3.82 to 4.2 million lines due to all the new RDNA3 enablement code and header files.
With the 4.2 million lines, this morning I was cloc'ing "tags/amd-drm-next-5.19-2022-05-11" at which the AMD driver area is at 3.67 million lines, another 439k lines of comments, and 148k blank lines spanning more 1,932 files within this Direct Rendering Manager area.
------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C/C++ Header 1223 59639 374434 3199095 C 657 87851 63710 475906 Assembly 3 565 449 1906 make 49 372 1197 806 ------------------------------------------------------------------------------- SUM: 1932 148427 439790 3677713 -------------------------------------------------------------------------------
So with the latest AMD graphics driver code as of this morning for this code going into the next kernel, it's at 4,265,930 lines ahead of the Linux 5.19 merge window opening in a few weeks.
So the 4 million mark is being passed for the modern AMD kernel graphics driver in Linux 5.19. So then where does the newly-opened NVIDIA open-source kernel graphics modules fit in? Keeping in mind measuring up line counts isn't very effective, the NVIDIA code published yesterday comes in at about 1 million. Keep in mind that the NVIDIA driver is incomplete, the NVIDIA open kernel code only is for Turing GPUs and newer where as AMDGPU goes back to GCN 1.2/1.0, the DRM-Next code is already laying the foundation for RDNA3, and that the AMD open-source code has been maturing for years already compared to NVIDIA's fresh code drop.
But in any case, with the out-of-tree NVIDIA Linux Open GPU Kernel Module sources published yesterday, it comes in at around 1,052,112 lines -- of which 695k lines are detected code.
------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C 972 94239 91707 456965 C/C++ Header 1457 49573 110773 217080 C++ 31 3311 3921 16878 Bourne Shell 1 714 2297 2748 make 8 204 293 1409 ------------------------------------------------------------------------------- SUM: 2469 148041 208991 695080 -------------------------------------------------------------------------------
In NVIDIA's case with this out-of-tree open kernel driver they are also offloading lots of work now to the GPU System Processor (GSP) and boasting larger binary firmware there as a result. In any event, there is no real value to this code size comparison besides satisfying curiosity and trivia... And, of course, these numbers just represent the kernel graphics driver portion and not any of the user-space components like the Mesa OpenGL/Vulkan drivers. So take the numbers as you wish.
The Intel i915 kernel Linux graphics driver area for supporting integrated graphics through DG2/Alchemist Arc Graphics meanwhile comes in at 341k lines as of Linux 5.18 Git (239k as detected code lines, the rest comments and blanks). Or the in-tree open-source NVIDIA "Nouveau" code comes in at around 151k lines of code, 25.6k lines of comments, and 20.3k blank lines.
20 Comments