Commit Graph

9733 Commits

Author SHA1 Message Date
Kazu Hirata b788e352ab [Transforms] Use all_of instead of any_of (NFC) 2022-01-02 22:53:09 -08:00
Mehdi Amini 1461bd13c9 Revert "Define a `cppAccessorType` to const-ref in APFloatParameter and update ODS emitter to use it for verifier signatures"
This reverts commit 89af17c0c7.

This broke the gcc5 build.
2022-01-03 06:32:50 +00:00
William S. Moses 93c791839a [MLIR] Canonicalize/fold select %x, 1, 0 to extui
Two canonicalizations for select %x, 1, 0
  If the return type is i1, return simply the condition %x, otherwise extui %x to the return type.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D116517
2022-01-03 01:26:28 -05:00
William S. Moses 834cf3be22 [MLIR][Arith] Canonicalize and/or with ext
Replace and(ext(a),ext(b)) with ext(and(a,b)). This both reduces one instruction, and results in the computation (and/or) being done on a smaller type.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D116519
2022-01-03 01:25:30 -05:00
Mehdi Amini 78389de4d3 Add back missing return to non-void function
It was incorrectly removed accidentally in e4e463e747.
2022-01-03 06:18:25 +00:00
Mehdi Amini a5a24c9370 Remove misused RAII gil_scoped_release/gil_scoped_acquire: without name they don't have any effect
I'm not sure what is the right fix here, but adding a name to all these
lead to many segfaults.

Reviewed By: stellaraccident

Differential Revision: https://reviews.llvm.org/D116506
2022-01-03 06:17:04 +00:00
Groverkss 29120a5130 [MLIR][NFC] Fix clang-tidy errors in Analysis/Presburger/
This patch fixes clang-tidy errors related to different parameter names
in header file and source file in Analysis/Presburger/ directory.
2022-01-03 11:42:48 +05:30
Mehdi Amini 564619b786 Use cast<> instead of dyn_cast<> when we don't check the result (NFC) 2022-01-03 06:06:36 +00:00
Mehdi Amini 891a0d7ccd Remove dead return after return (NFC) 2022-01-03 06:03:34 +00:00
Mehdi Amini e4e463e747 Remove useless nesting blok and dead return statement in TosaToLinalg.cpp (NFC)
Flagged by Coverity.
2022-01-03 06:02:21 +00:00
Mehdi Amini a1e62aa75b Minor reflow of FloorDivSIOp/CeilDivSIOp folder to limit the number of APInt API calls (NFC)
Cache the result of the comparison in boolean, and check early for 0 to
leverage `(a < 0) == !(a > 0)`.
2022-01-03 05:55:23 +00:00
Groverkss 8506c8c13b [MLIR] Move LinearTransform to Presburger/
This patch moves LinearTransform to Presburger/ and makes it use
IntegerPolyhedron instead of FlatAffineConstraints. Also modifies its usage in
`FlatAffineConstraints::findIntegerSample` to support the changes.

This patch is part of a series of patches for moving presburger math functionality into Presburger directory.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D116311
2022-01-03 11:11:09 +05:30
William S. Moses 1bb9f4e482 [MLIR] Create folders for extsi/extui
Create folders/canonicalizers for extsi/extui. Specifically,

extui(extui(x)) -> extui(x)
extsi(extsi(x)) -> extsi(x)
extsi(extui(x)) -> extui(x)

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D116515
2022-01-03 00:11:23 -05:00
Mehdi Amini 89af17c0c7 Define a `cppAccessorType` to const-ref in APFloatParameter and update ODS emitter to use it for verifier signatures
This reduce an unnecessary amount of copy of non-trivial objects, like
APFloat.

Reviewed By: rriddle, jpienaar

Differential Revision: https://reviews.llvm.org/D116505
2022-01-03 04:57:11 +00:00
Mehdi Amini 590a62d1b2 Add a script to run clang-tidy on the entire MLIR codebase 2022-01-03 04:55:26 +00:00
Mehdi Amini 717c4bf7e3 Apply clang-tidy fixes for misc-unused-parameters in MLIR AffineStructures.cpp (NFC) 2022-01-03 02:32:41 +00:00
William S. Moses 1a0a177965 [MLIR] Create fold for cmp of ext
This patch creates folds for cmpi( ext(%x : i1, iN) != 0) -> %x

