diku-dk / futhark

:boom::computer::boom: A data-parallel functional programming language
http://futhark-lang.org
ISC License
2.38k stars 165 forks source link

Add fast path for large arrays. #2162

Closed athas closed 3 months ago

athas commented 3 months ago

Currently only handles one dimensional arrays, but could be extended. Since this is only useful for generated code, I don't think wider applicability is important.

There is still work to do in the frontend, where some passes (e.g. monomorphisation) do not handle this particularly efficiently. We may want to also add ArrayVal to the frontend language, and desugar to it during full normalisation.

athas commented 3 months ago

@WilliamDue With this change, futhark cuda --library json.fut takes 14s on my machine (vs 73s before). I think I can still make it a bit faster. Also, this is an OK demonstration of how many places you have to modify the compiler when adding a fundamental new language construct.

athas commented 3 months ago

Now down to 9.5s.

athas commented 3 months ago

Now 6.1s. Last bottleneck seems to be lexing.