Slashdot Mirror


Genetic Algorithms for GCC Optimization

captain igor writes "For the power users in the house that enjoy taking the time to squeeze every last drop of performance out of their programs, here's an interesting little program I ran across today call Acovea. Out since 2003, Acovea's main function is using genetic algorithms to determine an optimal set off Gcc optimization flags to squeeze the most performance out of a given program. Certainly an interesting concept, definitely worth a look. Some nice results on a P4 and Opteron can be found here "

3 of 45 comments (clear)

  1. Ouch by Scarblac · · Score: 4, Insightful

    Q: How can you tell you have perhaps gone slightly overboard in making compiler optimization options available?

    A: Your users have not just given up trying to reason out what they should do, or even brute forcing every possible combination, they're inventing fucking genetic algorithms to find out what works best.

    Basically the act of "calling gcc from the command line" is know officially a murky problem space to attack with pseudo-random hill climbing stuff...

    --
    I believe posters are recognized by their sig. So I made one.
    1. Re:Ouch by RML · · Score: 4, Insightful

      I just see this as an extension to the whole "extreme programming" idea of "code something, anything, until you get the output you want for your test cases, then stop coding".

      It's a good idea in theory, but it seems much better to have a well thought out approach.


      Figuring out how different optimization passes interact is too complicated for humans to do correctly. The interactions tend to be subtle, unexpected, and sometimes completely counterintuitive. The only way to get it right is to run lots of real-world testcases with different combinations of optimizations and tune the defaults based on the results. Acovea just automates that for the nice folks working on gcc.

      --
      Human/Ranger/Zangband
  2. Re:Performance by chance? by shaka999 · · Score: 4, Insightful

    I use GA's for circuit optimization all the time. They are very effective and often find things I wouldn't have thought of.

    That said, you don't take their results and just run with it. I find you that once a solution is found I have to go back and understand what and why it did what it did. In the case of circuit optimization I need to make sure that the optimizer isn't just exploiting a modeling problem (this has happened a few times). In the case of optimizing for complier flags I'd imagine the same thing applies.

    After the optimizer finishes selecting flags the developer should go back and make sure that all the flags make sense and aren't risky. Its at this point a developer can decide what he/she wants to use.

    --
    One should not theorize before one has data. -Sherlock Holmes-