Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

Create Account  |  Retrieve Password

AMD Alleges Intel Compilers Create Slower AMD Code

Posted by CmdrTaco on Tue Jul 12, 2005 10:39 AM
from the getting-a-little-spicier dept.
edxwelch writes "In AMD's recient anti-trust lawsuit AMD have examined the Intel compiler and found that it deliberatly runs code slower when it detects that the processor is an AMD. "To achieve this, Intel designed the compiler to compile code along several alternate code paths. ... By design, the code paths were not created equally. If the program detects a "Genuine Intel" microprocessor, it executes a fully optimized code path and operates with the maximum efficiency. However, if the program detects an "Authentic AMD" microprocessor, it executes a different code path that will degrade the program's performance or cause it to crash.""
+ -
story
This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More
Loading... please wait.
  • by DeadSea (69598) * on Tuesday July 12 2005, @10:41AM (#13042874) Homepage Journal

    That is an outragous claim! No company would stoop so low. Why, that would be like claiming that Microsoft configured its servers to give broken HTML to browsers other than Internet Explorer. That would be like saying that Apple gave away free MP3s that work in the Ipod but that crash other music players. That would be like saying that Adobe publishes pdfs that b0rk XPDF.

    Anybody can see that this claim is ludicrous and that things like this just don't happen. (but I hope I'm not giving anybody any ideas.)

    Type your currency conversion into a free form text box

    • by cwebb1977 (650175) on Tuesday July 12 2005, @10:44AM (#13042928) Homepage
      Hey, Microsoft doesn't even know the difference between correct and broken HTML!
    • by dsginter (104154) on Tuesday July 12 2005, @10:44AM (#13042930)
      In other news... [yahoo.com]

      They'll probably be convicted and then buy the regulators like MS so they only get a slap on the wrist.

      On that note, was there *anything* negative that came of the Microsoft monopoly ruling?
    • Re:Simply ludicrous (Score:5, Interesting)

      by RootsLINUX (854452) <rootslinuxNO@SPAMgmail.com> on Tuesday July 12 2005, @10:46AM (#13042951) Homepage
      Well, I don't think they would make such a claim without at least some sort of evidence. And we all know that Intel is a corporation that doesn't like to play nice with the other kids. During my senior year of undergrad my computer architecture professor consistently refered to Intel as "the evil empire", so who knows. I'd like to see AMD present some hard evidence though.
      • Part of AMD's claims is outrageous. Why would AMD expect its competitor, Intel, to write software that supports AMD's own products? We would not expect IBM to modify AIX or any other IBM software package to run on SPARC, which is a poorly designed processor.

        1. AMD's claim is that the Intel Compiler produces code that actively detects the AMD CPU, then intentionally runs slower code. That's not the same thing as Intel optimizing their compiler for the Pentium Architecture.

        2. If you think the SPARC is a poorly designed processor, you need your head checked.

        By restricting the GCC compilers to generating only a simple but fast subset of instructions, we could encourage both AMD and Intel to deprecate and, ultimately, eliminate the more complex x86 instructions. Linux and the bulk of open-source software use the GCC compilers and would provide a critical mass of support for a new streamlined transistor-count-reduced x86 chips. Here, I am thinking, "shockingly reduced in power due to using 1/3 of the transistors."

        Wouldn't that make the x86 Platform act like one of those "Poorly Designed RISC Processors" you were just complaining about?

        In any case, you won't see much of a transistor reduction. Most of the instructions you're trying to avoid are implemented in MicroCode and add no significant overhead to the chip. What *does* add all the transistors is the 20 stage pipeline, branch prediction, superscalar execution, Out Of Order instructions, etc, etc, etc.
  • by Eponymous Cowboy (706996) * on Tuesday July 12 2005, @10:43AM (#13042922)
    I noticed this problem back in January of 2004, with Intel C++ 8.0, and went through heck over nine months with Intel's customer support to get it fixed until I eventually had to abandon their compiler.

    On any non-Intel processors, it specifically included an alternate code path for "memcpy" that actually used "rep movsb" to copy one byte at a time, instead of (for example) "rep movsd" to copy a doubleword at a time (or MMX instructions to copy quadwords). This was probably the most brain-dead memcpy I'd ever seen, and was around 4X slower than even a typical naive assembly memcpy:

    push ecx
    shr ecx, 2
    rep movsd
    pop ecx
    and ecx, 3
    rep movsb

    They responded with completely ridiculous answers, such as:

    "Our 8.0 memcpy was indeed optimized for a Pentium(r)4 Processor,when we reworked this routine we used the simplest, most robust, and straightforward implementation for older processors so that we didn't need the extra code to check for alignment, length, overlap, and other conditions."

    BS. I went and added the following line to the beginning of my source code:

    extern "C" int __intel_cpu_indicator;

    then I added:

    __intel_cpu_indicator = -512;

    to the "main" function.

    This forced Intel C++ to use the "Pentium 4" memcpy regardless of which processor in in the machine. It turns out that their special "Pentium 4" memcpy which I tested thoroughly in all kinds of situations, and it worked perfectly fine on an AMD Athlon and a Pentium III. I pointed this out to them.

    I received the following response:

    "The fast mempcy is over 2000 lines of hand coded assembly, with lots of special cases where different code paths are chosen based on relative alignment of the source and destination. ... If the performance of memcpy/memset only are improved for Pentium III will that satisfy you?"

    I answered "No," saying that I needed support for AMD processors as well. I also gave them a copy of my own memcpy routine that was 50% faster than theirs--and just used MMX. They closed the support issue and did nothing to resolve it.

    I switched back to Visual C++.
  • by Anonymous Coward on Tuesday July 12 2005, @10:45AM (#13042942)
    In version 1.0 of my software, I always throw in some loops that just count to a million to throw in some delays. That way you can include "optimization" as a deliverable for version 2.0.

    profit!
  • by Jarnis (266190) on Tuesday July 12 2005, @10:49AM (#13042994)
    The submission is old news. Anyone who read the earlier AMD antitrust documentation knew about this claim. It's among the things Intel has done to drive AMD to dirt.

    However, what's news, is that EU antitrust investigators raided Intel and some OEMs today...

    http://theinquirer.net/?article=24554 [theinquirer.net]

    They probably were hunting for some documents related to alleged antitrust violations - nice free additional ammo for AMD and their case, methinks...
  • by ylikone (589264) on Tuesday July 12 2005, @10:51AM (#13043032) Homepage
    ...software. Something like this would never be implemented in an open source compiler. With open source, you know exactly what you get... with closed, you get what the owners want you to get, which will help their bottom line.
  • Relevant Section (Score:5, Informative)

    by Dakrin1 (220684) on Tuesday July 12 2005, @11:02AM (#13043174)
    The filing actually has a ton more complaints than just what the poster mentioned. Here is the relevant section:

    c. Intel's Leveraging of Its Other Product Lines to Unfairly Disadvantage

    AMD in the Marketplace
    122. Intel has also designed and marketed microprocessor-related products with the
    goal of compromising performance for those who opt for AMD solutions, even if it requires
    sacrificing its own product quality and integrity.
    123. An example is Intel's compilers. Generally, independent software vendors
    ("ISVs") write software programs in high-level languages, such as C, C++, or Fortran. Before
    these programs can be understood by a computer system, they must be translated into object
    code - a machine-readable language - by a software program called a compiler. Different
    companies write compilers for different operating systems (Windows, Linux, etc.) and for
    different programming languages (C, C++, Fortran, etc.). Intel offers compilers for use with a
    variety of different operating systems and programming languages.
    124. Intel's compilers are designed to perform specialized types of optimizations that
    are particularly advantageous for ISVs developing software programs that rely heavily upon
    floating point or vectorized mathematical calculations. Such programs include, for example,
    mathematical modeling, multimedia, and video game applications.
    125. Intel has designed its compiler purposely to degrade performance when a program
    is run on an AMD platform. To achieve this, Intel designed the compiler to compile code
    along several alternate code paths. Some paths are executed when the program runs on an Intel
    platform and others are executed when the program is operated on a computer with an AMD
    microprocessor. (The choice of code path is determined when the program is started, using a
    feature known as "CPUID" which identifies the computer's microprocessor.) By design, the
    code paths were not created equally. If the program detects a "Genuine Intel" microprocessor,
    it executes a fully optimized code path and operates with the maximum efficiency. However,
    if the program detects an "Authentic AMD" microprocessor, it executes a different code path
    that will degrade the program's performance or cause it to crash.
    126. ISVs are forced to choose between Intel's compilers, which degrade the
    performance of their software when operated with AMD microprocessors, or third-party
    compilers, which do not contain Intel's particular optimizations. Sadly for AMD and its
    customers, for legitimate reasons Intel's compilers appeal to certain groups of ISVs, especially
    those developing software programs that rely heavily on floating point and vectorized math
    calculations. Unbeknownst to them, performance of their programs is degraded when run on
    an AMD microprocessor not because of design deficiencies on the part of AMD, but
    deviousness on the part of Intel.
  • by MatD (895409) on Tuesday July 12 2005, @11:03AM (#13043193)
    I know how this can happen (and it has nothing to do with being evil).
    The engineers get the specs for the next version of the compiler. They also get a slew of bug reports from the last version. They have a short amount of time to impliment the new specs, and fix the bugs.
    The bug reports will be something like, "on AMD processors when doing a memcopy with optimization xyz turned on, the processors mispredicts half the time. This makes it very slow."
    The engineer in that case, turns the optimization off for that generated code, thereby 'fixing' the bug (but not really). It happens all the time.
    It's not a nefarious plot, it's the same time crunch issue that every software engineer has to deal with.
    • by pcidevel (207951) on Tuesday July 12 2005, @10:47AM (#13042974)
      Because a compiler just spits out machine instructions, it's a trivial task to compare the instructions from one code path to another.

      For example, you write some code that would typically use SSE2 regisers when compiled, then you compile the code for each processor, and check to see if it used SSE2 registers on each, or if it ouput slower "emulation" style instructions on the AMD.
    • by the_weasel (323320) on Tuesday July 12 2005, @10:48AM (#13042976) Homepage
      Which is exactly what we did when we discovered this. And sure enough, when the Intel compiler thought our AMD was a Genuine Intel certain functions increased dramatically.

      The company I work for submitted a few reports on this a few months ago, as I am sure did many others. I am very pleased to see them following up on it.

    • Because the Intel compiler actually generates multiple copies of routines, then figures out which one to call at run-time based on a processor detection routine they stick in the program. Example:
      [thalakan@shaitan ~]> icc -axKWNPB -c test5.c -o test5.o
      test5.c(3) : (col. 16) remark: main has been targeted for automatic cpu dispatch.
      [thalakan@shaitan ~]> nm test5.o
      00000000 r _2il0floatpacket.1
      00000008 r _2il0floatpacket.3
      00000020 r _2il0floatpacket.5
      00000028 r _2il0floatpacket.7
      U __intel_cpu_indicator
      U __intel_cpu_indicator_init
      U __intel_proc_init
      00000000 T main
      000000f2 t main.A <-- SSE version
      00000028 t main.H <-- x87 version
      U printf
      U rand
      U targets
      U time
      [thalakan@shaitan ~]>
      The remark about automatic CPU dispatch is the compiler notifying you it's going to generate multiple copies of the routine.
      • Re:Never (Score:5, Insightful)

        by slavemowgli (585321) on Tuesday July 12 2005, @11:04AM (#13043205) Homepage
        They key point here is that in order to invoke Hanlon's razor, you have to be able to *adequately* explain the issue by assuming stupidity instead of malice, though. In other words, the explanation of the issue by means of stupidity must be reasonable; if you (as an unprejudiced, objective person) can instantly dismiss that explanation because it's obviously untrue, then Hanlon's razor does not apply.

        Now ask yourself again: do you believe that it's PURE COINCIDENCE that Intel's compiler produces slow code for its competitor's processors? Code that even a novice Assembler programmer would be able to improve instantly (see the rep movsb vs. rep movsd issue mentioned in a comment above, for example?) Do you believe that, for some funny reason, they never happened to notice? That noone ever complained to them about it? That they're really just an innocent victim here?

        Well, do you? If yes, please get back to me, I have a used car to sell you. :)
    • > wouldn't there be programs all over that ran fine on Intel but crashed on AMD?

      Most Linux development is done using GCC , Most of windows with MSVC++. Only true hard-core inner-loop optimising geeks usually use Intel C/C++ compilers. These are people like game devs, crypto developers and HPC programmers.

      So yeah, there's a lot of code that doesn't work with Amd64 when compiled with ICC. But how many people build stuff on Amd64 with an Intel compiler ?. (remember this is not valid for stuff compiled on a pentium 4 but running on amd64)
    • by 99BottlesOfBeerInMyF (813746) on Tuesday July 12 2005, @11:11AM (#13043309)

      If they intentionally bloated the machine code for AMD processors, then that is wrong.

      If you RTFA you'll see that AMD is charging (and numerous sources are confirming) that Intel did extra work to specifically make things slower when programs compiled with their compiler were run on an AMD. On previous poster even posted his two line partial fix for the issue that drastically improved code speed and which he gave to Intel while trying to solve this issue with the compiler. Basically it just tricked the compiler into always using the copy function for Intel processors. This was obviously malicious.