[Mesa-dev] What I'm working on

Dave Airlie airlied at gmail.com
Tue Oct 12 16:20:22 PDT 2010

On Wed, Oct 13, 2010 at 3:33 AM, Ian Romanick <idr at freedesktop.org> wrote:
> Hash: SHA1
> Brian Paul wrote:
>> On 10/11/2010 03:49 PM, Ian Romanick wrote:
>>> It should be possible to move ir_to_mesa out of core Mesa and into a
>>> (lower) driver level.  As has been discussed numerous times, the
>>> assembly-like IRs in Mesa (classic Mesa IR and TGSI) are completely
>>> useless for generating code for GPUs.
>> I'm sorry, but that's an exageration.  Mesa IR and TGSI are very similar
>> to the original ARB vertex/fragment program languages which were clearly
>> intended for GPU implementation.  They may not be ideal in some ways,
>> but certainly not completely useless.
> I suppose I should have said "useless for generating high quality code
> for GPUs."
> The original ARB vertex/fragment program languages were clearly intended
> for *direct* GPU translation.  That is, the intention was that there
> would be a nearly 1-to-1 translation from instructions in the source
> language to instructions on the hardware.  For that generation of
> hardware that was a good assumption, but this hasn't been the case for
> many years.  It certainly isn't true on i965 or r600.
> Look at what the r600 driver.  It translates Mesa IR (r600g presumably
> does the same with TGSI) back up to some higher-level IR before doing
> register allocation, code generation, and scheduling.  Every single
> credible DX driver also works this way, and driver writers *hate* it.
> The driver basically has to decompile one assembly back into a
> higher-level IR, attempting to infer the intention of the origin program
> along the way.
> When we have access to the original program already in a higher-level
> IR, this is just plain madness.  The driver has to do more work.  Since
> information is lost as the IR becomes lower and lower, the driver has
> less information to use to do that work.  It's a lose/lose situation.
> Outside of DX and Mesa, no multi-target compiler works like this.  LLVM
> doesn't[1].  GCC doesn't[2].  LCC doesn't[3].  Open64 (formerly MipsPro)
> doesn't[4].  Closed-source GLSL compilers don't.  There is a reason. :)

The AMD IR is findable with google, I think their GLSL compiler spits
that out, it seems to my untrained eye to be more TGSI like than not,
but you guys know more about what you are talking about than I.



More information about the mesa-dev mailing list