futhark icon indicating copy to clipboard operation
futhark copied to clipboard

Suggestion: restrict index functions to a single LMAD

Open athas opened this issue 2 years ago • 3 comments

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?

athas avatar Jul 17 '22 19:07 athas

#1309 is the kind of bug that is due to multi-LMAD shenanigans, although I have another fix for it.

athas avatar Jul 17 '22 20:07 athas

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.

Munksgaard avatar Jul 17 '22 21:07 Munksgaard

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.

athas avatar Jul 18 '22 15:07 athas