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

Higher order codegen #181

Merged
merged 235 commits into from
Mar 13, 2023
Merged

Higher order codegen #181

merged 235 commits into from
Mar 13, 2023

Conversation

NeuralCoder3
Copy link
Collaborator

@NeuralCoder3 NeuralCoder3 commented Feb 1, 2023

This branch contains fixes for higher-order code generation.
The fixes regard the llvm backend, memory dialect, and closure conversion dialect.

This branch is the base of the current state of automatic differentiation and the matrix dialect.

Summary

Miscellaneous:

  • .gitignore: ignore build folder but not everything with build in its name
  • error.sh: small script to make it easier to provide issue information for failing tests

Core

  • dump filters for functions
  • print list of executed passes
  • fix lam_spec divergence

Dialects

  • refly:
    • debug_dump: a pass that just dumps the world to stdout
  • affine:
    • correctly propagate accumulator
  • compile/opt:
    • move dialect conditionals from opt to compile for accessibility
    • generalize internal cleanup phase to avoid code duplication (parametrized over prefix)
  • direct
    • fix issue of nested cps2ds calls using a stack
  • mem
    • more mem manipulation operations (not assuming mem at position 1)
    • reshape: rewrite argument shape of a function (take special care of mems)
    • add_mem: documentation improvement, ignore argument position mems
  • core:
    • add free
  • clos:
    • move phase2pass wrapper

Tests

  • allow filter annotation in printed thorin code
  • more direct, mem, clos tests regarding mem issues

@NeuralCoder3 NeuralCoder3 mentioned this pull request Feb 1, 2023
@NeuralCoder3 NeuralCoder3 marked this pull request as ready for review February 2, 2023 09:05
@NeuralCoder3 NeuralCoder3 mentioned this pull request Feb 9, 2023
6 tasks
thorin/analyses/deptree.cpp Outdated Show resolved Hide resolved
thorin/def.cpp Outdated Show resolved Hide resolved
thorin/pass/pipelinebuilder.h Show resolved Hide resolved
lit/main_loop.thorin Outdated Show resolved Hide resolved
lit/autodiff/general/invoke_ds.thorin Outdated Show resolved Hide resolved
dialects/direct/passes/cps2ds.h Outdated Show resolved Hide resolved
dialects/direct/passes/cps2ds.cpp Outdated Show resolved Hide resolved
dialects/mem/passes/rw/reshape.cpp Show resolved Hide resolved
dialects/core/be/ll/ll.cpp Outdated Show resolved Hide resolved
dialects/core/be/ll/ll.cpp Outdated Show resolved Hide resolved
dialects/direct/passes/cps2ds.cpp Outdated Show resolved Hide resolved
dialects/mem/mem.h Outdated Show resolved Hide resolved
dialects/mem/mem.h Outdated Show resolved Hide resolved
dialects/mem/mem.h Show resolved Hide resolved
dialects/mem/mem.h Show resolved Hide resolved
lit/clos/lib.c Outdated Show resolved Hide resolved
lit/clos/lib.c Outdated Show resolved Hide resolved
lit/clos/lib.c Outdated Show resolved Hide resolved
lit/mem/arg_style_no_extern.thorin.disabled Outdated Show resolved Hide resolved
@leissa
Copy link
Member

leissa commented Mar 13, 2023

On a more stylistic note, I think we should remove the space just in front of the @ when dumping filters. Say, we have a curried function:

.con foo(a: T)@(.tt)(b: U) = /*...*/

With the current logic, it would look like this:

.con foo(a: T) @(.tt)(b: U) = /*...*/

And now it looks as if the filter belongs to the second curried function.

@NeuralCoder3
Copy link
Collaborator Author

On a more stylistic note, I think we should remove the space just in front of the @ when dumping filters. Say, we have a curried function:

.con foo(a: T)@(.tt)(b: U) = /*...*/

With the current logic, it would look like this:

.con foo(a: T) @(.tt)(b: U) = /*...*/

And now it looks as if the filter belongs to the second curried function.

Do curried functions still exist at the dumping stage?
I would expect them to be syntactic sugar that is resolved at parsing.

@leissa
Copy link
Member

leissa commented Mar 13, 2023

On a more stylistic note, I think we should remove the space just in front of the @ when dumping filters. Say, we have a curried function:

.con foo(a: T)@(.tt)(b: U) = /*...*/

With the current logic, it would look like this:

.con foo(a: T) @(.tt)(b: U) = /*...*/

And now it looks as if the filter belongs to the second curried function.

Do curried functions still exist at the dumping stage? I would expect them to be syntactic sugar that is resolved at parsing.

correct. But I still find it better for the sake of consistency to remove the space.

@leissa leissa merged commit 1374e0c into AnyDSL:master Mar 13, 2023
@leissa leissa deleted the ho_codegen branch March 13, 2023 13:31
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