[PATCH] D25482: [PPC] Allow two post RA schedulers to be in the pipeline and select one depending on the Machine Function's subtarget

Ehsan Amiri via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 13 10:28:43 PDT 2016


amehsan added a comment.

> The pattern adds an extra non-obvious possibility why a pass wouldn't run, which has its costs when reading and debugging any pass.

Not sure I follow here. Note that we have two overload of skipFunction(). Any pass that does not want to call the subtarget, can call the current overload. Any pass that calls the new overload, will need to call subtarget one way or another. So the extra check is there in both cases.

> There is exactly one runPass() function which has to handle a combination of subtarget + passid to make a decision, this is very likely to get unwieldy as more passes and more subtarget exceptions get added in the future.

In most cases this function looks at (cpu, pass) pair and return true/false based on that. Any subtarget that starts to have a complicated runPass, can engineer their code properly. For example by adding private functions for each pass, and calling the private function based on pass id.  (Note that the difference with having enablePostRA... function is that the pass dependent extra function is no longer part of the subtarget interface).

> Having 1 callback per pass (like enablePostRAScheduling) at least keeps the passid dimension out of it and makes it easier to search and understand the behaviour IMO.

I see two problems with this. The minor problem is this: for the example that we have discussed so far, we need one enablePostRA function that returns an enum and an enableMachinePipeliner that returns a bool. This is a minor advantage for the current patch in terms of code quality. (In addition to a less polluted interface for subtarget). The more important problem is related to the following:

> Well I was proposing to always schedule both passes in TargetPassConfig rather than requiring interested targets to overload a newly introduced addPostRASched() functions to keep things simpler.

This is not a good idea. There are already backends that have stopped using Post RA top down scheduler <https://github.com/llvm-mirror/llvm/blob/master/lib/Target/AArch64/AArch64TargetMachine.cpp#L289> and use the new MI scheduler. Also the general idea, AFAIK, is that the top down scheduler is the old mechanism and MI scheduler is the new mechanism. With what you are proposing, we are saying that people who have moved/will move to the new scheduler (or potentially any new subtarget that starts using new mechanism from the beginning), should continue calling the old scheduler until every backend has moved off of it so we can entirely remove it. I don't think this is a good idea. This reminds me of the first point of your comment that I quoted here: "The pattern adds an extra non-obvious possibility why a pass wouldn't run, which has its costs when reading and debugging any pass.". Not exactly the same issue, but similar.


https://reviews.llvm.org/D25482





More information about the llvm-commits mailing list