[llvm] MachineBlockPlacement: Add tolerance to comparisons (PR #67197)

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 14:47:47 PDT 2023


MatzeB wrote:

> Do you have any idea why this impacts so many of the block ordering tests?

Most tests have no profile information and so we end up assigning equal branch weights in many cases. This means multiple successors with the same BlockFrequency are pretty common.

To make matters worse we not every integer divides cleanly. Say a block as a BlockFrequency value of 7 and has two successors with equal branch weights. We will assign frequencies 3 and 4 to the successors introducing some sort of extra numerical inaccuracy that isn't meaningful for the code.

> 2. Do you intend to limit this functionality to the baseline ordering only (i.e, Does applyExtTsp() remain sensitive to small variations)?

I was hoping that this is mostly a drive-by change to make my live easier for #66285 I did not get around to learn abut the est-tsp code so this won't be affected by this change. It would be good to introduce an equivalent change there too at some time.

> 3. Is this functionality supposed to be controlled by a flag?

I wasn't sure if anybody would ever use such a flag. I did have a flag during my personal experiments, but I felt we can rather save a couple lines of code when upstreaming and maybe gain a tiny bit of perf from hardcoded values. That said I am happy to bring back a flag if you prefer that.

https://github.com/llvm/llvm-project/pull/67197


More information about the llvm-commits mailing list