[PATCH] D132408: [SimplifyCFG] accumulate bonus insts cost

Yaxun Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 6 14:57:08 PDT 2022


yaxunl added a comment.

In D132408#3772225 <https://reviews.llvm.org/D132408#3772225>, @yaxunl wrote:

> In D132408#3772184 <https://reviews.llvm.org/D132408#3772184>, @fhahn wrote:
>
>> In D132408#3757270 <https://reviews.llvm.org/D132408#3757270>, @yaxunl wrote:
>>
>>> In D132408#3756337 <https://reviews.llvm.org/D132408#3756337>, @nikic wrote:
>>>
>>>> Do you have any numbers for the impact of this change? I suspect (but haven't checked) that it may be quite significant, because the current tiny bonus inst threshold (1) is tuned for the current implementation, and this patch will result in much less common dest folding than would be desirable.
>>>
>>> For a synthetic benchmark geared towards loops with small workloads, we saw around 16% performance gain due to avoiding always executing 31 extra load instructions by not folding 31 basic blocks coming from an unrolled loop.
>>>
>>> For typical HIP programs, I did not see significant performance differences before and after this change. This is because the original bonus instruction threshold 2 is very small. It only allows folding small basic blocks which only contain one instruction other than the cmp/branch instructions. In practical applications, such basic blocks are rare and usually are not performance bottlenecks. Only in special situations (e.g. a fully unrolled loop of large loop counts ends up with a large number of foldable basic blocks) the performance penalty becomes significant.
>>
>> I am not sure what typical HIP programs mean here. Did you measure the impact on general CPU benchmarks?
>
> No. Can you recommend a free CPU benchmark that is suitable for this purpose? Thanks.

I will try running the SPEC CPU benchmark. There are many sub-tests. Do you recommend any sub-tests that are most relevant to this patch? Thanks.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132408/new/

https://reviews.llvm.org/D132408



More information about the llvm-commits mailing list