futhark
futhark copied to clipboard
Suggestion: restrict index functions to a single LMAD
Supporting multiple LMADs leads to complex code and currently unfixed compiler bugs. Further, indexing such a multi-LMAD index function is very slow. Finally, in many cases (such as every time we return from a Body) we force re-manifestation if the result is a multi-LMAD. I believe that multi-LMAD index functions are not worth the cost. I propose that we restrict index functions to a single LMAD. Whenever an index transformation results in something that would currently be a multi-LMAD, we insert a copy. I have not measured the impact of this, but given how rare multi-LMADs are in real programs, I don't think it will be a big problem. Thoughts?
#1309 is the kind of bug that is due to multi-LMAD shenanigans, although I have another fix for it.
I'm all for simplifying the handling of LMADs. At the very least, it would be interesting to see what the performance impact would be.
I'm working on the allocator and memory representation for the past few days, I believe in this simplification more than I have ever believed anything in my life.