Successfully identified regression in *llvm* in CI configuration tcwg_bmk_llvm_tk1/llvm-release-arm-spec2k6-O2_LTO. So far, this commit has regressed CI configurations: - tcwg_bmk_llvm_tk1/llvm-release-arm-spec2k6-O2_LTO
Culprit: <cut> commit 880822255e21179e9706ebaf77fff9111d9d3844 Author: Tobias Gysi gysit@google.com Date: Wed Mar 24 14:22:17 2021 +0000
[mlir][linalg] Do not call region builder during vectorization.
All linalg operations having a region builder shall call it during op creation. Calling it during vectorization is obsolete.
Differential Revision: https://reviews.llvm.org/D99168 </cut>
Results regressed to (for first_bad == 880822255e21179e9706ebaf77fff9111d9d3844) # reset_artifacts: -10 # build_abe binutils: -9 # build_abe stage1 -- --set gcc_override_configure=--with-mode=arm --set gcc_override_configure=--disable-libsanitizer: -8 # build_abe linux: -7 # build_abe glibc: -6 # build_abe stage2 -- --set gcc_override_configure=--with-mode=arm --set gcc_override_configure=--disable-libsanitizer: -5 # build_llvm true: -3 # true: 0 # benchmark -- -O2_LTO_marm artifacts/build-880822255e21179e9706ebaf77fff9111d9d3844/results_id: 1 # 456.hmmer,hmmer_base.default regressed by 104
from (for last_good == 92417ebbd10382436136ed5e755be567304ac139) # reset_artifacts: -10 # build_abe binutils: -9 # build_abe stage1 -- --set gcc_override_configure=--with-mode=arm --set gcc_override_configure=--disable-libsanitizer: -8 # build_abe linux: -7 # build_abe glibc: -6 # build_abe stage2 -- --set gcc_override_configure=--with-mode=arm --set gcc_override_configure=--disable-libsanitizer: -5 # build_llvm true: -3 # true: 0 # benchmark -- -O2_LTO_marm artifacts/build-92417ebbd10382436136ed5e755be567304ac139/results_id: 1
Artifacts of last_good build: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-release-... Results ID of last_good: tk1_32/tcwg_bmk_llvm_tk1/bisect-llvm-release-arm-spec2k6-O2_LTO/4267 Artifacts of first_bad build: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-release-... Results ID of first_bad: tk1_32/tcwg_bmk_llvm_tk1/bisect-llvm-release-arm-spec2k6-O2_LTO/4268 Build top page/logs: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-release-...
Configuration details:
Reproduce builds: <cut> mkdir investigate-llvm-880822255e21179e9706ebaf77fff9111d9d3844 cd investigate-llvm-880822255e21179e9706ebaf77fff9111d9d3844
git clone https://git.linaro.org/toolchain/jenkins-scripts
mkdir -p artifacts/manifests curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-release-... --fail curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-release-... --fail curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-release-... --fail chmod +x artifacts/test.sh
# Reproduce the baseline build (build all pre-requisites) ./jenkins-scripts/tcwg_bmk-build.sh @@ artifacts/manifests/build-baseline.sh
# Save baseline build state (which is then restored in artifacts/test.sh) mkdir -p ./bisect rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /llvm/ ./ ./bisect/baseline/
cd llvm
# Reproduce first_bad build git checkout --detach 880822255e21179e9706ebaf77fff9111d9d3844 ../artifacts/test.sh
# Reproduce last_good build git checkout --detach 92417ebbd10382436136ed5e755be567304ac139 ../artifacts/test.sh
cd .. </cut>
History of pending regressions and results: https://git.linaro.org/toolchain/ci/base-artifacts.git/log/?h=linaro-local/c...
Artifacts: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-release-... Build log: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-release-...
Full commit (up to 1000 lines): <cut> commit 880822255e21179e9706ebaf77fff9111d9d3844 Author: Tobias Gysi gysit@google.com Date: Wed Mar 24 14:22:17 2021 +0000
[mlir][linalg] Do not call region builder during vectorization.
All linalg operations having a region builder shall call it during op creation. Calling it during vectorization is obsolete.
Differential Revision: https://reviews.llvm.org/D99168 --- .../Dialect/Linalg/Transforms/Vectorization.cpp | 31 ++++++---------------- 1 file changed, 8 insertions(+), 23 deletions(-)
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp index d4581013ae69..10562d68a9e0 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp @@ -288,7 +288,7 @@ static AffineMap getTransferReadMap(LinalgOp linalgOp, unsigned argIndex) {
/// Generic vectorization function that rewrites the body of a `linalgOp` into /// vector form. Generic vectorization proceeds as follows: -/// 1. The region for the linalg op is created if necessary. +/// 1. Verify the `linalgOp` has one non-empty region. /// 2. Values defined above the region are mapped to themselves and will be /// broadcasted on a per-need basis by their consumers. /// 3. Each region argument is vectorized into a vector.transfer_read (or 0-d @@ -299,36 +299,21 @@ static AffineMap getTransferReadMap(LinalgOp linalgOp, unsigned argIndex) { LogicalResult vectorizeAsLinalgGeneric( OpBuilder &builder, LinalgOp linalgOp, SmallVectorImpl<Value> &newResults, ArrayRef<CustomVectorizationHook> customVectorizationHooks = {}) { - // 1. Certain Linalg ops do not have a region but only a region builder. - // If so, build the region so we can vectorize. - std::unique_ptr<Region> owningRegion; - Region *region; - if (linalgOp->getNumRegions() > 0) { - region = &linalgOp->getRegion(0); - } else { - // RAII avoid remaining in block. - OpBuilder::InsertionGuard g(builder); - owningRegion = std::make_unique<Region>(); - region = owningRegion.get(); - Block *block = builder.createBlock(region); - auto elementTypes = llvm::to_vector<4>( - llvm::map_range(linalgOp.getShapedOperandTypes(), - [](ShapedType t) { return t.getElementType(); })); - block->addArguments(elementTypes); - linalgOp.getRegionBuilder()(*block, /*captures=*/{}); - } - Block *block = ®ion->front(); + // 1. Fail to vectorize if the operation does not have one non-empty region. + if (linalgOp->getNumRegions() != 1 || linalgOp->getRegion(0).empty()) + return failure(); + auto &block = linalgOp->getRegion(0).front();
BlockAndValueMapping bvm; // 2. Values defined above the region can only be broadcast for now. Make them // map to themselves. llvm::SetVector<Value> valuesSet; - mlir::getUsedValuesDefinedAbove(*region, valuesSet); + mlir::getUsedValuesDefinedAbove(linalgOp->getRegion(0), valuesSet); bvm.map(valuesSet.getArrayRef(), valuesSet.getArrayRef());
// 3. Turn all BBArgs into vector.transfer_read / load. SmallVector<AffineMap> indexings; - for (auto bbarg : block->getArguments()) { + for (auto bbarg : block.getArguments()) { Value vectorArg = linalgOp.getShapedOperand(bbarg.getArgNumber()); AffineMap map; VectorType vectorType = extractVectorTypeFromShapedValue(vectorArg); @@ -360,7 +345,7 @@ LogicalResult vectorizeAsLinalgGeneric( hooks.push_back(vectorizeYield);
// 5. Iteratively call `vectorizeOneOp` to each op in the slice. - for (Operation &op : block->getOperations()) { + for (Operation &op : block.getOperations()) { VectorizationResult result = vectorizeOneOp(builder, &op, bvm, hooks); if (result.status == VectorizationStatus::Failure) { LLVM_DEBUG(dbgs() << "\n[" DEBUG_TYPE "]: failed to vectorize: " << op); </cut>