[PATCH] D106426: [FuncSpec] Support specialising recursive functions

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 22 19:13:58 PDT 2021


ChuanqiXu added a comment.

In D106426#2895819 <https://reviews.llvm.org/D106426#2895819>, @SjoerdMeijer wrote:

> In D106426#2892809 <https://reviews.llvm.org/D106426#2892809>, @ChuanqiXu wrote:
>
>> And my question is: what would be different if we don't change the value for `FuncSpecializationMaxIters`?
>
> I have no plan to change the default number of iterations at this point. First, I wanted to get this features in, so that it can be controlled with this option. But next, when we start looking at enabling the function specialisation pass by default and need to look at compile times again, we can revise this what would be acceptable. Or perhaps we do need a "aggressive" options, that sets the number of iterations to some value. But yeah, getting function specialisation enabled by default is going to be difficult, and didn't want to make it even more difficult by consider changing the default at this point



> I have no plan to change the default number of iterations at this point.

Yeah, I didn't neither. If the default behavior doesn't change, we don't need to measure the numbers again to save time.

> Or perhaps we do need a "aggressive" options, that sets the number of iterations to some value.

This is the problem. Since the number of recursive function get specialized may increase with `FuncSpecializationMaxIters`, it may be scaring to users (may be other compiler engineer tuning the performance). I think the problem may come from there is no restriction between iterations.
One solution may be add  a structure like `Set<Set<Function*>>` to record functions specialized and a structure `Set<Function*, Argument*>` to record the function specialized for specific argument. Then we could give higher penalty for the recursive cases for the same argument. The design for data structure may not be best. But I think I stated my concern. Simply, I don't want the number of specialized functions get increased linearly with `FuncSpecializationMaxIters` increases unlimitedly.


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

https://reviews.llvm.org/D106426



More information about the llvm-commits mailing list