[all-commits] [llvm/llvm-project] af66cd: [mlir][Python] Context managers for Context, Inser...
Stella Laurenzo via All-commits
all-commits at lists.llvm.org
Sun Nov 1 19:02:18 PST 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: af66cd173fe00b86d1c399b585738eaa01a65042
https://github.com/llvm/llvm-project/commit/af66cd173fe00b86d1c399b585738eaa01a65042
Author: Stella Laurenzo <stellaraccident at gmail.com>
Date: 2020-11-01 (Sun, 01 Nov 2020)
Changed paths:
M mlir/docs/Bindings/Python.md
M mlir/lib/Bindings/Python/IRModules.cpp
M mlir/lib/Bindings/Python/IRModules.h
M mlir/lib/Bindings/Python/PybindUtils.h
M mlir/lib/Bindings/Python/mlir/dialects/std.py
A mlir/test/Bindings/Python/context_managers.py
M mlir/test/Bindings/Python/dialects.py
M mlir/test/Bindings/Python/insertion_point.py
M mlir/test/Bindings/Python/ir_array_attributes.py
M mlir/test/Bindings/Python/ir_attributes.py
M mlir/test/Bindings/Python/ir_location.py
M mlir/test/Bindings/Python/ir_module.py
M mlir/test/Bindings/Python/ir_operation.py
M mlir/test/Bindings/Python/ir_types.py
Log Message:
-----------
[mlir][Python] Context managers for Context, InsertionPoint, Location.
* Finishes support for Context, InsertionPoint and Location to be carried by the thread using context managers.
* Introduces type casters and utilities so that DefaultPyMlirContext and DefaultPyLocation in method signatures does the right thing (allows explicit or gets from the thread context).
* Extend the rules for the thread context stack to handle nesting, appropriately inheriting and clearing depending on whether the context is the same.
* Refactors all method signatures to follow the new convention on trailing parameters for defaulting parameters (loc, ip, context). When the objects are carried in the thread context, this allows most explicit uses of these values to be elided.
* Removes the style guide section on putting accessors to construct global objects on the PyMlirContext: this style fails to make good use of the new facility since it is often the only thing remaining needing an MlirContext.
* Moves Module parse/creation from mlir.ir.Context to static methods on mlir.ir.Module.
* Moves Context.create_operation to a static Operation.create method.
* Moves Type parsing from mlir.ir.Context to static methods on mlir.ir.Type.
* Moves Attribute parsing from mlir.ir.Context to static methods on mlir.ir.Attribute.
* Move Location factory methods from mlir.ir.Context to static methods on mlir.ir.Location.
* Refactors the std dialect fake "ODS" generated code to take advantage of the new scheme.
Differential Revision: https://reviews.llvm.org/D90547
More information about the All-commits
mailing list