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

Provide packed API functions #2158

Open
athas opened this issue Jul 1, 2024 · 1 comment
Open

Provide packed API functions #2158

athas opened this issue Jul 1, 2024 · 1 comment
Labels
compiler enhancement student-viable Viable as a student project

Comments

@athas
Copy link
Member

athas commented Jul 1, 2024

Some of the functions exposed by the C API have a variable number of parameters, depending on the underlying Futhark program:

  • Entry points have a parameter for every input and for every output.
  • Record creation functions take a parameter for every field.
  • Sum type creation functions take a parameter for every payload value.
  • Array creation functions take a parameter for every dimension.
  • ...others?

This is inconvenient for some users, particularly those making use of run-time linking (dlopen()), as it is difficult to invoke a function with a dynamically known number of arguments. It is also slightly inconvenient for other FFIs in some cases.

As a solution, we could expose "packed" variants of these functions (does a better name exist?) where each sequence of variable-length parameters is replaced with a single array that contains pointers to those values.

@athas
Copy link
Member Author

athas commented Jul 25, 2024

In order to not complicate the code generator for this relatively niche use case, the best way to implement this would be to have a separate facility (which can be part of futhark) for generating packed wrapper code from a manifest file.

@athas athas added the student-viable Viable as a student project label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler enhancement student-viable Viable as a student project
Projects
None yet
Development

No branches or pull requests

1 participant