Merge google -> main (#3863)

95ac5ea Synchronize submodules
c61b3a5 Merge pull request #3860 from rsuderman:main-to-google
2b4ddc1 Merge pull request #3853 from rsuderman:main-to-google
08ba510 Synchronize submodules with LLVM at llvm/llvm-project@c30ab6c
f1c5ffd Synchronize submodules
633ecb3 Integrate LLVM at llvm/llvm-project@a8db144
e882ead Format LoadStoreVectorization.cpp.
6fb8dea Synchronize submodules
6676458 Synchronize submodules with LLVM at llvm/llvm-project@76b6cb5
06b142b Merge pull request #3833 from ScottTodd:main-to-google
107a4ce Disable flaky test.
57640c9 Merge branch 'google' into main-to-google
16d662d Synchronize submodules
269d91a Integrate LLVM at llvm/llvm-project@c30ab6c
abd52b3 Synchronize submodules
7f0f6de Integrate LLVM at llvm/llvm-project@76b6cb5
bb7ecd6 Synchronize submodules
b3ba7f2 Integrate LLVM at llvm/llvm-project@a7b6574
2205157 Update pass-pipeline tests to remove ambiguity.
25ae98b Fix header guard and clarify file comment.
diff --git a/SUBMODULE_VERSIONS b/SUBMODULE_VERSIONS
index fc186cc..7371f9a 100644
--- a/SUBMODULE_VERSIONS
+++ b/SUBMODULE_VERSIONS
@@ -5,8 +5,8 @@
 a5d9d0f7d368054fd1691aedf1db4116efcc233e third_party/flatbuffers
 4fb0ff7069bd88ee85902f4d0bb62794e5f6d021 third_party/flatcc
 f2fb48c3b3d79a75a88a99fba6576b25d42ec528 third_party/googletest
-2ad01e4b485d8753600766d967d1a7358b98ddd3 third_party/llvm-bazel
-c8d73d939fa4fda9c87b3979225d02d63062bd68 third_party/llvm-project
+6d15aaeb7ac6cb70b6c67f04a081939b5f121136 third_party/llvm-bazel
+a8db144169279332db59d30051f249efa0201ab3 third_party/llvm-project
 55801f03f9cc69abfcf8b508a873f702c11b3b5f third_party/mlir-emitc
 74d7261be17cf659d5930d4830609406bd7553e3 third_party/pffft
 d8c7ee00a687ac369e62e2032514a93a9b413502 third_party/pybind11
@@ -14,7 +14,7 @@
 a1390ed39ec77ecfb574bc6fcd5bfc5e3adbdea9 third_party/sdl2
 685f86471e9d26b3eb7676695a2e2cefb4551ae9 third_party/spirv_cross
 f8bf11a0253a32375c32cad92c841237b96696c0 third_party/spirv_headers
-3ea78d0fdd5402809e12d067b81dcd2a43cc8a45 third_party/tensorflow
+6468a1d17ae43c161e836bd3d1af081e8e44ef0d third_party/tensorflow
 d7059eca6351546d1f51e248fc75e49dfeee709e third_party/tracy
 9bd3f561bcee3f01d22912de10bb07ce4e23d378 third_party/vulkan_headers
 3528e2aed3e8808f33e1e7d63eeb1560456a605a third_party/vulkan_memory_allocator
diff --git a/WORKSPACE b/WORKSPACE
index af5b7be..c93b301 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -152,6 +152,17 @@
     path = "third_party/tensorflow",
 )
 
+# TF depends on tf_toolchains.
+http_archive(
+    name = "tf_toolchains",
+    sha256 = "4c4231037088ad3b56520712a370db45860100304eea2c1a2dfc9944db10da4f",
+    strip_prefix = "toolchains-1.1.3",
+    urls = [
+        "http://mirror.tensorflow.org/github.com/tensorflow/toolchains/archive/v1.1.3.tar.gz",
+        "https://github.com/tensorflow/toolchains/archive/v1.1.3.tar.gz",
+    ],
+)
+
 # Import all of the tensorflow dependencies.
 load("@org_tensorflow//tensorflow:workspace.bzl", "tf_repositories")
 ###############################################################################
