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

Modular PrimOps #64

Open
andorp opened this issue Dec 29, 2019 · 4 comments
Open

Modular PrimOps #64

andorp opened this issue Dec 29, 2019 · 4 comments
Assignees
Labels
proposal A suggestion on how to improve the compiler

Comments

@andorp
Copy link
Member

andorp commented Dec 29, 2019

The GRIN frontends should not depend on the built-in evaluation of the primitive operations. Currently we are able to define the ffi and primitive operations, but their interpretation are still tied to the Reducer.Eval, Reducer.LLVM.CodeGen modules.

The use case: I as a frontend developer, want to create my own primitive operations which suits the best to the compiler I work on. To do that, I have to define the set or primitives. Those primitives configured in the ffi/pure section in my GRIN prelude.

Stages:

  1. I would like to add their implementation to the Pure Evaluator to get the semantics right.
  2. Implement my primitive operations in the prim_ops.h / prim_ops.c which are linked during the executable generation phase
  3. Extend the LLVM codegen which my implementation for the primitives in a modular/pluginable way.
@andorp
Copy link
Member Author

andorp commented Dec 29, 2019

Currently I am working on the first stage, where the PrimOps.hs is defined in the Idris-GRIN-Backend repository and uses a PureEvalPlugin. I sketched the implementation in the #65 PR. But in the long run I would like to implement the rest of the stages too.

@andorp andorp added the proposal A suggestion on how to improve the compiler label Dec 29, 2019
@andorp andorp assigned andorp, csabahruska and Anabra and unassigned andorp Dec 29, 2019
@Anabra
Copy link
Member

Anabra commented Dec 31, 2019

Looks great.

@csabahruska
Copy link
Member

My plan was to remove the GRIN primop prelude completely. Then add LLVM primops that are understood by the LLVM codegen.

@andorp
Copy link
Member Author

andorp commented Jan 4, 2020

I think these goals are not contradictory. We can implement the PrimOps based on the LLVM ones once they introduced.

Currently I am working with the test suite found in Idris-Dev. At this stage I need the PrimOp abstraction for the Idris-GRIN-backend to not to pollute the PrimOps in the GRIN repository.
At the next stage I can start to work on adding the primops from LLVM to the GRIN. After that full featured LLVM codegen for the Idris repository could be implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal A suggestion on how to improve the compiler
Projects
None yet
Development

No branches or pull requests

3 participants