Posts: 469 from 2003/4/11
It's not really to push, just out of curiosity. Any news about this?
Sorry for the quiet as of late. I've been working on the R600 (and R700, Evergreen and Northern Islands) driver over the past few weeks, mostly focusing on writing the shader compiler for it. The shader compiler seems
to be in a fairly good shape right now (more on that in the next paragraphs, for those interested), so my focus will shift to getting all the other parts required to make the driver work done. These things are mainly basic hardware setup, state handling, texture handling and so on. This means that I unfortunately am still not at a place where the driver can render even the simplest thing, but once I do get there, there will be very rapid progress to a fully functional driver. I am hoping
to have the R600 driver run its first simple apps next week, although I can make no promise that that's when it'll happen.
The following can be skipped for those who are not interested in the technical side of the driver development.
Now how can I know the shader compiler is in a good shape if I can't run it yet? Well, graphics hardware in general, and certainly Radeons specifically, there's really not much you can do in terms of getting any sort of debug info out of the hardware. I write the driver, I try it and I get basically one of 4 possible outcomes:
1) There's a software crash.
2) Nothing happens.
3) The hardware crashes, but the OS keeps running.
4) The hardware completely locks up the entire system.
1 is the easiest to debug, since it's almost certainly a software problem. The other 3 are much more difficult to debug, although each failure mode does give a hint as to what's going on. However, a bug in the shader compiler can cause any of the failure modes labelled 2-4 above, with no or little additional info available to help me figure out why it's failing. Simultaneously pretty much any other mistake in the Radeon state setup can also result in any of the same 3 failure modes, so it's really hard to tell what's going on at a first glance when there is a problem.
When it comes to debugging shaders, there's no mechanism for stepping through a compiled shader program to see what's happening and when. There's no way to even get any sort of run time information out of there, so that makes debugging it very much a trial and error thing, which is very time consuming.
So one thing I'm doing to reduce the amount of time I have to spend fumbling around in the dark is that not only do I write the shader compiler, I also write a disassembler for the shader binary that gets uploaded to the Radeon hardware for execution. So while writing the driver, I first make it compile whatever program is passed to it, and then immediately afterwards it disassembles what it has just compiled. It then dumps all this data (the original shader source, all the intermediate compiler states after parsing, optimising, etc and the disassembled program) for me in the debug log. I then go through everything manually, comparing it to the original shader source passed to the driver to make sure the final compiled program actually matches what the source code does.
Doing it this way is a bit more work up front, but it saves me time in the end, as it helps me catch a lot of simple mistakes that happen while initially writing the compiler, and it helps me confirm that what the compiler does is actually correct. It is also why I can state - without having actually run any shader binary produced by the compiler - that the compiler is in a fairly good shape currently.
Another interesting thing about R600 and newer hardware is that the part of the hardware that fetches vertex data from memory and presents it to the vertex shader for processing, which was fixed-function hardware in previous Radeons is now entirely, 100% a shader on its own. That means that just to have the hardware fetch vertex data from memory, the driver has to generate a shader to instruct the Radeon how to do so.
I rarely log in to MorphZone which means that I often miss private messages sent on here. If you wish to contact me, please email me at [username]@asgaard.morphos-team.net, where [username] is my username here on MorphZone.