summaryrefslogtreecommitdiff
path: root/mlir/test/python/dialects/func.py
AgeCommit message (Collapse)Author
2024-12-02[mlir,python] Fix case when `FuncOp.arg_attrs` is not set (#117188)Perry Gibson
FuncOps can have `arg_attrs`, an array of dictionary attributes associated with their arguments. E.g., ```mlir func.func @main(%arg0: tensor<8xf32> {test.attr_name = "value"}, %arg1: tensor<8x16xf32>) ``` These are exposed via the MLIR Python bindings with `my_funcop.arg_attrs`. In this case, it would return `[{test.attr_name = "value"}, {}]`, i.e., `%arg1` has an empty `DictAttr`. However, if I try and access this property from a FuncOp with an empty `arg_attrs`, e.g., ```mlir func.func @main(%arg0: tensor<8xf32>, %arg1: tensor<8x16xf32>) ``` This raises the error: ```python return ArrayAttr(self.attributes[ARGUMENT_ATTRIBUTE_NAME]) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: 'attempt to access a non-existent attribute' ``` This PR fixes this by returning the expected `[{}, {}]`.
2023-10-19[mlir][python] simplify extensions (#69642)Maksim Levental
https://github.com/llvm/llvm-project/pull/68853 enabled a lot of nice cleanup. Note, I made sure each of the touched extensions had tests.
2023-05-26[NFC][Py Reformat] Reformat python files in mlir subdirTobias Hieta
This is an ongoing series of commits that are reformatting our Python code. Reformatting is done with `black`. If you end up having problems merging this commit because you have made changes to a python file, the best way to handle that is to run git checkout --ours <yourfile> and then reformat it with black. If you run into any problems, post to discourse about it and we will try to help. RFC Thread below: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style Differential Revision: https://reviews.llvm.org/D150782
2022-03-16[mlir] Move the Builtin FuncOp to the Func dialectRiver Riddle
This commit moves FuncOp out of the builtin dialect, and into the Func dialect. This move has been planned in some capacity from the moment we made FuncOp an operation (years ago). This commit handles the functional aspects of the move, but various aspects are left untouched to ease migration: func::FuncOp is re-exported into mlir to reduce the actual API churn, the assembly format still accepts the unqualified `func`. These temporary measures will remain for a little while to simplify migration before being removed. Differential Revision: https://reviews.llvm.org/D121266
2022-03-01[mlir] Rename the Standard dialect to the Func dialectRiver Riddle
The last remaining operations in the standard dialect all revolve around FuncOp/function related constructs. This patch simply handles the initial renaming (which by itself is already huge), but there are a large number of cleanups unlocked/necessary afterwards: * Removing a bunch of unnecessary dependencies on Func * Cleaning up the From/ToStandard conversion passes * Preparing for the move of FuncOp to the Func dialect See the discussion at https://discourse.llvm.org/t/standard-dialect-the-final-chapter/6061 Differential Revision: https://reviews.llvm.org/D120624