Integrate llvm-project at 6edbdf80cac119f8f30d2ae6fa2972d9e778510b (#9223)
* Handle rename of eliminateInitTensors
* update bufferization
* disable failing tests due to mhlo to linalg
* TF switch to C++17
* cherry-pick mhlo revert
* Enable newly passing tests
Co-authored-by: Stella Laurenzo <laurenzo@google.com>
diff --git a/compiler/src/iree/compiler/Codegen/Common/IREEComprehensiveBufferizePass.cpp b/compiler/src/iree/compiler/Codegen/Common/IREEComprehensiveBufferizePass.cpp
index c85a2c2..95b2049 100644
--- a/compiler/src/iree/compiler/Codegen/Common/IREEComprehensiveBufferizePass.cpp
+++ b/compiler/src/iree/compiler/Codegen/Common/IREEComprehensiveBufferizePass.cpp
@@ -32,10 +32,12 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
+#include "mlir/Dialect/Bufferization/Transforms/AllocTensorElimination.h"
#include "mlir/Dialect/Bufferization/Transforms/BufferUtils.h"
#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
+#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/MemRef/Transforms/Passes.h"
@@ -114,8 +116,8 @@
// Rewrite init_tensors that are anchored on specific ops.
IRRewriter rewriter(op->getContext());
- if (failed(linalg::insertSliceAnchoredInitTensorEliminationStep(rewriter, op,
- state)))
+ if (failed(bufferization::insertSliceAnchoredAllocTensorEliminationStep(
+ rewriter, op, state)))
return failure();
if (failed(
storeTensorOpAnchoredInitTensorEliminationStep(rewriter, op, state)))
@@ -188,6 +190,7 @@
Optional<BufferizationOptions::AllocationFn> allocationFn,
Optional<BufferizationOptions::DeallocationFn> deallocationFn,
Optional<BufferizationOptions::MemCpyFn> memCpyFn) {
+ passManager.addPass(createLinalgInitTensorToAllocTensorPass());
passManager.addPass(createIREEComprehensiveBufferizePass(
allocationFn, deallocationFn, memCpyFn));
passManager.addPass(memref::createResolveShapedTypeResultDimsPass());
diff --git a/compiler/src/iree/compiler/Codegen/Common/test/iree_comprehensive_bufferize.mlir b/compiler/src/iree/compiler/Codegen/Common/test/iree_comprehensive_bufferize.mlir
index ca2c34e..d40726b 100644
--- a/compiler/src/iree/compiler/Codegen/Common/test/iree_comprehensive_bufferize.mlir
+++ b/compiler/src/iree/compiler/Codegen/Common/test/iree_comprehensive_bufferize.mlir
@@ -274,7 +274,7 @@
%input = arith.constant dense<[[1.0, 2.0, 3.0],
[4.0, 5.0, 6.0]]> : tensor<2x3xf32>
- %init = linalg.init_tensor [2, 3] : tensor<2x3xf32>
+ %init = bufferization.alloc_tensor() : tensor<2x3xf32>
%0 = iree_linalg_ext.reverse
dimensions(dense<0> : tensor<1xi64>)
ins(%input : tensor<2x3xf32>)
@@ -291,8 +291,8 @@
// CHECK: memref.alloc
// CHECK: iree_linalg_ext.fft ins(%{{.*}} : index) outs(%{{.*}}, %{{.*}} : memref<1024xf32>, memref<1024xf32>)
func.func @fft_tensor(%idx: index) -> (tensor<1024xf32>, tensor<1024xf32>) {
- %t0 = linalg.init_tensor [1024] : tensor<1024xf32>
- %t1 = linalg.init_tensor [1024] : tensor<1024xf32>
+ %t0 = bufferization.alloc_tensor() : tensor<1024xf32>
+ %t1 = bufferization.alloc_tensor() : tensor<1024xf32>
%0:2 = iree_linalg_ext.fft
ins(%idx: index)
outs(%t0, %t1: tensor<1024xf32>, tensor<1024xf32>)
@@ -387,8 +387,8 @@
%input_values = flow.dispatch.tensor.load %0, offsets = [0, 0], sizes = [200, 8], strides = [1, 1] : !flow.dispatch.tensor<readonly:200x8xf32> -> tensor<200x8xf32>
%1 = hal.interface.binding.subspan set(0) binding(1) type(storage_buffer) : !flow.dispatch.tensor<readonly:200x8xi32>
%input_indices = flow.dispatch.tensor.load %1, offsets = [0, 0], sizes = [200, 8], strides = [1, 1] : !flow.dispatch.tensor<readonly:200x8xi32> -> tensor<200x8xi32>
- %out_values = linalg.init_tensor [200, 3] : tensor<200x3xf32>
- %out_indices = linalg.init_tensor [200, 3] : tensor<200x3xi32>
+ %out_values = bufferization.alloc_tensor() : tensor<200x3xf32>
+ %out_indices = bufferization.alloc_tensor() : tensor<200x3xi32>
%2:2 = iree_linalg_ext.topk
dimension(1)
ins(%input_values, %input_indices : tensor<200x8xf32> , tensor<200x8xi32>)
diff --git a/compiler/src/iree/compiler/Codegen/Interfaces/BufferizationInterfaces.cpp b/compiler/src/iree/compiler/Codegen/Interfaces/BufferizationInterfaces.cpp
index b5bb029..3bbaa89 100644
--- a/compiler/src/iree/compiler/Codegen/Interfaces/BufferizationInterfaces.cpp
+++ b/compiler/src/iree/compiler/Codegen/Interfaces/BufferizationInterfaces.cpp
@@ -15,6 +15,7 @@
#include "mlir/Dialect/Arithmetic/Transforms/BufferizableOpInterfaceImpl.h"
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
+#include "mlir/Dialect/Bufferization/Transforms/AllocTensorElimination.h"
#include "mlir/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.h"
#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
#include "mlir/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.h"
@@ -29,10 +30,10 @@
using mlir::bufferization::BufferizationAliasInfo;
using mlir::bufferization::BufferizationState;
using mlir::bufferization::DialectAnalysisState;
+using mlir::bufferization::eliminateAllocTensors;
using mlir::bufferization::OneShotBufferizationOptions;
using mlir::bufferization::PostAnalysisStepFn;
using mlir::bufferization::replaceOpWithNewBufferizedOp;
-using mlir::linalg::eliminateInitTensors;
namespace mlir {
namespace iree_compiler {
@@ -332,7 +333,7 @@
/// DispatchTensorStoreOp to the InitTensorOp must have bufferized in-place.
LogicalResult storeTensorOpAnchoredInitTensorEliminationStep(
RewriterBase &rewriter, Operation *op, AnalysisState &state) {
- return eliminateInitTensors(
+ return eliminateAllocTensors(
rewriter, op, state,
/*anchorMatchFunc=*/
[&](OpOperand &operand, SmallVector<Value> &) {
diff --git a/integrations/tensorflow/WORKSPACE b/integrations/tensorflow/WORKSPACE
index dca6b2b..e774a00 100644
--- a/integrations/tensorflow/WORKSPACE
+++ b/integrations/tensorflow/WORKSPACE
@@ -7,7 +7,7 @@
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
-TENSORFLOW_COMMIT = "38dcd191cef71d23c37e200962876e001838087b"
+TENSORFLOW_COMMIT = "ede8ff4b5468837f04434029a088fd3459e6e78f"
git_repository(
name = "org_tensorflow",
diff --git a/integrations/tensorflow/build_tools/bazel/iree-tf.bazelrc b/integrations/tensorflow/build_tools/bazel/iree-tf.bazelrc
index 3542912..a7166c2 100644
--- a/integrations/tensorflow/build_tools/bazel/iree-tf.bazelrc
+++ b/integrations/tensorflow/build_tools/bazel/iree-tf.bazelrc
@@ -7,6 +7,9 @@
# For now, just import the main IREE bazelrc
try-import %workspace%/../../build_tools/bazel/iree.bazelrc
+# TF uses C++17.
+build:generic_clang --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
+
# Ignore visibility issues in TensorFlow. They are inconsistently applied
# to the OSS codebase.
build --nocheck_visibility
diff --git a/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__dynamic_dims_Conv3D.run b/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__dynamic_dims_Conv3D.run
index d6ebdbe..c12598e 100644
--- a/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__dynamic_dims_Conv3D.run
+++ b/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__dynamic_dims_Conv3D.run
@@ -1,3 +1,2 @@
-# XFAIL: *
# REQUIRES: llvmaot
# RUN: %PYTHON -m iree_tf_tests.layers.layers_test --target_backends=iree_llvmaot --dynamic_dims=true --training=false --test_default_kwargs_only=true --layer=Conv3D --artifacts_dir=%t
diff --git a/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__full_api_Conv1DTranspose.run b/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__full_api_Conv1DTranspose.run
index ea47ab5..5349488 100644
--- a/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__full_api_Conv1DTranspose.run
+++ b/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__full_api_Conv1DTranspose.run
@@ -1,3 +1,2 @@
-# XFAIL: *
# REQUIRES: llvmaot
# RUN: %PYTHON -m iree_tf_tests.layers.layers_test --target_backends=iree_llvmaot --dynamic_dims=false --training=false --test_default_kwargs_only=false --layer=Conv1DTranspose --artifacts_dir=%t
diff --git a/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__full_api_Conv2DTranspose.run b/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__full_api_Conv2DTranspose.run
index b1b203c..180fc41 100644
--- a/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__full_api_Conv2DTranspose.run
+++ b/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__full_api_Conv2DTranspose.run
@@ -1,3 +1,2 @@
-# XFAIL: *
# REQUIRES: llvmaot
# RUN: %PYTHON -m iree_tf_tests.layers.layers_test --target_backends=iree_llvmaot --dynamic_dims=false --training=false --test_default_kwargs_only=false --layer=Conv2DTranspose --artifacts_dir=%t
diff --git a/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__full_api_Conv3DTranspose.run b/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__full_api_Conv3DTranspose.run
index e9b2f5c..b081230 100644
--- a/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__full_api_Conv3DTranspose.run
+++ b/integrations/tensorflow/test/iree_tf_tests/layers/llvmaot__full_api_Conv3DTranspose.run
@@ -1,3 +1,2 @@
-# XFAIL: *
# REQUIRES: llvmaot
# RUN: %PYTHON -m iree_tf_tests.layers.layers_test --target_backends=iree_llvmaot --dynamic_dims=false --training=false --test_default_kwargs_only=false --layer=Conv3DTranspose --artifacts_dir=%t
diff --git a/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__dynamic_dims_Conv3D.run b/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__dynamic_dims_Conv3D.run
index d5cc7a5..59d0105 100644
--- a/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__dynamic_dims_Conv3D.run
+++ b/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__dynamic_dims_Conv3D.run
@@ -1,3 +1,2 @@
# REQUIRES: vulkan
# RUN: %PYTHON -m iree_tf_tests.layers.layers_test --target_backends=iree_vulkan --dynamic_dims=true --training=false --test_default_kwargs_only=true --layer=Conv3D --artifacts_dir=%t
-# XFAIL: *
diff --git a/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__full_api_Conv1DTranspose.run b/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__full_api_Conv1DTranspose.run
index e8600bd..f6d847b 100644
--- a/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__full_api_Conv1DTranspose.run
+++ b/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__full_api_Conv1DTranspose.run
@@ -1,3 +1,2 @@
# REQUIRES: vulkan
# RUN: %PYTHON -m iree_tf_tests.layers.layers_test --target_backends=iree_vulkan --dynamic_dims=false --training=false --test_default_kwargs_only=false --layer=Conv1DTranspose --artifacts_dir=%t
-# XFAIL: *
diff --git a/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__full_api_Conv2DTranspose.run b/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__full_api_Conv2DTranspose.run
index 0f18d97..02973ac 100644
--- a/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__full_api_Conv2DTranspose.run
+++ b/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__full_api_Conv2DTranspose.run
@@ -1,3 +1,2 @@
# REQUIRES: vulkan
# RUN: %PYTHON -m iree_tf_tests.layers.layers_test --target_backends=iree_vulkan --dynamic_dims=false --training=false --test_default_kwargs_only=false --layer=Conv2DTranspose --artifacts_dir=%t
-# XFAIL: *
diff --git a/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__full_api_Conv3DTranspose.run b/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__full_api_Conv3DTranspose.run
index c0d39a5..bdd5cbe 100644
--- a/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__full_api_Conv3DTranspose.run
+++ b/integrations/tensorflow/test/iree_tf_tests/layers/vulkan__full_api_Conv3DTranspose.run
@@ -1,3 +1,2 @@
# REQUIRES: vulkan
# RUN: %PYTHON -m iree_tf_tests.layers.layers_test --target_backends=iree_vulkan --dynamic_dims=false --training=false --test_default_kwargs_only=false --layer=Conv3DTranspose --artifacts_dir=%t
-# XFAIL: *
diff --git a/integrations/tensorflow/test/iree_tf_tests/uncategorized/llvmaot__conv_transpose.run b/integrations/tensorflow/test/iree_tf_tests/uncategorized/llvmaot__conv_transpose.run
index 5692494..aabb0da 100644
--- a/integrations/tensorflow/test/iree_tf_tests/uncategorized/llvmaot__conv_transpose.run
+++ b/integrations/tensorflow/test/iree_tf_tests/uncategorized/llvmaot__conv_transpose.run
@@ -1,3 +1,2 @@
# REQUIRES: llvmaot
# RUN: %PYTHON -m iree_tf_tests.uncategorized.conv_transpose_test --target_backends=iree_llvmaot --artifacts_dir=%t
-# XFAIL: *
diff --git a/integrations/tensorflow/test/iree_tf_tests/uncategorized/vulkan__conv_transpose.run b/integrations/tensorflow/test/iree_tf_tests/uncategorized/vulkan__conv_transpose.run
index 6196033..705fdd7 100644
--- a/integrations/tensorflow/test/iree_tf_tests/uncategorized/vulkan__conv_transpose.run
+++ b/integrations/tensorflow/test/iree_tf_tests/uncategorized/vulkan__conv_transpose.run
@@ -1,3 +1,2 @@
# REQUIRES: vulkan
# RUN: %PYTHON -m iree_tf_tests.uncategorized.conv_transpose_test --target_backends=iree_vulkan --artifacts_dir=%t
-# XFAIL: *
diff --git a/third_party/llvm-project b/third_party/llvm-project
index a576382..6edbdf8 160000
--- a/third_party/llvm-project
+++ b/third_party/llvm-project
@@ -1 +1 @@
-Subproject commit a5763829eb085fa2b6f7b5a36f3de8e20e41d257
+Subproject commit 6edbdf80cac119f8f30d2ae6fa2972d9e778510b
diff --git a/third_party/mlir-hlo b/third_party/mlir-hlo
index f8e8a95..c8ddb2a 160000
--- a/third_party/mlir-hlo
+++ b/third_party/mlir-hlo
@@ -1 +1 @@
-Subproject commit f8e8a9546b66b49c54e8c596f8c23b2af457065a
+Subproject commit c8ddb2a0ddc075ce20c3ec04823fe2cf399a51d6