Slashdot Mirror


Inside the Intel Compiler

deadfx writes "Linux Journal is carrying an article authored by members of the Intel Compiler Lab examining specific optimizations employed by the compiler that allowed it to beat the gcc compiler on several benchmarks."

11 of 52 comments (clear)

  1. Re:Patented? by 4of12 · · Score: 4, Insightful

    From what very little I understand, gcc has years of infrastructure focused on multiple machine instruction sets.

    I'm pleasantly surprised gcc can do as well as it does considering that it can be built and run on some very unusual and dated pieces of hardware (although, from the recent release notes, it looks like some of the most obscure ones are slipping into oblivion.)

    --
    "Provided by the management for your protection."
  2. So... by zulux · · Score: 3, Informative

    I hope the fine folks of GCC don't trade one inch of platform independance for a mile of "performance" on an Intel chip.

    The best wat to get better performance out of GCC is to recopile your program - targeted to PowerPC, Alpha, Mips or hell... AMD.

    Screwing with GCC to get better x86 performance is like puting a trubo on a Honda Civic - just buy the damn Corvette.

    --

    Moneyed corporations, non-working 'poor' and criminal prisoners are turning productive citizens into tax-slaves.

    1. Re:So... by turgid · · Score: 2, Insightful

      ...and why don't YOU look up the meaning of proprietary in a dictionary. SPARC is an open standard. x86 is not.

    2. Re:So... by oliverthered · · Score: 2, Informative

      If you take a look at the change logs (for feture releases) you'll see that the optimization process is being made more granular in 3.4 (i think)

      --
      thank God the internet isn't a human right.
    3. Re:So... by turgid · · Score: 2, Informative

      It's only high performance on 4 gigabytes of RAM or less. Then you're back into segmentation and other hackery, just like in the "good old days" of MS-DOS. You young 'uns, don't know how good you have it. In my day, your code had to fit inside 64k segements, and so did your data. No arrays bigger than 65533 bytes, and you had to do "far" jumps to code in other segments. Yes, addresses were 20 bits, but you had to make them up with two 16-bit chunks. So, you needed 32 bits of storage to address 1 megabyte of RAM. Don't get me started on TSRs...

  3. bad code gets good optimization.. by josepha48 · · Score: 2, Interesting
    To me it would seem that the partial redundancy would only work if the code was like the examples they give. If you coded such that there was no partial redundancy in the code then it probably would not be any better than gcc.

    i.e.
    x[i] += a[i+j*n] + b[i+j*n];
    could be coded as
    l=i+j*n;
    x[i] += a[l] + b[l];

    Both would yeild the same result, one would use more variables, but both would only do the calc once. Would this be any different?

    Personally I can see not doing the calc's twice, but I'd think that a good programmer would code so he is not doing the calcs twice.

    --

    Only 'flamers' flame!

  4. Re:Patented? by devphil · · Score: 5, Interesting


    Many of the optimizations discussed in the article are being implemented in GCC. Actually, some (e.g., SSA) have been in a parallel development branch for quite a while now, where they can make major funky changes and not have to play by the "no breakage" rules that govern the release branches.

    Just last week there was a discussion about OpenMP and how it might be implemented in GCC.

    A huge optimization that the article mentioned in the intro (but didn't go into in depth, I think) is intraprocedural optimization. That can be hard in languages that don't compile the entire program at once; you really need help from the linker.

    it can be built and run on some very unusual and dated pieces of hardware (although, from the recent release notes, it looks like some of the most obscure ones are slipping into oblivion.)

    Absolutely. If nobody's using those platforms, and we want to make a change that might effect them in a negative way -- but we can't tell, because we don't have that machine available to test on -- we have two options: make the change and hope it doesn't break, or deliberately mark the platform as "no one cares, so neither do we".

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
  5. Bad code arises during compilation of good code by Tom7 · · Score: 2, Insightful


    In fact,

    a[x] = b[x] + c[x];

    probably compiles into something like (in the C equivalent):

    offset_b = x * 4 +
    val_b = *offset_b;
    offset_c = x * 4 +
    val_c = *offset_c;
    offset_a = x * 4 +
    val_a = val_c + val_b;
    *offset_a = val_a;

    (Set aside the fact that C automatically scales pointers arithmetic for you. Also ignore for the moment the fact that x86 allows you to do a scalar multiply by 4 in the load instruction -- pretend we are accessing structures of some large or non-power-of-two size.)

    Here the computation of x * 4 is redundant, even though we never wrote x * 4 in the original program.

    The point is, dumb code doesn't just arise because of dumb programmers, but because of the compilation process. (Also imagine you are calling a macro that computes offsets for you, etc.) Anway, every compiler implements this level of common sub-expression elimination, even gcc, so don't worry!

  6. Optimization and compiler bugs by dpbsmith · · Score: 2, Interesting

    Something that's been bothering me ever since I was bitten by my first compiler bug several decades ago. (And couldn't get the bug acknowledged by the vendor because I couldn't get it to occur in a short code fragment).

    WHY does every vendor have optimization on by default all the time? Optimization routines in compilers are the most likely places to have bugs, and they are often extraordinarily subtle bugs that are hard to reproduce. I have personally encountered bugs in which the insertion of deletion of a COMMENT affected the code, and certainly many of us have encountered bugs that could not be demonstrated in a short fragment because they only occurred when things got deeply nested and the compiler ran out of temporary registers.

    Optimization also interferes with debuggers. I know that YOU are capable of doing up-front planning and writing bug-free code, but _I_ am not, and forcing me to recompile in order to use the debugger is one more hurdle in the way of getting the bugs out of the code.

    Why isn't optimization off by default, and turned on only in specific modules, or certain SECTIONS of the code (with pragmas)--those specific sections that can be demonstrated to be time-critical?

  7. Inside the Intel compiler by truth_revealed · · Score: 2, Funny

    must be dark in there

  8. Re:GCC limits optimizations due to politics? by truth_revealed · · Score: 2, Interesting

    It's a shame that RMS fails to see the advantage of opening up GCC's data structures. Sure there would be some cheaters who'd use it for personal gain (writing proprietary front-ends for the GCC backend) - but there would be ten times as many people creating useful free languages and other free tools with it. It would also greatly aid in the learning of GCC itself (no simple task). It's a calculated risk, but in my opinion, one with more upside than downside potential. But who are we to say what RMS should do with his work? The FSF is the copyright holder, afterall.