In essence this matches patterns matching an extension of a boolean, that != 0, which is equivalent to the original condition.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D116504
2022-01-02 19:48:52 -05:00
Mehdi Amini 3f127d8aaa Use `= default` for the ValueShapeRange copy-constructor (NFC)
This makes it trivially copyable.
2022-01-02 23:43:52 +00:00
Mehdi Amini 56f5e4abb8 Replace raw-loop with llvm::any_of() in PresburgerSet.cpp (NFC)
Reported by clang-tidy.
2022-01-02 22:39:57 +00:00
Mehdi Amini 4f415216ca Apply clang-tidy fixes for performance-unnecessary-value-param to MLIR (NFC) 2022-01-02 22:37:13 +00:00
Mehdi Amini 337c937ddb Apply clang-tidy fixes for performance-move-const-arg to MLIR (NFC) 2022-01-02 22:36:56 +00:00
Mehdi Amini 7964568632 Apply clang-tidy fixes for readability-simplify-boolean-expr to MLIR NormalizeMemRefs.cpp (NFC) 2022-01-02 22:26:57 +00:00
Mehdi Amini e4853be2f1 Apply clang-tidy fixes for performance-for-range-copy to MLIR (NFC) 2022-01-02 22:19:56 +00:00
Mehdi Amini abb336d26b Apply clang-tidy fixes for modernize-use-equals-default to MLIR (NFC) 2022-01-02 22:18:36 +00:00
Mehdi Amini f829d62c21 Apply clang-tidy fixes for modernize-use-default-member-init to MLIR ReductionNode.cpp (NFC) 2022-01-02 22:18:21 +00:00
Mehdi Amini 5caee2176a Apply clang-tidy fixes for bugprone-argument-comment to MLIR ArithmeticOps.cpp (NFC) 2022-01-02 22:14:48 +00:00
Mehdi Amini 6786d7e4f5 Apply clang-tidy fixes for readability-simplify-boolean-expr to MLIR (NFC)
Reviewed By: rriddle, Mogball

Differential Revision: https://reviews.llvm.org/D116253
2022-01-02 01:59:31 +00:00
Mehdi Amini 5a1f6077ec Apply clang-tidy fixes for readability-container-size-empty for MLIR (NFC)
Reviewed By: rriddle, Mogball

Differential Revision: https://reviews.llvm.org/D116252
2022-01-02 01:56:38 +00:00
Mehdi Amini f0fff1dfde Remove unused applyPad function from TosaToLinalg.cpp (NFC) 2022-01-02 01:53:18 +00:00
Mehdi Amini ad5d7ace34 Apply clang-tidy fixes for readability-const-return-type to MLIR (NFC)
Reviewed By: rriddle, Mogball

Differential Revision: https://reviews.llvm.org/D116251
2022-01-02 01:51:39 +00:00
Mehdi Amini 1fc096af1e Apply clang-tidy fixes for performance-unnecessary-value-param to MLIR (NFC)
Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D116250
2022-01-02 01:45:18 +00:00
Mehdi Amini b11510d5df Apply clang-tidy fixes for modernize-use-using to MLIR (NFC)
Reviewed By: rriddle, Mogball

Differential Revision: https://reviews.llvm.org/D116357
2022-01-02 01:25:14 +00:00
Mehdi Amini 0ae2e9580c Apply clang-tidy fixes for modernize-use-override to MLIR (NFC)
Reviewed By: rriddle, jpienaar

Differential Revision: https://reviews.llvm.org/D116356
2022-01-02 01:24:02 +00:00
Mehdi Amini 513463b589 Apply clang-tidy fixes for llvm-qualified-auto to MLIR (NFC)
Reviewed By: rriddle, Mogball

Differential Revision: https://reviews.llvm.org/D116355
2022-01-02 01:21:40 +00:00
Mehdi Amini a86b957fd7 Apply clang-tidy fixes for bugprone-macro-parentheses to MLIR (NFC)
Reviewed By: rriddle, Mogball

