Live data from Hacker News

AMD Open-Source GPU Kernel Driver Above 5M Lines, Entire Linux Kernel at 34.8M

phoronix.com

41–50 of 77 posts

Re: AMD Open-Source GPU Kernel Driver Above 5M Lines, Entire Linux Kernel at 34.8M

#41
post #19

Does a graphical representation of the files in the Linux kernel exist anywhere? Like a graphical file explorer but for the different kernel components.

you can run windirstat (or similar tool) on a checkout to get an idea

Yeah, I guess this is the answer. When I posted the question I had this[1] in mind, and was thinking of something like that with simplified labels maybe. But I guess the file structure is so organized it would explain itself to anyone interested in this kind of thing.

[1] https://upload.wikimedia.org/wikipedia/commons/d/d5/GNOME_Di...

Re: AMD Open-Source GPU Kernel Driver Above 5M Lines, Entire Linux Kernel at 34.8M

#42
I am working on the kernel right now, the code is very pleasant (as far as C code goes) to work with.

Whereas I worked on Chrome's V8 C++ code for a year and I still could not say I understand more than half of it. Its complexity is a factor more than the Linux kernel.

Re: AMD Open-Source GPU Kernel Driver Above 5M Lines, Entire Linux Kernel at 34.8M

#43
post #34
post #14

Earlier quoted context omitted.

The issue is that the generated code is checked in. Surely there's a better solution.

They _could_ in theory post the (no doubt) Perl scripts that generate those headers from the HDL along with the relevant source files, but I imagine that would be a _very_ hard sell. And probably not much more helpful to the kernel, as no one reads those headers anyways, and the compile time will not improve by shuffling where the generation step happens. It may be more practical to rework the scripts to try to find…

As long as it's deterministic there should be no issue checking in the generators right?

Re: AMD Open-Source GPU Kernel Driver Above 5M Lines, Entire Linux Kernel at 34.8M

#44
post #13

Earlier quoted context omitted.

I have not seen these scripts, but can confirm that AMD has a long history of such Perl scripts. Look at hipcc for a current, moderately frustrating, example of this. Also the last time I met one of the open source driver team in person he was, in fact, wearing a classic ATI red ATI t-shirt straight in from Markham. Much of that team is European now though from what I hear, and they’re generally a good bunch.

>ATI t-shirt straight in from Markham. Curious how much of AMD Radeon GPU development now is being done in Markham-Canada, as AFAIK, the modern Radeon architecture stems from ATI's acquisition of ArtX[1], a US-based spin-ff of SGI, which was responsible for the GPUs in the Nintendo GameCube, Wii and many other innovations like programable shaders, later found in ATI/AMD GPUs. >Much of that team is European now though…

>I didn't know AMD has a GPU design team in Europe

AFAIK they don't, but the Linux driver guys seem to be mostly German and Polish and such. And yeah, they are doing good work. I half-expect AMD to reboot their Windows driver from the Linux driver code base at some point.

Re: AMD Open-Source GPU Kernel Driver Above 5M Lines, Entire Linux Kernel at 34.8M

#45

As a comparison: FreeBSD: ~9M loc NetBSD: ~7M loc OpenBSD: ~3M loc And this includes the base userland (not just kernel) https://www.csoonline.com/article/564373/is-the-bsd-os-dying...

NetBSD currently contains an older version of this driver, from Linux 5.6. Checking just now it comes to 2.2M loc. Running the same test on the Linux 6.4 source tree, does give me the reported 5M loc.

Maybe the figures you quote exclude things imported from elsewhere like gcc and llvm, I get a figure of 75M loc for base + kernel of NetBSD-10.

Re: AMD Open-Source GPU Kernel Driver Above 5M Lines, Entire Linux Kernel at 34.8M

#46
post #38
post #28

Earlier quoted context omitted.

As the article pointed out, the vast majority of the lines of code in the driver are autogenerated header files for things like defining hardware registers. There's not much complexity or logic in that type of code. Probably if AMD wanted to spend the time, they could compress it down to a fraction of it's current size.

Right, if you have 7 different architectures, each with it's own register map, and then model-specific tweaks, you're going to have a ton of code like that.

We could just compile it into a proprietary blob like Nvidia! /s

Re: AMD Open-Source GPU Kernel Driver Above 5M Lines, Entire Linux Kernel at 34.8M

#47
post #25

Earlier quoted context omitted.

If you're not intimately familiar with GPU drivers and what goes on this gives you a very quick, back-of-the-envelope of the size and complexity of the work involved. 1/7th the size and complexity of the kernel for this one driver. I raised an eyebrow but I have only the vaguest notion of how the hardware works and what a driver might have to manage.

>If you're not intimately familiar with GPU drivers and what goes on this gives you a very quick, back-of-the-envelope of the size and complexity of the work involved. 1/7th the size and complexity of the kernel for this one driver. ehh, no. almost all of this are header files >Meanwhile the open-source NVIDIA "Nouveau" driver is around 201k (21.7k blank lines, 24.3k lines of comments, and 155k lines of code). Or the…

Nouveau barely works iirc

Re: AMD Open-Source GPU Kernel Driver Above 5M Lines, Entire Linux Kernel at 34.8M

#48

Earlier quoted context omitted.

>ATI t-shirt straight in from Markham. Curious how much of AMD Radeon GPU development now is being done in Markham-Canada, as AFAIK, the modern Radeon architecture stems from ATI's acquisition of ArtX[1], a US-based spin-ff of SGI, which was responsible for the GPUs in the Nintendo GameCube, Wii and many other innovations like programable shaders, later found in ATI/AMD GPUs. >Much of that team is European now though…

>I didn't know AMD has a GPU design team in Europe AFAIK they don't, but the Linux driver guys seem to be mostly German and Polish and such. And yeah, they are doing good work. I half-expect AMD to reboot their Windows driver from the Linux driver code base at some point.

[deleted]

Re: AMD Open-Source GPU Kernel Driver Above 5M Lines, Entire Linux Kernel at 34.8M

#49
post #34

Earlier quoted context omitted.

They _could_ in theory post the (no doubt) Perl scripts that generate those headers from the HDL along with the relevant source files, but I imagine that would be a _very_ hard sell. And probably not much more helpful to the kernel, as no one reads those headers anyways, and the compile time will not improve by shuffling where the generation step happens. It may be more practical to rework the scripts to try to find…

As long as it's deterministic there should be no issue checking in the generators right?

The generators themselves probably not, but the definition of all those registers is from hardware. These kind of code generators convert input source files that describe the hardware into C header files for the software.

But I expect AMD would be skittish about open-sourcing anything that could even remotely be construed as HDL, even if it's just dry lists of registers. Open sourcing the drivers is one thing, but the hardware itself is another.

Post reply on HN