thorin2 icon indicating copy to clipboard operation
thorin2 copied to clipboard

What should we do when allocating nominal arrays?

Open leissa opened this issue 2 years ago • 2 comments

What should we do with sth like this?

«i: n; «i as Nat; T»»

See #165.

leissa avatar Dec 16 '22 21:12 leissa

As note: An alternative (to #165) way how this issue manifests is during code generation (instead of application):

%core.trait.* is expected to be resolved entirely before code generation. In some cases, however, it remains and no size is computed.

Example: %core.trait.size «_3152207; «_3152209; .Idx 4294967296»». Fork: Neuralcoder3 Branch: matrix_dialect Call: ./build/bin/thorin -d matrix lit/matrix/print_const_dyn_mat.thorin -d affine -d direct -d clos -o - -VVVV --output-ll T.ll Note: add_mem is disabled due to another bug (possibly related to projections)

The indices are statically unknown.

Note: Code generation fails with assert(false); without telling that it happens during code generation or what is wrong. A more informative error like assert(false && "trait should be lowered before codegen"); would be helpful.

NeuralCoder3 avatar Jan 09 '23 15:01 NeuralCoder3

We've already mentioned that in a couple of other issues like #9 that we probably want to move away from assertions and instead use proper error messages/exceptions instead. In the midterm we could expose this "failure is an option" to the compilation pipeline.

leissa avatar Jan 09 '23 18:01 leissa