[Lima] Update on lima dev

Qiang Yu yuq825 at gmail.com
Mon Jun 11 01:56:46 UTC 2018


Hi Erico,

Add lima ML and Connor.

> 1) about register spilling in ppir: apparently what needs to be done
> is to turn ra_allocate(g) in ppir into a loop and implement
> "choose_spill_node" and "spill_node" ppir functions in case
> ra_allocate fails. Like is done in
> src/mesa/src/broadcom/compiler/vir_register_allocate.c .
> If I understand correctly about ppir, we could have multiple
> operations in a single pp instruction but we are not doing that for
> now.
In fact I do merge two node into same instr when ^vmul or ^fmul
can be used to save a reg. And yes, we need to add a merge stage
latter for optimization

> So my first implementation would be simply to add a load/store
> temporary before and after every use of the spilled registers. From
> what I understood it is not the best performance-wise but could solve
> the problem.
> Is this solution ok for now?
I'm OK with this.

>
> 2) about converting scalar to vec4. I spent less time on this one, but
> so far seems like a hard problem. Do you think it is even possible to
> implement a generic solution (for example iterating the list of noces
> and reconstructing vectors in loads and alu operations, or
> implementing some new algorithm), or do you already expect we will use
> a new mesa "cap" to turn off conversion to scalar?
I was also thinking the two choice you mentioned. I think the scalar
to vec4 method is preferred if can be implemented because NIR link
time optimization need scalar. As if it is implementable I don't have a
good algorithm now. @Connor, do you have any idea with this?

>
> 3) I noticed that gpir doesn't use ra_allocate() and the
> register_allocate infrastructure from mesa, while pp does. Is there a
> reason for that, or should gpir move to also use mesa's
> register_allocate later?
>
It's OK for gpir reg alloc implemented like this. It's called linear
scan reg alloc I heard from Connor. It's simpler and faster than
graph coloring based reg alloc. Besides mesa's reg alloc is for HW
has vec regs which introduce vec4/vec3/vec2/vec1 conflict problem.
gp is just scalar HW, so no need to use mesa's ra. BTW. there're
two ra pass in gpir, first is for value reg, second is for real reg.
I haven't implemented spill for real reg alloc, but it's not triggered
yet.

Regards,
Qiang


More information about the lima mailing list