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

[ReuseIR] Pipeline #66

Open
SchrodingerZhu opened this issue Sep 5, 2024 · 5 comments
Open

[ReuseIR] Pipeline #66

SchrodingerZhu opened this issue Sep 5, 2024 · 5 comments

Comments

@SchrodingerZhu
Copy link
Owner

SchrodingerZhu commented Sep 5, 2024

./bin/reuse-opt ../reuse-mlir/test/integration/basic/list_of_i32.mlir -reuse-ir-closure-outlining -reuse-ir-token-reuse -reuse-ir-infer-union-tag -reuse-ir-expand-control-flow=outline-nested-release=0 -reuse-ir-acquire-release-fusion -reuse-ir-expand-control-flow=outline-nested-release=1
  • -reuse-ir-closure-outlining outlines closure creations into vtable and other operations.
  • -reuse-ir-insert-acquire-release (unimplemented) ping @QuarticCat
  • -reuse-ir-token-reuse uses available tokens to replace TokenAllocOp
  • -reuse-ir-infer-union-tag is a helper pass to cut off branches on union types if it has a known variant. acquire-release-fusion is conservative about complicated branches (at lease for now).
  • -reuse-ir-expand-control-flow=outline-nested-release=0 expands one layer of hidden control flows due to release, destroy and other operations. This will expose the release operations inside destroy for fusion.
  • -reuse-ir-acquire-release-fusion fuses consecutive acquire/release on precisely aliased RC pointers.
  • -reuse-ir-expand-control-flow=outline-nested-release=1 converts the remaining release/destroy operations into outlined functions (notice that some drop routines are possibly recursive).

After the above:

  • convert-scf-to-cf converts structured control flow to branches among basic blocks.
  • convert-reuse-ir-to-llvm lowers whatever remains in reuse_ir down to LLVM dialect. (Not complete)
  • convert-arith-to-llvm (and other passes of needed) lowers arith operations.

Then, translate mlir to LLVMIR:

 <previous-output> | mlir-translate -mlir-to-llvmir

Then, obtain the optimized machine code

 <previous-output>  | opt -O3 | llc # or use clang to drive the compilation from `.ll` if you want
@SchrodingerZhu
Copy link
Owner Author

@anqurvanillapy @Lancern @CyanPineapple Please be aware of current pipeline.

@QuarticCat please notify me when you start to implement the missing passes.

@Lancern
Copy link
Collaborator

Lancern commented Sep 6, 2024

Not fully related to this issue, but do we have or plan to have a documentation page that explains the ops, types, passes, etc. in ReuseIR just like any other MLIR dialects do?

@SchrodingerZhu
Copy link
Owner Author

I would like to have one. I don't yet know how to generate the document from tablegen. Could you check that?

@Lancern
Copy link
Collaborator

Lancern commented Sep 6, 2024

I would like to have one. I don't yet know how to generate the document from tablegen. Could you check that?

Let me work on this. Opening a new issue to track this.

@Lancern
Copy link
Collaborator

Lancern commented Sep 6, 2024

Opening a new issue to track this.

Tracked in #69 .

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

No branches or pull requests

2 participants