diff --git a/integrations/tensorflow/compiler/dialect/tf_tensorlist/conversion/test/convert_tf_to_tf_tensorlist.mlir b/integrations/tensorflow/compiler/dialect/tf_tensorlist/conversion/test/convert_tf_to_tf_tensorlist.mlir
index 38f1aeb..1f08ff4 100644
--- a/integrations/tensorflow/compiler/dialect/tf_tensorlist/conversion/test/convert_tf_to_tf_tensorlist.mlir
+++ b/integrations/tensorflow/compiler/dialect/tf_tensorlist/conversion/test/convert_tf_to_tf_tensorlist.mlir
@@ -1,4 +1,4 @@
-// RUN: iree-tf-opt %s -pass-pipeline=convert-tf-to-tf_tensorlist -split-input-file -allow-unregistered-dialect -verify-diagnostics | IreeFileCheck %s
+// RUN: iree-tf-opt %s -pass-pipeline='func(convert-tf-to-tf_tensorlist)' -split-input-file -allow-unregistered-dialect -verify-diagnostics | IreeFileCheck %s
 
 // TODO(silvasean): Handle interprocedural conversion.
 
diff --git a/integrations/tensorflow/e2e/keras/layers/BUILD b/integrations/tensorflow/e2e/keras/layers/BUILD
index d13e515..43de7d9 100644
--- a/integrations/tensorflow/e2e/keras/layers/BUILD
+++ b/integrations/tensorflow/e2e/keras/layers/BUILD
@@ -119,7 +119,7 @@
     "Reshape",
     "SeparableConv1D",
     "SeparableConv2D",
-    "SimpleRNN",
+    # "SimpleRNN",  # TODO(meadowlark): Debug flakiness.
     "SimpleRNNCell",
     "Softmax",
     "SpatialDropout1D",
@@ -139,7 +139,6 @@
     {
         # Wrapping these in a tf.function appears to cause a keras bug.
         "layer": [
-            "ConvLSTM2D",
             "GRUCell",
             "LSTMCell",
             "SimpleRNNCell",
@@ -167,7 +166,6 @@
             "LocallyConnected2D",
             "Masking",
             "MultiHeadAttention",
-            "SimpleRNN",
             "UpSampling2D",
         ],
         "target_backends": [
@@ -268,7 +266,7 @@
     "MaxPool3D",
     "SeparableConv1D",
     "SeparableConv2D",
-    "SimpleRNN",
+    # "SimpleRNN",  # TODO(meadowlark): Debug flakiness.
 ]
 
 FAILING_FULL_API = [
@@ -498,7 +496,7 @@
     "LSTM",
     "LSTMCell",
     "MultiHeadAttention",
-    "SimpleRNN",
+    # "SimpleRNN",  # TODO(meadowlark): Debug flakiness.
     "SimpleRNNCell",
     "SpatialDropout1D",
     "SpatialDropout2D",
diff --git a/iree/compiler/Conversion/CodegenUtils/GetNumWorkgroups.h b/iree/compiler/Conversion/CodegenUtils/GetNumWorkgroups.h
index 0ce710f..e8cd9db 100644
--- a/iree/compiler/Conversion/CodegenUtils/GetNumWorkgroups.h
+++ b/iree/compiler/Conversion/CodegenUtils/GetNumWorkgroups.h
@@ -12,8 +12,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#ifndef MLIR_EDGE_BENCHMARKS_STRATEGIES_WORKGROUPCALULCATION_H_
-#define MLIR_EDGE_BENCHMARKS_STRATEGIES_WORKGROUPCALULCATION_H_
+#ifndef IREE_COMPILER_CONVERSION_CODEGENUTILS_GETNUMWORKGROUPS_H_
+#define IREE_COMPILER_CONVERSION_CODEGENUTILS_GETNUMWORKGROUPS_H_
 
 #include <cstdint>
 
@@ -94,4 +94,4 @@
 }  // namespace iree_compiler
 }  // namespace mlir
 
-#endif  // MLIR_EDGE_BENCHMARKS_STRATEGIES_WORKGROUPCALULCATION_H_
+#endif  // IREE_COMPILER_CONVERSION_CODEGENUTILS_GETNUMWORKGROUPS_H_
diff --git a/iree/compiler/Conversion/CodegenUtils/MatmulCodegenStrategy.cpp b/iree/compiler/Conversion/CodegenUtils/MatmulCodegenStrategy.cpp
index 654e421..43bbf3e 100644
--- a/iree/compiler/Conversion/CodegenUtils/MatmulCodegenStrategy.cpp
+++ b/iree/compiler/Conversion/CodegenUtils/MatmulCodegenStrategy.cpp
@@ -13,10 +13,8 @@
 // limitations under the License.
 
 // -----------------------------------------------------------------------------
