This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Handling prefetcher tag collisions while allocating registers


On 10/23/2017 07:44 PM, Kugan Vivekanandarajah wrote:
Hi All,

I am wondering if there is anyway we can prefer certain registers in
register allocations. That is, I want to have some way of recording
register allocation decisions (for loads in loop that are accessed in
steps) and use this to influence register allocation of other loads
(again that are accessed in steps).
In some cases, you can achieve assigning the same register for particular pseudos. Please, see threads in ira-color.c. But the pseudos should be colorable at the same time.
This is for architectures (like falkor AArch64) that use hardware
perefetchers that use signatures of the loads to lock into and tune
prefetching parameters. Ideally, If the loads are from the same
stream, they should have same signature and if they are from different
stream, they should have different signature. Destination, base
register and offset are used in the signature. Therefore, selecting
different register can influence this.

In LLVM, this is implemented as a machine specific pass that runs
after register allocation. It then inserts mov instruction with
scratch registers to manage this. We can do a machine reorg pass in
gcc but detecting strided loads at that stage is not easy.
I guess finding the strided loads in GCC RA has the same difficulty as in a reorg pass after it.

I think it is better to implement it as a separate pass because it is too specific and RA is already complicated. Implementing it in RA will have some constraints (not all cases will be implemented) and you will need to overcome many obstacles because RA might change its decisions in many places after initial assignments (e.g. in ira-color.c::improve_allocation and in many LRA places).

I am trying to implement this in gcc and wondering what is the
preferred and acceptable way to implement this. Any thoughts ?


My preference would be a separate pass but the final decision is up to you. I am just sharing my thoughts.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]