4 ms·
Hydra: Generalizing peephole optimizations with program synthesis [pdf]
- mncharity 2y ago> Hydra transforms an ungeneralized [peephole] optimization [...] from a developer or a superoptimizer into a generalized version that is often suitable for inclusion in a compiler [llvm] Example: `y ≠ 0 |= (y:i64 − 42) × 2048 ⇒ (y − 42) ≪ 11` to `IsPowerOf2(C) |= z × C ⇒ z ≪ log2(C)`.
- fooker 2y agoWho would even use such a tool? I expect doing this manually to be one of the fun/rewarding aspects of working on a compiler? Sounds very much like automating the wrong thing similar to AI generated 'art'.
- azornathogron 2y agoThis is a little different to art in that it's less subjective: an optimizer that produces faster code (or perhaps smaller code, or some other optimization goal) is better, and this is measurable using benchmarks. A tool that can give you a better compiler will be used, because people want better compilers.
- fooker 2y ago> because people want better compilers. If you ask developers what they want from their development ecosystem, better compilers wouldn't even be in the top ten.
- saagarjha 2y agoThere are plenty of nontrivial transformations that compilers still have yet to do if you are looking for "art". This just automates a class of optimization so it can be done reliably and generally.
- fooker 2y agoOkay, that makes sense