summaryrefslogtreecommitdiff
path: root/mlir/lib/Query/Matcher/Parser.cpp
AgeCommit message (Collapse)Author
2025-11-17[MLIR] Apply clang-tidy fixes for readability-identifier-naming in ↵Mehdi Amini
Parser.cpp (NFC)
2025-05-13[mlir] Improve mlir-query tool by implementing `getBackwardSlice` and ↵Denzel-Brian Budii
`getForwardSlice` matchers (#115670) Improve mlir-query tool by implementing `getBackwardSlice` and `getForwardSlice` matchers. As an addition `SetQuery` also needed to be added to enable custom configuration for each query. e.g: `inclusive`, `omitUsesFromAbove`, `omitBlockArguments`. Note: backwardSlice and forwardSlice algoritms are the same as the ones in `mlir/lib/Analysis/SliceAnalysis.cpp` Example of current matcher. The query was made to the file: `mlir/test/mlir-query/complex-test.mlir` ```mlir ./mlir-query /home/dbudii/personal/llvm-project/mlir/test/mlir-query/complex-test.mlir -c "match getDefinitions(hasOpName(\"arith.add f\"),2)" Match #1: /home/dbudii/personal/llvm-project/mlir/test/mlir-query/complex-test.mlir:5:8: %0 = linalg.generic {indexing_maps = [#map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0 : tensor<5x5xf32>) outs(%arg1 : tensor<5x5xf32>) { ^ /home/dbudii/personal/llvm-project/mlir/test/mlir-query/complex-test.mlir:7:10: note: "root" binds here %2 = arith.addf %in, %in : f32 ^ Match #2: /home/dbudii/personal/llvm-project/mlir/test/mlir-query/complex-test.mlir:10:16: %collapsed = tensor.collapse_shape %0 [[0, 1]] : tensor<5x5xf32> into tensor<25xf32> ^ /home/dbudii/personal/llvm-project/mlir/test/mlir-query/complex-test.mlir:13:11: %c2 = arith.constant 2 : index ^ /home/dbudii/personal/llvm-project/mlir/test/mlir-query/complex-test.mlir:14:18: %extracted = tensor.extract %collapsed[%c2] : tensor<25xf32> ^ /home/dbudii/personal/llvm-project/mlir/test/mlir-query/complex-test.mlir:15:10: note: "root" binds here %2 = arith.addf %extracted, %extracted : f32 ^ 2 matches. ```
2024-03-03Reapply "Reapply "[mlir-query] Add function extraction feature to mlir-query""Jacques Pienaar
Fix ASAN by erasing the op extracted post printing. This reverts commit 732a5cba8c739ed40a7280b5d74ca717910c2c4c.
2024-03-03Revert "Reapply "[mlir-query] Add function extraction feature to mlir-query""Jacques Pienaar
Commit fails on sanitizers. This reverts commit 22f34ea3b05537235956c99fe942aa95b88762c0.
2024-03-03Reapply "[mlir-query] Add function extraction feature to mlir-query"Jacques Pienaar
Fix build deps. This reverts commit de55c2f869925a3ed7f26e168424021c6bc46799.
2024-02-29Revert "[mlir-query] Add function extraction feature to mlir-query"Mehdi Amini
This reverts commit c66f2d0c4a46ba66fb98a2cab4e63ad90888a261. The bot is broken.
2024-02-29[mlir-query] Add function extraction feature to mlir-queryDevajith Valaparambil Sreeramaswamy
This enables specifying the extract modifier to extract all matches into a function. This currently does this very directly by converting all operands to function arguments (ones due to results of other matched ops are dropped) and all results as return values. Differential Revision: https://reviews.llvm.org/D158693
2024-01-08[mlir] Use StringRef::ltrim (NFC)Kazu Hirata
2023-12-13[mlir] Use StringRef::{starts,ends}_with (NFC)Kazu Hirata
This patch replaces uses of StringRef::{starts,ends}with with StringRef::{starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. I'm planning to deprecate and eventually remove StringRef::{starts,ends}with.
2023-10-13[mlir][mlir-query] Introduce mlir-query tool with autocomplete supportDevajith
This commit adds the initial version of the mlir-query tool, which leverages the pre-existing matchers defined in mlir/include/mlir/IR/Matchers.h The tool provides the following set of basic queries: hasOpAttrName(string) hasOpName(string) isConstantOp() isNegInfFloat() isNegZeroFloat() isNonZero() isOne() isOneFloat() isPosInfFloat() isPosZeroFloat() isZero() isZeroFloat() Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D155127