[Mesa-dev] What I'm working on
idr at freedesktop.org
Tue Oct 12 10:33:48 PDT 2010
-----BEGIN PGP SIGNED MESSAGE-----
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
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. GCC doesn't. LCC doesn't. Open64 (formerly MipsPro)
doesn't. Closed-source GLSL compilers don't. There is a reason. :)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
More information about the mesa-dev