Changes

Summary

  1. [llvm-profgen] Refactor PerfReader to allow different types of perf scripts (details)
  2. [mlir][SCF] Peel scf.for loops for even step divison (details)
  3. [mlir][affine] addLowerOrUpperBound: Disallow pos among boundOperands (details)
Commit 6da9241aabe12c07fb905e5b3d2e4e16ef7d4296 by wlei
[llvm-profgen] Refactor PerfReader to allow different types of perf scripts

In order to support different types of perf scripts, this change tried to refactor `PerfReader` by adding the base class `PerfReaderBase` and current HybridPerfReader is derived from it for CS profile generation. Common functions like, passMM2PEvents, extract_lbrs, extract_callstack, etc. can be reused.

Next step is to add LBR only reader(for non-CS profile) and aggregated perf scripts reader(do a pre-aggregation of scripts).

Reviewed By: hoy, wenlei

Differential Revision: https://reviews.llvm.org/D107014
The file was modifiedllvm/tools/llvm-profgen/ProfiledBinary.h
The file was modifiedllvm/tools/llvm-profgen/PerfReader.cpp
The file was modifiedllvm/tools/llvm-profgen/PerfReader.h
The file was modifiedllvm/tools/llvm-profgen/llvm-profgen.cpp
Commit 3a41ff4883fe8b9e34a4f30aa9eecaf2ecb2ef44 by springerm
[mlir][SCF] Peel scf.for loops for even step divison

Add ForLoopBoundSpecialization pass, which specializes scf.for loops into a "main loop" where `step` divides the iteration space evenly and into an scf.if that handles the last iteration.

This transformation is useful for vectorization and loop tiling. E.g., when vectorizing loads/stores, programs will spend most of their time in the main loop, in which only unmasked loads/stores are used. Only the in the last iteration (scf.if), slower masked loads/stores are used.

Subsequent commits will apply this transformation in the SparseDialect and in Linalg's loop tiling.

Differential Revision: https://reviews.llvm.org/D105804
The file was modifiedmlir/include/mlir/Dialect/SCF/Passes.td
The file was modifiedmlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
The file was modifiedmlir/include/mlir/Dialect/SCF/Passes.h
The file was modifiedutils/bazel/llvm-project-overlay/mlir/BUILD.bazel
The file was modifiedmlir/include/mlir/Dialect/SCF/Transforms.h
The file was addedmlir/test/Dialect/SCF/for-loop-peeling.mlir
Commit fef4708472b2924ee09f2b332d94fe3a99bd5717 by springerm
[mlir][affine] addLowerOrUpperBound: Disallow pos among boundOperands

Bounds such as `dim_{pos} <= c_1 * dim_x + ...` where `x == pos` are invalid. `addLowerOrUpperBound` previously added an incorrect inequality to the set. Such cases are now explicitly rejected.

Differential Revision: https://reviews.llvm.org/D107220
The file was modifiedmlir/lib/Analysis/AffineStructures.cpp