[all-commits] [llvm/llvm-project] eabd1a: [MLIR][Vector] Fix bug in ExtractStrideSlicesOp ca...
Hank via All-commits
all-commits at lists.llvm.org
Mon Aug 25 23:45:08 PDT 2025
Branch: refs/heads/release/21.x
Home: https://github.com/llvm/llvm-project
Commit: eabd1a5701fa23a84879ff81a8abbeea7397e1b2
https://github.com/llvm/llvm-project/commit/eabd1a5701fa23a84879ff81a8abbeea7397e1b2
Author: Tomás Longeri <tlongeri at google.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/lib/Dialect/Vector/IR/VectorOps.cpp
M mlir/test/Dialect/Vector/canonicalize.mlir
Log Message:
-----------
[MLIR][Vector] Fix bug in ExtractStrideSlicesOp canonicalization (#147591)
The pattern would produce an invalid slice when some dimensions were
both sliced and broadcast.
Commit: 80e8900b97d3f15fd8a6b44a933781aa02e29618
https://github.com/llvm/llvm-project/commit/80e8900b97d3f15fd8a6b44a933781aa02e29618
Author: Artemiy Bulavin <artemiyb at graphcore.ai>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/lib/IR/AttributeDetail.h
M mlir/lib/IR/MLIRContext.cpp
M mlir/lib/Pass/PassCrashRecovery.cpp
M mlir/unittests/IR/CMakeLists.txt
A mlir/unittests/IR/DistinctAttributeAllocatorTest.cpp
Log Message:
-----------
[MLIR] Fix use-after-frees when accessing DistinctAttr storage (#148666)
This PR fixes a use-after-free error that happens when `DistinctAttr`
instances are created within a `PassManager` running with crash recovery
enabled. The root cause is that `DistinctAttr` storage is allocated in a
thread_local allocator, which is destroyed when the crash recovery
thread joins, invalidating the storage.
Moreover, even without crash reproduction disabling multithreading on
the context will destroy the context's thread pool, and in turn delete
the threadlocal storage. This means a call to
`ctx->disableMulthithreading()` breaks the IR.
This PR replaces the thread local allocator with a synchronised
allocator that's shared between threads. This persists the lifetime of
allocated DistinctAttr storage instances to the lifetime of the context.
### Problem Details:
The `DistinctAttributeAllocator` uses a
`ThreadLocalCache<BumpPtrAllocator>` for lock-free allocation of
`DistinctAttr` storage in a multithreaded context. The issue occurs when
a `PassManager` is run with crash recovery (`runWithCrashRecovery`), the
pass pipeline is executed on a temporary thread spawned by
`llvm::CrashRecoveryContext`. Any `DistinctAttr`s created during this
execution have their storage allocated in the thread_local cache of this
temporary thread. When the thread joins, the thread_local storage is
destroyed, freeing the `DistinctAttr`s' memory. If this attribute is
accessed later, e.g. when printing, it results in a use-after-free.
As mentioned previously, this is also seen after creating some
`DistinctAttr`s and then calling `ctx->disableMulthithreading()`.
### Solution
`DistinctAttrStorageAllocator` uses a synchronised, shared allocator
instead of one wrapped in a `ThreadLocalCache`. The former is what
stores the allocator in transient thread_local storage.
### Testing:
A C++ unit test has been added to validate this fix. (I was previously
reproducing this failure with `mlir-opt` but I can no longer do so and I
am unsure why.)
-----
Note: This is a 2nd attempt at my previous PR
https://github.com/llvm/llvm-project/pull/128566 that was reverted in
https://github.com/llvm/llvm-project/pull/133000. I believe I've
addressed the TSAN and race condition concerns.
Commit: 6d00bfba92711c9586300bf98907307f542657a5
https://github.com/llvm/llvm-project/commit/6d00bfba92711c9586300bf98907307f542657a5
Author: Longsheng Mou <longshengmou at gmail.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/include/mlir/Dialect/Mesh/Transforms/Simplifications.h
M mlir/test/Dialect/Mesh/simplifications.mlir
Log Message:
-----------
[mlir][mesh] Add null check for dyn_cast to prevent crash (#149266)
This PR adds a null check for dyn_cast result before use to prevent
crash, and use `isa` instead `dyn_cast` to make code clean. Fixes
#148619.
Commit: 5f1f668988056d54fd61547a274bfe11142c1366
https://github.com/llvm/llvm-project/commit/5f1f668988056d54fd61547a274bfe11142c1366
Author: Daniel Garvey <34486624+dan-garvey at users.noreply.github.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
Log Message:
-----------
[mlir] Fix missing import (#150330)
building this file would fail when
MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS = 1
Signed-off-by: dan <danimal197 at gmail.com>
Commit: d5be26a90aa48fe9f4d36cc00178195ef120a5ce
https://github.com/llvm/llvm-project/commit/d5be26a90aa48fe9f4d36cc00178195ef120a5ce
Author: ronigoldman22 <156088210+ronigoldman22 at users.noreply.github.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/lib/Transforms/RemoveDeadValues.cpp
M mlir/test/Transforms/remove-dead-values.mlir
Log Message:
-----------
Fix Bug in RemoveDeadValues Pass (#148437)
This patch fixes a bug in the RemoveDeadValues pass where unused
function arguments were not removed from the function signature in an
edge case where the function returns void.
A corresponding test was added to the MLIR LIT test suite to cover this
case.
Commit: 59bdb0bb91a06c35cd34b128bfa67234212dcb64
https://github.com/llvm/llvm-project/commit/59bdb0bb91a06c35cd34b128bfa67234212dcb64
Author: Matthias Springer <me at m-sp.org>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
Log Message:
-----------
[mlir][SCF] Do not access erased operation in `scf.while` lowering (#150741)
Do not access the erased `scf.while` operation in the lowering pattern.
That won't work anymore in a One-Shot Dialect Conversion and triggers a
use-after-free sanitizer error.
After the One-Shot Dialect Conversion refactoring, a
`ConversionPatternRewriter` will behave more like a normal
`PatternRewriter`.
Commit: 5eff9ac65fcb4ab5b087ee0919b26678a1ad8dc6
https://github.com/llvm/llvm-project/commit/5eff9ac65fcb4ab5b087ee0919b26678a1ad8dc6
Author: Tom Eccles <tom.eccles at arm.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
Log Message:
-----------
[mlir][OpenMP][NFC] Fix gcc 14 warning (#151941)
GCC couldn't tell that the enum is checked exhaustively and so was
warning about there being no return on this path from the function.
Commit: a77611f58ed08894301d5639b3677dfa6aee4985
https://github.com/llvm/llvm-project/commit/a77611f58ed08894301d5639b3677dfa6aee4985
Author: Boyana Norris <brnorris03 at gmail.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/lib/IR/MLIRContext.cpp
M mlir/test/IR/test-clone.mlir
Log Message:
-----------
[mlir] Clone attrs of unregistered dialect ops (#151847)
`Operation::clone` does not clone the properties of unregistered ops.
This patch modifies the property initialization for unregistered ops to
initialize properties as attributes.
fixes #151640
---------
Signed-off-by: Boyana Norris <brnorris03 at gmail.com>
Commit: 98746467ef8d8e11c905eaed352aef35590555af
https://github.com/llvm/llvm-project/commit/98746467ef8d8e11c905eaed352aef35590555af
Author: Philip Lassen <plassen at groq.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/include/mlir/Analysis/DataFlowFramework.h
Log Message:
-----------
[NFC][mlir] Update DataFlowFramework.h to be compatible with clang c++23 (#152040)
This change makes `DataFlowFramework.h` compatible with `clang++` and
`--std=c++23`.
Previously clang was checking the templated `DataFlowSolver::eraseState`
body before being instantiated. This resulted in issues with incomplete
types, and happened at least with `clang++-19`.
This is fixed by moving the definition of `DataFlowSolver::eraseState`
after the `AnalysisState`'s full class declaration.
For full context:
-
https://discourse.llvm.org/t/what-is-the-status-of-c-23-support-in-mlir/87674/12
Commit: 5b9412624dc37b0f5d6e2ee8aa26789df4587290
https://github.com/llvm/llvm-project/commit/5b9412624dc37b0f5d6e2ee8aa26789df4587290
Author: Boyana Norris <brnorris03 at gmail.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/cmake/modules/AddMLIR.cmake
Log Message:
-----------
[mlir][cmake] Fix MLIR shared library installation (#152195)
When `LLVM_INSTALL_TOOLCHAIN_ONLY=ON`, the MLIR shared library
(`libMLIR*`) is not installed even though it is built with the
`INSTALL_WITH_TOOLCHAIN` argument to the `add_mlir_library` cmake
function. This patch ensures that `libMLIR*` is installed when
`LLVM_INSTALL_TOOLCHAIN_ONLY=ON`.
Patch verified
[here](https://github.com/llvm/llvm-project/issues/151247#issuecomment-3156387055).
fixes #151247
Commit: 49ebd43dfd588a31a55c39ca68f428daff06ade6
https://github.com/llvm/llvm-project/commit/49ebd43dfd588a31a55c39ca68f428daff06ade6
Author: Sasa Vuckovic <svuckovic at tenstorrent.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/include/mlir/Pass/PassOptions.h
M mlir/test/Pass/pipeline-options-parsing.mlir
M mlir/test/lib/Pass/TestPassManager.cpp
Log Message:
-----------
[MLIR] Make `PassPipelineOptions` virtually inheriting from PassOptions to allow diamond inheritance (#146370)
## Problem
Given 3 pipelines, A, B, and a superset pipeline AB that runs both the A
& B pipelines, it is not easy to manage their options - one needs to
manually recreate all options from A and B into AB, and maintain them.
This is tedious.
## Proposed solution
Ideally, AB options class inherits from both A and B options, making the
maintenance effortless. Today though, this causes problems as their base
classes `PassPipelineOptions<A>` and `PassPipelineOptions<B>` both
inherit from `mlir::detail::PassOptions`, leading to the so called
"diamond inheritance problem", i.e. multiple definitions of the same
symbol, in this case parseFromString that is defined in
mlir::detail::PassOptions.
Visually, the inheritance looks like this:
```
mlir::detail::PassOptions
↑ ↑
| |
PassPipelineOptions<A> PassPipelineOptions<B>
↑ ↑
| |
AOptions BOptions
↑ ↑
+---------+--------+
|
ABOptions
```
A proposed fix is to use the common solution to the diamond inheritance
problem - virtual inheritance.
Commit: 166a0f7a605711defcfabe4e5e3e71fb9c2921d0
https://github.com/llvm/llvm-project/commit/166a0f7a605711defcfabe4e5e3e71fb9c2921d0
Author: yronglin <yronglin777 at gmail.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/include/mlir/IR/PatternMatch.h
Log Message:
-----------
[NFC][mlir] Fully qualify namespace to avoid an MSVC bug (#152860)
VS17.6 has a name lookup issue, and was fixed in VS17.7, it impact down
stream MLIR based project. This MR add full qualifiers to workaround
this issue.
Reproducer: https://godbolt.org/z/Ea6e1Kc3E
Signed-off-by: yronglin <yronglin777 at gmail.com>
Commit: cd7a9f6cdd75f0e80b82d613e6ace4ad9e075018
https://github.com/llvm/llvm-project/commit/cd7a9f6cdd75f0e80b82d613e6ace4ad9e075018
Author: Nick Smith <127986401+nsmithtt at users.noreply.github.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/test/mlir-tblgen/enums-python-bindings.td
M mlir/tools/mlir-tblgen/EnumPythonBindingGen.cpp
Log Message:
-----------
[MLIR][Python] MLIR Enum Python bindings infinite recursion (#151584) (#151588)
Fixes an infinite recursion bug when using I32BitEnumAttrCaseGroup with
python bindings.
For more info, see issue:
- https://github.com/llvm/llvm-project/issues/151584
Commit: 9a688979c75bfef07f3704834d12e5403d90f799
https://github.com/llvm/llvm-project/commit/9a688979c75bfef07f3704834d12e5403d90f799
Author: Baz <batzorig1691 at gmail.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/include/mlir/ExecutionEngine/MemRefUtils.h
M mlir/unittests/ExecutionEngine/Invoke.cpp
Log Message:
-----------
[mlir][ExecutionEngine] fix default free function in `OwningMemRef`. (#153133)
`basePtr` should be freed instead of `data` because it is the one which
is storing the output of `malloc`. In `allocAligned()`, the `data` is
malloced and then assigned to `basePtr`.
Commit: 0d793d4ad973a3d507071a218be809f064d33686
https://github.com/llvm/llvm-project/commit/0d793d4ad973a3d507071a218be809f064d33686
Author: Matthias Springer <me at m-sp.org>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/lib/Dialect/Utils/StaticValueUtils.cpp
M mlir/test/Dialect/SCF/canonicalize.mlir
Log Message:
-----------
[mlir][DialectUtils] Fix div by zero crash (#153380)
Commit: d04de7b4cb7929b9d7b608924608ba4c22859d5b
https://github.com/llvm/llvm-project/commit/d04de7b4cb7929b9d7b608924608ba4c22859d5b
Author: Mehdi Amini <joker.eph at gmail.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
M mlir/test/Dialect/Arith/canonicalize.mlir
M mlir/test/Transforms/test-canonicalize.mlir
Log Message:
-----------
[MLIR] Erase unreachable blocks before applying patterns in the greedy rewriter (#153957)
Operations like:
%add = arith.addi %add, %add : i64
are legal in unreachable code. Unfortunately many patterns would be
unsafe to apply on such IR and can lead to crashes or infinite loops. To
avoid this we can remove unreachable blocks before attempting to apply
patterns.
We may have to do this also whenever the CFG is changed by a pattern, it
is left up for future work right now.
Fixes #153732
Commit: fee593daa5e9a313b9c73b7c9753dd348890322e
https://github.com/llvm/llvm-project/commit/fee593daa5e9a313b9c73b7c9753dd348890322e
Author: Mehdi Amini <joker.eph at gmail.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/lib/Transforms/Utils/WalkPatternRewriteDriver.cpp
M mlir/test/IR/test-walk-pattern-rewrite-driver.mlir
Log Message:
-----------
[MLIR] Refactor the walkAndApplyPatterns driver to remove the recursion (#154037)
This is in preparation of a follow-up change to stop traversing
unreachable blocks.
This is not NFC because of a subtlety of the early_inc. On a test case
like:
```
scf.if %cond {
"test.move_after_parent_op"() ({
"test.any_attr_of_i32_str"() {attr = 0 : i32} : () -> ()
}) : () -> ()
}
```
We recursively traverse the nested regions, and process an op when the
region is done (post-order).
We need to pre-increment the iterator before processing an operation in
case it gets deleted. However
we can do this before or after processing the nested region. This
implementation does the latter.
Commit: 648c566cde1cd464400a46b5e638da74ccdeaac3
https://github.com/llvm/llvm-project/commit/648c566cde1cd464400a46b5e638da74ccdeaac3
Author: Mehdi Amini <joker.eph at gmail.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/lib/Dialect/SCF/IR/SCF.cpp
Log Message:
-----------
[MLIR] Fix SCF verifier crash (#153974)
An operand of the nested yield op can be null and hasn't been verified
yet when processing the enclosing operation. Using `getResultTypes()`
will dereference this null Value and crash in the verifier.
Commit: 1339866cf24344b1f4b7c83060ac4bb8f65f58c9
https://github.com/llvm/llvm-project/commit/1339866cf24344b1f4b7c83060ac4bb8f65f58c9
Author: Mehdi Amini <joker.eph at gmail.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/include/mlir/Transforms/WalkPatternRewriteDriver.h
M mlir/lib/Transforms/Utils/WalkPatternRewriteDriver.cpp
M mlir/test/IR/test-walk-pattern-rewrite-driver.mlir
Log Message:
-----------
[MLIR] Stop visiting unreachable blocks in the walkAndApplyPatterns driver (#154038)
This is similar to the fix to the greedy driver in #153957 ; except that
instead of removing unreachable code, we just ignore it.
Operations like:
```
%add = arith.addi %add, %add : i64
```
are legal in unreachable code.
Unfortunately many patterns would be unsafe to apply on such IR and can
lead to crashes or infinite loops.
Commit: 3e22f22450f37821086dce023c9c54247edfccfd
https://github.com/llvm/llvm-project/commit/3e22f22450f37821086dce023c9c54247edfccfd
Author: Mehdi Amini <joker.eph at gmail.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/lib/Analysis/DataFlow/LivenessAnalysis.cpp
M mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp
M mlir/lib/Transforms/RemoveDeadValues.cpp
M mlir/test/Analysis/DataFlow/test-liveness-analysis.mlir
M mlir/test/Transforms/remove-dead-values.mlir
M mlir/test/lib/Analysis/DataFlow/TestLivenessAnalysis.cpp
Log Message:
-----------
[MLIR] Fix Liveness analysis handling of unreachable code (#153973)
This patch is forcing all values to be initialized by the
LivenessAnalysis, even in dead blocks. The dataflow framework will skip
visiting values when its already knows that a block is dynamically
unreachable, so this requires specific handling.
Downstream code could consider that the absence of liveness is the same
a "dead".
However as the code is mutated, new value can be introduced, and a
transformation like "RemoveDeadValue" must conservatively consider that
the absence of liveness information meant that we weren't sure if a
value was dead (it could be a newly introduced value.
Fixes #153906
Commit: 6a252e45784d93a9eeaa4a18133d31325e5fdb69
https://github.com/llvm/llvm-project/commit/6a252e45784d93a9eeaa4a18133d31325e5fdb69
Author: Mehdi Amini <joker.eph at gmail.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/include/mlir/IR/Operation.h
M mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
Log Message:
-----------
[MLIR] Introduce a OpWithState class to act as a stream modifier for Operations (NFC) (#151547)
On the model of OpWithFlags, this modifier allows to stream an operation
using a custom AsmPrinter.
Commit: a93ae211fe2390f7cbb359376b5bff5092023cb0
https://github.com/llvm/llvm-project/commit/a93ae211fe2390f7cbb359376b5bff5092023cb0
Author: Hank <49036880+hankluo6 at users.noreply.github.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M mlir/include/mlir/AsmParser/AsmParser.h
M mlir/lib/AsmParser/DialectSymbolParser.cpp
M mlir/lib/AsmParser/ParserState.h
M mlir/lib/Bytecode/Reader/BytecodeReader.cpp
A mlir/test/IR/recursive-distinct-attr.mlir
Log Message:
-----------
[MLIR] Fix duplicated attribute nodes in MLIR bytecode deserialization (#151267)
Fixes #150163
MLIR bytecode does not preserve alias definitions, so each attribute
encountered during deserialization is treated as a new one. This can
generate duplicate `DISubprogram` nodes during deserialization.
The patch adds a `StringMap` cache that records attributes and fetches
them when encountered again.
Compare: https://github.com/llvm/llvm-project/compare/3263ad76c430...a93ae211fe23
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list