[Mlir-commits] [mlir] [mlir][ValueBounds] Skip analysis for identical slice components (PR #226894)
Ziliang Zhang
llvmlistbot at llvm.org
Sun Sep 27 23:13:26 PDT 2026
ziliangzl wrote:
# Stress-test report
This patch fixes a small but surprisingly expensive pattern in One-Shot
Bufferize. When two slices reuse the same SSA values or attributes for their
offsets, sizes, or strides, `areEquivalentSlices` used to invoke the full
ValueBounds solver anyway. The new fast path recognizes those components as
equal immediately and keeps the existing solver fallback for everything else.
## Workloads
I used two IR shapes taken from IREE's LLVMCPU tests:
- dynamic masking from `vectorize_with_masking_and_hoist.mlir`, replicated
20,000 times;
- a deeply tiled matmul from `peel.mlir`, replicated 1,000 times.
The IREE-only lowering attributes were removed, and HAL workgroup queries in
the tiled case were replaced with constants. The tensor, SCF, linalg, and
slice structure was otherwise preserved. These are intentionally amplified
stress tests, not full IREE model compilations.
## Setup
Both binaries were built in Release mode with assertions disabled from the
same checkout. The baseline differed only by removal of the new identity
checks. After warm-up, I ran the following command five times per binary,
interleaving baseline and optimized runs:
```bash
mlir-opt input.mlir \
--one-shot-bufferize='check-parallel-regions=0' \
-o /dev/null
```
## Results
The table reports median wall time.
| Workload | Baseline | Optimized | Reduction | Speedup |
| --- | ---: | ---: | ---: | ---: |
| Dynamic masking, 20,000 copies | 4.95 s | 2.81 s | 43.2% | 1.76x |
| Tiled matmul, 1,000 copies | 1.58 s | 0.23 s | 85.4% | 6.87x |
The results were stable across the five runs: dynamic masking ranged from
4.93–4.97 seconds at baseline and 2.80–2.86 seconds after the change. The
tiled case ranged from 1.58–1.59 seconds at baseline and was 0.23 seconds in
all optimized runs.
https://github.com/llvm/llvm-project/pull/226894
More information about the Mlir-commits
mailing list