Earlier quoted context omitted.
Because we "should", but actually don't, know ahead of time what semantic preserving transformations are available. The entire point is to discover them. If you find this bizarre, consider that your semantic preserving transformations should be able to do examples in Figure 12 and 13 of http://theory.stanford.edu/~aiken/publications/papers/asplos...
But it seems to me that the fact that they have a theorem prover at all means they do know ahead of time what semantic preserving transformations are available.
Learning to Superoptimize Programs
21–28 of 28 posts
Re: Learning to Superoptimize Programs
#22This technique is only as good as the objective function. In most real world scenarios there is no canonical objective function, nor a comprehensive test suite exercising all branches of the code.
How does this claim mesh with this quote from the paper: """Stoke (Schkufza et al., 2013) performs black-box optimization of a cost function on the space of programs, represented as a series of instructions. Each instruction is composed of an opcode, specifying what to execute, and some operands, specifying the corresponding registers. Each given input program T defines a cost function. For a candidate program R called rewrite, the goal is to optimize the following cost function"""
Re: Learning to Superoptimize Programs
#23This work should be read in context of prior work, STOKE: http://stoke.stanford.edu/ This work outperforms STOKE, and STOKE outperformed existing methods including GCC, LLVM, ICC, traditional superoptimization, expert human, etc. That's why comparison with existing methods are omitted. This work is also limited to Hacker's Delight and automatically generated programs, but so was STOKE. But STOKE readily extended to c…
Re: Learning to Superoptimize Programs
#24Even if this was useful, it presumes the ability to prove a application correct while modifying it. This would only be doable in very limited circumstances not general purpose applications.
For example, CompCert compiler will produce correct assembly from a correct, C program. A set of optimizations might be available for the middle passes. Let's say C program gets taken to form I for intermediate. We know I is correct because that's what CompCert does. Applying J = optimize(I) might break it semantically in process of trying to speed it up. J might not equal I in some way. So, strategy is to develop an equivalence check as strong as CompCert to do J = Optimize(I), If Equals(I, J), Then Return J, Else Return I.
An example of a project doing this for real-world stuff is effort to formalize and equivalence-check LLVM's intermediate code:
Re: Learning to Superoptimize Programs
#25Where is the source? It's not science until you can reproduce their result.
http://www.robots.ox.ac.uk/~tvg/code.php
You might also say that it's not science until it's been peer reviewed and this is a preprint from 2 weeks ago…
Re: Learning to Superoptimize Programs
#26As someone not well versed in compilers, this approach seems bizarre. 1. Given some chunk of a program, we should know ahead of time which I/O preserving transformations are available to us, because math. 2. Random search isn't going to find you some kind of Godel-esque situation where the optimized instructions are equivalent to the un-optimized ones in an unprovable way, especially when one of your steps is "prove…
Because we "should", but actually don't, know ahead of time what semantic preserving transformations are available. The entire point is to discover them. If you find this bizarre, consider that your semantic preserving transformations should be able to do examples in Figure 12 and 13 of http://theory.stanford.edu/~aiken/publications/papers/asplos...
The problem is that the ranges pointed by x and y could (partially) overlap, in which case the SSE-based optimization is incorrect.
Edit: Even more damning, gcc actually does produce an equivalent optimal code sequence for me when the incoming pointers are correctly marked as restrict and -march=native is used. (Although perhaps that's due to different gcc versions; maybe a gcc improvement was inspired by that article.)
Edit #2: I see they actually discuss this in the main article text. Oh well, I'm leaving the comment here since the figure by itself is misleading.
Re: Learning to Superoptimize Programs
#27This work should be read in context of prior work, STOKE: http://stoke.stanford.edu/ This work outperforms STOKE, and STOKE outperformed existing methods including GCC, LLVM, ICC, traditional superoptimization, expert human, etc. That's why comparison with existing methods are omitted. This work is also limited to Hacker's Delight and automatically generated programs, but so was STOKE. But STOKE readily extended to c…
That sounds pretty awesome. So, are these only instruction-level optimizations or is there a good toolkit for doing it SSA level as well? My idea being combining it with formal, equivalence checks in certified compilers so we get optimizations plus ensure correctness given original version was correct via certified transform. Certified to v1 -> superoptimize to v2 -> certified checker (v1, v2) -> rinse repeat.
Re: Learning to Superoptimize Programs
#28Earlier quoted context omitted.
That sounds pretty awesome. So, are these only instruction-level optimizations or is there a good toolkit for doing it SSA level as well? My idea being combining it with formal, equivalence checks in certified compilers so we get optimizations plus ensure correctness given original version was correct via certified transform. Certified to v1 -> superoptimize to v2 -> certified checker (v1, v2) -> rinse repeat.
souper: https://github.com/google/souper