Revision tags: llvmorg-17.0.4 |
|
#
3be3883e |
| 24-Oct-2023 |
Benjamin Maxwell <benjamin.maxwell@arm.com> |
[mlir][VectorOps] Support string literals in `vector.print` (#68695)
Printing strings within integration tests is currently quite annoyingly
verbose, and can't be tucked into shared helpers as the
[mlir][VectorOps] Support string literals in `vector.print` (#68695)
Printing strings within integration tests is currently quite annoyingly
verbose, and can't be tucked into shared helpers as the types depend on
the length of the string:
```
llvm.mlir.global internal constant @hello_world("Hello, World!\0")
func.func @entry() {
%0 = llvm.mlir.addressof @hello_world : !llvm.ptr<array<14 x i8>>
%1 = llvm.mlir.constant(0 : index) : i64
%2 = llvm.getelementptr %0[%1, %1]
: (!llvm.ptr<array<14 x i8>>, i64, i64) -> !llvm.ptr<i8>
llvm.call @printCString(%2) : (!llvm.ptr<i8>) -> ()
return
}
```
So this patch adds a simple extension to `vector.print` to simplify
this:
```
func.func @entry() {
// Print a vector of characters ;)
vector.print str "Hello, World!"
return
}
```
Most of the logic for this is now shared with `cf.assert` which already
does something similar.
Depends on #68694
show more ...
|
Revision tags: llvmorg-17.0.3, llvmorg-17.0.2 |
|
#
78c49743 |
| 28-Sep-2023 |
Quinn Dawkins <quinn.dawkins@gmail.com> |
[MLIR][Vector] Allow non-default memory spaces in gather/scatter lowerings (#67500)
GPU targets can gather on non-default address spaces (e.g. global), so
this removes the check for the default mem
[MLIR][Vector] Allow non-default memory spaces in gather/scatter lowerings (#67500)
GPU targets can gather on non-default address spaces (e.g. global), so
this removes the check for the default memory space.
show more ...
|
Revision tags: llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init |
|
#
98f6289a |
| 11-Jul-2023 |
Diego Caballero <diegocaballero@google.com> |
[mlir][Vector] Add support for Value indices to vector.extract/insert
`vector.extract/insert` ops only support constant indices. This PR is extending them so that arbitrary values can be used instea
[mlir][Vector] Add support for Value indices to vector.extract/insert
`vector.extract/insert` ops only support constant indices. This PR is extending them so that arbitrary values can be used instead.
This work is part of the RFC: https://discourse.llvm.org/t/rfc-psa-remove-vector-extractelement-and-vector-insertelement-ops-in-favor-of-vector-extract-and-vector-insert-ops
Differential Revision: https://reviews.llvm.org/D155034
show more ...
|
#
1b8b5564 |
| 20-Sep-2023 |
Nicolas Vasilache <nicolasvasilache@users.noreply.github.com> |
[mlir][Vector] Add fastmath flags to vector.reduction (#66905)
This revision pipes the fastmath attribute support through the
vector.reduction op. This seemingly simple first step already requires
[mlir][Vector] Add fastmath flags to vector.reduction (#66905)
This revision pipes the fastmath attribute support through the
vector.reduction op. This seemingly simple first step already requires
quite some genuflexions, file and builder reorganization. In the
process, retire the boolean reassoc flag deep in the LLVM dialect
builders and just use the fastmath attribute.
During conversions, templated builders for predicated intrinsics are
partially cleaned up. In the future, to finalize the cleanups, one
should consider adding fastmath to the VPIntrinsic ops.
show more ...
|
#
8f5d5194 |
| 13-Sep-2023 |
Daniil Dudkin <unterumarmung@yandex.ru> |
[mlir][vector] Implement Workaround Lowerings for Masked `fm**imum` Reductions
This patch is part of a larger initiative aimed at fixing floating-point `max` and `min` operations in MLIR: https://di
[mlir][vector] Implement Workaround Lowerings for Masked `fm**imum` Reductions
This patch is part of a larger initiative aimed at fixing floating-point `max` and `min` operations in MLIR: https://discourse.llvm.org/t/rfc-fix-floating-point-max-and-min-operations-in-mlir/72671.
Within LLVM, there are no masked reduction counterparts for vector reductions such as `fmaximum` and `fminimum`. More information can be found here: https://github.com/llvm/llvm-project/issues/64940#issuecomment-1690694156.
To address this issue in MLIR, where we need to generate appropriate lowerings for these cases, we employ regular non-masked intrinsics. However, we modify the input vector using the `arith.select` operation to effectively deactivate undesired elements using a "neutral mask value". The neutral mask value is the smallest possible value for the `fmaximum` reduction and the largest possible value for the `fminimum` reduction.
Depends on D158618
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D158773
show more ...
|
#
709b2742 |
| 13-Sep-2023 |
Daniil Dudkin <unterumarmung@yandex.ru> |
[mlir][vector] Bring back `maxf`/`minf` reductions
This patch is part of a larger initiative aimed at fixing floating-point `max` and `min` operations in MLIR: https://discourse.llvm.org/t/rfc-fix-f
[mlir][vector] Bring back `maxf`/`minf` reductions
This patch is part of a larger initiative aimed at fixing floating-point `max` and `min` operations in MLIR: https://discourse.llvm.org/t/rfc-fix-floating-point-max-and-min-operations-in-mlir/72671.
In line with the mentioned RFC, this patch tackles tasks 2.3 and 2.4. It adds LLVM conversions for the `maxf`/`minf` reductions to the non-NaN-propagating LLVM intrinsics.
Depends on D158618
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D158659
show more ...
|
#
4a831250 |
| 13-Sep-2023 |
Daniil Dudkin <unterumarmung@yandex.ru> |
[mlir][vector] Rename vector reductions: `maxf` → `maximumf`, `minf` → `minimumf`
This patch is part of a larger initiative aimed at fixing floating-point `max` and `min` operations in MLIR: https:/
[mlir][vector] Rename vector reductions: `maxf` → `maximumf`, `minf` → `minimumf`
This patch is part of a larger initiative aimed at fixing floating-point `max` and `min` operations in MLIR: https://discourse.llvm.org/t/rfc-fix-floating-point-max-and-min-operations-in-mlir/72671.
Here, we are addressing task 2.1 from the plan, which involves renaming the vector reductions to align with the semantics of the corresponding LLVM intrinsics.
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D158618
show more ...
|
#
ce254598 |
| 14-Aug-2023 |
Matthias Springer <me@m-sp.org> |
[mlir][Conversion] Store const type converter in ConversionPattern
ConversionPatterns do not (and should not) modify the type converter that they are using.
* Make `ConversionPattern::typeConverter
[mlir][Conversion] Store const type converter in ConversionPattern
ConversionPatterns do not (and should not) modify the type converter that they are using.
* Make `ConversionPattern::typeConverter` const. * Make member functions of the `LLVMTypeConverter` const. * Conversion patterns take a const type converter. * Various helper functions (that are called from patterns) now also take a const type converter.
Differential Revision: https://reviews.llvm.org/D157601
show more ...
|
#
f36e909d |
| 11-Aug-2023 |
Benjamin Maxwell <benjamin.maxwell@arm.com> |
[mlir][VectorOps] Use SCF for vector.print and allow scalable vectors
Reland of the original patch after updating the Python binding tests, a few CUDA/GPU MLIR tests, and ensuring the assembly forma
[mlir][VectorOps] Use SCF for vector.print and allow scalable vectors
Reland of the original patch after updating the Python binding tests, a few CUDA/GPU MLIR tests, and ensuring the assembly format is round-trippable.
This patch splits the lowering of vector.print into first converting an n-D print into a loop of scalar prints of the elements, then a second pass that converts those scalar prints into the runtime calls. The former is done in VectorToSCF and the latter in VectorToLLVM.
The main reason for this is to allow printing scalable vector types, which are not possible to fully unroll at compile time, though this also avoids fully unrolling very large vectors.
To allow VectorToSCF to add the necessary punctuation between vectors and elements, a "punctuation" attribute has been added to vector.print. This abstracts calling the runtime functions such as printNewline(), without leaking the LLVM details into the higher abstraction levels. For example:
vector.print punctuation <comma>
lowers to
llvm.call @printComma() : () -> ()
The output format and runtime functions remain the same, which avoids the need to alter a large number of tests (aside from the pipelines).
Reviewed By: awarzynski, c-rhodes, aartbik
Differential Revision: https://reviews.llvm.org/D156519
show more ...
|
#
1b272d21 |
| 10-Aug-2023 |
Mehdi Amini <joker.eph@gmail.com> |
Revert "[mlir][VectorOps] Use SCF for vector.print and allow scalable vectors"
This reverts commit 490dae26cb3bee2e8401e4c2a7ad3e0996be67d0.
Bot is broken, seems like there is a problem of ambiguit
Revert "[mlir][VectorOps] Use SCF for vector.print and allow scalable vectors"
This reverts commit 490dae26cb3bee2e8401e4c2a7ad3e0996be67d0.
Bot is broken, seems like there is a problem of ambiguity in the parser.
show more ...
|
#
490dae26 |
| 09-Aug-2023 |
Benjamin Maxwell <benjamin.maxwell@arm.com> |
[mlir][VectorOps] Use SCF for vector.print and allow scalable vectors
Reland of the original patch after updating the Python binding tests and a few CUDA/GPU MLIR tests.
This patch splits the lower
[mlir][VectorOps] Use SCF for vector.print and allow scalable vectors
Reland of the original patch after updating the Python binding tests and a few CUDA/GPU MLIR tests.
This patch splits the lowering of vector.print into first converting an n-D print into a loop of scalar prints of the elements, then a second pass that converts those scalar prints into the runtime calls. The former is done in VectorToSCF and the latter in VectorToLLVM.
The main reason for this is to allow printing scalable vector types, which are not possible to fully unroll at compile time, though this also avoids fully unrolling very large vectors.
To allow VectorToSCF to add the necessary punctuation between vectors and elements, a "punctuation" attribute has been added to vector.print. This abstracts calling the runtime functions such as printNewline(), without leaking the LLVM details into the higher abstraction levels. For example:
vector.print <comma>
lowers to
llvm.call @printComma() : () -> ()
The output format and runtime functions remain the same, which avoids the need to alter a large number of tests (aside from the pipelines).
Reviewed By: awarzynski, c-rhodes, aartbik
Differential Revision: https://reviews.llvm.org/D156519
show more ...
|
#
b160442d |
| 09-Aug-2023 |
Benjamin Maxwell <benjamin.maxwell@arm.com> |
Revert "[mlir][VectorOps] Use SCF for vector.print and allow scalable vectors"
This reverts commit 3875804a0725c6490b4c0e76e1c0e1e0dbccedf4.
This caused some test failures for the MLIR python bindi
Revert "[mlir][VectorOps] Use SCF for vector.print and allow scalable vectors"
This reverts commit 3875804a0725c6490b4c0e76e1c0e1e0dbccedf4.
This caused some test failures for the MLIR python bindings. Reverting until those are addressed.
show more ...
|
#
3875804a |
| 09-Aug-2023 |
Benjamin Maxwell <benjamin.maxwell@arm.com> |
[mlir][VectorOps] Use SCF for vector.print and allow scalable vectors
This patch splits the lowering of vector.print into first converting an n-D print into a loop of scalar prints of the elements,
[mlir][VectorOps] Use SCF for vector.print and allow scalable vectors
This patch splits the lowering of vector.print into first converting an n-D print into a loop of scalar prints of the elements, then a second pass that converts those scalar prints into the runtime calls. The former is done in VectorToSCF and the latter in VectorToLLVM.
The main reason for this is to allow printing scalable vector types, which are not possible to fully unroll at compile time, though this also avoids fully unrolling very large vectors.
To allow VectorToSCF to add the necessary punctuation between vectors and elements, a "punctuation" attribute has been added to vector.print. This abstracts calling the runtime functions such as printNewline(), without leaking the LLVM details into the higher abstraction levels. For example:
vector.print <comma>
lowers to
llvm.call @printComma() : () -> ()
The output format and runtime functions remain the same, which avoids the need to alter a large number of tests (aside from the pipelines).
Reviewed By: awarzynski, c-rhodes, aartbik
Differential Revision: https://reviews.llvm.org/D156519
show more ...
|
#
dad9de0a |
| 02-Aug-2023 |
Daniil Dudkin <unterumarmung@yandex.ru> |
[mlir][vector] Improve lowering to LLVM for `minf`, `maxf` reductions
This patch improves the lowering by changing target LLVM intrinsics from `reduce.fmax` and `reduce.fmin`, which have different s
[mlir][vector] Improve lowering to LLVM for `minf`, `maxf` reductions
This patch improves the lowering by changing target LLVM intrinsics from `reduce.fmax` and `reduce.fmin`, which have different semantic for handling NaN, to `reduce.fmaximum` and `reduce.fminimum` ones.
Fixes #63969
Depends on D155869
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D155877
show more ...
|
#
16b75cd2 |
| 31-Jul-2023 |
Matthias Springer <me@m-sp.org> |
[mlir][vector] Use DenseI64ArrayAttr for ExtractOp/InsertOp positions
`DenseI64ArrayAttr` provides a better API than `I64ArrayAttr`. E.g., accessors returning `ArrayRef<int64_t>` (instead of `ArrayA
[mlir][vector] Use DenseI64ArrayAttr for ExtractOp/InsertOp positions
`DenseI64ArrayAttr` provides a better API than `I64ArrayAttr`. E.g., accessors returning `ArrayRef<int64_t>` (instead of `ArrayAttr`) are generated.
Differential Revision: https://reviews.llvm.org/D156684
show more ...
|
#
b1d26875 |
| 17-Jul-2023 |
Matthias Springer <me@m-sp.org> |
[mlir][IR] Remove duplicate `isLastMemrefDimUnitStride` functions
This function is duplicated in various dialects.
Differential Revision: https://reviews.llvm.org/D155462
|
#
f22af204 |
| 21-Jun-2023 |
Andrzej Warzynski <andrzej.warzynski@arm.com> |
[mlir][VectorType] Remove `numScalableDims` from the vector type
This is a follow-up of https://reviews.llvm.org/D153372 in which `numScalableDims` (single integer) was effectively replaced with `is
[mlir][VectorType] Remove `numScalableDims` from the vector type
This is a follow-up of https://reviews.llvm.org/D153372 in which `numScalableDims` (single integer) was effectively replaced with `isScalableDim` bitmask.
This change is a part of a larger effort to enable scalable vectorisation in Linalg. See this RFC for more context: * https://discourse.llvm.org/t/rfc-scalable-vectorisation-in-linalg/
Differential Revision: https://reviews.llvm.org/D153412
show more ...
|
Revision tags: llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4 |
|
#
5550c821 |
| 08-May-2023 |
Tres Popp <tpopp@google.com> |
[mlir] Move casting calls from methods 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 functionali
[mlir] Move casting calls from methods 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.
Caveats include: - This clang-tidy script probably has more problems. - This only touches C++ code, so nothing that is being generated.
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 first patch was created with the following steps. The intention is to only do automated changes at first, so I waste less time if it's reverted, and so the first mass change is more clear as an example to other teams that will need to follow similar steps.
Steps are described per line, as comments are removed by git: 0. Retrieve the change from the following to build clang-tidy with an additional check: https://github.com/llvm/llvm-project/compare/main...tpopp:llvm-project:tidy-cast-check 1. Build clang-tidy 2. Run clang-tidy over your entire codebase while disabling all checks and enabling the one relevant one. Run on all header files also. 3. Delete .inc files that were also modified, so the next build rebuilds them to a pure state. 4. Some changes have been deleted for the following reasons: - Some files had a variable also named cast - Some files had not included a header file that defines the cast functions - Some files are definitions of the classes that have the casting methods, so the code still refers to the method instead of the function without adding a prefix or removing the method declaration at the same time.
``` ninja -C $BUILD_DIR clang-tidy
run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\ -header-filter=mlir/ mlir/* -fix
rm -rf $BUILD_DIR/tools/mlir/**/*.inc
git restore mlir/lib/IR mlir/lib/Dialect/DLTI/DLTI.cpp\ mlir/lib/Dialect/Complex/IR/ComplexDialect.cpp\ mlir/lib/**/IR/\ mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp\ mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp\ mlir/test/lib/Dialect/Test/TestTypes.cpp\ mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp\ mlir/test/lib/Dialect/Test/TestAttributes.cpp\ mlir/unittests/TableGen/EnumsGenTest.cpp\ mlir/test/python/lib/PythonTestCAPI.cpp\ mlir/include/mlir/IR/ ```
Differential Revision: https://reviews.llvm.org/D150123
show more ...
|
Revision tags: llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1 |
|
#
2bc4c3e9 |
| 23-Mar-2023 |
Nicolas Vasilache <nicolas.vasilache@gmail.com> |
[mlir][Vector] NFC - Reorganize vector patterns
Vector dialect patterns have grown enormously in the past year to a point where they are now impenetrable. Start reorganizing them towards finer-grain
[mlir][Vector] NFC - Reorganize vector patterns
Vector dialect patterns have grown enormously in the past year to a point where they are now impenetrable. Start reorganizing them towards finer-grained control.
Differential Revision: https://reviews.llvm.org/D146736
show more ...
|
Revision tags: llvmorg-16.0.0, llvmorg-16.0.0-rc4 |
|
#
4eb1f1fa |
| 08-Mar-2023 |
Adrian Kuegel <akuegel@google.com> |
[mlir] Apply ClangTidyLegacy findings (NFC)
- 'override' is redundant since the function is already declared 'final'. - 'virtual' is redundant since the function is already declared 'override'.
|
#
657f60a0 |
| 03-Mar-2023 |
Aart Bik <ajcbik@google.com> |
[mlir][vector] add support for printing f16 and bf16
Love or hate it, but the vector.print operation was the very first operation that actually made "end-to-end" CHECK integration testing possible f
[mlir][vector] add support for printing f16 and bf16
Love or hate it, but the vector.print operation was the very first operation that actually made "end-to-end" CHECK integration testing possible for MLIR. This revision adds support for the -until recently- less common but important floating-point types f16 and bf16.
This will become useful for accelerator specific testing (e.g. NVidia GPUs)
Reviewed By: wrengr
Differential Revision: https://reviews.llvm.org/D145207
show more ...
|
#
69049988 |
| 03-Mar-2023 |
Mehdi Amini <joker.eph@gmail.com> |
Fix crash in ConvertVectorToLLVM.cpp pattern
Fixes #61094
|
Revision tags: llvmorg-16.0.0-rc3 |
|
#
c339f9e1 |
| 22-Feb-2023 |
Diego Caballero <diegocaballero@google.com> |
[mlir][Vector] Support masking for more contraction flavors
This patch adds masking support for more contraction flavors including those with any combiner operation (add, mul, min, max, and, or, etc
[mlir][Vector] Support masking for more contraction flavors
This patch adds masking support for more contraction flavors including those with any combiner operation (add, mul, min, max, and, or, etc.) and regular matmul contractions.
Combiner operations that are performing vertical reductions (and, therefore, they are not represented with a horizontal reduction operation) can be executed unmasked. However, the previous value of the accumulator must be propagated for lanes that shouldn't accumulate. We achieve this goal by introducing a select operation after the accumulator to choose between the combined and the previous accumulator value. This design decision is made to avoid introducing masking support to all the arithmetic and logical operations in the Arith dialect. VP intrinsics do not support pass-thru values either so we would have to generate the same sequence when lowering to LLVM. The op + select pattern is peepholed by some backend with native masking support for those operations.
Consequently, this patch removes masking support from the vector.fma operation to follow the same approach for all the combiner operations.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D144239
show more ...
|
#
a1aad28d |
| 16-Feb-2023 |
Lei Zhang <antiagainst@google.com> |
[mlir][vector] NFC: Improve vector type accessor methods
Plain `getVectorType()` can be quite confusing and error-prone given that, well, vector ops always work on vector types, and it can commonly
[mlir][vector] NFC: Improve vector type accessor methods
Plain `getVectorType()` can be quite confusing and error-prone given that, well, vector ops always work on vector types, and it can commonly involve both source and result vectors. So this commit makes various such accessor methods to be explicit w.r.t. source or result vectors.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D144159
show more ...
|
#
9452356d |
| 15-Feb-2023 |
Diego Caballero <diegocaballero@google.com> |
[mlir][Vector] Add support for masked vector.contract
This patch adds support for masking vector.contract ops with the vector.mask approach. This also includes the lowering of vector.contract throug
[mlir][Vector] Add support for masked vector.contract
This patch adds support for masking vector.contract ops with the vector.mask approach. This also includes the lowering of vector.contract through the vector.outerproduct path to LLVM. For now, this only adds support for one of the many potential flavors of vector.contract/vector.outerproduct but unsupported cases will fail gratefully.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D143965
show more ...
|