Merge pull request #2504 from ScottTodd:main-to-google

PiperOrigin-RevId: 321003958
diff --git a/README.md b/README.md
index e3e0b0b..e6de0e2 100644
--- a/README.md
+++ b/README.md
@@ -110,13 +110,13 @@
 
 ## Build Status
 
-CI System | Platform | Build System | Component       | Status
-:-------: | :------: | :----------: | :-------------: | :----:
-Kokoro    | Linux    | Bazel        | Core            | [![kokoro-status-linux-bazel-core](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/core/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/core/main_result.html)
-Kokoro    | Linux    | Bazel        | Bindings        | [![kokoro-status-linux-bazel-bindings](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/bindings/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/bindings/main_result.html)
-Kokoro    | Linux    | Bazel        | Integrations    | [![kokoro-status-linux-bazel-integrations](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/integrations/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/integrations/main_result.html)
-Kokoro    | Linux    | CMake        | Core + Bindings | [![kokoro-status-linux-cmake](https://storage.googleapis.com/iree-oss-build-badges/linux/cmake/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/cmake/main_result.html)
-Kokoro    | Android    | CMake        | Runtime (build only) | [![kokoro-status-android-cmake](https://storage.googleapis.com/iree-oss-build-badges/cmake/android/arm64-v8a/google_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/cmake/android/arm64-v8a/google_result.html)
+CI System | Platform | Build System | Component            | Status
+:-------: | :------: | :----------: | :------------------: | :----:
+Kokoro    | Linux    | Bazel        | Core                 | [![kokoro-status-linux-bazel-core](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/core/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/core/main_result.html)
+Kokoro    | Linux    | Bazel        | Bindings             | [![kokoro-status-linux-bazel-bindings](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/bindings/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/bindings/main_result.html)
+Kokoro    | Linux    | Bazel        | Integrations         | [![kokoro-status-linux-bazel-integrations](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/integrations/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/integrations/main_result.html)
+Kokoro    | Linux    | CMake        | Core + Bindings      | [![kokoro-status-linux-cmake](https://storage.googleapis.com/iree-oss-build-badges/linux/cmake/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/cmake/main_result.html)
+Kokoro    | Android  | CMake        | Runtime (build only) | [![kokoro-status-android-cmake](https://storage.googleapis.com/iree-oss-build-badges/cmake/android/arm64-v8a/google_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/cmake/android/arm64-v8a/google_result.html)
 
 ## License
 
diff --git a/SUBMODULE_VERSIONS b/SUBMODULE_VERSIONS
index d1217f6..5f8f8aa 100644
--- a/SUBMODULE_VERSIONS
+++ b/SUBMODULE_VERSIONS
@@ -3,7 +3,7 @@
 4c13807b7d43ff0946b7ffea0ae3aee9e611d778 third_party/dear_imgui
 a5d9d0f7d368054fd1691aedf1db4116efcc233e third_party/flatbuffers
 f2fb48c3b3d79a75a88a99fba6576b25d42ec528 third_party/googletest
-c2a61ef3885019c5e0444d8789de63e1ce4d5003 third_party/llvm-project
+6bda276f93023ae91937cb8a1f45bf27e5a3ced7 third_party/llvm-project
 17b12a4481daa150e2d1ea3ada086b551b856707 third_party/marl
 67f3ccebee84f3488b46a8d3ac005178c52ff264 third_party/mlir-emitc
 80d452484c5409444b0ec19383faa84bb7a4d351 third_party/pybind11
@@ -11,7 +11,7 @@
 b73f111094da3e380a1774b56b15f16c90ae8e23 third_party/sdl2
 f8bf11a0253a32375c32cad92c841237b96696c0 third_party/spirv_headers
 57eb48aed36160c4876bc8310d9ca84d42ee9e2a third_party/swiftshader
-585d8410613ad0d0551193e0ae1396864afdb69e third_party/tensorflow
+12b62d11b6f77ba6caeece562b54cf6f986f58e5 third_party/tensorflow
 864d86e8b6d21449474db5e9313dbff90aa9c24f third_party/tracy
 9bd3f561bcee3f01d22912de10bb07ce4e23d378 third_party/vulkan_headers
 909f36b714c9239ee0b112a321220213a474ba53 third_party/vulkan_memory_allocator
diff --git a/bindings/java/com/google/iree/native/context_wrapper.cc b/bindings/java/com/google/iree/native/context_wrapper.cc
index b585cef..f6c0448 100644
--- a/bindings/java/com/google/iree/native/context_wrapper.cc
+++ b/bindings/java/com/google/iree/native/context_wrapper.cc
@@ -28,5 +28,7 @@
 
 int ContextWrapper::id() const { return iree_vm_context_id(context_); }
 
+ContextWrapper::~ContextWrapper() { iree_vm_context_release(context_); }
+
 }  // namespace java
 }  // namespace iree
diff --git a/bindings/java/com/google/iree/native/context_wrapper.h b/bindings/java/com/google/iree/native/context_wrapper.h
index e8cc6d7..eb54ebd 100644
--- a/bindings/java/com/google/iree/native/context_wrapper.h
+++ b/bindings/java/com/google/iree/native/context_wrapper.h
@@ -28,6 +28,8 @@
 
   int id() const;
 
+  ~ContextWrapper();
+
  private:
   iree_vm_context_t* context_ = nullptr;
 };
diff --git a/bindings/java/com/google/iree/native/instance_wrapper.cc b/bindings/java/com/google/iree/native/instance_wrapper.cc
index 4d0f98b..0ba6a8e 100644
--- a/bindings/java/com/google/iree/native/instance_wrapper.cc
+++ b/bindings/java/com/google/iree/native/instance_wrapper.cc
@@ -43,5 +43,7 @@
 
 iree_vm_instance_t* InstanceWrapper::instance() const { return instance_; }
 
+InstanceWrapper::~InstanceWrapper() { iree_vm_instance_release(instance_); }
+
 }  // namespace java
 }  // namespace iree
diff --git a/bindings/java/com/google/iree/native/instance_wrapper.h b/bindings/java/com/google/iree/native/instance_wrapper.h
index 3ec72ab..e97bfc5 100644
--- a/bindings/java/com/google/iree/native/instance_wrapper.h
+++ b/bindings/java/com/google/iree/native/instance_wrapper.h
@@ -27,6 +27,8 @@
 
   iree_vm_instance_t* instance() const;
 
+  ~InstanceWrapper();
+
  private:
   iree_vm_instance_t* instance_ = nullptr;
 };
diff --git a/bindings/java/com/google/iree/native/module_wrapper.cc b/bindings/java/com/google/iree/native/module_wrapper.cc
index a36617f..15f1fa1 100644
--- a/bindings/java/com/google/iree/native/module_wrapper.cc
+++ b/bindings/java/com/google/iree/native/module_wrapper.cc
@@ -28,5 +28,7 @@
       IREE_LOC);
 }
 
+ModuleWrapper::~ModuleWrapper() { iree_vm_module_release(module_); }
+
 }  // namespace java
 }  // namespace iree
diff --git a/bindings/java/com/google/iree/native/module_wrapper.h b/bindings/java/com/google/iree/native/module_wrapper.h
index 95935fb..24097bc 100644
--- a/bindings/java/com/google/iree/native/module_wrapper.h
+++ b/bindings/java/com/google/iree/native/module_wrapper.h
@@ -25,6 +25,8 @@
  public:
   Status Create(const uint8_t* flatbuffer_data, iree_host_size_t length);
 
+  ~ModuleWrapper();
+
  private:
   iree_vm_module_t* module_ = nullptr;
 };
diff --git a/build_tools/bazel/third_party_import/llvm-project/overlay/mlir/BUILD.bazel b/build_tools/bazel/third_party_import/llvm-project/overlay/mlir/BUILD.bazel
index 5627067..18a7c4d 100644
--- a/build_tools/bazel/third_party_import/llvm-project/overlay/mlir/BUILD.bazel
+++ b/build_tools/bazel/third_party_import/llvm-project/overlay/mlir/BUILD.bazel
@@ -545,6 +545,7 @@
     deps = [
         ":Affine",
         ":AffinePassIncGen",
+        ":AffineUtils",
         ":Analysis",
         ":IR",
         ":Pass",
@@ -2768,6 +2769,7 @@
         "@llvm-project//mlir/test:TestDialect",
         "@llvm-project//mlir/test:TestIR",
         "@llvm-project//mlir/test:TestPass",
+        "@llvm-project//mlir/test:TestReducer",
         "@llvm-project//mlir/test:TestSPIRV",
         "@llvm-project//mlir/test:TestTransforms",
     ],
@@ -2916,6 +2918,7 @@
         "@llvm-project//mlir/test:TestDialect",
         "@llvm-project//mlir/test:TestIR",
         "@llvm-project//mlir/test:TestPass",
+        "@llvm-project//mlir/test:TestReducer",
         "@llvm-project//mlir/test:TestSPIRV",
         "@llvm-project//mlir/test:TestTransforms",
     ],
diff --git a/build_tools/bazel/third_party_import/llvm-project/overlay/mlir/test/BUILD.bazel b/build_tools/bazel/third_party_import/llvm-project/overlay/mlir/test/BUILD.bazel
index 4b999bf..e096605 100644
--- a/build_tools/bazel/third_party_import/llvm-project/overlay/mlir/test/BUILD.bazel
+++ b/build_tools/bazel/third_party_import/llvm-project/overlay/mlir/test/BUILD.bazel
@@ -168,6 +168,18 @@
 )
 
 cc_library(
+    name = "TestReducer",
+    srcs = [
+        "lib/Reducer/MLIRTestReducer.cpp",
+    ],
+    deps = [
+        "@llvm-project//mlir:IR",
+        "@llvm-project//mlir:Pass",
+        "@llvm-project//mlir:Support",
+    ],
+)
+
+cc_library(
     name = "TestTransforms",
     srcs = glob(["lib/Transforms/*.cpp"]),
     defines = ["MLIR_CUDA_CONVERSIONS_ENABLED"],
diff --git a/docs/GetStarted/cmake_options_and_variables.md b/docs/GetStarted/cmake_options_and_variables.md
index 69665d3..8e121fc 100644
--- a/docs/GetStarted/cmake_options_and_variables.md
+++ b/docs/GetStarted/cmake_options_and_variables.md
@@ -143,8 +143,8 @@
 cross-compiling, it's the artifact names being load-bearing. The artifact names
 are used to express dependencies across CMake invocation boundary (remember that
 we cannot access targets defined in another CMake invocation); the
-package-prefixed CMake target names are just custom targets depending on the host
-artifact.
+package-prefixed CMake target names are just custom targets depending on the
+host artifact.
 
 #### `IREE_HOST_BINARY_ROOT`:FILEPATH
 
diff --git a/integrations/tensorflow/e2e/README.md b/integrations/tensorflow/e2e/README.md
index 57d8d8e..deef755 100644
--- a/integrations/tensorflow/e2e/README.md
+++ b/integrations/tensorflow/e2e/README.md
@@ -23,7 +23,6 @@
 The test suites can be run excluding Vulkan by specifying
 `--test_tag_filters="-driver=vulkan"` in the `bazel test` invocation.
 
-
 ## Compiling `tf.Module`s
 
 Compatible TensorFlow modules can be compiled to specific IREE backends using
@@ -41,7 +40,6 @@
     exported_names=['predict'])
 ```
 
-
 ## Running tests
 
 For locally running tests and iterating on backend development, `bazel run` is
diff --git a/integrations/tensorflow/e2e/scatter_update_test.py b/integrations/tensorflow/e2e/scatter_update_test.py
index 66562b0..cdd3277 100644
--- a/integrations/tensorflow/e2e/scatter_update_test.py
+++ b/integrations/tensorflow/e2e/scatter_update_test.py
@@ -69,8 +69,7 @@
     tensor = tf.ones([4, 3], dtype=tf.int32)
     indices = tf.constant([[1]])
     updates = tf.constant([[2, 3, 4]])
-    result = self.get_module().scatter_update_2D_slice(
-        tensor, indices, updates)
+    result = self.get_module().scatter_update_2D_slice(tensor, indices, updates)
     result.assert_all_close()
 
 
diff --git a/iree/compiler/Conversion/LinalgToSPIRV/ConvertToSPIRVPass.cpp b/iree/compiler/Conversion/LinalgToSPIRV/ConvertToSPIRVPass.cpp
index 8a0e806..17e4ec7 100644
--- a/iree/compiler/Conversion/LinalgToSPIRV/ConvertToSPIRVPass.cpp
+++ b/iree/compiler/Conversion/LinalgToSPIRV/ConvertToSPIRVPass.cpp
@@ -218,7 +218,12 @@
     // TODO(thomasraoux): use coloumn major operand when TransfertRead +
     // TransposeOp.
     if (!op.permutation_map().isIdentity()) return failure();
-    if (op.masked()) return failure();
+    if (op.masked() &&
+        llvm::any_of(op.masked()->template cast<ArrayAttr>(),
+                     [](mlir::Attribute maskedDim) {
+                       return maskedDim.cast<BoolAttr>().getValue();
+                     }))
+      return failure();
     auto matType = spirv::CooperativeMatrixNVType::get(
         vecType.getElementType(), spirv::Scope::Subgroup, vecType.getDimSize(0),
         vecType.getDimSize(1));
diff --git a/third_party/llvm-project b/third_party/llvm-project
index c2a61ef..6bda276 160000
--- a/third_party/llvm-project
+++ b/third_party/llvm-project
@@ -1 +1 @@
-Subproject commit c2a61ef3885019c5e0444d8789de63e1ce4d5003
+Subproject commit 6bda276f93023ae91937cb8a1f45bf27e5a3ced7
diff --git a/third_party/tensorflow b/third_party/tensorflow
index 585d841..12b62d1 160000
--- a/third_party/tensorflow
+++ b/third_party/tensorflow
@@ -1 +1 @@
-Subproject commit 585d8410613ad0d0551193e0ae1396864afdb69e
+Subproject commit 12b62d11b6f77ba6caeece562b54cf6f986f58e5