Where do I put the propeller?

Here is an analogy for your consideration. “Where do I put the propeller?”

LLVM (the optimizer/codegen) is like a car design. It’s got a good engine, frame, and other parts. It’s got an active community of people around refining the design and using it for many purposes. It’s a good car for these people.

OpenMP and similar pragmas are like a helicopter design. A few people have decided that they wish to design helicopters. It’s a lot of work to design a complete helicopter, and a helicopter needs some of the same things a car needs, so their plan is to take this popular car design and attach a propeller and other things that they’ll need. They’re really excited about this because it will free them from worrying about the boring parts so that they can focus on the cool parts like propeller blades and flight control surfaces. However, there are a few minor issues. We just need somewhere to attach a propeller. And we’ll need to make the transmission design modular so that we can do some custom things there. And possibly a few other minor tweaks that will come up as we go forward. It shouldn’t be much.

Then they encounter some friction. Most of the people around primarily care about cars. Some of them think that helicopters sound cool, and are eager to help figure out how to attach a propeller mount to the car roof, however they find that the frame of the car isn’t prepared to handle that kind of load. A redesign of the frame, or somehow making the frame modular, is not something that can be trivially dropped in. The car people find themselves pushing back. Then the helicopter people point out that in other helicopter designs, most of the important parts were designed specifically for a helicopter’s needs, and that that is widely considered the best design methodology for helicopters, and so why can’t we do that here?

You want a no-compromise helicopter, and you are talking about starting from a car conversion kit helicopter. Quite possibly you can meet your goals with this approach, and you may save a fair amount of work, however you’ll also end up making compromises and doing extra work that you wouldn’t have otherwise needed. Which approach is best depends on many factors.

Dan

Personally, I find that to be a ridiculous and unhelpful analogy. It is clearly possible and useful to represent loop information in LLVM IR. OpenMP is one particular use of it, but there are plenty of others.

-Chris

I want an industrial-strength compiler. With the possibilities that we have here in the LLVM developers community, the sky is the limit. I see no reason why we should restrict ourselves to any design that has serious known limitations.

I've spent 8 years working on a compiler that was a bleeding edge of compiler technology, and with people who had a wealth of wisdom and insight into how to build compilers. I've tried very hard to absorb that intangible knowledge and I believe that to a considerable extent I have managed to do that. Now, that we have a still developing compiler that we can do whatever we want with, I'm presenting ideas that I believe may be the key to having a world-class optimizer.

The thread that you branched off from shows that there is an interest in the scientific and research community in having a compiler that can perform well on codes where loop optimizations (including user-guided optimizations) are of paramount importance, so I'm not convinced by your argument that the community as a whole is happy with what we have. Certainly, some people are, but we should not leave out a large group that could also benefit from our work.

-Krzysztof