This is an archive of the discontinued LLVM Phabricator instance.

[LSR] Skip transformation if the cost of no LSR is cheaper than the best solution selected
AbandonedPublic

Authored by junbuml on Apr 28 2016, 12:55 PM.

Details

Summary

I'm posting this to get any early feedback. Please let me know if this make sense.

TODO: tests should be added.

Diff Detail

Event Timeline

junbuml updated this revision to Diff 55463.Apr 28 2016, 12:55 PM
junbuml retitled this revision from to [LSR] Skip transformation if the cost of no LSR is cheaper than the best solution selected.
junbuml updated this object.
junbuml added reviewers: gberry, qcolombet, mcrosier.
junbuml added a subscriber: llvm-commits.
junbuml updated this object.May 2 2016, 9:22 AM
junbuml added reviewers: sanjoy, majnemer.

With this change, I observed %2 performance improvement in spec2006/astar. This is a pretty simple try. Please let me know any feedback.

qcolombet edited edge metadata.May 2 2016, 9:49 AM

Hi Jun,

Instead of having a new method, can’t we consider this solution as part of the normal processing?
That way, if this is the best solution, we would naturally get it.

Cheers,
-Quentin

Instead of having a new method, can’t we consider this solution as part of the normal processing?
That way, if this is the best solution, we would naturally get it.

Hi Quentin,

I tried to add the original formula used in IsNothingCheaperThanBestSolution() as candidates to allow SolveRecurse() pick them during normal process. However, with that try, I found the formula from original IR was failed to be added in LSRUse::InsertFormula() because they overlapped with the initial formula created in CollectFixupsAndInitialFormulae().

Instead of adding more candidate and expanding search space in SolveRecurse(), we may also want to have a separate function which only finds the cost from original IR.

Hi Jun,

The thing with LSR is that it is already complex enough that if we can avoid adding more separate paths I think it is best.

I found the formula from original IR was failed to be added in LSRUse::InsertFormula() because they overlapped with the initial formula created in CollectFixupsAndInitialFormulae().

That is an interesting piece of information!
Why is best better than this one but not better than the one we add with IsNothingCheaperThanBestSolution?

Cheers,
-Quentin

gberry resigned from this revision.May 23 2016, 3:28 PM
gberry removed a reviewer: gberry.
gberry added a subscriber: gberry.
sanjoy resigned from this revision.Aug 9 2016, 10:28 PM
sanjoy removed a reviewer: sanjoy.

Looks stale, please add me back if you want to revive this.

junbuml abandoned this revision.Aug 10 2016, 7:34 AM

The initial cost I meant here was the cost before the post-increment normalization, and I skipped rewriting for the best solution selected from the post-inc transformed candidates if the initial cost is cheaper than the best solution. However, I found very fundamental cases were not handled by skipping rewriting.