Live data from Hacker News

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

phoronix.com

31–40 of 77 posts

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

#31

I'm not sure I get why the comparison to the Kernel is needed. GPUs are wildly complex. Rendering is wildly complex. Managing memory and data is complex. Managing connected hardware is complex. I am not sure why anyone would expect a GPU Driver to be small while also doing a billion things and playing games as well as mature gaming platforms.

It is said nvidia hardware programming interface is much more simple than AMD one.

If true, AMD is doing something wrong here. And yes, giga tons of generated headers related to registers.

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

#33

Earlier quoted context omitted.

Because it's large and large is difficult to maintain. AMD maintains it but do we know how they are generated? Probably not. It's like a gift that stinks but you can't complain about because it's a gift.

>but do we know how they are generated? Probably not Having worked in the semi industry, I can fathom a guess: It's a spaghetti mess of cascading Perl scripts that parse the Verilog/VHDL design files, with their development going back 20+ years, full of comments like "don't touch this line because it breaks another line, nobody knows why", and maintained by a team where a gray-beard "Gandalf" engineer wearing an ATI…

There's bound to be some tcl in there too...

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

#34
post #14
post #4

The openbsd situation is even worse. over there the driver is bigger than the rest of the kernel. Don't get me wrong I use the driver every day and AMD is definitely one of the good guys for making an open source driver and them who ported it are absolute heros. However.... Sometimes I wish AMD had tied down the isa to their cards a little better. Narrowed the interface if you would. because as it is the driver is so…

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 ways to reduce the verbosity and redundancy. The actual .c driver code probably doesn't need every copy of every lines in all those .h files.

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

#35
post #25

I'm not sure I get why the comparison to the Kernel is needed. GPUs are wildly complex. Rendering is wildly complex. Managing memory and data is complex. Managing connected hardware is complex. I am not sure why anyone would expect a GPU Driver to be small while also doing a billion things and playing games as well as mature gaming platforms.

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 Intel i915 DRM kernel graphics driver is around 381k lines via the same cloc judgment.

so it seems like GPU driver is around 1% of kernel's code

and you start thinking why actually kernel has this much code if GPU (out of all software) needs just around 1%.

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

#37

Earlier quoted context omitted.

A lot of open source projects work that way. Open source means you get access to the source and get to make changes for your own use. It doesn't mean you get to force anyone else to merge your code.

> It doesn't mean you get to force anyone else to merge your code. Sure, you can fork the code if you really feel that strongly about it. My main "issue" is that it basically removes one of the big benefits of open source, that we can collaborate and do better as a collective. If it's just a big code dump that other kernel developers can't really touch it's more "source code is available" than actual open source.

The fundamental premise of open source is full access to the source with the possibility to make changes and redistribute those changes [0]. Anything else, including collaboration to improve the code, is a nice cherry on top but not consequential to the concept of open source.

[0] https://opensource.org/osd/

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

#38
post #28
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.

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.

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

#39
... and it doesn't work right. When you start googling for your syslog entries you find countless reports spanning many kernel versions of identical looking crashes, likely with different root causes since all the message basically says is "the GPU hung".

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

#40
post #4

The openbsd situation is even worse. over there the driver is bigger than the rest of the kernel. Don't get me wrong I use the driver every day and AMD is definitely one of the good guys for making an open source driver and them who ported it are absolute heros. However.... Sometimes I wish AMD had tied down the isa to their cards a little better. Narrowed the interface if you would. because as it is the driver is so…

There is no business reason to restrict themselves on the ISA, and it would be make their hardware less performant compared to the competition which would not be so bound.

The competition is very much bound to a rather narrow ISA which is why CUDA is forward and backwards compatible whilst ROCm isn’t.

ROCm will be pointless until at least forward compatibility will be guaranteed by design.

Post reply on HN