[Mesa-dev] Mesa IR as a list of instructions
Eric Anholt
eric at anholt.net
Wed May 28 11:37:31 PDT 2014
Here's a series I started back in January as a little experiment.
Basically, I feel guilty for pushing GLSL IR into the driver, and wish I'd
just fixed up Mesa IR back in the day. But, given that we're still
feeding Mesa IR into drivers as well (ARB programs and fixed function
vertex programs), it made me think: What if I fixed it up now, and got
Mesa IR to the point that we could just garbage collect the GLSL IR input
paths to drivers?
Mesa IR has a bunch of weaknesses that need to get sorted out if it's
going to be useful:
- It's a single giant array of instructions, making modifications of the
instruction stream (instruction lowering, optimization, etc.) more
expensive in code and CPU time than it should be.
- It doesn't have any variable declarations, so if you have dynamic array
indexing, optimization just shuts down (plus, no annotation on the
temps, so debugging is irritating).
- It doesn't have integer instructions or anything else post-GLSL-1.30.
- The optimization passes for it are totally ad-hoc and fairly weak.
- It's not SSA.
I'm interested in fixing all of these. How do people feel about this
goal?
This series fixes the first bullet point above. Patch 15 is huge, but I
didn't see a way to chop it up smaller without maintaining the list
alongside the array for some intermediate patches. I'd be willing to do
so if needed, though, to make review doable. You can also find the
changes in the "mesa-ir" branch of my git tree.
More information about the mesa-dev
mailing list