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

Closure Conversion - higher order return #117

Open
NeuralCoder3 opened this issue Oct 14, 2022 · 7 comments · May be fixed by #138
Open

Closure Conversion - higher order return #117

NeuralCoder3 opened this issue Oct 14, 2022 · 7 comments · May be fixed by #138
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@NeuralCoder3
Copy link
Collaborator

1E) '([], ((.Idx 4294967296, aug_pow_else_745690_660849_352178, _660885_351873):closure_type_352061, ([], aug_pow_then_745900_661112_352340, ()):closure_type_352416)#_352541#2:(.Idx 3))' of type 
2E) '      (.Idx 4294967296, aug_pow_else_745690_660849_352178, _660885_351873):closure_type_352061, ([], aug_pow_then_745900_661112_352340, ()):closure_type_352416)#_352541#1:(.Idx 3)' of domain 

1T) '[★,                   ((.Idx 4294967296, aug_pow_else_745690_660849_352178, _660885_351873):closure_type_352061, ([], aug_pow_then_745900_661112_352340, ()):closure_type_352416)#_352541#0:(.Idx 3)]' to 
2T) '[closure_type_352015, ((.Idx 4294967296, aug_pow_else_745690_660849_352178, _660885_351873):closure_type_352061,  ([], aug_pow_then_745900_661112_352340, ()):closure_type_352416)#_352541#0:(.Idx 3)]'
      ^ only here

This behavior is exhibited for instance in pow_autodiff_eval_filter2_eval.thorin.

The program is a differentiated version of pow and as such a minimal recursive function that folds continuations inside each other in the return continuation.

@NeuralCoder3 NeuralCoder3 added bug Something isn't working help wanted Extra attention is needed labels Oct 14, 2022
@leissa
Copy link
Member

leissa commented Oct 14, 2022

Was this the issue where several closures end up in the same slot?

@NeuralCoder3
Copy link
Collaborator Author

Was this the issue where several closures end up in the same slot?

The issue might be related. At least the starting position is similar.
But for the same slot issue, thorin/closure conv was at least able to

  • generate thorin code
  • generate llvm code

Only the execution failed.

In the example above, already the thorin code optimization fails.

@leissa leissa self-assigned this Oct 14, 2022
@NeuralCoder3
Copy link
Collaborator Author

Was this the issue where several closures end up in the same slot?

I opened #118 for the other issue.

@leissa
Copy link
Member

leissa commented Oct 25, 2022

I'm pretty sure it's a duplicate of #126 but rn I get:

error: cannot pass argument '(.insert (%autodiff.zero «2; .Idx 4294967296», 0:(.Idx 2), s_473244), _473271)' of type '[«2; .Idx 4294967296», .Cn .Idx 4294967296]' to 'id_pb_471440' of domain '[«2; .Idx 4294967296», .Cn «2; .Idx 4294967296»]'

@NeuralCoder3
Copy link
Collaborator Author

NeuralCoder3 commented Oct 26, 2022

This program should not need autodiff to run.
I run it with

./build/bin/thorin -o - -VVVV -d clos lit/autodiff/pow_autodiff_eval2.thorin.disabled

to get the issue.

The behavior displayed in your case might be another unrelated bug in autodiff or direct. (Although I get another error related to curried function specialization)

@NeuralCoder3
Copy link
Collaborator Author

NeuralCoder3 commented Oct 26, 2022

Maybe helpful:
clos/pow_ad_eval_simpl.thorin (only clos dialect) and pow_autodiff.thorin (also ad,direct)
experience the same problem. (I am not if it was always that way or if this test worked at some point.)

@NeuralCoder3
Copy link
Collaborator Author

I'm pretty sure it's a duplicate of #126 but rn I get:

error: cannot pass argument '(.insert (%autodiff.zero «2; .Idx 4294967296», 0:(.Idx 2), s_473244), _473271)' of type '[«2; .Idx 4294967296», .Cn .Idx 4294967296]' to 'id_pb_471440' of domain '[«2; .Idx 4294967296», .Cn «2; .Idx 4294967296»]'

Even when adding the memory by hand, errors still occur.

I added some more tests with the manual placement of mem to ad_ptr_merge (I figured that is the branch with the most advanced closure conversion -- but I might be wrong).
The files are lit/clos/pow_ad_eval_simpl[*].thorin

leissa added a commit that referenced this issue Nov 6, 2022
@leissa leissa linked a pull request Nov 6, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants