Community
cancel
Showing results for 
Search instead for 
Did you mean: 
meldaproduction
Beginner
98 Views

How to get vectorization report just for a certain function/loop?

I'm often fighting with ICC not being able to vectorize something and it is really inconvenient to explore the logs having thousands of lines. Is there some pragma or something that would enable vectorization only on some part of the code of my choosing?

0 Kudos
18 Replies
TimP
Black Belt
98 Views

I try to use vecreport-file to get a separate report for each source file. This would be a reason for adhering to traditional limits on individual sources.

Another possibility (not the only one) is to set -no-vec and put pragma simd where you want to see vectorization.

meldaproduction
Beginner
98 Views

Thanks for the info, will try, not sure if any of the options will help though. Fortunately it's not a dealbreaker.

98 Views

Vector Advisor really might help here:

https://software.intel.com/en-us/advisor_getting_started_intro

It tries to filter compiler logs in the right way:)

TimP
Black Belt
98 Views

I wonder if I will need to roll back my old box to win7 to use advisor. It looks somewhat promising if it weren't so difficult to get it running.

meldaproduction
Beginner
98 Views

Aaaaha, so well, since it is part of the Composer product, does it work or doesn't it? :D

TimP
Black Belt
98 Views

No it's part of parallel studio. They are working on it. They sent a python script which should unlock the current version for removal and reinstall . It doesn't run on either of my python installations. On win10 it hits permissions failures which presumably would be fixed if they begin to work on it for win10.

Marián__VooDooMan__M
New Contributor II
98 Views

I use for this purpose my own bash script (ran after link phase in project file). In the project I set that I want result redirect to .log file, and that script in case of error just outputs the result, so I see it in VS IDE. In case of success it greps for vectorization messages, sorts it and then greps for excluded and included messages. Filters for excludes and includes are just 2 text files, each phrase on a single line. The script is long like just 10 lines of bash code. It is not so hard when you know basics of Unix scripting. Unfortunately, you need cygwin or msys to run external bash script, as windows scripting features are so poor...

Marián__VooDooMan__M
New Contributor II
98 Views

By the way, in VS IDE, you can click into build log report, and pres Ctrl+f to find, or better Ctrl+i for incremental search.

Marián__VooDooMan__M
New Contributor II
98 Views

Ah, and I forgot, of course unfortunately you need to know line numbers of certain loop you want to inspect, e.g.:

2>      c:\Users\...\....cpp(64,5):remark #15520: loop was not vectorized: loop with early exits cannot be vectorized unless it meets search loop idiom criteria

in this case it is file ....cpp line number 64, in my case there is a for() loop.

Marián__VooDooMan__M
New Contributor II
98 Views

Or you can always turn on in the project properties generation of assembler output (text file *.asm with assembly instructions and comments) and inspect it by searching for particular function.

jimdempseyatthecove
Black Belt
98 Views

Here is a simple suggestion for Intel to implement, but there may be an easy hack for you to accomplish this yourself.

This would be to have the vectorization report capture the #pragma message("***** Check this ****")
Or to add #pragma vector report message("looky here")

This way you can annotate the report.

The hack way, which I haven't explored, is to insert a piece of do nothing code that has the side effect of inserting something into the report that is useful as an annotation. An example might be to request something to be vectorized that you know cannot (and the report will indicate this). If you can do this with a #defined macro then you can easily enable/disable it.

Jim Demspey

 

meldaproduction
Beginner
98 Views

Good idea, though I'm not sure if it helps that much. The report will be full of "unsuccessful" vectorizations so...

Marián__VooDooMan__M
New Contributor II
98 Views

meldaproduction wrote:

Good idea, though I'm not sure if it helps that much. The report will be full of "unsuccessful" vectorizations so...

Yes, it will be so. But as I said you can always click into output box ("winlet"/"widget"/"sub-window") and press Ctrl+i for incremental search, and type immediately after Ctrl+i "Check this" or "*****" and you are on your way...

Marián__VooDooMan__M
New Contributor II
98 Views

But beware when your function is auto-inlined or a templated function or inlined explicitly, or compiled with /Qipo, or in a header file included in more unit files, you might get multiple instances of these reports...

Yuan_C_Intel
Employee
98 Views

Hi, meldaproduction

Please try option: -qopt-report-filter=string (Linux)  or  /Qopt-report-filter:string (Windows)

We start support this from 15.0, please find more details from 2015 user guide, see:

https://software.intel.com/en-us/node/524999

Hope this helps.

Thanks.


 

 

 

Yuan_C_Intel
Employee
98 Views

Another option is:  -qopt-report-routine=substring or /Qopt-report-routine:substring

See user guide: https://software.intel.com/en-us/node/525004

Thanks.

 

Marián__VooDooMan__M
New Contributor II
98 Views

jimdempseyatthecove wrote:

Here is a simple suggestion for Intel to implement, but there may be an easy hack for you to accomplish this yourself.

This would be to have the vectorization report capture the #pragma message("***** Check this ****")
Or to add #pragma vector report message("looky here")

This way you can annotate the report.

The hack way, which I haven't explored, is to insert a piece of do nothing code that has the side effect of inserting something into the report that is useful as an annotation. An example might be to request something to be vectorized that you know cannot (and the report will indicate this). If you can do this with a #defined macro then you can easily enable/disable it.

Jim Demspey

  1. #pragma message("***** Check this ****"): it works only if you have not pre-compiled headers turned off, if you have it in header file included inside of them... so it is not suitable for release builds. E.g. my project is not suitable to run in Debug mode, since it is very slow there, since it's dependant on heavy optimizations, because it processes in real time the data, it is sound processing SW... I need to run in Release mode, and enable my own asserts to debug it, and it works fine then, but consuming only few extra percents of CPU...
  2. #pragma vector report message("looky here"): gives an error in MSVC 2013 ICC 15 as unknown pragma.
TimP
Black Belt
98 Views

Vladimir Polin (Intel) wrote:

Vector Advisor really might help here:

https://software.intel.com/en-us/advisor_getting_started_intro

It tries to filter compiler logs in the right way:)

The version posted 16 June 2015 appears to have resolved installation problems.  I took the precaution of removing prior beta versions prior to install.

Compiler log filtering works only when main() and functions to be analyzed are built by the same Intel C++ version (15.0 or 16.0).

Advisor hasn't been made to work on Windows 10.  As far as I could see, all the other tools are fine on win10.

Advisor runs with compilation by other compilers (I tested Microsoft and gnu) but of course it omits the features which depend on compile logs.  You can see whether vector or fma code is executed by turning on asm view.

Advisor throws verbose warnings where it sees time spent in remainder loops, but I don't see these as posing a performance issue as long as they are vectorized remainders.  It doesn't appear to be filtering on actual effectiveness of remainder loops, contrary to what is implied.

Reply