Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Hydra: Generalizing peephole optimizations with program synthesis [pdf] (utah.edu)
38 points by luu on June 14, 2024 | hide | past | favorite | 6 comments


> 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)`.


Who 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'.


There 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.


Okay, that makes sense


This 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.


> 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: