Vladimir Miloserdov via llvm-dev
2017-Aug-15 13:43 UTC
[llvm-dev] -Rpass-missed vs -Rpass-analysis
Hello, I am currently working on optimization remarks enhancement (e.g. in loop-vectorize pass). There are 3 options to enable such diagnostics: -Rpass, -Rpass-missed and -Rpass-analysis.>From help:-Rpass-analysis=<value> Report transformation analysis from optimization passes whose name matches the given POSIX regular expression -Rpass-missed=<value> Report missed transformations by optimization passes whose name matches the given POSIX regular expression -Rpass=<value> Report transformations performed by optimization passes whose name matches the given POSIX regular expression The question is when to generate "missed" remark and when an "analysis" one? In my opinion we should generate "missed" remarks with a short explanation why optimization did not succeed and "analysis" with additional data on optimization process (e.g. "cost of vector instructions here is X, cost of scalar version is Y" and so on). Also, this is taken from https://reviews.llvm.org/D3683: -Rpass-missed is used by optimizers to inform the user when they tried to apply an optimization but couldn't (or wouldn't). -Rpass-analysis is used by optimizers to report analysis results back to the user (e.g., why the transformation could not be applied). Now consider loop vectorization pass. We can't vectorize a loop with a switching statement, so it will be informative to give a message like "loop not vectorized: loop contains switching statement". But should this message refer to -Rpass-missed or -Rpass-analysis? In current version it goes to "analysis", and if user is using -Rpass-missed instead it gives only "loop not vectorized". What's the point of doing it in that way? "Missed" remark becomes nearly useless for users. In the end, should we consider replacing -Rpass-missed and -Rpass-analysis (and maybe -Rpass also) with a single option? BR, - Vladimir Miloserdov -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170815/5383b880/attachment.html>
Friedman, Eli via llvm-dev
2017-Aug-15 17:56 UTC
[llvm-dev] -Rpass-missed vs -Rpass-analysis
On 8/15/2017 6:43 AM, Vladimir Miloserdov via llvm-dev wrote:> > Hello, > > I am currently working on optimization remarks enhancement (e.g. in > loop-vectorize pass). There are 3 options to enable such diagnostics: > -Rpass, -Rpass-missed and -Rpass-analysis. > > From help: > > -Rpass-analysis=<value> Report transformation analysis from > optimization passes whose name matches the given POSIX regular expression > > -Rpass-missed=<value> Report missed transformations by optimization > passes whose name matches the given POSIX regular expression > > -Rpass=<value> Report transformations performed by > optimization passes whose name matches the given POSIX regular expression > > The question is when to generate “missed” remark and when an > “analysis” one? In my opinion we should generate “missed” remarks with > a short explanation why optimization did not succeed and “analysis” > with additional data on optimization process (e.g. “cost of vector > instructions here is X, cost of scalar version is Y” and so on). >Not sure it's useful to emit the cost of each individual instruction (any remark which includes LLVM IR instructions is going to be very difficult to understand for anyone who isn't a compiler developer), but the intuition is correct, I think.> Also, this is taken from https://reviews.llvm.org/D3683: > -Rpass-missed is used by optimizers to inform the user when they tried > to apply an optimization but couldn't (or wouldn't). > -Rpass-analysis is used by optimizers to report analysis results back > to the user (e.g., why the transformation could not be applied). > > Now consider loop vectorization pass. We can’t vectorize a loop with a > switching statement, so it will be informative to give a message like > “loop not vectorized: loop contains switching statement”. But should > this message refer to -Rpass-missed or -Rpass-analysis? In current > version it goes to “analysis”, and if user is using -Rpass-missed > instead it gives only “loop not vectorized”. What’s the point of doing > it in that way? “Missed” remark becomes nearly useless for users. >That sounds like a bug. -Eli -- Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170815/7f697a0f/attachment-0001.html>
Hi,> On Aug 15, 2017, at 6:43 AM, Vladimir Miloserdov via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hello, > > I am currently working on optimization remarks enhancement (e.g. in loop-vectorize pass). There are 3 options to enable such diagnostics: -Rpass, -Rpass-missed and -Rpass-analysis. > > From help: > -Rpass-analysis=<value> Report transformation analysis from optimization passes whose name matches the given POSIX regular expression > -Rpass-missed=<value> Report missed transformations by optimization passes whose name matches the given POSIX regular expression > -Rpass=<value> Report transformations performed by optimization passes whose name matches the given POSIX regular expression > > The question is when to generate “missed” remark and when an “analysis” one? In my opinion we should generate “missed” remarks with a short explanation why optimization did not succeed and “analysis” with additional data on optimization process (e.g. “cost of vector instructions here is X, cost of scalar version is Y” and so on). > > Also, this is taken from https://reviews.llvm.org/D3683: <https://reviews.llvm.org/D3683:> > -Rpass-missed is used by optimizers to inform the user when they tried > to apply an optimization but couldn't (or wouldn't). > -Rpass-analysis is used by optimizers to report analysis results back > to the user (e.g., why the transformation could not be applied). > > Now consider loop vectorization pass. We can’t vectorize a loop with a switching statement, so it will be informative to give a message like “loop not vectorized: loop contains switching statement”. But should this message refer to -Rpass-missed or -Rpass-analysis? In current version it goes to “analysis”, and if user is using -Rpass-missed instead it gives only “loop not vectorized”. What’s the point of doing it in that way? “Missed” remark becomes nearly useless for users.Yes, this was a mistake when remarks were implemented in the loop vectorizer and then it got carried over to other passes as well. For example, a fix to remedy the situation in the Inliner: https://reviews.llvm.org/rL293492. It would be great to improve LV to only use analysis for things where we don’t know the outcome of the optimization yet but the intermediate analysis results would be interesting/actionable to the user. We also use analysis for neutral things like reporting the size of the generated function, size of the stack frame, etc.> > In the end, should we consider replacing -Rpass-missed and -Rpass-analysis (and maybe -Rpass also) with a single option?I think that there are valid use cases for asking for remarks for performed and missed optimization separately. For example, in order to better understand the generated assembly you only want -Rpass. On the other hand there is a new workflow to generate all remarks in external optimization record files with -fsave-optimization-record. (This can then be visualized with tools/opt-viewer/opt-viewer.py.) Adam> > BR, > - Vladimir Miloserdov > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170815/122e34f2/attachment.html>