-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
GHC to GRIN? #10
Comments
Hi, The Currently there is no supported way to convert GHC Haskell to GRIN IR, however this approach was my first attempt to implement. The My ultimate goal is to use GHC as a Haskell language frontend for the GRIN optimizer, but I'll reach this goal in smaller steps. I also target the problem from two directions:
GHC Haskell programs have lots of C code dependencies, either via the RTS or via some cabal packages. |
Hi! Actually, my programs are in Haskell only due to the current workflow, but essentially they are more like simplified Haskell Core, since I need only Also, I have a more specific off-topic question. To translate a program to hardware (namely System Verilog) the program should not contain any higher-order functions which at the moment is achieved through defunctionalization. As far as I can tell GRIN does not provide defunctionalization, but am I right that inlining applied to the whole program provides something similar to this? |
If you want to avoid C-land dependencies then you should not use GHC's Prelude at all. Even the Yes the GRIN does not implement defunctionaliation transformation. GRIN is a first order IR, so any higher order code should be defunctionalized before the GRIN conversion. BTW, this is why I'd like to implement the lambda calculus like convenience IR. It would provide the defunctionalization transformation for free. But that is future work. Inlining is orthogonal to defunctionalization. |
Could you please elaborate about how one would get defunctionalization for free? There is a procedure in Boquist's thesis about how to translate higher-order functions to GRIN where the |
The Boq thesis describes how to convert a closure converted and lambda lifted higher order IR to GRIN. If my lambda IR implementation would include the defunctionalization transformation then the users would get this feature for free. |
Is there currently an ability to generate GRIN representation for an input Haskell program?
At the moment the structure of repositories seems to be pretty unclear. Am I right, that https://github.com/grin-compiler/grin contains only those parts of grin that operate only with GRIN representation and does not have any frontends support? And what is the purpose of this repository? Most of the modules inside
stack.yaml
are commented out and if I uncomment some of themstack build
does not succeedThe thing that I wanted to do is to try to utilize GRIN as an intermediate representation for hardware generation, but my input programs are in Haskell (and are optimized first using Haskell-related stuff). Is there any workflow how one would achieve this?
The text was updated successfully, but these errors were encountered: