mirror of https://github.com/llvm/torch-mlir
a375ccf9da
The first use case is to annotate certain program constructs as either exported or private. In this commit we plumb it down to GlobalizeObjectGraph which makes use of this information. Recommended review order: 1. class_annotator.h/.cpp + `test/module_import/annotations/*` - New abstractions to communicate with Python code and annotate. 2. IR changes in TorchOps.td - Adding "private" attribute to various things. 3. ivalue_import.cpp changes - Module + ClassAnnotator = annotated IR 4. GlobalizeObjectGraph.cpp + tests - use new "private" attributes to create "private" IR. - also, tweak some of the op deleting mechanics, which was triggering some memory errors / assertions With this, we can run the classifier through and inline it as follows: ``` frontends/pytorch/utils/pt_util.py --import --exported-name forward ~/tmp/classifier.pt \ | npcomp-opt -torch-globalize-object-graph -inline ``` IR: https://gist.github.com/silvasean/32dcad9f6270557f412094a77cecdd69 |
||
---|---|---|
.. | ||
globalize-object-graph-error.mlir | ||
globalize-object-graph-methods.mlir | ||
globalize-object-graph-module-uses-error.mlir | ||
globalize-object-graph-module-uses.mlir | ||
globalize-object-graph-submodules.mlir | ||
globalize-object-graph-visibility.mlir | ||
globalize-object-graph.mlir | ||
invalid.mlir | ||
ops.mlir |