[Mesa-dev] What I'm working on

José Fonseca jfonseca at vmware.com
Tue Oct 12 07:39:55 PDT 2010


On Mon, 2010-10-11 at 14:49 -0700, Ian Romanick wrote:
> 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.  llvmpipe has shown that they are
> also completely useless for generating code for CPUs.

Ian,

I don't fully understand the above. I'm not sure if there's actually an
disagreement or just different terminology.


TGSI is indeed inadequate for optimization (as in TGSI -> TGSI
transformations), but it was never intended for that role: there was
always the assumption it would be feed into an optimization compiler
(ie. TGSI -> xxx -> GPU code).

The role of TGSI was to be API agnostic (i.e., support xxx -> TGSI, yyy
-> TGSI). I admit this is not advantage the only frontend is Mesa, but
TGSI proved to be very useful when used in conjunction with other APIs
beyond GL. It also makes hashing easy.

FWIW, I'm fine with TGSI being replaced with something else (LLVM IR,
mesa/src/glsl's), provided that IR is a superset of TGSI.


Also, for the record, I don't think the problem is resemblance to
assembly.

Take LLVM IR for example: it is an assembly-like IR in SSA form, as
every instruction consists of an opcode plus operands, and operands
can't be complex expressions.

What makes TGSI and Mesa IR inadequate for compilation is not their
assembly resemblance, but the fact they lack any other auxiliary
structure (a tree form or SSA form would be advisable, but they are
merely an one directional list), and therefore are very difficult to
walk, analyze, or rewrite.


Jose



More information about the mesa-dev mailing list