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

Rewrite CPPL to use new loader interface #192

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

elegios
Copy link
Contributor

@elegios elegios commented Feb 4, 2025

This PR is a large sweeping set of changes with the primary goal of making the coreppl compilation pipeline more robust. The PR is marked as draft for reasons I'll get into at the end. Changes include:

  • Directly using the compilation functions from the mi compiler, instead of printing to a temporary file and running mi on it. This avoids extra work, including re-typechecking code post-transformation, which can be fragile.
  • More principled inclusion of files (mostly inference runtime files) using the new loader API. This avoids duplicate code elimination and makes it easier to ensure that everything's been symbolized and type-checked. It also makes it easier to create other languages building on top of coreppl.
  • Precise tracking of where runtime functions originate. Previously references to functions in runtimes would be inserted as strings and then symbolized in an appropriate environment. Now they are inserted already symbolized, by looking them up in a file-specific symbolize environment. This gives better errors if something goes wrong, and makes it easier to track what's going on when looking at compiler code.
  • Inference-specific transformations are now parameterized slightly differently, they get a single value with all relevant data (options, the ast to transform, environments, etc.).

There are three tasks/questions remaining before marking this PR ready:

  • Auto-differentiation is currently not supported. It's non-trivial to figure out which parts of the program should be lifted, so we haven't quite decided/figured out what the best approach to deal with this is.
  • The rootppl backend has not been updated at all, to the point where it's commented out of the compiler. I'm not sure to what extent it is used currently, and thus how much effort to put on it.
  • Cleanup, a bunch of code is now irrelevant/redundant and likely unused, and should thus be removed.

Update:

  • AD is now supported, though only in CorePPL files. This maintains the status quo, but unfortunately means that other languages that want AD have to do work to do it, they cannot merely include the appropriate Loader language fragment and hook.
  • We removed the RootPPL backend and related code, and updated the Readme to point to the paper-corresponding point in the repository history, as well as the artifact.
  • I've removed what dead/redundant code I could find, though it would not surprise me if there's more.

Includes code by @gizemcaylak and @br4sco.

@elegios elegios force-pushed the in-progress branch 2 times, most recently from 936a619 to 5b77619 Compare February 17, 2025 12:18
@elegios elegios force-pushed the in-progress branch 3 times, most recently from c07ad7c to a0aec03 Compare March 4, 2025 11:46
@elegios elegios marked this pull request as ready for review March 4, 2025 14:56
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.

3 participants