| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[mlir][python] remove various caching mechanisms (#70831) This PR removes the various caching mechanisms currently in the python bindings - both positive caching and negative caching. | 2 年前 | |
[mlir] Expose simplifyAffineExpr through python api (#133926) | 1 年前 | |
[NFC][Py Reformat] Reformat python files in mlir subdir 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 | 3 年前 | |
[mlir][python] fix PyDenseResourceElementsAttribute finalizer (#150561) This PR melds https://github.com/llvm/llvm-project/pull/150137 and https://github.com/llvm/llvm-project/pull/149414 *and* partially reverts https://github.com/llvm/llvm-project/pull/124832. The summary is the PyDenseResourceElementsAttribute finalizer/deleter has/had two problems 1. wasn't threadsafe (can be called from a different thread than that which currently holds the GIL) 2. can be called while the interpreter is "not initialized" https://github.com/llvm/llvm-project/pull/124832 for some reason decides to re-initialize the interpreter to avoid case 2 and runs afoul of the fact that Py_IsInitialized can be false during the finalization of the interpreter itself (e.g., at the end of a script). I don't know why this decision was made (I missed the PR) but I believe we should never be calling [Py_Initialize](https://docs.python.org/3/c-api/init.html#c.Py_Initialize): > In an application \*\*\*\***embedding Python**\*\*\*\*, this should be called before using any other Python/C API functions **but we aren't embedding Python**! So therefore we will only be in case 2 when the interpreter is being finalized and in that case we should just leak the buffer. Note, [lldb](https://github.com/llvm/llvm-project/blob/548ca9e97673a168023a616d311d901ca04b29a3/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp#L81-L93) does a similar sort of thing for its finalizers. Co-authored-by: Anton Korobeynikov <anton@korobeynikov.info> Co-authored-by: Max Manainen <maximmanainen@gmail.com> Co-authored-by: Anton Korobeynikov <anton@korobeynikov.info> Co-authored-by: Max Manainen <maximmanainen@gmail.com> | 1 年前 | |
| 1 年前 | ||
[MLIR][Python] Add docstring for generated python op classes (#158198) This PR adds support in mlir-tblgen for generating docstrings for each Python class corresponding to an MLIR op. The docstrings are currently derived from the op’s description in ODS, with indentation adjusted to display nicely in Python. This makes it easier for Python users to see the op descriptions directly in their IDE or LSP while coding. In the future, we can extend the docstrings to include explanations for each method, attribute, and so on. This idea was previously discussed in the #mlir-python channel on Discord with @makslevental and @superbobry. --------- Co-authored-by: Maksim Levental <maksim.levental@gmail.com> | 10 个月前 | |
[mlir][py][c] Enable setting block arg locations. (#169033) This enables changing the location of a block argument. Follows the approach for updating type of block arg. | 8 个月前 | |
[MLIR][Python] add unchecked gettors (#160954) Some of the current gettors require passing locations (i.e., there be an active location) because they're using the "checked" APIs. This PR adds "unchecked" gettors which only require an active context. | 9 个月前 | |
[MLIR][py] Add PyThreadPool as wrapper around MlirLlvmThreadPool in MLIR python bindings (#130109) In some projects like JAX ir.Context are used with disabled multi-threading to avoid caching multiple threading pools: https://github.com/jax-ml/jax/blob/623865fe9538100d877ba9d36f788d0f95a11ed2/jax/_src/interpreters/mlir.py#L606-L611 However, when context has enabled multithreading it also uses locks on the StorageUniquers and this can be helpful to avoid data races in the multi-threaded execution (for example with free-threaded cpython, https://github.com/jax-ml/jax/issues/26272). With this PR user can enable the multi-threading: 1) enables additional locking and 2) set a shared threading pool such that cached contexts can have one global pool. | 1 年前 | |
[mlir][python] automatic location inference (#151246) This PR implements "automatic" location inference in the bindings. The way it works is it walks the frame stack collecting source locations (Python captures these in the frame itself). It is inspired by JAX's [implementation](https://github.com/jax-ml/jax/blob/523ddcfbcad005deab5a7d542df4c706f5ee5e9c/jax/_src/interpreters/mlir.py#L462) but moves the frame stack traversal into the bindings for better performance. The system supports registering "included" and "excluded" filenames; frames originating from functions in included filenames **will not** be filtered and frames originating from functions in excluded filenames **will** be filtered (in that order). This allows excluding all the generated *_ops_gen.py files. The system is also "toggleable" and off by default to save people who have their own systems (such as JAX) from the added cost. Note, the system stores the entire stacktrace (subject to locTracebackFramesLimit) in the Location using specifically a CallSiteLoc. This can be useful for profiling tools (flamegraphs etc.). Shoutout to the folks at JAX for coming up with a good system. --------- Co-authored-by: Jacques Pienaar <jpienaar@google.com> | 11 个月前 | |
[NFC][Py Reformat] Reformat python files in mlir subdir 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 | 3 年前 | |
[mlir] Better Python diagnostics (#128581) Updated the Python diagnostics handler to emit notes (in addition to errors) into the output stream so that users have more context as to where in the IR the error is occurring. | 1 年前 | |
[mlir][py] Enable loading only specified dialects during creation. (#121421) Gives option post as global list as well as arg to control which dialects are loaded during context creation. This enables setting either a good base set or skipping in individual cases. | 1 年前 | |
[NFC][Py Reformat] Reformat python files in mlir subdir 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 | 3 年前 | |
[MLIR][Python] bind InsertionPointAfter (#157156) | 10 个月前 | |
[NFC][Py Reformat] Reformat python files in mlir subdir 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 | 3 年前 | |
[mlir][CAPI][python] bind CallSiteLoc, FileLineColRange, FusedLoc, NameLoc (#129351) This PR extends the python bindings for CallSiteLoc, FileLineColRange, FusedLoc, NameLoc with field accessors. It also adds the missing value.location accessor. I also did some "spring cleaning" here (cast -> dyn_cast) after running into some of my own illegal casts. | 1 年前 | |
[MLIR][Python] restore liveModuleMap (#158506) There are cases where the same module can have multiple references (via PyModule::forModule via PyModule::createFromCapsule) and thus when PyModules get gc'd mlirModuleDestroy can get called multiple times for the same actual underlying mlir::Module (i.e., double free). So we do actually need a "liveness map" for modules. Note, if type_caster<MlirModule>::from_cpp weren't a thing we could guarantree this never happened except explicitly when users called PyModule::createFromCapsule. | 10 个月前 | |
[MLIR][Python] Add wrappers for scf.index_switch (#167458) The C++ index switch op has utilities for getCaseBlock(int i) and getDefaultBlock(), so these have been added. Optional body builder args have been added: one for the default case and one for the switch cases. | 8 个月前 | |
[MLIR][Python] remove liveOperations (#155114) Historical context: PyMlirContext::liveOperations was an optimization meant to cut down on the number of Python object allocations and (partially) a mechanism for updating validity of ops after transformation. E.g. during walking/transforming the AST. See original patch [here](https://reviews.llvm.org/D87958). Inspired by a [renewed](https://github.com/llvm/llvm-project/pull/139721#issuecomment-3217131918) interest in https://github.com/llvm/llvm-project/pull/139721 (which has become a little stale...) <p align="center"> <img width="504" height="375" alt="image" src="https://github.com/user-attachments/assets/0daad562-d3d1-4876-8d01-5dba382ab186" /> </p> In the previous go-around (https://github.com/llvm/llvm-project/pull/92631) there were two issues which have been resolved 1. ops that were "fetched" under a root op which has been transformed are no longer reported as invalid. We simply "[formally forbid](https://github.com/llvm/llvm-project/pull/92631#issuecomment-2119397018)" this; 2. Module._CAPICreate(module_capsule) must now be followed by a module._clear_mlir_module() to prevent double-freeing of the actual ModuleOp object (i.e. calling the dtor on the OwningOpRef<ModuleOp>): python module = ... module_dup = Module._CAPICreate(module._CAPIPtr) module._clear_mlir_module() - **the alternative choice** here is to remove the Module._CAPICreate API altogether and replace it with something like Module._move(module) which will do both Module._CAPICreate and module._clear_mlir_module. Note, the other approach I explored last year was a [weakref system](https://github.com/llvm/llvm-project/pull/97340) for mlir::Operation which would effectively hoist this liveOperations thing into MLIR core. Possibly doable but I now believe it's a bad idea. The other potentially breaking change is is, which checks object equality rather than value equality, will now report False because we are always allocating new Python objects (ie that's the whole point of this change). Users wanting to check equality for Operation and Module should use ==. | 10 个月前 | |
[mlir][python] add use_name_loc_as_prefix to value.get_name() (#135052) Add use_name_loc_as_prefix to value.get_name(). | 1 年前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 2 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 10 个月前 | ||
| 8 个月前 | ||
| 9 个月前 | ||
| 1 年前 | ||
| 11 个月前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 10 个月前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 10 个月前 | ||
| 8 个月前 | ||
| 10 个月前 | ||
| 1 年前 |