Writing GPU drivers

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
nulik
Member
Member
Posts: 46
Joined: Thu Oct 20, 2011 2:07 pm

Writing GPU drivers

Post 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
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Writing GPU drivers

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Rusky
Member
Member
Posts: 792
Joined: Wed Jan 06, 2010 7:07 pm

Re: Writing GPU drivers

Post 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?
shmx
Member
Member
Posts: 68
Joined: Sat Jan 16, 2016 10:43 am

Re: Writing GPU drivers

Post 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.
nulik
Member
Member
Posts: 46
Joined: Thu Oct 20, 2011 2:07 pm

Re: Writing GPU drivers

Post 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.
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Re: Writing GPU drivers

Post 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
shmx
Member
Member
Posts: 68
Joined: Sat Jan 16, 2016 10:43 am

Re: Writing GPU drivers

Post 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.
shmx
Member
Member
Posts: 68
Joined: Sat Jan 16, 2016 10:43 am

Re: Writing GPU drivers

Post by shmx »

All documentation on Intel GPU can be found in Google.
nulik
Member
Member
Posts: 46
Joined: Thu Oct 20, 2011 2:07 pm

Re: Writing GPU drivers

Post 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!
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: Writing GPU drivers

Post 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.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
User avatar
Rusky
Member
Member
Posts: 792
Joined: Wed Jan 06, 2010 7:07 pm

Re: Writing GPU drivers

Post 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.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Writing GPU drivers

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Rusky
Member
Member
Posts: 792
Joined: Wed Jan 06, 2010 7:07 pm

Re: Writing GPU drivers

Post 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.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Writing GPU drivers

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Rusky
Member
Member
Posts: 792
Joined: Wed Jan 06, 2010 7:07 pm

Re: Writing GPU drivers

Post 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.
Post Reply