Page 1 of 2

Writing GPU drivers

Posted: Mon Jan 25, 2016 10:22 am
by nulik
Hi,
for a parallel computing project I need to use GPUs. The "OS" where I am going to use the GPU has nothing , it is an exokernel OS, with about 10% of glibc functions. So, OpenCL and "user installable drivers" from the manufacturer wont work. To make it shorter, my question is this: which GPU manufacturer would you go for, to write your own driver? (just one GPU model support will be enough) Besides NVIDIA, Intel, and AMD there are some few GPU manufactuers out there, but who of those manufacturers have the most open source friendly technology? I need it to be open source, so I can port the driver to my OS and use the GPU. And I do not want to suffer like the Nouveau folks reverse engineering the GPU-CPU communication traffic.

Will appreciate very much your comments.
TIA
Nulik

Re: Writing GPU drivers

Posted: Mon Jan 25, 2016 11:39 am
by Brendan
Hi,
nulik wrote:for a parallel computing project I need to use GPUs. The "OS" where I am going to use the GPU has nothing , it is an exokernel OS, with about 10% of glibc functions. So, OpenCL and "user installable drivers" from the manufacturer wont work. To make it shorter, my question is this: which GPU manufacturer would you go for, to write your own driver? (just one GPU model support will be enough) Besides NVIDIA, Intel, and AMD there are some few GPU manufactuers out there, but who of those manufacturers have the most open source friendly technology? I need it to be open source, so I can port the driver to my OS and use the GPU. And I do not want to suffer like the Nouveau folks reverse engineering the GPU-CPU communication traffic.
Run.

Run now.

Run fast. Don't look back.

Don't stop running until the project's deadline has passed. Only then should you look back at the carnage the project's failure caused and marvel at the sheer horror. :roll:


Cheers,

Brendan

Re: Writing GPU drivers

Posted: Mon Jan 25, 2016 11:56 am
by Rusky
Well that was incredibly helpful! Good job representing OSDev.org, Brendan!



Intel is probably the most openly documented of the three, but also the least powerful. AMD is documented to some degree and has open source drivers for Linux, but as far as I know those drivers aren't as capable as the closed-source ones. Nvidia, as you noted, is (almost) completely undocumented.

The only other GPUs I know of that are still in use today are for mobile devices, and those aren't very open- PowerVR, Qualcomm, etc. However, Broadcom recently released the source and specification for their GPU used in the Raspberry Pi- but that's probably around the same level as an Intel GPU.

Is there any reason you have to use that particular OS for this project? What kind of schedule/funding do you have?

Re: Writing GPU drivers

Posted: Mon Jan 25, 2016 1:00 pm
by shmx
it's too hard. There is no compatibility between the cards even one manufacturer. I made a video mode switching and hardware cursor through the registers for the R600-R700. Initialize AMD GPU is too difficult. Almost all documents closed. Intel GPU is much easier + open documentation. Initialize GPU + GART is about 10k С code lines (min) for new AMD GPU. About nVidia I do not know anything. I do not think that it is easier.

Re: Writing GPU drivers

Posted: Mon Jan 25, 2016 1:23 pm
by nulik
shmx wrote:it's too hard. There is no compatibility between the cards even one manufacturer. I made a video mode switching and hardware cursor through the registers for the R600-R700. Initialize AMD GPU is too difficult. Almost all documents closed. Intel GPU is much easier + open documentation. Initialize GPU + GART is about 10k С code lines (min) for new AMD GPU. About nVidia I do not know anything. I do not think that it is easier.
Thanks! This input is very helpful. I actually don't need a lot of power, just the average. The Intel GPU will work. What models of Intel GPUs are you talking about? Is there any sample code I can see? I hope it is not the Xeon Phi, since it is very expensive.

Re: Writing GPU drivers

Posted: Mon Jan 25, 2016 3:50 pm
by JAAman
nulik wrote: Thanks! This input is very helpful. I actually don't need a lot of power, just the average. The Intel GPU will work. What models of Intel GPUs are you talking about? Is there any sample code I can see? I hope it is not the Xeon Phi, since it is very expensive.
what they are talking about is the integrated graphics that is built into almost every single Intel CPU sold in the last 6 years -- basically, if your computer has an Intel CPU, it probably also has an Intel GPU -- only exceptions are the workstation chips (xeon), some low-end chips (mostly older atom use a different graphics system, but also certain models of pentium/celron) and the E series chips

all the documentation for them has been moved to https://01.org/linuxgraphics/documentat ... ation-prms

Re: Writing GPU drivers

Posted: Mon Jan 25, 2016 4:02 pm
by shmx
nulik wrote:What models of Intel GPUs are you talking about?
I've only worked with the old 945 chips. New chips (integrated in CPU) is not much more complicated.
nulik wrote:Is there any sample code I can see?
There are only fragments of source code for attempts (half successful ) organization 2D acceleration. You can view the source code KolibriOS. They are much more advanced in this.

Re: Writing GPU drivers

Posted: Mon Jan 25, 2016 4:04 pm
by shmx
All documentation on Intel GPU can be found in Google.

Re: Writing GPU drivers

Posted: Mon Jan 25, 2016 8:02 pm
by nulik
JAAman wrote:
all the documentation for them has been moved to https://01.org/linuxgraphics/documentat ... ation-prms
Thanks! Looks like neither today I am going to sleep, very exciting stuff!

Re: Writing GPU drivers

Posted: Tue Jan 26, 2016 4:36 pm
by SpyderTL
I'm not sure what your actual restrictions are, but you may want to consider using VMWare to run your OS, as its 3D accelerated functionality is fairly simple and well documented with examples and source code.

VirtualBox is also an option, although I think VMWare has better documentation, and possibly more features.

If you must run on an actual machine, Intel is probably the way to go.

Re: Writing GPU drivers

Posted: Tue Jan 26, 2016 4:53 pm
by Rusky
Another (likely relatively minor) consideration is that AMD cards are pretty straightforward to pass through to KVM/Xen virtual machines, Nvidia is possible but harder, and Intel is not possible yet but work is being done to let multiple VMs (including dom0) share a single Intel GPU without going through something like VMWare's graphics acceleration interface.

Re: Writing GPU drivers

Posted: Tue Jan 26, 2016 10:49 pm
by Brendan
Hi,
SpyderTL wrote:I'm not sure what your actual restrictions are, but you may want to consider using VMWare to run your OS, as its 3D accelerated functionality is fairly simple and well documented with examples and source code.
VM interfaces typically convert the guests graphics into the host's OpenGL/DirectX API, which is fine for 3D graphics but isn't usable for GPGPU.


Cheers,

Brendan

Re: Writing GPU drivers

Posted: Tue Jan 26, 2016 11:38 pm
by Rusky
OpenGL and DirectX both support compute shaders, so it should be possible in principle. I can't tell at a glance whether VMWare or VirtualBox can handle them though.

Re: Writing GPU drivers

Posted: Tue Jan 26, 2016 11:59 pm
by Brendan
Hi,
Rusky wrote:OpenGL and DirectX both support compute shaders, so it should be possible in principle. I can't tell at a glance whether VMWare or VirtualBox can handle them though.
It really doesn't take much searching to find out they can't (unless you're using some form of "PCI pass through" to give the guest direct access to the real GPU).


Cheers,

Brendan

Re: Writing GPU drivers

Posted: Wed Jan 27, 2016 12:29 am
by Rusky
Are you saying they can't, or don't? Because I don't believe either is entirely true- I've seen fairly recent games run (very slowly) in VMWare and VirtualBox, and those games tend to use compute shaders.