Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7942 Discussions

VS2005 vs Intel C++ Compiler, w.r.t. SSE2+

wpfeil
Beginner
1,573 Views

I've just read this thread, and also from word of mouth, have heard that the Intel compiler does better with SSE intrinsics than MSVC. We currently use VS2005, and are supporting SSE2 and higher only. The MSVC compiler does a less-than-stellar job avoiding XMM register spilling, etc.

I am wondering if there's a nice how-toon using the Intel compiler with the VS2005 ide, or at least using the Intel compiler for simd-ciritical portions of our code.

I have the evaluation latest version of the Intel compilercurrently.

Thanks,
William

0 Kudos
26 Replies
TimP
Honored Contributor III
285 Views

As you two have pointed out, the lack of auto-vectorization in MSVC prevents it from competing in performance with other compilers, for the applications under discussion. That has not prevented MSVC from taking 90% of the commercial C++ compiler market; some customers consider lack of support for restrict and auto-vectorization a virtue, and more don't care. C++ standards don't recognize restrict, so each compiler which implements it does so in its own way.

As for auto-vectorization of C++ STL, g++ has taken the lead there (using __restrict__). Still, in many cases, ICL may catch up with liberal use of #pragma ivdep.

0 Kudos
Lars_Petter_E_1
Beginner
285 Views

Apart from the lack of automatic vectorization and restrict MSVC has:

  • No Loop Permutation nor Interchange

  • No Loop Distribution

  • No Loop Fusion

  • No Data Prefetching

  • No Scalar Replacement

  • No Unroll and Jam

  • No Loop Blocking nor Tiling

  • No Partial-Sum Optimization

  • No Loadpair Optimization

  • No Predicate Optimization

  • No Loop Versioning with Low Trip-Count Check

  • No Loop Reversal

  • No Profile-Guided Loop Unrolling

  • No Loop Peeling

  • No Data Transformation: Malloc Combining and Memset Combining

  • No Loop Rerolling

  • No Memset and Memcpy Recognition

  • No Statement Sinking for Creating Perfect Loopnests

MSVC is surely not a supercomputing compiler.

Best Regards,

Lars Petter Endresen

0 Kudos
TimP
Honored Contributor III
285 Views

That's an interesting wish list, possibly taken from a document on Intel C++ 9 for Itanium. Do you have a benchmark which demonstrates presence and usefulness of each optimization?

Some of those optimizations have been specific to Intel compilers for Itanium; some present ina pastversion and not retained; somemay beabout to make an appearance in compilers for Xeon.

Loop reversal is one of my pet wishes. I have had Intel and gnu compiler issues on file for years on this. There isn't sufficient incentive for it, and many otherson the list,in a non-vector non-auto-parallelcompiler. Current compilers sometimes vectorize loops by techniques which don't work as well as reversal.

MSVC deals with certain optimizations onlyby useof options which aren't compatible with a mixed build, with Fortran or C compilers other than MSVC. Your implied point about MSVC not being aimed at supercomputing is one I would agree with.

0 Kudos
Lars_Petter_E_1
Beginner
285 Views

An excellent FORTRAN 77 code I was so lucky to work with some time ago,was so well implemented that I saw many loop transformations in action. Actually many "timeless" functions in that code were written more than 20 years ago, and are impossible to improve any further. I cannot easilyremember which of the loop transformations (taken from Intel 10.1.021 Compiler Help) we did not take advantage of, but this software really is an interesting case study.

Best Regards,

Lars Petter Endresen

0 Kudos
levicki
Valued Contributor I
285 Views
should they honor stupid people writing stupid software or smart people writing smart software?

Lars, I wouldn't call people who know how to use advanced C++ features stupid. That just isn't right.

I see that you are heavily biased against C++. I believe that C++ has its own place for certain tasks and that compiler which bears the title "Intel C++ Compiler" should perform equally well with C++ code as it does with Fortranized C code. That makes further discussion pointless.

Furthermore, I do not understand why are you advocating use of ICC so fiercely when the original poster only asked how it works with intrinsics? In my opinion it is rude to be so pushy about something you like, and to try to persuade others into it. Saying that ICC does better job at code optimization and pointing a person to a free trial is enough. You sound like a used car salesman.

You do not need to improve the matrix multiplication any more, my point is that in many cases it is quite difficult to match the compiler with your own code (implementing unroll-and-jam may also be a laborious process...)

I just shaved off 20 seconds with a simple tweak that took a minute to do. I am sure I could at least match it if I had enough time to waste.

0 Kudos
Lars_Petter_E_1
Beginner
285 Views

Indeed you are right. "Stupid" is not the right word in this context. Sorry.You have a valid point. Let us instead call the developers more or less mislead, and the software they write more or less compiler friendly. Regarding the point about being pushy I also agree, but the current situations is that MSVC has 90% of the marked and the C++ litterature is currently being overwhelmed with books that forwards all the terrific capabilities of advanced C++, including STL and all the bizarrelanguage features you know about.

Now, when we have a test case where the "less is more" naive C implementation isin the order of ~100x faster than the implementation in the "C++ Bible", I think it is fair to be a little pushy -this is more reminiscent of David vs Goliath than anything else. My main point is that MSVC is not so suitable for supercomputing as many other compilers, including GCC that has a very interesting ongoing vectorization project. Try compiling the test case with GCC and you wlll see that MSVC is not doing so well.

The best developers I know are C++ developers, that uses many of the advanced features of the language, but they are aware of the potential side-effect of their choices. In most situations MSVC using C++ with STL is an excellent choice since most software in use is not performance critical. To master C++ on all levels from high level abstractions to low level SIMD and ILP instructions generated by the compiler is quite tricky, but compilers are making progress and for example Boost may be better optimized with many future compilers.

0 Kudos
Reply