#
b4fa28b4 |
| 04-Nov-2020 |
Sean Silva <silvasean@google.com> |
[mlir] Add ElementwiseMappable trait and apply it to std elementwise ops.
This patch adds an `ElementwiseMappable` trait as discussed in the RFC here: https://llvm.discourse.group/t/rfc-std-elementw
[mlir] Add ElementwiseMappable trait and apply it to std elementwise ops.
This patch adds an `ElementwiseMappable` trait as discussed in the RFC here: https://llvm.discourse.group/t/rfc-std-elementwise-ops-on-tensors/2113/23
This trait can power a number of transformations and analyses. A subsequent patch adds a convert-elementwise-to-linalg pass exhibits how this trait allows writing generic transformations. See https://reviews.llvm.org/D90354 for that patch.
This trait slightly changes some verifier messages, but the diagnostics are usually about as good. I fiddled with the ordering of the trait in the .td file trait lists to minimize the changes here.
Differential Revision: https://reviews.llvm.org/D90731
show more ...
|
#
b870d9ec |
| 02-Nov-2020 |
River Riddle <riddleriver@gmail.com> |
[mlir] Optimize Op definitions and registration to optimize for code size
This revision refactors the base Op/AbstractOperation classes to reduce the amount of generated code size when defining a ne
[mlir] Optimize Op definitions and registration to optimize for code size
This revision refactors the base Op/AbstractOperation classes to reduce the amount of generated code size when defining a new operation. The current scheme involves taking the address of functions defined directly on Op and Trait classes. This is problematic because even when these functions are empty/unused we still result in these functions being defined in the main executable. In this revision, we switch to using SFINAE and template type filtering to remove remove functions that are not needed/used. For example, if an operation does not define a custom `print` method we shouldn't define a templated `printAssembly` method for it. The same applies to parsing/folding/verification/etc. This dropped MLIR code size for a large downstream library by ~10%(~1 mb in an opt build).
Differential Revision: https://reviews.llvm.org/D90196
show more ...
|
#
7dff6b81 |
| 16-Oct-2020 |
ahmedsabie <ahmed13579@gmail.com> |
[MLIR] Add idempotent trait folding
This trait simply adds a fold of f(f(x)) = f(x) when an operation is labelled as idempotent
Reviewed By: rriddle, andyly
Differential Revision: https://reviews.
[MLIR] Add idempotent trait folding
This trait simply adds a fold of f(f(x)) = f(x) when an operation is labelled as idempotent
Reviewed By: rriddle, andyly
Differential Revision: https://reviews.llvm.org/D89421
show more ...
|
#
b49787df |
| 13-Oct-2020 |
Geoffrey Martin-Noble <gcmn@google.com> |
Remove unused SideEffectInterfaces header
This change removes an unnecessary header introduced in https://github.com/llvm/llvm-project/commit/c0b3abd19a3e.
Differential Revision: https://reviews.ll
Remove unused SideEffectInterfaces header
This change removes an unnecessary header introduced in https://github.com/llvm/llvm-project/commit/c0b3abd19a3e.
Differential Revision: https://reviews.llvm.org/D89347
show more ...
|
#
c0b3abd1 |
| 13-Oct-2020 |
ahmedsabie <ahmed13579@gmail.com> |
[MLIR] Add a foldTrait() mechanism to allow traits to define folding and test it with an Involution trait
This is the same diff as https://reviews.llvm.org/D88809/ except side effect free check is r
[MLIR] Add a foldTrait() mechanism to allow traits to define folding and test it with an Involution trait
This is the same diff as https://reviews.llvm.org/D88809/ except side effect free check is removed for involution and a FIXME is added until the dependency is resolved for shared builds. The old diff has more details on possible fixes.
Reviewed By: rriddle, andyly
Differential Revision: https://reviews.llvm.org/D89333
show more ...
|
#
8bdbe295 |
| 09-Oct-2020 |
James Molloy <jmolloy@google.com> |
[mlir] Fix bug in computing operation order
When attempting to compute a differential orderIndex we were calculating the bailout condition correctly, but then an errant "+ 1" meant the orderIndex we
[mlir] Fix bug in computing operation order
When attempting to compute a differential orderIndex we were calculating the bailout condition correctly, but then an errant "+ 1" meant the orderIndex we created was invalid.
Added test.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D89115
show more ...
|
#
5367a8b6 |
| 09-Oct-2020 |
Mehdi Amini <joker.eph@gmail.com> |
Revert "[MLIR] Add a foldTrait() mechanism to allow traits to define folding and test it with an Involution trait"
This reverts commit 1ceaffd95a6bdc4b7d2193e049bcd6b40ee9ff50.
The build is broken
Revert "[MLIR] Add a foldTrait() mechanism to allow traits to define folding and test it with an Involution trait"
This reverts commit 1ceaffd95a6bdc4b7d2193e049bcd6b40ee9ff50.
The build is broken with -DBUILD_SHARED_LIBS=ON ; seems like a possible layering issue to investigate:
tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Operation.cpp.o: In function `mlir::MemoryEffectOpInterface::hasNoEffect(mlir::Operation*)': Operation.cpp:(.text._ZN4mlir23MemoryEffectOpInterface11hasNoEffectEPNS_9OperationE[_ZN4mlir23MemoryEffectOpInterface11hasNoEffectEPNS_9OperationE]+0x9c): undefined reference to `mlir::MemoryEffectOpInterface::getEffects(llvm::SmallVectorImpl<mlir::SideEffects::EffectInstance<mlir::MemoryEffects::Effect> >&)'
show more ...
|
#
1ceaffd9 |
| 09-Oct-2020 |
ahmedsabie <ahmed13579@gmail.com> |
[MLIR] Add a foldTrait() mechanism to allow traits to define folding and test it with an Involution trait
This change allows folds to be done on a newly introduced involution trait rather than havin
[MLIR] Add a foldTrait() mechanism to allow traits to define folding and test it with an Involution trait
This change allows folds to be done on a newly introduced involution trait rather than having to manually rewrite this optimization for every instance of an involution
Reviewed By: rriddle, andyly, stephenneuendorffer
Differential Revision: https://reviews.llvm.org/D88809
show more ...
|
Revision tags: llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3 |
|
#
8893d081 |
| 02-Sep-2020 |
Rahul Joshi <jurahul@google.com> |
[MLIR] Change Operation::create() methods to use Value/Type/Block ranges.
- Introduce a new BlockRange class to represent range of blocks (constructible from an ArrayRef<Block *> or a SuccessorRan
[MLIR] Change Operation::create() methods to use Value/Type/Block ranges.
- Introduce a new BlockRange class to represent range of blocks (constructible from an ArrayRef<Block *> or a SuccessorRange); - Change Operation::create() methods to use TypeRange for result types, ValueRange for operands and BlockRange for successors.
Differential Revision: https://reviews.llvm.org/D86985
show more ...
|
#
01700c45 |
| 02-Sep-2020 |
Mehdi Amini <joker.eph@gmail.com> |
Store an Identifier instead of a StringRef for the OperationName inside an AbstractOperation (NFC)
Instead of storing a StringRef, we keep an Identifier which otherwise requires a lock on the contex
Store an Identifier instead of a StringRef for the OperationName inside an AbstractOperation (NFC)
Instead of storing a StringRef, we keep an Identifier which otherwise requires a lock on the context to retrieve. This will allow to get an Identifier for any registered Operation for "free".
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D86994
show more ...
|
Revision tags: llvmorg-11.0.0-rc2 |
|
#
f9dc2b70 |
| 18-Aug-2020 |
Mehdi Amini <joker.eph@gmail.com> |
Separate the Registration from Loading dialects in the Context
This changes the behavior of constructing MLIRContext to no longer load globally registered dialects on construction. Instead Dialects
Separate the Registration from Loading dialects in the Context
This changes the behavior of constructing MLIRContext to no longer load globally registered dialects on construction. Instead Dialects are only loaded explicitly on demand: - the Parser is lazily loading Dialects in the context as it encounters them during parsing. This is the only purpose for registering dialects and not load them in the context. - Passes are expected to declare the dialects they will create entity from (Operations, Attributes, or Types), and the PassManager is loading Dialects into the Context when starting a pipeline.
This changes simplifies the configuration of the registration: a compiler only need to load the dialect for the IR it will emit, and the optimizer is self-contained and load the required Dialects. For example in the Toy tutorial, the compiler only needs to load the Toy dialect in the Context, all the others (linalg, affine, std, LLVM, ...) are automatically loaded depending on the optimization pipeline enabled.
To adjust to this change, stop using the existing dialect registration: the global registry will be removed soon.
1) For passes, you need to override the method:
virtual void getDependentDialects(DialectRegistry ®istry) const {}
and registery on the provided registry any dialect that this pass can produce. Passes defined in TableGen can provide this list in the dependentDialects list field.
2) For dialects, on construction you can register dependent dialects using the provided MLIRContext: `context.getOrLoadDialect<DialectName>()` This is useful if a dialect may canonicalize or have interfaces involving another dialect.
3) For loading IR, dialect that can be in the input file must be explicitly registered with the context. `MlirOptMain()` is taking an explicit registry for this purpose. See how the standalone-opt.cpp example is setup:
mlir::DialectRegistry registry; registry.insert<mlir::standalone::StandaloneDialect>(); registry.insert<mlir::StandardOpsDialect>();
Only operations from these two dialects can be in the input file. To include all of the dialects in MLIR Core, you can populate the registry this way:
mlir::registerAllDialects(registry);
4) For `mlir-translate` callback, as well as frontend, Dialects can be loaded in the context before emitting the IR: context.getOrLoadDialect<ToyDialect>()
Differential Revision: https://reviews.llvm.org/D85622
show more ...
|
#
e75bc5c7 |
| 19-Aug-2020 |
Mehdi Amini <joker.eph@gmail.com> |
Revert "Separate the Registration from Loading dialects in the Context"
This reverts commit d14cf45735b0d09d7d3caf0824779520dd20ef10. The build is broken with GCC-5.
|
#
d14cf457 |
| 18-Aug-2020 |
Mehdi Amini <joker.eph@gmail.com> |
Separate the Registration from Loading dialects in the Context
This changes the behavior of constructing MLIRContext to no longer load globally registered dialects on construction. Instead Dialects
Separate the Registration from Loading dialects in the Context
This changes the behavior of constructing MLIRContext to no longer load globally registered dialects on construction. Instead Dialects are only loaded explicitly on demand: - the Parser is lazily loading Dialects in the context as it encounters them during parsing. This is the only purpose for registering dialects and not load them in the context. - Passes are expected to declare the dialects they will create entity from (Operations, Attributes, or Types), and the PassManager is loading Dialects into the Context when starting a pipeline.
This changes simplifies the configuration of the registration: a compiler only need to load the dialect for the IR it will emit, and the optimizer is self-contained and load the required Dialects. For example in the Toy tutorial, the compiler only needs to load the Toy dialect in the Context, all the others (linalg, affine, std, LLVM, ...) are automatically loaded depending on the optimization pipeline enabled.
To adjust to this change, stop using the existing dialect registration: the global registry will be removed soon.
1) For passes, you need to override the method:
virtual void getDependentDialects(DialectRegistry ®istry) const {}
and registery on the provided registry any dialect that this pass can produce. Passes defined in TableGen can provide this list in the dependentDialects list field.
2) For dialects, on construction you can register dependent dialects using the provided MLIRContext: `context.getOrLoadDialect<DialectName>()` This is useful if a dialect may canonicalize or have interfaces involving another dialect.
3) For loading IR, dialect that can be in the input file must be explicitly registered with the context. `MlirOptMain()` is taking an explicit registry for this purpose. See how the standalone-opt.cpp example is setup:
mlir::DialectRegistry registry; registry.insert<mlir::standalone::StandaloneDialect>(); registry.insert<mlir::StandardOpsDialect>();
Only operations from these two dialects can be in the input file. To include all of the dialects in MLIR Core, you can populate the registry this way:
mlir::registerAllDialects(registry);
4) For `mlir-translate` callback, as well as frontend, Dialects can be loaded in the context before emitting the IR: context.getOrLoadDialect<ToyDialect>()
Differential Revision: https://reviews.llvm.org/D85622
show more ...
|
#
d84fe55e |
| 18-Aug-2020 |
Mehdi Amini <joker.eph@gmail.com> |
Revert "Separate the Registration from Loading dialects in the Context"
This reverts commit e1de2b75501e5eaf8777bd5248382a7c55a44fd6. Broke a build bot.
|
#
e1de2b75 |
| 18-Aug-2020 |
Mehdi Amini <joker.eph@gmail.com> |
Separate the Registration from Loading dialects in the Context
This changes the behavior of constructing MLIRContext to no longer load globally registered dialects on construction. Instead Dialects
Separate the Registration from Loading dialects in the Context
This changes the behavior of constructing MLIRContext to no longer load globally registered dialects on construction. Instead Dialects are only loaded explicitly on demand: - the Parser is lazily loading Dialects in the context as it encounters them during parsing. This is the only purpose for registering dialects and not load them in the context. - Passes are expected to declare the dialects they will create entity from (Operations, Attributes, or Types), and the PassManager is loading Dialects into the Context when starting a pipeline.
This changes simplifies the configuration of the registration: a compiler only need to load the dialect for the IR it will emit, and the optimizer is self-contained and load the required Dialects. For example in the Toy tutorial, the compiler only needs to load the Toy dialect in the Context, all the others (linalg, affine, std, LLVM, ...) are automatically loaded depending on the optimization pipeline enabled.
To adjust to this change, stop using the existing dialect registration: the global registry will be removed soon.
1) For passes, you need to override the method:
virtual void getDependentDialects(DialectRegistry ®istry) const {}
and registery on the provided registry any dialect that this pass can produce. Passes defined in TableGen can provide this list in the dependentDialects list field.
2) For dialects, on construction you can register dependent dialects using the provided MLIRContext: `context.getOrLoadDialect<DialectName>()` This is useful if a dialect may canonicalize or have interfaces involving another dialect.
3) For loading IR, dialect that can be in the input file must be explicitly registered with the context. `MlirOptMain()` is taking an explicit registry for this purpose. See how the standalone-opt.cpp example is setup:
mlir::DialectRegistry registry; mlir::registerDialect<mlir::standalone::StandaloneDialect>(); mlir::registerDialect<mlir::StandardOpsDialect>();
Only operations from these two dialects can be in the input file. To include all of the dialects in MLIR Core, you can populate the registry this way:
mlir::registerAllDialects(registry);
4) For `mlir-translate` callback, as well as frontend, Dialects can be loaded in the context before emitting the IR: context.getOrLoadDialect<ToyDialect>()
show more ...
|
#
d0e2c79b |
| 14-Aug-2020 |
Mehdi Amini <joker.eph@gmail.com> |
Fix method name to start with lower case to match style guide (NFC)
|
#
25ee8517 |
| 15-Aug-2020 |
Mehdi Amini <joker.eph@gmail.com> |
Revert "Separate the Registration from Loading dialects in the Context"
This reverts commit 20563933875a9396c8ace9c9770ecf6a988c4ea6.
Build is broken on a few bots
|
#
20563933 |
| 15-Aug-2020 |
Mehdi Amini <joker.eph@gmail.com> |
Separate the Registration from Loading dialects in the Context
This changes the behavior of constructing MLIRContext to no longer load globally registered dialects on construction. Instead Dialects
Separate the Registration from Loading dialects in the Context
This changes the behavior of constructing MLIRContext to no longer load globally registered dialects on construction. Instead Dialects are only loaded explicitly on demand: - the Parser is lazily loading Dialects in the context as it encounters them during parsing. This is the only purpose for registering dialects and not load them in the context. - Passes are expected to declare the dialects they will create entity from (Operations, Attributes, or Types), and the PassManager is loading Dialects into the Context when starting a pipeline.
This changes simplifies the configuration of the registration: a compiler only need to load the dialect for the IR it will emit, and the optimizer is self-contained and load the required Dialects. For example in the Toy tutorial, the compiler only needs to load the Toy dialect in the Context, all the others (linalg, affine, std, LLVM, ...) are automatically loaded depending on the optimization pipeline enabled.
Differential Revision: https://reviews.llvm.org/D85622
show more ...
|
#
ba92dadf |
| 15-Aug-2020 |
Mehdi Amini <joker.eph@gmail.com> |
Revert "Separate the Registration from Loading dialects in the Context"
This was landed by accident, will reland with the right comments addressed from the reviews. Also revert dependent build fixes.
|
#
ebf521e7 |
| 14-Aug-2020 |
Mehdi Amini <joker.eph@gmail.com> |
Separate the Registration from Loading dialects in the Context
This changes the behavior of constructing MLIRContext to no longer load globally registered dialects on construction. Instead Dialects
Separate the Registration from Loading dialects in the Context
This changes the behavior of constructing MLIRContext to no longer load globally registered dialects on construction. Instead Dialects are only loaded explicitly on demand: - the Parser is lazily loading Dialects in the context as it encounters them during parsing. This is the only purpose for registering dialects and not load them in the context. - Passes are expected to declare the dialects they will create entity from (Operations, Attributes, or Types), and the PassManager is loading Dialects into the Context when starting a pipeline.
This changes simplifies the configuration of the registration: a compiler only need to load the dialect for the IR it will emit, and the optimizer is self-contained and load the required Dialects. For example in the Toy tutorial, the compiler only needs to load the Toy dialect in the Context, all the others (linalg, affine, std, LLVM, ...) are automatically loaded depending on the optimization pipeline enabled.
show more ...
|
#
c224bc71 |
| 12-Aug-2020 |
Mehdi Amini <joker.eph@gmail.com> |
Remove DialectHooks and introduce a Dialect Interfaces instead
These hooks were introduced before the Interfaces mechanism was available.
DialectExtractElementHook is unused and entirely removed. T
Remove DialectHooks and introduce a Dialect Interfaces instead
These hooks were introduced before the Interfaces mechanism was available.
DialectExtractElementHook is unused and entirely removed. The DialectConstantFoldHook is used a fallback in the operation fold() method, and is replaced by a DialectInterface. The DialectConstantDecodeHook is used for interpreting OpaqueAttribute and should be revamped, but is replaced with an interface in 1:1 fashion for now.
Differential Revision: https://reviews.llvm.org/D85595
show more ...
|
Revision tags: llvmorg-11.0.0-rc1, llvmorg-12-init |
|
#
e2b71610 |
| 11-Jul-2020 |
Rahul Joshi <jurahul@google.com> |
[MLIR] Add argument related API to Region
- Arguments of the first block of a region are considered region arguments. - Add API on Region class to deal with these arguments directly instead of usi
[MLIR] Add argument related API to Region
- Arguments of the first block of a region are considered region arguments. - Add API on Region class to deal with these arguments directly instead of using the front() block. - Changed several instances of existing code that can use this API - Fixes https://bugs.llvm.org/show_bug.cgi?id=46535
Differential Revision: https://reviews.llvm.org/D83599
show more ...
|
Revision tags: llvmorg-10.0.1, llvmorg-10.0.1-rc4 |
|
#
9db53a18 |
| 07-Jul-2020 |
River Riddle <riddleriver@gmail.com> |
[mlir][NFC] Remove usernames and google bug numbers from TODO comments.
These were largely leftover from when MLIR was a google project, and don't really follow LLVM guidelines.
|
Revision tags: llvmorg-10.0.1-rc3 |
|
#
52af9c59 |
| 02-Jul-2020 |
Rahul Joshi <jurahul@google.com> |
[MLIR] Add a NoRegionArguments trait
- This trait will verify that all regions attached to an Op have no arguments - Fixes https://bugs.llvm.org/show_bug.cgi?id=46521 : Add trait NoRegionArguments
[MLIR] Add a NoRegionArguments trait
- This trait will verify that all regions attached to an Op have no arguments - Fixes https://bugs.llvm.org/show_bug.cgi?id=46521 : Add trait NoRegionArguments
Differential Revision: https://reviews.llvm.org/D83016
show more ...
|
Revision tags: llvmorg-10.0.1-rc2 |
|
#
7b226fde |
| 16-Jun-2020 |
Lucy Fox <lucyfox@google.com> |
[MLIR] Add an Op util which returns its name with the dialect stripped.
Differential Revision: https://reviews.llvm.org/D81435
|