r/ProgrammingLanguages • u/Athas Futhark • Mar 24 '26
Scan-scatter fusion
https://futhark-lang.org/blog/2026-03-24-scan-scatter-fusion.html
24
Upvotes
r/ProgrammingLanguages • u/Athas Futhark • Mar 24 '26
View all comments
Show parent comment
4
u/Athas Futhark Mar 24 '26
You mean writing it as a map with summation over the prefixes? I strongly dislike that approach, as it makes it impossible to assign a good asymptotic cost model to the language. I am highly skeptical of compiler optimisations that intentionally try to make asymptotic improvements (but I accept that things like hoisting can do so), as I believe it leads to brittle programs. I went into some detail in this post.
It may be a useful approach if you use a tactics/scheduling language to optimise your naive program, as you then have complete confidence in what the result looks like (and can assign a cost semantic to the result). But for conventional black box optimisers I do not believe it is a good idea.