Slashdot Mirror


IBM Releases Open Source Machine Learning Compiler

sheepweevil writes "IBM just released Milepost GCC, 'the world's first open source machine learning compiler.' The compiler analyses the software and determines which code optimizations will be most effective during compilation using machine learning techniques. Experiments carried out with the compiler achieved an average 18% performance improvement. The compiler is expected to significantly reduce time-to-market of new software, because lengthy manual optimization can now be carried out by the compiler. A new code tuning website has been launched to coincide with the compiler release. The website features collaborative performance tuning and sharing of interesting optimization cases."

45 of 146 comments (clear)

  1. Automation... by juanergie · · Score: 2, Insightful

    ... can create stupid humans. Let's embrace technology but beware of falling into ignorance.

    --
    Aeroespacio.org
    1. Re:Automation... by TinBromide · · Score: 2, Informative

      I fail to see how automation leads to lower IQ scores. Care to elaborate? How does stepping up the pace, and eliminating tedious, mundane jobs, lead to a lesser society? I call FUD.

      wooooosh.
      See idiocracy. Go out and watch it. I'll wait








      Saw it? Good, now you should get the joke.

      --
      Is it sad that I am more likely to recognize you and your posts by your sig than your name or UID?
    2. Re:Automation... by Fluffeh · · Score: 2, Informative
      I would argue. Either you get it without needing to watch the movie simply by being surrounded by people who in their day to day existence simply follow instructions blindly "because they have to" or you won't get it - whether you watch the movie or not.

      As for the GP, I believe he is mixing two things incorrectly:

      fail to see how automation leads to lower IQ scores
      and
      lead to a lesser society

      Lower IQ scores don't immediately mean a lesser society, but if you take the thinking out of a process and let a process/machine/program do all the thinking, your mind will inevitably get lazy and your work will suffer over time

      --
      Moved to http://soylentnews.org/. You are invited to join us too!
    3. Re:Automation... by piojo · · Score: 3, Insightful

      if you take the thinking out of a process and let a process/machine/program do all the thinking, your mind will inevitably get lazy and your work will suffer over time

      I think that it could very well free your mind to think about better things. Build systems are a good example. If I had to manually compile each translation unit, I couldn't spend as much time thinking about the code.

      --
      A cat can't teach a dog to bark.
    4. Re:Automation... by h4rm0ny · · Score: 2, Insightful


      Abstraction is one of the foundations of higher thinking. There is something to be said for being able to do lower-level tasks, but you don't concern yourself with the internals of them when you want to treat them as discrete objects. Nobody thinks about the construction of an AND gate when they're designing something that uses AND gates. Nobody thinks about the internal workings of a method or function when they simply want to call it. In every area, the process is the same: You first learn the basic components, and then you assemble them into a composite of those components (whether a function, a muscial chord, a template in an MVC or whatever), and operate on a higher level.

      It's been too many years since I've really worked with compilers directly, but to me this looks impressive. Can someone who is more up to date with the field tell me if this is an appropriate moment to go: "Woah!" Because I feel like it might be.

      --

      Aide-toi, le Ciel t'aidera - Jeanne D'Arc.
    5. Re:Automation... by michelcolman · · Score: 2, Insightful

      Most programmers stopped "thinking about the code" long ago and just slap together a bunch of libraries. That's why my DVD/HD player takes about 30 seconds loading operating systems (I hope that last 's' is an exaggeration, but I fear it may even be correct) before it will even eject a disc. As for the supposedly huge performance improvement of 18% (that's all?!), I have regularly hand-optimised code that ran more than twice as fast.

    6. Re:Automation... by aaribaud · · Score: 2, Insightful

      Joke aside, as for any rather absolute statement, there is only a part of truth both in the statement and in its opposite. Granted, automation does not necessarily lead to a lesser [level of intelligence in] society. However, not everything that automation can do must necessarily be done by automated means. For instance, calculators have automated calculus. I for one, welcome our key-laden overlords from arctangent, because I rarely have to compute arctangent and find it handy to have a calculator to do it for me. However, calculators can also do simple arithmetic like additions and multiplications ; and this can (and does, in the experience I can gather from my immediate vicinity) lead to a lessening of people's capability at doing additions and multiplications -- operations which are much more frequent than arctangents.

    7. Re:Automation... by tkinnun0 · · Score: 2, Interesting

      See idiocracy. Go out and watch it. I'll wait

      The main tenets in Idiocracy were that IQ is hereditary and those with less IQ spend more time procreating. Automation was merely allowing their society to function, barely. IOW, I don't see your point. Can you elaborate, please?

  2. Oh really? by zmotula · · Score: 5, Insightful

    The compiler is expected to significantly reduce time-to-market of new software, because lengthy manual optimization can now be carried out by the compiler.

    Oh, so new software takes too long to build because of lengthy manual optimization? That's news indeed. Even if it did, will the compiler find a better polygon intersection algorithm for me? Will it write a spatial hash? Will it find places when I am calculating something in a tight loop and move the code somewhere higher?

    1. Re:Oh really? by lee1026 · · Score: 5, Interesting

      The last one is actually quite possible, and indeed is a huge area of compiler research.

    2. Re:Oh really? by Thanshin · · Score: 3, Funny

      Oh, so new software takes too long to build because of lengthy manual optimization?

      It depends on your definition of optimization.

      In my current project we have about twenty guys "performing lengthy manual optimizations". It sounds quite better than having twenty guys "correcting the absolute crap that wouldn't even compile".

    3. Re:Oh really? by Fullers · · Score: 2, Insightful

      Highly optimized software does take a long time to build because of manual optimization. Plus, if anything changes, that optimization might need to be done again. And yes, a good compiler will move that loop for you.

    4. Re:Oh really? by jcupitt65 · · Score: 5, Informative

      Read the article, that's not what this does. This is a project to automatically generate optimising compilers for custom architectures. The summary is a little unclear :-(

      It reduces time to market because you don't have to spend ages making an optimising compiler for your custom chip.

    5. Re:Oh really? by kwikrick · · Score: 2, Informative

      No, this 'learning' compiler only learns how to optimally translate C++ statements to machine level operations. It cannot choose high level algorithms for you. And the reason that such a learning compiler is useful is not to help lazy application programmers, but because developing new, optimised compilers for the many different processors and platforms out there (think computers, mobile phones, embedded systems, etc) is time consuming.

      --
      assignment != equality != identity
    6. Re:Oh really? by John+Hasler · · Score: 2, Insightful

      Thanks. That is very, very different from what the summary says.

      --
      Warning: this article may contain humor, sarcasm, parody, and perhaps even irony. Read at your own risk.
    7. Re:Oh really? by DiegoBravo · · Score: 3, Interesting

      That kind of confusing summaries are too frequent that sometimes I go to RTFA!

      Seriously, the summaries should be subject to moderation too (I don't know if the firehose thing lets do that.)

    8. Re:Oh really? by maxwell+demon · · Score: 2, Funny

      Oh, so new software takes too long to build because of lengthy manual optimization?

      Yes. That's why most manuals are not very optimized. So the next time you think a manual is close to useless, don't complain. It's in order to save you time in the building process.

      --
      The Tao of math: The numbers you can count are not the real numbers.
    9. Re:Oh really? by AceJohnny · · Score: 2, Interesting

      While the the summary is wrong on this subject, I can tell you that, yes, manual optimization is part of our work and can slow down the release of our product. If we told a customer that yes, we will be able to do VGA 30FPS H.264 encode. Code optimization on our custom core is going to take some time and effort. I work in the embedded multimedia field.

      I think we're going to be very, very interested in this project.

      --
      Misleading titles? Inflammatory blurbs? Keep in mind that Slashdot is a tabloid.
  3. Oblig. by fuzzyfuzzyfungus · · Score: 2, Funny

    "My GNU is a neural net processor, a learning compiler..."

  4. Less time? How about same time, better product? by TinBromide · · Score: 3, Insightful

    The compiler is expected to significantly reduce time-to-market of new software, because lengthy manual optimization can now be carried out by the compiler.

    How about this: The coders take the time they would have used to "optimize" and instead better document, test, and debug the code. Instead of same quality, less money, make it better quality, same money? You know that the developer isn't going to charge less money for a new product because it took them less time to get it out the door.

    --
    Is it sad that I am more likely to recognize you and your posts by your sig than your name or UID?
  5. Dumb Summary by QuantumG · · Score: 5, Insightful

    automatically learn how to best optimise programs for re-configurable heterogeneous embedded processors

    That's kinda important to mention no?

    --
    How we know is more important than what we know.
    1. Re:Dumb Summary by mozzis · · Score: 3, Insightful

      Absolutely. This is not for the normal processors we all know and love, nor is it any good for javascript or python etc. Compilers for C++, C#, java etc. on normal CPUs all have pretty ferocious optimizers already. Not that an attentive human programmer can't make much more of a difference, usually.

      --
      This is not a self-referential sig.
  6. Few Questions for any programmers by contr0l · · Score: 2, Interesting

    I'm not a programmer at all, but have dabbled in a few different languages, as I find programming very interesting. (Got pretty good at mirc scripting when I was younger, which lead to visual basic, C++, and now C# dballing that nvr leads to anything). This said, I have a basic knowledge of programming in general. My question is, What things can a compiler do to your code to 'optimize' it for you? I would think majority of any good optimizations might require rethinking whole methods of doing things and/or recoding chunks of code. If the compiler tries to do this, wouldn't it likely screw your code up? Or how would it know 'what' your really trying to do? Outside of removing comments, can someone please explain other Basic optimization methods, (I say basic, like removing comments - You know that cant screw anything up), that a compiler can do on your code that wont screw it up? Thanks in advance.

    1. Re:Few Questions for any programmers by EvanED · · Score: 5, Informative

      What things can a compiler do to your code to 'optimize' it for you?

      Check out the Wikipedia article on optimization for some examples.

      In brief, some of the more common ones are things like substituting known values for expressions (e.g. x = 3; y = x + 2; can be changed to x = 3; y = 5;), moving code that doesn't do anything when run repeatedly outside a loop, and architecture-specific optimizations like code scheduling and register allocation. (E.g. with no -O parameters, or -O0, for something like "y = x; z = x;" GCC will generate code that loads "x" from memory twice, once for each statement. With optimization, it will load it once and store it in a register for both instructions.)

      If the compiler tries to do this, wouldn't it likely screw your code up?

      There are cases where optimizations will screw something up. One example is as follows. It's considered good security practice to zero out memory that held sensitive information (e.g. passwords or cryptographic keys) to limit the lifetime of that data. So you might see something like "password = input(); check(password); zero_memory(password); delete password;". But the compiler might see that zero_memory writes into password, but those values are never read. Why write something if you never need it? So it would remove the zero_memory call as it's useless code that can't affect anything. So it removes it. And your program no longer clears the sensitive memory.

      This was actually a bug in a couple crypto libraries for a while.

    2. Re:Few Questions for any programmers by walshy007 · · Score: 5, Insightful

      it optimizes the translation of to assembly opcodes. When you code the stuff you type is not in the binary that's compiled/assembled/linked.

      I highly recommend you add a tiny amount of assembly programming dabbling to that list, and you will gain better understanding of how compiler optimization is not a simple affair. There are many ways to do the same thing.

      As for an example of a basic optimization method, removing dead code, code that is in there but never called by the main method.

      Another one is vector optimization, where certain routines or parts of routines where it's suitable use the vector units of a cpu to speed things up a little.

    3. Re:Few Questions for any programmers by Anonymous Coward · · Score: 3, Interesting
      Classic examples:
      • Replace a mod (e.g. x % 32) with a bitwise-and (e.g. x & 31) when the divisor is a power of two. Nearly every compiler does this now, but twenty years ago it was a common manual optimization trick.
      • Replace a branch with an arithmetic operation that yields the same result.

        i < 0 ? -i : i

        vs

        cdq
        xor eax, edx
        sub eax, edx

    4. Re:Few Questions for any programmers by walshy007 · · Score: 4, Informative

      in regards to learning assembly, if you run linux, the best book I can recommend is Programming from the ground up it's licensed under the GNU free documentation license, and in my honest opinion is likely the single best book for anyone who has no idea that wants to start, I already had some clue so skipped the first two thirds of the book, but read it for shits and giggles later and found it to be a very easy to grasp book.

      To this day if I forget minor details about things I pick that back up and re-read it a bit :)

    5. Re:Few Questions for any programmers by EvanED · · Score: 2, Informative

      Replace a mod (e.g. x % 32) with a bitwise-and (e.g. x & 31) when the divisor is a power of two.

      Another very similar one, and one that comes up more commonly, is the replacement of a multiplication or division by a constant by a series of additions, subtractions, and bitshifts.

      For instance, "x/4" is the same as "x>>2", but the division at one point in time (and still with some compilers and no optimization) would produce code that ran slower. Some people still make this optimization by hand, but I'd say it's almost certainly a bad idea nowadays, at least in the absence of information that your compiler isn't optimizing it and that it would be important.

      (You can combine operations too. x*7 is the same as x3-x, x*20 is the same as x4 + x2, etc.)

    6. Re:Few Questions for any programmers by EvanED · · Score: 2

      (You can combine operations too. x*7 is the same as x3-x, x*20 is the same as x4 + x2, etc.)

      That should be
        x*7 == x << 3 - x
        x*20 == x << 4 + x << 2

      Slashcode (somewhat reasonably) ate my <<s.

    7. Re:Few Questions for any programmers by BlackSabbath · · Score: 5, Informative

      Before you get flamed to death by some idiot, you've got realise that compilers translate a higher-level language into a lower-level one, typically into machine instructions (or in the case of Java and .NET, virtual machine instructions), turning source code into executable form. Interpreters on the other hand, execute each statement of the language directly (effectively forming a virtual machine for that language).

      Naive compiler translations can be functionally correct but sub-optimal with respect to runtime performance, memory/disk footprint etc. Compiler optimisation is the effort to make this translation as optimal as possible with respect to some variable(s) e.g. performance, size

      What you are thinking of sound like source code optimization. There are various interpretations of this but to my mind, this means a combination of optimal algorithm selection and optimal algorithm implementation. Note that complex algorithms can be decomposed into smaller common algorithms e.g. a sort routine may be part of some higher-level algorithm, the sort-routine may be optimised independently of the higher-level routine.

      Check out: http://en.wikipedia.org/wiki/Compiler_optimization

    8. Re:Few Questions for any programmers by sydneyfong · · Score: 3, Insightful

      Assembly itself is not "hard". The language itself is simple. I'd argue that most of the "hardness" is due to its simplicity. There is almost none of the abstract structures and methods that high level languages provide you, and even for something something as "simple" as calling a function, you'll have to manually push data on a stack, jump to the new location, and then pop back the data afterwards, etc.

      Might be unnecessary for those programmers who has no interest in understanding how the computer actually works, but it's worth a look.

      Disclaimer: I've never really done any assembly programming, but only "dabbled" in it for a bit a few years ago.

      --
      Don't quote me on this.
    9. Re:Few Questions for any programmers by symbolset · · Score: 2, Informative

      What things can a compiler do to your code to 'optimize' it for you?

      The correct answer to this question is... it depends. No matter how advanced your compiler is it can't select the correct algorithm for you. If you're ordering your lists with a bubble sort instead of some kind of btree, there's nothing the compiler can do to help you except deliver the best O(n^2) sort it can. A truly artistic programmer can transcend all of the optimizations this compiler might achieve, by several orders of magnitude.

      But if you're the kind of code geek that Microsoft hires, yeah, you might get a version of Windows that boots to a usable desktop in under five minutes.

      --
      Help stamp out iliturcy.
    10. Re:Few Questions for any programmers by Another,+completely · · Score: 2, Insightful

      I agree that it's a good idea to learn assembly / machine language to understand what a compiler is doing, but learning the assembly language of the computer you use at home is not as reasonable a suggestion today as it once was. Learning to code to a 6802 wasn't bad; it only has a few instructions, and it's very instructive (and fun) to find out how many things you can do with just those. I think trying to write for your home PC in assembly is now beyond a beginner exercise though.

      Microcontroller manufacturers often provide emulators and assemblers for their products, so you might download one of those to try. Then, when you get the hang of it, maybe a developer board and some 7-seg LEDs to build a calculator or something. Coding to this year's Intel chips is best left to the compilers and the mystics.

      Anybody out there know a good emulator for teaching assembly programming?

    11. Re:Few Questions for any programmers by ZerothAngel · · Score: 2, Informative

      Anybody out there know a good emulator for teaching assembly programming?

      SPIM is a possibility. It was used in a few courses (operating systems, compilers) at UCB some years ago. (Don't know if it's still used.)

    12. Re:Few Questions for any programmers by TheRaven64 · · Score: 2, Interesting

      Another very similar one, and one that comes up more commonly, is the replacement of a multiplication or division by a constant by a series of additions, subtractions, and bitshifts.

      ARGH! Mod parent down! Please, please, please don't ever repeat this again to people asking things about optimisation. On most modern computers, shifts are slow. They are often even microcoded as multiplications, because they are incredibly rare in code outside segments where someone has decided to 'optimise'. Even when they're not, a typical CPU has more multiply units than shift units and the extra operations needed from the shift and add sequence bloat i-cache usage and cause pipeline stalls by adding adjacent dependencies. The 'optimised' version you describe will almost certainly be slower than the version using the multiply instruction.

      I did some benchmarks with a Core 2 Duo a few months back of this exact optimisation and discovered that in the simplest case the add-and-shift version was as slow as the multiply, in any more complex case it was slower. There's a reason why GCC hasn't done this for some years.

      --
      I am TheRaven on Soylent News
    13. Re:Few Questions for any programmers by Arlet · · Score: 2

      Even faster is the closed form solution:

      http://mathworld.wolfram.com/BinetsFibonacciNumberFormula.html

    14. Re:Few Questions for any programmers by smallfries · · Score: 2, Informative

      No that's not true. A shift instruction has a one cycle latency and 1/2 cycle throughput on the Core2 / Core2-Duo. An add instruction also has a one cycle latency and 1/3 cycle throughput on the Core2-Duo.

      The integer multiplier on the Core2-Duo has a 4-cycle throughput and an 8-cycle latency. So in a "simple" case like x*9 = (x<<3)+x the optimisation would take 2 cycles, and the straight mul would take 8. In more complex cases the individual shifts will pipeline for more of a benefit. Only in cases where (t/3)+ceil(lg(t)) >= 8 will the optimisation be as slow as the multiplier for an expansion of t terms (obviously logs in the base 2 as the additions will form a tree). On x86 lacks of registers will kill this optimisation before the cost of the instructions exceeds the multiplier cost.

      And yes, I've also benchmarked the code to test it on a Core2-Duo, and my results match Intel's published figures and Agner Fog's data tables so I suggest you recheck your benchmark.

      Getting back to the article, the Milepost work isn't really suitable for this type of optimisation anyway. They try and optimise the compile-time by tuning the optimisation flags. For this type of low-level tuning of code the approaches in Program Interpolation, Sketching or PetaBricks would be more appropriate.

      --
      Slashdot: where don knuth is an idiot because he cant grasp the awesome power of php
  7. I for one? by Anenome · · Score: 2, Funny

    Who would've guessed a compiler would become the first program to achieve sentience ;P

    It will surely, er, program our programs to kill us.

    --
    "I Don't Have Enough Faith to be an Atheist"
    1. Re:I for one? by Norsefire · · Score: 5, Funny

      It will surely, er, program our programs to kill us.

      No, it'll just optimize out all emergency stop and safety routines. Humans inevitably die anyway so there is no point in slowing down the code to prevent it.

    2. Re:I for one? by EvanED · · Score: 3, Funny

      Humans inevitably die anyway so there is no point in slowing down the code to prevent it.

      In fact, think of how much of an optimization that is! I mean, suppose people were killed by our robot overloads at 25. That's 1/3 of 75 years old; that's a 3x improvement in the speed we go through our life! In a world where a 20% improvement in speed for a new optimization is very impressive, 3x is just great!

  8. Will it fix Crysis and Vangaurd? by velen · · Score: 2, Funny

    So that the games run on a normal machine?

  9. will they add clippy? by tbj61898 · · Score: 2, Insightful

    It seems like You're computing a spatial Hash! Would You like to use the fastest subroutine I know or use your own?

    seriously... this post talk about machine learning optimization, will it be like "more stuff You compile, better luck with resulting machine code" ?

    It's like a new GPS navigation software thats not only capable of route optimization but also capable of destination suggestions. "It sounds like You're going to a grocery store to buy pizza... there's a pizza hut round the corner!"

    --
    nop, nop, nop #VBLANK
  10. Ricer? by srnty · · Score: 2, Funny

    This just screams for some Gentoo Ricer jokes. Looks interesting though.

  11. Summary is extremely misleading by Skuto · · Score: 3, Informative

    >The compiler is expected to significantly reduce time-to-market of new software,
    >because lengthy manual optimization can now be carried out by the compiler.

    The time to *make a new compiler* for a certain processor is reduced, and the
    process of figuring which optimizations are should be in the compiler for that architecture
    is automated.

    This is for the kind of research where they attempt to make many specialized processors
    on a single chip instead of a general monolithic one. In this case, you need many
    compilers and tuning those is important. It's the time optimizing THOSE that is lowered,
    not the one of writing the software that is compiled itself.

    I see no real relevance to the "normal" desktop situation on that website.

  12. Re:"Lengthy manual optimization"? by SpinyNorman · · Score: 2, Insightful

    I always thought that testing and debugging were the lengthy manual steps

    Not if you wrote the code well! ;-)

    Seriously, as someone who's been doing this a long time (since '78, professionally since '82), and who is still at the top of his game, I nowadays spend *very* little time on debugging since it works first time - even the complicated multi-threaded, mutex type of stuff which is what I primarily write nowadays. After a while you stop making mistakes!

    But, anyways, it seems the main target for this adaptive optimization (from TFA) is embedded usage for novel targets. i.e the latest smart phone or maybe games console, where you don't have the typical "essentially infinite for the needs of the application" CPU resources of a desktop app, and you don't have the luxury of a fairly static target (PC architecture) that has had the benefit of years of code generator hand optimization. For this target usage, someone (either you or the compiler) may need to perform extensive low-level optimizations (in addition to the high level design and choice of algorithms), and it therefore helps if an off-the-shelf compiler is available that can do this, and does not rely on the code generator having to be hand-optimized for the hardware architecture you're targeting.