Skip to content

[polly][ScheduleOptimizer] Fix long compile time(hang) reported in polly #75141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 2, 2024

Conversation

kartcq
Copy link
Contributor

@kartcq kartcq commented Dec 12, 2023

[polly][ScheduleOptimizer] There is no upper cap set on current Schedule Optimizer to compute schedule. In some cases a very long compile time taken to compute the schedule resulting in hang kind of behavior. This patch introduces a flag 'polly-schedule-computeout' to pass the cap which is initialized to 300000. This patch handles the compute out cases by bailing out and exiting gracefully.

This patch fixes the bug reported under polly : #69090

…SL quota

There is no upper cap set on current Schedule Optimizer to compute schedule. In
some cases a very long compile time taken to compute the schedule resulting in
hang kind of behavior. This patch introduces a flag 'polly-schedule-computeout'
to pass the cap which is initialized to 300000. This patch handles the compute
out cases by bailing out and exiting gracefully.

Change-Id: Id506832df4ae8d3f140579ba10cf570e18efac62
@efriedma-quic
Copy link
Collaborator

The isl_options_set_on_error thing still seems like an issue; there's a path to restore on_error, but it doesn't run if the quota is hit.

Do we actually need to explicitly check hasQuotaExceeded() at all? If there's an error, the schedule should be null, and there's already a check for if (Schedule.is_null()).

@kartcq
Copy link
Contributor Author

kartcq commented Dec 19, 2023

Thanks for your comments @efriedma-quic

> The isl_options_set_on_error thing still seems like an issue; there's a path to restore on_error, but it doesn't run if the quota is hit.
Your concern makes sense. I have removed the early return there.

> Do we actually need to explicitly check hasQuotaExceeded() at all? If there's an error, the schedule should be null, and there's already a check for if (Schedule.is_null()).
I will still choose to keep hasQuotaExceeded() function to add a debug print indicating the reason for bailout as quota exceeded.

@kartcq
Copy link
Contributor Author

kartcq commented Jan 2, 2024

ping @efriedma-quic @xgupta

Copy link
Collaborator

@efriedma-quic efriedma-quic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@efriedma-quic efriedma-quic merged commit d6c4d4c into llvm:main Jan 2, 2024
@avillega
Copy link

avillega commented Jan 3, 2024

I think this change might be breaking some of our builds, please revert if possible.
This is the error I am getting:

******************** TEST 'Polly :: ScheduleOptimizer/schedule_computeout.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /b/s/w/ir/x/w/llvm_build/tools/clang/stage2-bins/bin/opt -S -polly-optree -polly-delicm  -polly-opt-isl -polly-schedule-computeout=100000 -debug-only="polly-opt-isl" < /b/s/w/ir/x/w/llvm-llvm-project/polly/test/ScheduleOptimizer/schedule_computeout.ll 2>&1 | /b/s/w/ir/x/w/llvm_build/tools/clang/stage2-bins/bin/FileCheck /b/s/w/ir/x/w/llvm-llvm-project/polly/test/ScheduleOptimizer/schedule_computeout.ll
+ /b/s/w/ir/x/w/llvm_build/tools/clang/stage2-bins/bin/opt -S -polly-optree -polly-delicm -polly-opt-isl -polly-schedule-computeout=100000 -debug-only=polly-opt-isl
+ /b/s/w/ir/x/w/llvm_build/tools/clang/stage2-bins/bin/FileCheck /b/s/w/ir/x/w/llvm-llvm-project/polly/test/ScheduleOptimizer/schedule_computeout.ll
/b/s/w/ir/x/w/llvm-llvm-project/polly/test/ScheduleOptimizer/schedule_computeout.ll:94:10: error: CHECK: expected string not found in input
; CHECK: Schedule optimizer calculation exceeds ISL quota
         ^
<stdin>:1:1: note: scanning from here
opt: Unknown command line argument '-debug-only=polly-opt-isl'. Try: '/b/s/w/ir/x/w/llvm_build/tools/clang/stage2-bins/bin/opt --help'
^
<stdin>:2:20: note: possible intended match here
opt: Did you mean '--debug-pass=polly-opt-isl'?
                   ^

Input file: <stdin>
Check file: /b/s/w/ir/x/w/llvm-llvm-project/polly/test/ScheduleOptimizer/schedule_computeout.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: opt: Unknown command line argument '-debug-only=polly-opt-isl'. Try: '/b/s/w/ir/x/w/llvm_build/tools/clang/stage2-bins/bin/opt --help' 
check:94'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
            2: opt: Did you mean '--debug-pass=polly-opt-isl'? 
check:94'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:94'1                        ?                             possible intended match
>>>>>>

--

********************

efriedma-quic added a commit that referenced this pull request Jan 3, 2024
…ed in polly (#75141)"

This reverts commit d6c4d4c.

Broke buildldbots with asserts disabled; -debug-only is only available in
asserts builds.
@efriedma-quic
Copy link
Collaborator

Pushed revert.

@kartcq please fix the test so it either doesn't depend on DEBUG output, or uses REQUIRES: asserts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants