This is an archive of the discontinued LLVM Phabricator instance.

SLPVectorizer: limit the scheduling region size per basic block to avoid long compile times for very large blocks.
ClosedPublic

Authored by eeckstein on Sep 29 2015, 1:12 PM.

Details

Summary

Usually large blocks are not a problem. But if a large block (> 10k instructions) contains many (potential) chains of vector instructions, and those chains are spread over a wide range of instructions, then scheduling becomes a compile time problem.
This patch introduces a limit for the accumulate scheduling region size of a block.
For real-world functions this limit will never be exceeded (it's about 10x larger than the maximum value seen in the test-suite and external test suite).

Diff Detail

Event Timeline

eeckstein updated this revision to Diff 36025.Sep 29 2015, 1:12 PM
eeckstein retitled this revision from to SLPVectorizer: limit the scheduling region size per basic block to avoid long compile times for very large blocks..
eeckstein updated this object.
eeckstein added a reviewer: aschwaighofer.
eeckstein added a subscriber: llvm-commits.

Hi Erik,

Could we add a cl::opt to specify this threshold? That would also help writing a test for the change, as we can use a lower threshold there.

Thanks,
Michael

eeckstein updated this revision to Diff 36055.Sep 29 2015, 5:33 PM

Add an option to set the scheduling budget + a test which uses that option.

Thanks, Michael, for the suggestion.

LGTM, thanks!

BTW, would it make sense to add a test to check that we properly use MinScheduleRegionSize too?

Thanks,
Michael

mzolotukhin accepted this revision.Sep 29 2015, 5:42 PM
mzolotukhin added a reviewer: mzolotukhin.
This revision is now accepted and ready to land.Sep 29 2015, 5:42 PM

Thanks for reviewing!
I committed it in r248917.

BTW, would it make sense to add a test to check that we properly use MinScheduleRegionSize too?

It's not so important than checking that everything does well when the limit is exceeded. But yes, why not?
I'll add a test in a separate commit.

BTW, would it make sense to add a test to check that we properly use MinScheduleRegionSize too?

added in r248923

hfinkel closed this revision.Oct 27 2015, 6:41 PM