History log of /llvm-project/mlir/lib/IR/Operation.cpp (Results 1 – 25 of 306)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5
# f4d75863 26-Nov-2024 Jakub Kuderski <jakub@nod-labs.com>

[mlir] Use `llvm::filter_to_vector`. NFC. (#117655)

This got recently added to SmallVectorExtras:
https://github.com/llvm/llvm-project/pull/117460.


Revision tags: llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1
# 041b0a81 21-Sep-2024 wang-y-z <57429717+wang-y-z@users.noreply.github.com>

[MLIR][Operation] Fix `isBeforeInBlock` crash bug mentioned in https://github.com/llvm/llvm-project/issues/60909 (#101172)

# summary
This MR fix `isBeforeInBlock` crash bug mentioned in
https://gi

[MLIR][Operation] Fix `isBeforeInBlock` crash bug mentioned in https://github.com/llvm/llvm-project/issues/60909 (#101172)

# summary
This MR fix `isBeforeInBlock` crash bug mentioned in
https://github.com/llvm/llvm-project/issues/60909. Fixes #60909.
# Trigger condition
1. A block only have one operation.
2. `block->isOpOrderValid()` is true, but `op->hasValidOrder()` is
false.
3. call: `op->isBeforeInBlock(op)`, compared with op itself.

Will crash on `assert(blockFront != blockBack && "expected more than one
operation");`

# Case study
Simplified repro case in
`mlir/test/Pass/scf2cf-print-liveness-crash.mlir`
When put `-convert-scf-to-cf -test-print-liveness` together in one cmd
line, the first pass will work normally and crash on the second pass.
Details please refer https://github.com/llvm/llvm-project/issues/60909

# Solutions
option1. in `isBeforeInBlock`, check if block only have one operation
before step into `updateOrderIfNecessary`, if have only one, it must
return false
option2. in `isBeforeInBlock`, check if `this == other`, if true return
false
option3. fix `addNodeToList` logic

I prefer option3:

When a block contains only one operation and the user calls
op->isBeforeInBlock(op), if block->isOpOrderValid() returns true,
updateOrderIfNecessary is called. If op->hasValidOrder() is false, it
will crash at the assertion assert(blockFront != blockBack && "expected
more than one operation");.

This behavior is abnormal and needs fixing. I discovered that after the
first pass of `-convert-scf-to-cf`, there is a block with only one
operation where the block order is valid but the operation order is
invalid, leading to a crash when `-test-print-liveness` pass runs.

---------

Co-authored-by: isaacw <isaacw@nvidia.com>

show more ...


Revision tags: llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3
# 4c77cc63 16-Aug-2024 Luke Boyer <lukeboyer4@gmail.com>

[mlir][IR] Fix `checkFoldResult` error message (#104559)

checkFoldResult error message has expected and actual backwards.


Revision tags: llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7
# 4d60be04 25-May-2024 Beal Wang <colorfishes@outlook.com>

[mlir] Do not print empty property (#93379)

Skip printing property as `<<<NULL ATTRIBUTE>>>` when operation has an
empty property.

Co-authored-by: Biao Wang <biaow@nvidia.com>


Revision tags: llvmorg-18.1.6, llvmorg-18.1.5
# a5757c5b 19-Apr-2024 Christian Sigg <chsigg@users.noreply.github.com>

Switch member calls to `isa/dyn_cast/cast/...` to free function calls. (#89356)

This change cleans up call sites. Next step is to mark the member
functions deprecated.

See https://mlir.llvm.org/

Switch member calls to `isa/dyn_cast/cast/...` to free function calls. (#89356)

This change cleans up call sites. Next step is to mark the member
functions deprecated.

See https://mlir.llvm.org/deprecation and
https://discourse.llvm.org/t/preferred-casting-style-going-forward.

show more ...


Revision tags: llvmorg-18.1.4
# d488b222 12-Apr-2024 Beal Wang <colorfishes@outlook.com>

[mlir][ods] Do not print default-valued properties when the value is equal to the default (#87970)

This diff causes the `tblgen`-erated printProperties() function to skip
printing a `DefaultValuedA

[mlir][ods] Do not print default-valued properties when the value is equal to the default (#87970)

This diff causes the `tblgen`-erated printProperties() function to skip
printing a `DefaultValuedAttr` property when the value is equal to the
default.

Co-authored-by: Biao Wang <biaow@nvidia.com>

show more ...


Revision tags: llvmorg-18.1.3
# 971b8525 01-Apr-2024 Jakub Kuderski <jakub@nod-labs.com>

[mlir][NFC] Simplify type checks with isa predicates (#87183)

For more context on isa predicates, see:
https://github.com/llvm/llvm-project/pull/83753.


Revision tags: llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4
# e8d09a5b 20-Oct-2023 Mehdi Amini <joker.eph@gmail.com>

Apply clang-tidy fixes for readability-identifier-naming in Operation.cpp (NFC)


# 92157417 04-Jan-2024 Jakub Kuderski <jakub@nod-labs.com>

[mlir] Make fold result type check more verbose (#76867)

Print the op and its types when the fold type check fails. This is to
speed up debuging as it should be trivial to map the offending op to i

[mlir] Make fold result type check more verbose (#76867)

Print the op and its types when the fold type check fails. This is to
speed up debuging as it should be trivial to map the offending op to its
folder based on the op name.

show more ...


# f10302e3 20-Dec-2023 Matthias Springer <me@m-sp.org>

[mlir] Require folders to produce Values of same type (#75887)

This commit adds extra assertions to `OperationFolder` and `OpBuilder`
to ensure that the types of the folded SSA values match with th

[mlir] Require folders to produce Values of same type (#75887)

This commit adds extra assertions to `OperationFolder` and `OpBuilder`
to ensure that the types of the folded SSA values match with the result
types of the op. There used to be checks that discard the folded results
if the types do not match. This commit makes these checks stricter and
turns them into assertions.

Discarding folded results with the wrong type (without failing
explicitly) can hide bugs in op folders. Two such bugs became apparent
in MLIR (and some more in downstream projects) and are fixed with this
change.

Note: The existing type checks were introduced in
https://reviews.llvm.org/D95991.

Migration guide: If you see failing assertions (`folder produced value
of incorrect type`; make sure to run with assertions enabled!), run with
`-debug` or dump the operation right before the failing assertion. This
will point you to the op that has the broken folder. A common mistake is
a mismatch between static/dynamic dimensions (e.g., input has a static
dimension but folded result has a dynamic dimension).

show more ...


# 88d319a2 14-Dec-2023 Kazu Hirata <kazu@google.com>

[mlir] Use StringRef::{starts,ends}_with (NFC)

This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,end

[mlir] Use StringRef::{starts,ends}_with (NFC)

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.

show more ...


Revision tags: llvmorg-17.0.3, llvmorg-17.0.2
# c50617da 26-Sep-2023 Mehdi Amini <joker.eph@gmail.com>

Simplify diagnostic error management for MLIR properties API (NFC) (#67409)

This is a follow-up to 8c2bff1ab929 which lazy-initialized the
diagnostic and removed the need to dynamically abandon() a

Simplify diagnostic error management for MLIR properties API (NFC) (#67409)

This is a follow-up to 8c2bff1ab929 which lazy-initialized the
diagnostic and removed the need to dynamically abandon() an
InFlightDiagnostic. This further simplifies the code to not needed to
return a reference to an InFlightDiagnostic and instead eagerly emit
errors.

Also use `emitError` as name instead of `getDiag` which seems more
explicit and in-line with the common usage.

show more ...


Revision tags: llvmorg-17.0.1, llvmorg-17.0.0
# 8c2bff1a 11-Sep-2023 Mehdi Amini <joker.eph@gmail.com>

Lazy initialize diagnostic when handling MLIR properties (#65868)

Instead of eagerly creating a diagnostic that will be discarded in the
normal case, switch to lazy initialization on error.


# 28fe1a4e 07-Sep-2023 Tai Ly <tai.ly@arm.com>

[mlir] Add trait SameOperandsAndResultRank

This adds a native op trait SameOperandsAndResultRank
and associated verifier that checks that an operator's
operands and result types have same ranks if t

[mlir] Add trait SameOperandsAndResultRank

This adds a native op trait SameOperandsAndResultRank
and associated verifier that checks that an operator's
operands and result types have same ranks if their ranks
are known.

Signed-off-by: Tai Ly <tai.ly@arm.com>
Change-Id: I2d536f77be10f3710d0c8d84c907ff492a984fda

Reviewed By: rsuderman

Differential Revision: https://reviews.llvm.org/D156369

show more ...


Revision tags: llvmorg-17.0.0-rc4
# 0a0aff2d 30-Aug-2023 Mikhail Goncharov <goncharov.mikhail@gmail.com>

fix unused variable warnings in conditionals

warning was updated in 92023b15099012a657da07ebf49dd7d94a260f84


Revision tags: llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init
# 863e8123 21-Jul-2023 Jacques Pienaar <jpienaar@google.com>

[mlir] Move attr -> properties to not require Operation

This allows for converting before/without an Operation is created.

Differential Revision: https://reviews.llvm.org/D155996


# 21379151 20-Jul-2023 Matthias Springer <me@m-sp.org>

[mlir] Remove some code duplication between `Builders.cpp` and `FoldUtils.cpp`

Also update the documentation of `Operation::fold`, which did not take into account in-place foldings.

Differential Re

[mlir] Remove some code duplication between `Builders.cpp` and `FoldUtils.cpp`

Also update the documentation of `Operation::fold`, which did not take into account in-place foldings.

Differential Revision: https://reviews.llvm.org/D155691

show more ...


# dd115e5a 20-Jul-2023 Matthias Springer <me@m-sp.org>

[mlir][IR] Implement proper folder for `IsCommutative` trait

Commutative ops were previously folded with a special rule in `OperationFolder`. This change turns the folding into a proper `OpTrait` fo

[mlir][IR] Implement proper folder for `IsCommutative` trait

Commutative ops were previously folded with a special rule in `OperationFolder`. This change turns the folding into a proper `OpTrait` folder.

Differential Revision: https://reviews.llvm.org/D155687

show more ...


Revision tags: llvmorg-16.0.6
# e66f2beb 02-Jun-2023 Matthias Springer <me@m-sp.org>

[mlir][IR][NFC] Move CastOpInterface helpers to mlir/Interfaces

These helpers should not be part of the IR build unit.

The interface is now implemented on `builtin.unrealized_conversion_cast` with

[mlir][IR][NFC] Move CastOpInterface helpers to mlir/Interfaces

These helpers should not be part of the IR build unit.

The interface is now implemented on `builtin.unrealized_conversion_cast` with an external model.

Also rename the CastOpInterfaces Bazel target name to CastInterfaces to be consistent with the CMake target name.

Differential Revision: https://reviews.llvm.org/D146972

show more ...


Revision tags: llvmorg-16.0.5
# 31511900 19-May-2023 Mehdi Amini <joker.eph@gmail.com>

Fix quadratic behavior from Operation::setAttr() (NFC)

This API tries to ensure some backward compatibility for properties,
but doing so in multiple-layers was causing quadratic behavior.
Instead o

Fix quadratic behavior from Operation::setAttr() (NFC)

This API tries to ensure some backward compatibility for properties,
but doing so in multiple-layers was causing quadratic behavior.
Instead of `setAttrs()` repeatingly calling to `setAttr()` we inline
the logic and apply it locally in a single traversal.

Fixes #62800

Differential Revision: https://reviews.llvm.org/D150993

show more ...


# a3ef1b58 18-May-2023 Mehdi Amini <joker.eph@gmail.com>

Fix MLIR crash on 32 bits platforms

The properties size is compressed as a member of the Operation class
to assume a multiple of 8B is used for the storage. This matched the
natural alignment / padd

Fix MLIR crash on 32 bits platforms

The properties size is compressed as a member of the Operation class
to assume a multiple of 8B is used for the storage. This matched the
natural alignment / padding on 64 bits platforms, however we need some
explicit padding on 32 bits platforms, llvm::TrailingObjects will
compress and misalign.

Fixes #62763

show more ...


Revision tags: llvmorg-16.0.4
# c1fa60b4 11-May-2023 Tres Popp <tpopp@google.com>

[mlir] Update method cast calls to function calls

The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in a

[mlir] Update method cast calls to function calls

The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.

Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.

Context:

* https://mlir.llvm.org/deprecation/ at "Use the free function variants for dyn_cast/cast/isa/…"
* Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443

Implementation:
This follows a previous patch that updated calls
`op.cast<T>()-> cast<T>(op)`. However some cases could not handle an
unprefixed `cast` call due to occurrences of variables named cast, or
occurring inside of class definitions which would resolve to the method.
All C++ files that did not work automatically with `cast<T>()` are
updated here to `llvm::cast` and similar with the intention that they
can be easily updated after the methods are removed through a
find-replace.

See https://github.com/llvm/llvm-project/compare/main...tpopp:llvm-project:tidy-cast-check
for the clang-tidy check that is used and then update printed
occurrences of the function to include `llvm::` before.

One can then run the following:
```
ninja -C $BUILD_DIR clang-tidy

run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
-export-fixes /tmp/cast/casts.yaml mlir/*\
-header-filter=mlir/ -fix

rm -rf $BUILD_DIR/tools/mlir/**/*.inc
```

Differential Revision: https://reviews.llvm.org/D150348

show more ...


# eed9932a 05-May-2023 Kazu Hirata <kazu@google.com>

[mlir] Use std::optional instead of llvm::Optional (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue

[mlir] Use std::optional instead of llvm::Optional (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

show more ...


Revision tags: llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4
# 5e118f93 26-Feb-2023 Mehdi Amini <joker.eph@gmail.com>

Introduce MLIR Op Properties

This new features enabled to dedicate custom storage inline within operations.
This storage can be used as an alternative to attributes to store data that is
specific to

Introduce MLIR Op Properties

This new features enabled to dedicate custom storage inline within operations.
This storage can be used as an alternative to attributes to store data that is
specific to an operation. Attribute can also be stored inside the properties
storage if desired, but any kind of data can be present as well. This offers
a way to store and mutate data without uniquing in the Context like Attribute.
See the OpPropertiesTest.cpp for an example where a struct with a
std::vector<> is attached to an operation and mutated in-place:

struct TestProperties {
int a = -1;
float b = -1.;
std::vector<int64_t> array = {-33};
};

More complex scheme (including reference-counting) are also possible.

The only constraint to enable storing a C++ object as "properties" on an
operation is to implement three functions:

- convert from the candidate object to an Attribute
- convert from the Attribute to the candidate object
- hash the object

Optional the parsing and printing can also be customized with 2 extra
functions.

A new options is introduced to ODS to allow dialects to specify:

let usePropertiesForAttributes = 1;

When set to true, the inherent attributes for all the ops in this dialect
will be using properties instead of being stored alongside discardable
attributes.
The TestDialect showcases this feature.

Another change is that we introduce new APIs on the Operation class
to access separately the inherent attributes from the discardable ones.
We envision deprecating and removing the `getAttr()`, `getAttrsDictionary()`,
and other similar method which don't make the distinction explicit, leading
to an entirely separate namespace for discardable attributes.

Recommit d572cd1b067f after fixing python bindings build.

Differential Revision: https://reviews.llvm.org/D141742

show more ...


# 1e853421 01-May-2023 Mehdi Amini <joker.eph@gmail.com>

Revert "Introduce MLIR Op Properties"

This reverts commit d572cd1b067f1177a981a4711bf2e501eaa8117b.

Some bots are broken and investigation is needed before relanding.


12345678910>>...13