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

Defunctionalisation unnecessarily duplicates first order code #1968

Closed
athas opened this issue Jun 18, 2023 · 0 comments
Closed

Defunctionalisation unnecessarily duplicates first order code #1968

athas opened this issue Jun 18, 2023 · 0 comments

Comments

@athas
Copy link
Member

athas commented Jun 18, 2023

def f (x: i32) = x + 2

def main xs ys = (map f xs, map f ys)

When we defunctionalise this, we end up with three copies of the function f: the original one, as well as copies that arise from the residual function of the static values coming from the uses of f. Apart from causing code bloat, these residual functions also will lack any function-level attributes (such as #[noinline]) of the original function.

This is bad and should be fixed.

@athas athas closed this as completed in 25697a7 Jun 19, 2023
razetime pushed a commit to razetime/futhark that referenced this issue Jul 16, 2023
This is done by eta-expanding uses of function-typed variables.  We
will still generate a wrapper function, but it will always be small,
while previously we would duplicate the entire first order code, which
can be enormous.  This will be particularly important once we stop
inlining so much.

Closes diku-dk#1968.
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