Differential Revision: https://reviews.llvm.org/D116354
2022-01-02 01:20:01 +00:00
Mehdi Amini ee1fcb2fb6 Apply clang-tidy fixes for performance-move-const-arg to MLIR (NFC)
Reviewed By: rriddle, Mogball

Differential Revision: https://reviews.llvm.org/D116249
2022-01-02 01:16:15 +00:00
Mehdi Amini 89de9cc8a7 Apply clang-tidy fixes for performance-for-range-copy to MLIR (NFC)
Differential Revision: https://reviews.llvm.org/D116248
2022-01-02 01:13:42 +00:00
Mehdi Amini 322c891483 Apply clang-tidy fixes for modernize-use-equals-default to MLIR (NFC)
Differential Revision: https://reviews.llvm.org/D116247
2022-01-02 01:13:27 +00:00
Mehdi Amini 3bab9d4eb0 Apply clang-tidy fixes for bugprone-copy-constructor-init to MLIR (NFC)
Reviewed By: rriddle, Mogball

Differential Revision: https://reviews.llvm.org/D116245
2022-01-02 01:05:30 +00:00
Mehdi Amini ced8690d84 Apply clang-tidy fixes for bugprone-argument-comment to MLIR (NFC)
Differential Revision: https://reviews.llvm.org/D116244
2022-01-02 01:05:06 +00:00
Mehdi Amini ab6502ea67 Enable a few clang-tidy checks in MLIR
The dry-run of clang-tidy on the codebase with these enable were
well receive, and the codebase is "clean" (or almost) with respect
to these right now.
2022-01-02 01:05:06 +00:00
Mehdi Amini 104a827ea6 Move LinalgDetensorize pass option from .cpp file to the .td declaration (NFC) 2022-01-01 21:19:31 +00:00
Mehdi Amini a978847e3a Use const reference for diagnostic in callback (NFC)
This isn't a "small" struct, flagged by Coverity.
2022-01-01 21:15:50 +00:00
Kazu Hirata 491b4e1faa [IR] Remove redundant return statements (NFC)
Identified by readability-redundant-control-flow.
2022-01-01 09:14:21 -08:00
Kazu Hirata 63846a634d [mlir] Remove unused "using" (NFC)
Identified by misc-unused-using-decls.
2022-01-01 09:14:19 -08:00
Markus Böck eb6b2efe4e [mlir][NFC] Fully qualify use of SmallVector in generated C++ code of mlir-tblgen 2022-01-01 14:52:32 +01:00
Mehdi Amini 07b264d1f0 Pass the LLVMTypeConverter by reference in UnrankedMemRefBuilder (NFC)
This is a fairly large structure (952B according to Coverity), it was
already passed by reference in most places but not consistently.
2022-01-01 02:01:41 +00:00
Mehdi Amini bb6109aae6 Pass the LLVMTypeConverter by reference in MemRefBuilder (NFC)
This is a fairly large structure (952B according to Coverity), it was
already passed by reference in most places but not consistently.
2022-01-01 01:56:50 +00:00
Mehdi Amini 36a6e56bff Fix possible memory leak in a MLIR unit-test
Flagged by Coverity
2022-01-01 01:42:26 +00:00
Mehdi Amini a9f13f8065 Fix a few unitialized class members in MLIR (NFC)
Flagged by Coverity.
2022-01-01 01:40:36 +00:00
Mehdi Amini 8637be74a0 Remove redundant return after return in CodegenStrategy (NFC)
Reported by Coverity
2022-01-01 01:14:27 +00:00
Markus Böck 3536d24a1a [mlir][LLVMIR] Add `llvm.eh.typeid.for` intrinsic
MLIR already exposes landingpads, the invokeop and the personality function on LLVM functions. With this intrinsic it should be possible to implement exception handling via the exception handling mechanisms provided by the Itanium ABI.

Differential Revision: https://reviews.llvm.org/D116436
2022-01-01 02:03:00 +01:00
Stella Laurenzo 5cd0b817e2 [mlir] Allow IntegerAttr to parse zero width integers.
https://reviews.llvm.org/D109555 added support to APInt for this, so the special case to disable it is no longer valid. It is in fact legal to construct these programmatically today, and they print properly but do not parse.

Justification: zero bit integers arise naturally in various bit reduction optimization problems, and having them defined for MLIR reduces special casing.

I think there is a solid case for i0 and ui0 being supported. I'm less convinced about si0 and opted to just allow the parser to round-trip values that already verify. The counter argument is that the proper singular value for an si0 is -1. But the counter to this counter is that the sign bit is N-1, which does not exist for si0 and it is not unreasonable to consider this non-existent bit to be 0. Various sources consider it having the singular value "0" to be the least surprising.

Reviewed By: lattner

Differential Revision: https://reviews.llvm.org/D116413
2021-12-30 20:33:00 -08:00
MaheshRavishankar 59442a5460 [mlir][Linalg] Change signature of `get(Parallel/Reduce/Window)Dims` method.
These method currently takes a SmallVector<AffineExpr> & as an
argument to return the dims as AffineExpr. This creation of
AffineExpr objects is unnecessary.

Differential Revision: https://reviews.llvm.org/D116422
2021-12-30 14:02:15 -08:00
Mogball 4943cda398 [mlir][arith] fixing dependencies on memref/arith 2021-12-30 20:39:22 +00:00
long.chen d295dd10f2 [MLIR] Add explicit `using` to disambiguate between multiple implementations from base classes (NFC)
Both of DenseElementsAttr and ElementsAttrTrait define the method of
getElementType, this commit makes it available on
DenseIntOrFPElementsAttr and DenseStringElementsAttr.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D116389
2021-12-30 19:47:33 +00:00
William S. Moses a6a583dae4 [MLIR] Move AtomicRMW into MemRef dialect and enum into Arith
Per the discussion in https://reviews.llvm.org/D116345 it makes sense
to move AtomicRMWOp out of the standard dialect. This was accentuated by the
need to add a fold op with a memref::cast. The only dialect
that would permit this is the memref dialect (keeping it in the standard dialect
or moving it to the arithmetic dialect would require those dialects to have a
dependency on the memref dialect, which breaks linking).

As the AtomicRMWKind enum is used throughout, this has been moved to Arith.

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D116392
2021-12-30 14:31:33 -05:00
Jacques Pienaar 4a8cef157b [mlir] Change SCF/Complex to prefixed (NFC)
See
https://llvm.discourse.group/t/psa-ods-generated-accessors-will-change-to-have-a-get-prefix-update-you-apis/4476
2021-12-30 09:57:51 -08:00
Nicolas Vasilache 2e69f4f012 [mlir][vector] Fix illegal vector.transfer + tensor.insert/extract_slice folding
vector.transfer operations do not have rank-reducing semantics.

Bail on illegal rank-reduction: we need to check that the rank-reduced
dims are exactly the leading dims. I.e. the following is illegal:
```
   %0 = vector.transfer_write %v, %t[0,0], %cst :
     vector<2x4xf32>, tensor<2x4xf32>
   %1 = tensor.insert_slice %0 into %tt[0,0,0][2,1,4][1,1,1] :
     tensor<2x4xf32> into tensor<2x1x4xf32>
```

Cannot fold into:
```
   %0 = vector.transfer_write %v, %t[0,0,0], %cst :
     vector<2x4xf32>, tensor<2x1x4xf32>
```
For this, check the trailing `vectorRank` dims of the insert_slice result
tensor match the trailing dims of the inferred result tensor.

Differential Revision: https://reviews.llvm.org/D116409
2021-12-30 14:55:16 +00:00
MaheshRavishankar 7df7586a0b [mlir][MemRef] Deprecate unspecified trailing offset, size, and strides semantics of `OffsetSizeAndStrideOpInterface`.
The semantics of the ops that implement the
`OffsetSizeAndStrideOpInterface` is that if the number of offsets,
sizes or strides are less than the rank of the source, then some
default values are filled along the trailing dimensions (0 for offset,
source dimension of sizes, and 1 for strides). This is confusing,
especially with rank-reducing semantics. Immediate issue here is that
the methods of `OffsetSizeAndStridesOpInterface` assumes that the
number of values is same as the source rank. This cause out-of-bounds
errors.

So simplifying the specification of `OffsetSizeAndStridesOpInterface`
to make it invalid to specify number of offsets/sizes/strides not
equal to the source rank.

Differential Revision: https://reviews.llvm.org/D115677
2021-12-29 11:18:29 -08:00
William S. Moses 180455ae5e [MLIR][LLVM] Expose powi intrinsic to MLIR
Expose the powi intrinsic to the LLVM dialect within MLIR

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D116364
2021-12-29 13:09:35 -05:00
Johannes Doerfert 7e14e881c4 [OpenMP][OpenACC] Update test after encoding change in D113126 2021-12-29 01:29:07 -06:00
Johannes Doerfert 944aa0421c Reapply "[OpenMP][NFCI] Embed the source location string size in the ident_t"
This reverts commit 73ece231ee and
reapplies 7bfcdbcbf3 with mlir changes.
Also reverts commit 423ba12971 and
includes the unit test changes of
16da214004.
2021-12-29 01:10:38 -06:00
Kazu Hirata 773ea16eba [AST] Fix a warning
This patch fixes:

  mlir/include/mlir/Tools/PDLL/AST/Types.h:54:3: error: definition of
  implicit copy assignment operator for 'Type' is deprecated because
  it has a user-declared copy constructor [-Werror,-Wdeprecated-copy]
2021-12-28 22:52:56 -08:00
William S. Moses 99fc000c87 [MLIR] Expose atomicrmw and/or
LLVM (dialect and IR) have atomics for and/or. This patch enables atomic_rmw ops in the standard dialect for and/or that lower to these (in addition to the existing atomics such as addi, etc).

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D116345
2021-12-29 00:23:28 -05:00
William S. Moses ca8997eb7f [MLIR] Add constant folder for fptosi and friends
This patch adds constant folds for FPToSI/FPToUI/SIToFP/UIToFP

Reviewed By: mehdi_amini, bondhugula

Differential Revision: https://reviews.llvm.org/D116321
2021-12-28 23:50:01 -05:00
Rob Suderman f0cb77d7d5 [mlir][tosa] Resubmit split tosa-to-linalg named ops out of pass
Includes dependency fix that resulted in canonicalizer pass not linking in.

Linalg named ops lowering are moved to a separate pass. This allows TOSA
canonicalizers to run between named-ops lowerings and the general TOSA
lowerings. This allows the TOSA canonicalizers to run between lowerings.

Differential Revision: https://reviews.llvm.org/D116057
2021-12-28 11:22:58 -08:00
Groverkss 5f22f248d8 [MLIR] Use IntegerPolyhedron in Simplex instead of FlatAffineConstraints
This patch replaces usage of FlatAffineConstraints in Simplex with
IntegerPolyhedron. This removes dependency of Simplex on FlatAffineConstraints
and puts it on IntegerPolyhedron, which is part of Presburger library.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D116287
2021-12-27 19:06:35 +05:30
Groverkss 3f22d492ac [MLIR] Move `print()` and `dump()` from FlatAffineConstraints to IntegerPolyhedron.
This patch moves `FlatAffineConstraints::print` and
`FlatAffineConstraints::dump()` to IntegerPolyhedron.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D116289
2021-12-27 18:40:49 +05:30
Arjun P 4fe5cfe53e [MLIR] Add forgotten directory Support to unittests cmake
The Support directory was removed from the unittests cmake when the directory
was removed in 204c3b5516. Subsequent commits
added the directory back but seem to have missed adding it back to the cmake.

This patch also removes MLIRSupportIndentedStream from the list of linked
libraries to avoid an ODR violation (it's already part of MLIRSupport which
is also being linked here). Otherwise ASAN complains:

```
=================================================================
==102592==ERROR: AddressSanitizer: odr-violation (0x7fbdf214eee0):
  [1] size=120 'vtable for mlir::raw_indented_ostream' /home/arjun/llvm-project/mlir/lib/Support/IndentedOstream.cpp
  [2] size=120 'vtable for mlir::raw_indented_ostream' /home/arjun/llvm-project/mlir/lib/Support/IndentedOstream.cpp
These globals were registered at these points:
  [1]:
    #0 0x28a71d in __asan_register_globals (/home/arjun/llvm-project/build/tools/mlir/unittests/Support/MLIRSupportTests+0x28a71d)
    #1 0x7fbdf214a61b in asan.module_ctor (/home/arjun/llvm-project/build/lib/libMLIRSupportIndentedOstream.so.14git+0x661b)

  [2]:
    #0 0x28a71d in __asan_register_globals (/home/arjun/llvm-project/build/tools/mlir/unittests/Support/MLIRSupportTests+0x28a71d)
    #1 0x7fbdf2061c4b in asan.module_ctor (/home/arjun/llvm-project/build/lib/libMLIRSupport.so.14git+0x11bc4b)

==102592==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0
SUMMARY AddressSanitizer: odr-violation: global 'vtable for mlir::raw_indented_ostream' at /home/arjun/llvm-project/mlir/lib/Support/IndentedOstream.cpp
==102592==ABORTING
```

This patch also fixes a build issue with `DebugAction::classof` under Windows.

This commit re-lands this patch, which was previously reverted in
2132906836 due to a buildbot failure that
turned out to be because of a flaky test.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D116027
2021-12-27 14:42:48 +05:30
Arjun P 2132906836 Revert "[MLIR] Add forgotten directory Support to unittests cmake"
This reverts commit 0c553cc1af.

This caused a buildbot failure (https://lab.llvm.org/buildbot#builders/197/builds/888).

```
******************** TEST 'ScudoStandalone-Unit :: ./ScudoUnitTest-aarch64-Test/ScudoCommonTest.ResidentMemorySize' FAILED ********************
Script:
--
/home/tcwg-buildbot/worker/clang-aarch64-sve-vla/stage1/projects/compiler-rt/lib/scudo/standalone/tests/./ScudoUnitTest-aarch64-Test --gtest_filter=ScudoCommonTest.ResidentMemorySize
--
Note: Google Test filter = ScudoCommonTest.ResidentMemorySize
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from ScudoCommonTest
[ RUN      ] ScudoCommonTest.ResidentMemorySize
/home/tcwg-buildbot/worker/clang-aarch64-sve-vla/llvm/compiler-rt/lib/scudo/standalone/tests/common_test.cpp:49: Failure
Expected: (getResidentMemorySize()) > (OnStart + Size - Threshold), actual: 707358720 vs 943153152
[  FAILED  ] ScudoCommonTest.ResidentMemorySize (21709 ms)
[----------] 1 test from ScudoCommonTest (21709 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (21709 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] ScudoCommonTest.ResidentMemorySize
 1 FAILED TEST
********************
```
2021-12-26 13:59:23 +05:30
Mehdi Amini dabfefa490 Fix clang-tidy performance-move-const-arg in DLTI Dialect (NFC)
The const loop iterator was inhibiting the std::move().
2021-12-26 02:13:54 +00:00
Arjun P 0c553cc1af [MLIR] Add forgotten directory Support to unittests cmake
The Support directory was removed from the unittests cmake when the directory
was removed in 204c3b5516. Subsequent commits
added the directory back but seem to have missed adding it back to the cmake.

This patch also removes MLIRSupportIndentedStream from the list of linked
libraries to avoid an ODR violation (it's already part of MLIRSupport which
is also being linked here). Otherwise ASAN complains:

```
=================================================================
==102592==ERROR: AddressSanitizer: odr-violation (0x7fbdf214eee0):
  [1] size=120 'vtable for mlir::raw_indented_ostream' /home/arjun/llvm-project/mlir/lib/Support/IndentedOstream.cpp
  [2] size=120 'vtable for mlir::raw_indented_ostream' /home/arjun/llvm-project/mlir/lib/Support/IndentedOstream.cpp
These globals were registered at these points:
  [1]:
    #0 0x28a71d in __asan_register_globals (/home/arjun/llvm-project/build/tools/mlir/unittests/Support/MLIRSupportTests+0x28a71d)
    #1 0x7fbdf214a61b in asan.module_ctor (/home/arjun/llvm-project/build/lib/libMLIRSupportIndentedOstream.so.14git+0x661b)

  [2]:
    #0 0x28a71d in __asan_register_globals (/home/arjun/llvm-project/build/tools/mlir/unittests/Support/MLIRSupportTests+0x28a71d)
    #1 0x7fbdf2061c4b in asan.module_ctor (/home/arjun/llvm-project/build/lib/libMLIRSupport.so.14git+0x11bc4b)

==102592==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0
SUMMARY AddressSanitizer: odr-violation: global 'vtable for mlir::raw_indented_ostream' at /home/arjun/llvm-project/mlir/lib/Support/IndentedOstream.cpp
==102592==ABORTING
```

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D116027
2021-12-26 02:22:00 +05:30
Groverkss 5b2e611b73 [MLIR][FlatAffineConstraints][NFC] Move some static functions to be available to Presburger/
This patch moves some static functions from AffineStructures.cpp to
Presburger/Utils.cpp and some to be private members of FlatAffineConstraints
(which will later be moved to IntegerPolyhedron) to allow for a smoother
transition for moving FlatAffineConstraints math functionality to
Presburger/IntegerPolyhedron.

This patch is part of a series of patches for moving math functionality to
Presburger directory.

Reviewed By: arjunp, bondhugula

Differential Revision: https://reviews.llvm.org/D115869
2021-12-25 22:36:23 +05:30
William S. Moses 2709fd1520 [MLIR][LLVM] Add MemmoveOp to LLVM Dialect
LLVM Dialect in MLIR doesn't have a memmove op. This adds one.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D116274
2021-12-24 19:48:04 -05:00
Markus Böck a9e8b1ee7f [mlir] Fully qualify default types used in parser code 2021-12-24 22:25:50 +01:00
Groverkss 27a0718ad0 Revert "[MLIR][FlatAffineConstraints][NFC] Move some static functions to be available to Presburger/"
This reverts commit 6c0eaefaf8.
2021-12-25 00:39:27 +05:30
Groverkss 6c0eaefaf8 [MLIR][FlatAffineConstraints][NFC] Move some static functions to be available to Presburger/
This patch moves some static functions from AffineStructures.cpp to
Presburger/Utils.cpp and some to be private members of FlatAffineConstraints
(which will later be moved to IntegerPolyhedron) to allow for a smoother
transition for moving FlatAffineConstraints math functionality to
Presburger/IntegerPolyhedron.

This patch is part of a series of patches for moving math functionality to
Presburger directory.

Reviewed By: arjunp, bondhugula

Differential Revision: https://reviews.llvm.org/D115869
2021-12-25 00:11:35 +05:30
Mogball 41a64338cc [mlir] Add getNumThreads to MLIRContext
Querying threads directly from the thread pool fails if there is no thread pool or if multithreading is not enabled. Returns 1 by default.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D116259
2021-12-24 02:02:54 +00:00
Stella Laurenzo 8ff42766d1 [mlir] Use thread-pool's notion of thread count instead of requerying system.
The computed number of hardware threads can change over the life of the process based on affinity changes. Since we need a data structure that is at least as large as the maximum parallelism, it is important to use the value that was actually latched for the thread pool we will be dispatching work to.

Also adds an assert specifically for if it doesn't line up (I was getting a crash on an index into the vector).

Differential Revision: https://reviews.llvm.org/D116257
2021-12-23 17:04:45 -08:00
Mehdi Amini 735fe1da6b Revert "[mlir][tosa] Split tosa-to-linalg named ops out of pass"
This reverts commit 313de31fbb.

There is a missing CMake dependency, building with shared libraries is
broken:

55.509 [45/4/3061] Linking CXX shared library lib/libMLIRTosaToLinalg.so.14git
FAILED: lib/libMLIRTosaToLinalg.so.14git
...
TosaToLinalgPass.cpp: undefined reference to `mlir::createCanonicalizerPass()'
2021-12-24 00:09:15 +00:00
Rob Suderman 313de31fbb [mlir][tosa] Split tosa-to-linalg named ops out of pass
Linalg named ops lowering are moved to a separate pass. This allows TOSA
canonicalizers to run between named-ops lowerings and the general TOSA
lowerings. This allows the TOSA canonicalizers to run between lowerings.

Reviewed By: NatashaKnk

Differential Revision: https://reviews.llvm.org/D116057
2021-12-23 12:23:19 -08:00
Mogball 8f8c89f3cd [mlir] Remove spurious debug guard 2021-12-23 11:55:37 -08:00
Mehdi Amini 94a47dfde2 Revert "Fix warning: "unused variable 'attrClass'" (NFC)"
This reverts commit 724e6861b3.
This broke the build.
2021-12-23 03:59:25 +00:00
Mehdi Amini 724e6861b3 Fix warning: "unused variable 'attrClass'" (NFC) 2021-12-23 03:55:47 +00:00
Mogball 32e8b30d6e [mlir] Add unit test for disabling canonicalizer patterns (NFC) 2021-12-22 21:07:06 +00:00
Mehdi Amini e5639b3fa4 Fix more clang-tidy cleanups in mlir/ (NFC) 2021-12-22 20:53:11 +00:00
Mogball 7347c28def [mlir] Add missing unit tests to BUILD.bazel
Several unit test folders were missing from the bazel build, including: Transforms, Conversion, Rewrite
2021-12-22 20:00:27 +00:00
Mogball db68e6ab93 [mlir] Fix missing namespace (NFC) 2021-12-22 19:17:14 +00:00
Stanislav Funiak 9eb8e7b176 [MLIR][PDL] Clear up the terminology in the root ordering graph.
Previously, we defined a struct named `RootOrderingCost`, which stored the cost (a pair consisting of the depth of the connector and a tie breaking ID), as well as the connector itself. This created some confusion, because we would sometimes write, e.g., `cost.cost.first` (the first `cost` referring to the struct, the second one referring to the `cost` field, and `first` referring to the depth). In order to address this confusion, here we rename `RootOrderingCost` to `RootOrderingEntry` (keeping the fields and their names as-is).

This clarification exposed non-determinism in the optimal branching algorithm. When choosing the best local parent, we were previuosly only considering its depth (`cost.first`) and not the tie-breaking ID (`cost.second`). This led to non-deterministic choice of the parent when multiple potential parents had the same depth. The solution is to compare both the depth and the tie-breaking ID.

Testing: Rely on existing unit tests. Non-detgerminism is hard to unit-test.

Reviewed By: rriddle, Mogball

Differential Revision: https://reviews.llvm.org/D116079
2021-12-22 19:10:29 +00:00
Mogball 42ac4f3dc6 [mlir] Canonicalizer constructor should accept disabled/enabled patterns
There is no way to programmatically configure the list of disabled and enabled patterns in the canonicalizer pass, other than the duplicate the whole pass. This patch exposes the `disabledPatterns` and `enabledPatterns` options.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D116055
2021-12-22 19:08:31 +00:00
Adrian Kuegel 4a10457d33 [mlir][arith] Fix CmpIOP folding for vector types.
Previously, the folding assumed that it always operates on scalar types.

Differential Revision: https://reviews.llvm.org/D116151
2021-12-22 18:12:24 +01:00
Adrian Kuegel 6e9be9f7c1 [mlir][NFC] Use .empty() instead of .size() 2021-12-22 12:30:54 +01:00
Adrian Kuegel 35c0080333 [mlir][NFC] Fix typo in VectorOps.cpp 2021-12-22 12:24:43 +01:00
Butygin 28ab10f404 [mlir][memref] ReinterpretCast: allow static sizes/strides/offset where affine map expects dynamic
* There is no reason to forbid that case
* Also, user will get very unfriendly error like `expected result type with offset = -9223372036854775808 instead of 1`

Differential Revision: https://reviews.llvm.org/D114678
2021-12-21 16:20:01 +03:00
Stephan Herhut 8761f5ebf7 [mlir][Support] Avoid multiplication in floorDiv / ceilDiv
Using comparisons instead avoids potential overflow.

Differential Revision: https://reviews.llvm.org/D116096
2021-12-21 11:50:40 +01:00
Mehdi Amini bb56c2b366 Fix clang-tidy issues in mlir/ (NFC)
Differential Revision: https://reviews.llvm.org/D115956
2021-12-21 00:50:07 +00:00
Mogball 8cb785cad1 [mlir][arith] Clean up ExpandOps pass 2021-12-20 21:59:11 +00:00
Mogball 00e4354558 [mlir][ods] FIx incorrect comments in PassGen (NFC)
And incorrect command option description for `-gen-pass-decls`.
2021-12-20 21:14:20 +00:00
Mehdi Amini 02b6fb218e Fix clang-tidy issues in mlir/ (NFC)
Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D115956
2021-12-20 20:25:01 +00:00