Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C code generation involving large arrays of constants is very slow #2160

Closed
athas opened this issue Jul 3, 2024 · 0 comments
Closed

C code generation involving large arrays of constants is very slow #2160

athas opened this issue Jul 3, 2024 · 0 comments

Comments

@athas
Copy link
Member

athas commented Jul 3, 2024

The Futhark compiler can handle large arrays of monomorphic literals reasonably well (due to a specialised fast path). However, when the code generator constructs a C AST via language-c-quote and feeds it to the prettyprinter, it can take a pretty long time. I do not think language-c-quote is designed to handle array literals with that many elements. For a representative program submitted by @WilliamDue, the C backend takes 17s to generate the program, while the Python backend takes 1s - and that is including fairly naive (inefficient) prettyprinting.

I don't know if there is a quick way to hack up a fix, or if we should consider ditching language-c-quote and using a simpler representation for C. We don't need most of what it offers, and we particularly don't need its tracking of source locations (which I suspect is a major source of overhead).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant