AnyDSL/thorin2

Closure Conversion - higher order return

Opened this issue · 7 comments

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.

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

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.

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

I opened #118 for the other issue.

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»]'

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)

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.)

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