torch-mlir/frontends/pytorch/test/node_import
Sean Silva 3a890aa26c Miscellaneous changes while trying to work on ResNet18
- Move frontend lowering pipelines to c++ (this helps with reproducing
  failures in npcomp-opt)
- Add debugging printouts when compilation fails on RefBackendTestConfig

The experience now when a test fails during MLIR lowering is now like this:
```
NPCOMP TorchScript Object Graph IR -> NPCOMP Backend IR lowering failed with the following diagnostics:
failed to legalize operation 'torch.global_slot'
Module does not conform to npcomp's backend contract. See dialect conversion legality information above.

Error can be reproduced with:
$ npcomp-opt -torchscript-to-npcomp-backend-pipeline /tmp/ResNet18Module.mlir
```

And when TorchScript->MLIR import fails it looks like this:
```
PyTorch TorchScript module -> NPCOMP Object Graph IR import failed with the following diagnostics:
unhandled prim operation: %18 : int = prim::min(%17) # /usr/local/google/home/silvasean/.local/lib/python3.9/site-packages/torch/nn/functional.py:4532:4
```

Also,
- Add `--filter=<regex>` to e2e test harness to filter tests.
- Add a few prim ops that were needed to import ResNet18
- Fix torch.prim.Loop.condition assemblyFormat (it previously would not
  round-trip in the case of no loop-carried variables)
2021-04-27 11:51:11 -07:00
..
README.md Rename tests to match the code they test 2021-02-25 13:31:33 -08:00
add3.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
debug-info.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
elif.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
errors.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
function-derefine.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
if.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
list.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
loop.py Miscellaneous changes while trying to work on ResNet18 2021-04-27 11:51:11 -07:00
prim.py Miscellaneous changes while trying to work on ResNet18 2021-04-27 11:51:11 -07:00
tuple.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
types-bool.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
types-none.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00

README.md

node_import

Most of the tests in this directory test the importing of TorchScript torch::jit::Graph's.

However, TorchScript graphs don't really correspond directly to anything on the MLIR side. They are a weird combination of a context, builder, and function and just holds a torch::jit::Block. It is torch::jit::Node and torch::jit::Block which form the recursive structure analogous to MLIR's operation/region/block.

  • torch::jit::Node == mlir::Operation,
  • torch::jit::Block == mlir::Region containing single mlir::Block

Hence the name of this directory and the corresponding code in node_importer.h/cpp.