Reusing mpl's RTS #206
Replies: 1 comment 5 replies
-
Yes, the documentation for MLton is still largely accurate for MPL. There are a few small differences here and there (e.g. we've added additional prims), but nothing major. I agree, RSSA could be a reasonable target if you already know what your data layouts will be. Perhaps SSA2 could also work, although it's hard to say without knowing more specifics about GRIN. I will caution that, to the best of my knowledge, these IRs have never been used as separate targets and were never designed for this purpose. So, I can't say for sure how difficult it would be to target RSSA or similar from a different compiler front-end. Does GRIN have parallelism? If not, then you could try shooting for MLton's backend. If you're interested in taking advantage of parallelism by reusing the MPL runtime system, I'm not sure how easy this would be. At the very least, you would somehow need to recreate the MPL scheduler in GRIN. This code implements MPL's fork-join primitives, but it is a highly privileged piece of code, with many direct calls out to the runtime system to manipulate the GC and other details. The MPL GC and scheduler cooperate closely; they are essentially one combined system. Another pretty big hurdle is laziness---I see that GRIN focuses on lazy evaluation, which is likely not to perform well with MPL's runtime system. I'm happy to discuss if you're curious. |
Beta Was this translation helpful? Give feedback.
-
Hello, I am working on the GRIN project, another whole-program optimizing functional compiler: https://github.com/grin-compiler.
It currently has no RTS, so I’m considering the possibility of reusing MPL's or MLton's by compiling to one of their low-level IRs like SSA, SSA2, or RSSA. This would allow GRIN to target both LLVM and C code.
Does this documentation still hold true for MPL?
http://mlton.org/IntermediateLanguage
http://www.mlton.org/CompilerOverview
It gives me the impression RSSA is the best target since it starts before GC and other RTS features get added, but has explicit data representations instead of datatype declarations (GRIN is untyped, so it starts with neither but gets annotated with data representations via static analysis for optimizations and codegen).
Beta Was this translation helpful? Give feedback.
All reactions