Skip to content

Conversation

lsrcz
Copy link
Collaborator

@lsrcz lsrcz commented Sep 30, 2025

This pull request adds a helper for specializing a parametric function with a given environment. The resulting function will be inserted back to the source module.

The C API exposed a "batched" specializing helper that takes an typechecked module and return a cloned typechecked module with all specialized functions inserted. This is needed as our current use of C APIs is assuming that a module is immutable.

@lsrcz lsrcz requested a review from cdleary September 30, 2025 20:13
@proppy
Copy link
Member

proppy commented Oct 7, 2025

could this potentially also be used to add a flag to ir_converter_main that specialize a parametric function?

@proppy proppy requested a review from richmckeever October 7, 2025 06:31
@lsrcz
Copy link
Collaborator Author

lsrcz commented Oct 7, 2025

could this potentially also be used to add a flag to ir_converter_main that specialize a parametric function?

@proppy yeah, are you thinking about using a parametric function as the top function, and specialize with some parameters?

@lsrcz
Copy link
Collaborator Author

lsrcz commented Oct 7, 2025

This PR is now blocked by #3061 as the test suite is referring to functions defined there

@proppy
Copy link
Member

proppy commented Oct 8, 2025

@proppy yeah, are you thinking about using a parametric function as the top function, and specialize with some parameters?

👍 yes, this can easily be done w/ a wrapper function today, but is cumbersome to do w/o code generation when you want to instanciate a lot of function variants w/ different sizes.

/cc @richmckeever

@proppy
Copy link
Member

proppy commented Oct 8, 2025

This PR is now blocked by #3061 as the test suite is referring to functions defined there

Understood! Let's get #3061 in first.

@lsrcz
Copy link
Collaborator Author

lsrcz commented Oct 8, 2025

👍 yes, this can easily be done w/ a wrapper function today, but is cumbersome to do w/o code generation when you want to instanciate a lot of function variants w/ different sizes.

Yeah. I used to do code generation to serve my purpose, but replacing all the invocation sites is hard to do without a programmatic way to manipulate the DSLX.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants