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

Investigate Lambda Set Specialisation #1970

Open
athas opened this issue Jun 20, 2023 · 1 comment
Open

Investigate Lambda Set Specialisation #1970

athas opened this issue Jun 20, 2023 · 1 comment

Comments

@athas
Copy link
Member

athas commented Jun 20, 2023

Futhark imposes certain draconian type system restrictions in order to guarantee efficient defunctionalisation. Essentially we guarantee that any functional value can have only a single possible form, and then we specialise every higher-order function.

The paper Better Defunctionalization through Lambda Set Specialization shows a defunctionalisation technique that allows functional values to come from multiple lambdas, while precisely tracking exactly which are possible.

We should consider reimplementing defunctionalisation in terms of Lambda Set Specialization. Returning functions from branches can certainly result in slower code as the representation becomes a sum type, but it would be opt-in. Any code written under our current restrictions would be unaffected.

Specifically, after implementing Lambda Set Specialization we could allow functions to be returned from branches and used as loop variables. We still would not allow functions in arrays, as this can induce irregular arrays. However, it would mean that size-lifted and lifted types would have the same restrictions (can't be put in arrays) and hence could be combined into a single notion of lifted types.

@athas athas changed the title Investigate Lambda Specialisation Investigate Lambda Set Specialisation Jun 20, 2023
@athas
Copy link
Member Author

athas commented Jun 20, 2023

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