Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29382 Discussions

Support for passing hints to optimizer

ereisch
New Contributor II
858 Views

Is it possible (or are plans in the works) to support passing hints to the optimizer, in a manner similar to gcc's "__builtin_expect()" function?

 

Also, on a somewhat related note, is there a reliable manner in which to get the compiler to print out optimization feedback during the compilation stage?  When I upgraded to 2011 a few years ago, I noticed it would sometimes print out this information during the compile, but there didn't appear to be (or I couldn't find) a direct compiler flag to get this information out.  The reason for this is we would like to get more detail on what exactly the compiler is modifying/unrolling/reordering, such that we can alter the code where appropriate so we can pick up some of these gains in lower levels of optimization, or perhaps find good candidates for OpenMP directives.

 

Thanks

0 Kudos
3 Replies
Steven_L_Intel1
Employee
858 Views

We do actually have a lot of directives for giving hints to the optimizer, but for this one, as is suggested for gcc, we'd recommend using profile-guided optimization. We don't have an explicit directive like __builtin_expect.

There are many levels of optimization report available. See -opt-report and -vec-report.

0 Kudos
TimP
Honored Contributor III
858 Views

 __builtin_expect offers only near-0 and near-100% probability and wouldn't necessarily offer much over placing the favored branch in the if and unfavored in the else of if..then..else..endif.  Traditionally, the platform would favor forward conditional jump not-taken and backward jump taken, in the absence of profile guided or static profiling information.  Static profiling information may be placed in the asm file, if you choose to generate it.  Until recently, vectorization directives like VECTOR ALWAYS and omp simd would in effect request high priority for either branch when possible.

0 Kudos
Steven_L_Intel1
Employee
858 Views

I'll also comment that the hardware branch predictors have gotten very good...

0 Kudos
Reply