-// This is a copy of the matmul strategy infrastructure existing in mlir_edge.
-// This version will be removed once this gets upstreamed to common mlir.
-// Please try to limit changes in this code only minor changes or make sure the
-// changes are applied in mlir_edge as well.
+// This code will be removed once this gets upstreamed to common mlir.
+// Please try to limit changes in this code only minor changes.
 
 #include "iree/compiler/Conversion/CodegenUtils/MatmulCodegenStrategy.h"
 
diff --git a/iree/compiler/Conversion/LinalgToSPIRV/KernelDispatchUtils.cpp b/iree/compiler/Conversion/LinalgToSPIRV/KernelDispatchUtils.cpp
index a233a8b..16d4510 100644
--- a/iree/compiler/Conversion/LinalgToSPIRV/KernelDispatchUtils.cpp
+++ b/iree/compiler/Conversion/LinalgToSPIRV/KernelDispatchUtils.cpp
@@ -407,14 +407,12 @@
   //   producer and consumer must match for the parallel loops.
   for (auto dependence :
        dependenceGraph.getDependentOperations(rootOperation.getValue())) {
-    Optional<unsigned> viewIndex =
-        rootOperation->getIndexOfShapedOperand(dependence.indexingView);
-    AffineMap indexingMap = rootOperation->getIndexingMap(*viewIndex);
+    unsigned viewIndex = dependence.indexingOpView.operandIndex;
+    AffineMap indexingMap = rootOperation->getIndexingMap(viewIndex);
     linalg::LinalgOp fusedOp =
         cast<linalg::LinalgOp>(dependence.dependentOpView.op);
-    Optional<unsigned> fusedViewIndex =
-        fusedOp.getIndexOfShapedOperand(dependence.dependentOpView.view);
-    AffineMap fusedIndexingMap = fusedOp.getIndexingMap(*fusedViewIndex);
+    unsigned fusedViewIndex = dependence.dependentOpView.operandIndex;
+    AffineMap fusedIndexingMap = fusedOp.getIndexingMap(fusedViewIndex);
     if (indexingMap.getNumResults() < numOuterParallel ||
         fusedIndexingMap.getNumResults() < numOuterParallel ||
         !llvm::all_of(
diff --git a/iree/compiler/Conversion/LinalgToSPIRV/VectorizeMemref.cpp b/iree/compiler/Conversion/LinalgToSPIRV/VectorizeMemref.cpp
index 9391676..53846d8 100644
--- a/iree/compiler/Conversion/LinalgToSPIRV/VectorizeMemref.cpp
+++ b/iree/compiler/Conversion/LinalgToSPIRV/VectorizeMemref.cpp
@@ -265,8 +265,8 @@
       ConversionPatternRewriter &rewriter) const override {
     auto memrefType = getVectorizedMemRefType(rewriter, alloc.getType());
     if (!memrefType) return failure();
-    Value newAlloc =
-        rewriter.create<AllocOp>(alloc.getLoc(), *memrefType, alloc.value());
+    Value newAlloc = rewriter.create<AllocOp>(alloc.getLoc(), *memrefType,
+                                              alloc.dynamicSizes());
     rewriter.replaceOp(alloc, newAlloc);
     return success();
   }
diff --git a/iree/compiler/Conversion/LinalgToVector/LoadStoreVectorization.cpp b/iree/compiler/Conversion/LinalgToVector/LoadStoreVectorization.cpp
index e5358c5..e23ee89 100644
--- a/iree/compiler/Conversion/LinalgToVector/LoadStoreVectorization.cpp
+++ b/iree/compiler/Conversion/LinalgToVector/LoadStoreVectorization.cpp
@@ -205,7 +205,7 @@
         /*initTensors*/ ValueRange{}, genericOp.indexing_mapsAttr(),
         genericOp.iterator_types(),
         /*doc=*/nullptr,
-        /*library_call=*/nullptr,
+        /*library_call=*/nullptr, genericOp.sparseAttr(),
         /*symbol_source=*/nullptr);
 
     Region &newRegion = newOp.region();
diff --git a/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/constant_ops.mlir b/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/constant_ops.mlir
index 17dae9c..4692292 100644
--- a/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/constant_ops.mlir
+++ b/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/constant_ops.mlir
@@ -13,8 +13,8 @@
 
 // CHECK: vm.global.ref @pool_storage0_buffer init(@pool_storage0_buffer_initializer) : !vm.ref<!hal.buffer>
 hal.variable @pool_storage0_buffer init(@pool_storage0_buffer_initializer) : !hal.buffer attributes {sym_visibility = "private"}
-// CHECK: vm.func @pool_storage0_buffer_initializer() -> !vm.ref<!hal.buffer>
-func @pool_storage0_buffer_initializer() -> !hal.buffer attributes {sym_visibility = "private"} {
+// CHECK: vm.func private @pool_storage0_buffer_initializer() -> !vm.ref<!hal.buffer>
+func private @pool_storage0_buffer_initializer() -> !hal.buffer {
   %c0 = constant 0 : index
   %c16 = constant 16 : index
   %dev = hal.ex.shared_device : !hal.device
@@ -32,8 +32,8 @@
 
 // CHECK: vm.global.ref @pool_splats init(@pool_splats_initializer) : !vm.ref<!hal.buffer>
 hal.variable @pool_splats init(@pool_splats_initializer) : !hal.buffer attributes {sym_visibility = "private"}
-// CHECK: vm.func @pool_splats_initializer() -> !vm.ref<!hal.buffer>
-func @pool_splats_initializer() -> !hal.buffer attributes {sym_visibility = "private"} {
+// CHECK: vm.func private @pool_splats_initializer() -> !vm.ref<!hal.buffer>
+func private @pool_splats_initializer() -> !hal.buffer {
   %c64 = constant 64 : index
   %c0 = constant 0 : index
   %c4 = constant 4 : index
diff --git a/iree/compiler/Dialect/VM/Analysis/test/register_allocation.mlir b/iree/compiler/Dialect/VM/Analysis/test/register_allocation.mlir
index b9dfe09..6f0aea7 100644
--- a/iree/compiler/Dialect/VM/Analysis/test/register_allocation.mlir
+++ b/iree/compiler/Dialect/VM/Analysis/test/register_allocation.mlir
@@ -1,4 +1,4 @@
-// RUN: iree-opt -split-input-file -pass-pipeline='vm.module(test-iree-vm-register-allocation)' %s | IreeFileCheck %s
+// RUN: iree-opt -split-input-file -pass-pipeline='vm.module(vm.func(test-iree-vm-register-allocation))' %s | IreeFileCheck %s
 
 // CHECK-LABEL: @module
 vm.module @module {
diff --git a/iree/compiler/Dialect/VM/Analysis/test/value_liveness.mlir b/iree/compiler/Dialect/VM/Analysis/test/value_liveness.mlir
index 3997bab..755dc67 100644
--- a/iree/compiler/Dialect/VM/Analysis/test/value_liveness.mlir
+++ b/iree/compiler/Dialect/VM/Analysis/test/value_liveness.mlir
@@ -1,4 +1,4 @@
-// RUN: iree-opt -split-input-file -pass-pipeline='vm.module(test-iree-vm-value-liveness)' %s | IreeFileCheck %s
+// RUN: iree-opt -split-input-file -pass-pipeline='vm.module(vm.func(test-iree-vm-value-liveness))' %s | IreeFileCheck %s
 
 // CHECK-LABEL: @module
 vm.module @module {
diff --git a/third_party/llvm-bazel b/third_party/llvm-bazel
index 2ad01e4..6d15aae 160000
--- a/third_party/llvm-bazel
+++ b/third_party/llvm-bazel
@@ -1 +1 @@
-Subproject commit 2ad01e4b485d8753600766d967d1a7358b98ddd3
+Subproject commit 6d15aaeb7ac6cb70b6c67f04a081939b5f121136
diff --git a/third_party/llvm-project b/third_party/llvm-project
index c8d73d9..a8db144 160000
--- a/third_party/llvm-project
+++ b/third_party/llvm-project
@@ -1 +1 @@
-Subproject commit c8d73d939fa4fda9c87b3979225d02d63062bd68
+Subproject commit a8db144169279332db59d30051f249efa0201ab3
diff --git a/third_party/tensorflow b/third_party/tensorflow
index 3ea78d0..6468a1d 160000
--- a/third_party/tensorflow
+++ b/third_party/tensorflow
@@ -1 +1 @@
-Subproject commit 3ea78d0fdd5402809e12d067b81dcd2a43cc8a45
+Subproject commit 6468a1d17ae43c161e836bd3d1af081e8e44ef0d