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

PiperOrigin-RevId: 332123717
diff --git a/SUBMODULE_VERSIONS b/SUBMODULE_VERSIONS
index 3fc189e..a86dd8e 100644
--- a/SUBMODULE_VERSIONS
+++ b/SUBMODULE_VERSIONS
@@ -4,7 +4,7 @@
 a5d9d0f7d368054fd1691aedf1db4116efcc233e third_party/flatbuffers
 4fb0ff7069bd88ee85902f4d0bb62794e5f6d021 third_party/flatcc
 f2fb48c3b3d79a75a88a99fba6576b25d42ec528 third_party/googletest
-7841e21c98495ba5e33e0d2507d985bd5b938445 third_party/llvm-project
+85763e0758fbd238c81f233c6f9510e81c7de177 third_party/llvm-project
 17b12a4481daa150e2d1ea3ada086b551b856707 third_party/marl
 5dfc6b09104202d662efc7cb93d17c94eb269df7 third_party/mlir-emitc
 d8c7ee00a687ac369e62e2032514a93a9b413502 third_party/pybind11
@@ -12,7 +12,7 @@
 a1390ed39ec77ecfb574bc6fcd5bfc5e3adbdea9 third_party/sdl2
 f8bf11a0253a32375c32cad92c841237b96696c0 third_party/spirv_headers
 57eb48aed36160c4876bc8310d9ca84d42ee9e2a third_party/swiftshader
-d59e3e53cf2c3ad8db48463d0331df2fb55626d6 third_party/tensorflow
+ac057e43ce538c871081cc5cfbc5362b2068e270 third_party/tensorflow
 864d86e8b6d21449474db5e9313dbff90aa9c24f third_party/tracy
 9bd3f561bcee3f01d22912de10bb07ce4e23d378 third_party/vulkan_headers
 909f36b714c9239ee0b112a321220213a474ba53 third_party/vulkan_memory_allocator
diff --git a/build_tools/bazel/third_party_import/llvm-project/overlay/llvm/BUILD.bazel b/build_tools/bazel/third_party_import/llvm-project/overlay/llvm/BUILD.bazel
index c8f1c08..b4f18a9 100644
--- a/build_tools/bazel/third_party_import/llvm-project/overlay/llvm/BUILD.bazel
+++ b/build_tools/bazel/third_party_import/llvm-project/overlay/llvm/BUILD.bazel
@@ -2198,6 +2198,27 @@
 )
 
 cc_library(
+    name = "HelloNew",
+    srcs = glob([
+        "lib/Transforms/HelloNew/*.c",
+        "lib/Transforms/HelloNew/*.cpp",
+        "lib/Transforms/HelloNew/*.inc",
+        "lib/Transforms/HelloNew/*.h",
+    ]),
+    hdrs = glob([
+        "include/llvm/Transforms/HelloNew/*.h",
+        "include/llvm/Transforms/HelloNew/*.def",
+        "include/llvm/Transforms/HelloNew/*.inc",
+    ]),
+    copts = llvm_copts,
+    deps = [
+        ":Core",
+        ":Support",
+        ":config",
+    ],
+)
+
+cc_library(
     name = "HexagonAsmParser",
     srcs = glob([
         "lib/Target/Hexagon/AsmParser/*.c",
@@ -3343,6 +3364,7 @@
         ":CodeGen",
         ":Core",
         ":Coroutines",
+        ":HelloNew",
         ":IPO",
         ":InstCombine",
         ":Instrumentation",
diff --git a/docs/design_roadmap.md b/docs/design_roadmap.md
index ad4c613..a55072c 100644
--- a/docs/design_roadmap.md
+++ b/docs/design_roadmap.md
@@ -224,13 +224,13 @@
 the loaded value for a `flow.tensor.update` (or other operation):
 
 ```mlir
-  %index_tensor = flow.ex.stream.fragment(...) -> tensor<i32> { ... }
-  %index = flow.tensor.load %index_tensor : tensor<i32>
-  %result = flow.ex.stream.fragment(%arg0 = %index : i32, ...) -> ... {
-    %0 = flow.dispatch ...
-    %1 = flow.tensor.update %0, %arg2[%index] : tensor<10xf32> -> tensor<1x10xf32>
-    ...
-  }
+%index_tensor = flow.ex.stream.fragment(...) -> tensor<i32> { ... }
+%index = flow.tensor.load %index_tensor : tensor<i32>
+%result = flow.ex.stream.fragment(%arg0 = %index : i32, ...) -> ... {
+  %0 = flow.dispatch ...
+  %1 = flow.tensor.update %0, %arg2[%index] : tensor<10xf32> -> tensor<1x10xf32>
+  ...
+}
 ```
 
 Today the `flow.tensor.update` turns into HAL command buffer transfer operations
@@ -252,13 +252,13 @@
 follows exactly what one would do if recording commands in C:
 
 ```c++
-  vkCmdCopyBuffer(cmd, ...);
-  if (some_flag) {
-    vkCmdBindPipeline(cmd, ..., pipeline_a);
-  } else {
-    vkCmdBindPipeline(cmd, ..., pipeline_b);
-  }
-  vkCmdDispatch(cmd, ...);
+vkCmdCopyBuffer(cmd, ...);
+if (some_flag) {
+  vkCmdBindPipeline(cmd, ..., pipeline_a);
+} else {
+  vkCmdBindPipeline(cmd, ..., pipeline_b);
+}
+vkCmdDispatch(cmd, ...);
 ```
 
 The corresponding `flow` IR:
diff --git a/docs/developing_iree/benchmarking.md b/docs/developing_iree/benchmarking.md
index 6a0b974..4de35dd 100644
--- a/docs/developing_iree/benchmarking.md
+++ b/docs/developing_iree/benchmarking.md
@@ -141,7 +141,6 @@
 
 ```
 Package glfw3 was not found in the pkg-config search path.
-
 ```
 
 and then you could try to install `libglfw3-dev`.
diff --git a/experimental/ModelBuilder/test/BUILD b/experimental/ModelBuilder/test/BUILD
index 64a88a9..9c6c084 100644
--- a/experimental/ModelBuilder/test/BUILD
+++ b/experimental/ModelBuilder/test/BUILD
@@ -27,7 +27,10 @@
     name = "lit",
     srcs = glob(
         ["*.cpp"],
-        exclude = ["Bench*"],
+        exclude = [
+            "Bench*",
+            "TestMatMulVulkan.cpp",  # b/168746423
+        ],
     ),
     data = [
         # runtime libraries
diff --git a/integrations/tensorflow/compiler/dialect/tf_strings/ir/base.td b/integrations/tensorflow/compiler/dialect/tf_strings/ir/base.td
index 3bb8836..552ee4f 100644
--- a/integrations/tensorflow/compiler/dialect/tf_strings/ir/base.td
+++ b/integrations/tensorflow/compiler/dialect/tf_strings/ir/base.td
@@ -23,7 +23,7 @@
 
 def TFStrings_Dialect : Dialect {
   let name = "tf_strings";
-  let cppNamespace = "tf_strings";
+  let cppNamespace = "::mlir::iree_compiler::tf_strings";
   let summary = [{
     A strings dialect for simplifying tensorflow string operations.
   }];
diff --git a/integrations/tensorflow/compiler/dialect/tf_strings/ir/ops.cpp b/integrations/tensorflow/compiler/dialect/tf_strings/ir/ops.cpp
index 476d688..b442d43 100644
--- a/integrations/tensorflow/compiler/dialect/tf_strings/ir/ops.cpp
+++ b/integrations/tensorflow/compiler/dialect/tf_strings/ir/ops.cpp
@@ -24,14 +24,14 @@
 #include "mlir/IR/OpImplementation.h"
 #include "mlir/IR/PatternMatch.h"
 
-namespace mlir {
-namespace iree_compiler {
-namespace tf_strings {
-
 #define GET_OP_CLASSES
 #include "integrations/tensorflow/compiler/dialect/tf_strings/ir/ops.cpp.inc"
 #undef GET_OP_CLASSES
 
+namespace mlir {
+namespace iree_compiler {
+namespace tf_strings {
+
 void ToStringOp::build(OpBuilder& builder, OperationState& tblgen_state,
                        Value value) {
   build(builder, tblgen_state, StringType::get(builder.getContext()), value);
diff --git a/integrations/tensorflow/compiler/dialect/tf_strings/ir/ops.h b/integrations/tensorflow/compiler/dialect/tf_strings/ir/ops.h
index 0fa8d4b..c6e4d7e 100644
--- a/integrations/tensorflow/compiler/dialect/tf_strings/ir/ops.h
+++ b/integrations/tensorflow/compiler/dialect/tf_strings/ir/ops.h
@@ -29,16 +29,8 @@
 #include "mlir/IR/TypeUtilities.h"
 #include "mlir/Interfaces/CallInterfaces.h"
 
-namespace mlir {
-namespace iree_compiler {
-namespace tf_strings {
-
 #define GET_OP_CLASSES
 #include "integrations/tensorflow/compiler/dialect/tf_strings/ir/ops.h.inc"
 #undef GET_OP_CLASSES
 
-}  // namespace tf_strings
-}  // namespace iree_compiler
-}  // namespace mlir
-
 #endif  // INTEGRATIONS_TENSORFLOW_COMPILER_DIALECT_TFSTRINGS_IR_OPS_H_
diff --git a/integrations/tensorflow/compiler/dialect/tf_tensorlist/ir/tf_tensorlist_base.td b/integrations/tensorflow/compiler/dialect/tf_tensorlist/ir/tf_tensorlist_base.td
index e09cb56..880f86d 100644
--- a/integrations/tensorflow/compiler/dialect/tf_tensorlist/ir/tf_tensorlist_base.td
+++ b/integrations/tensorflow/compiler/dialect/tf_tensorlist/ir/tf_tensorlist_base.td
@@ -31,7 +31,7 @@
     This allows representing the TensorList construct with greater fidelity.
   }];
 
-  let cppNamespace = "tf_tensorlist";
+  let cppNamespace = "::mlir::tf_tensorlist";
 }
 
 def TfTensorList_TensorList :
diff --git a/integrations/tensorflow/compiler/dialect/tf_tensorlist/ir/tf_tensorlist_ops.cc b/integrations/tensorflow/compiler/dialect/tf_tensorlist/ir/tf_tensorlist_ops.cc
index d616e05..1ba95b4 100644
--- a/integrations/tensorflow/compiler/dialect/tf_tensorlist/ir/tf_tensorlist_ops.cc
+++ b/integrations/tensorflow/compiler/dialect/tf_tensorlist/ir/tf_tensorlist_ops.cc
@@ -16,11 +16,5 @@
 
 #include "mlir/IR/Builders.h"
 
-namespace mlir {
-namespace tf_tensorlist {
-
 #define GET_OP_CLASSES
 #include "integrations/tensorflow/compiler/dialect/tf_tensorlist/ir/tf_tensorlist_ops.cc.inc"
-
-}  // namespace tf_tensorlist
-}  // namespace mlir
diff --git a/integrations/tensorflow/compiler/dialect/tf_tensorlist/ir/tf_tensorlist_ops.h b/integrations/tensorflow/compiler/dialect/tf_tensorlist/ir/tf_tensorlist_ops.h
index 176fa6d..0250f0a 100644
--- a/integrations/tensorflow/compiler/dialect/tf_tensorlist/ir/tf_tensorlist_ops.h
+++ b/integrations/tensorflow/compiler/dialect/tf_tensorlist/ir/tf_tensorlist_ops.h
@@ -21,14 +21,8 @@
 #include "mlir/Interfaces/SideEffectInterfaces.h"
 #include "tensorflow/compiler/mlir/tensorflow/ir/tf_types.h"
 
-namespace mlir {
-namespace tf_tensorlist {
-
 // Declares the operations for this dialect using the generated header.
 #define GET_OP_CLASSES
 #include "integrations/tensorflow/compiler/dialect/tf_tensorlist/ir/tf_tensorlist_ops.h.inc"
 
-}  // namespace tf_tensorlist
-}  // namespace mlir
-
 #endif  // IREE_INTEGRATIONS_TENSORFLOW_COMPILER_TF_TENSORLIST_OPS_H_
diff --git a/iree/compiler/Dialect/Flow/IR/FlowBase.td b/iree/compiler/Dialect/Flow/IR/FlowBase.td
index fd5aa39..543ed3e 100644
--- a/iree/compiler/Dialect/Flow/IR/FlowBase.td
+++ b/iree/compiler/Dialect/Flow/IR/FlowBase.td
@@ -23,7 +23,7 @@
 
 def FLOW_Dialect : Dialect {
   let name = "flow";
-  let cppNamespace = "IREE::Flow";
+  let cppNamespace = "::mlir::iree_compiler::IREE::Flow";
 
   let summary = [{
     A dialect designed to model execution data flow and partitioning.
diff --git a/iree/compiler/Dialect/Flow/IR/FlowOps.cpp b/iree/compiler/Dialect/Flow/IR/FlowOps.cpp
index 1483c07..5dbb3d8 100644
--- a/iree/compiler/Dialect/Flow/IR/FlowOps.cpp
+++ b/iree/compiler/Dialect/Flow/IR/FlowOps.cpp
@@ -721,14 +721,14 @@
                           /*elidedAttrs=*/{});
 }
 
+}  // namespace Flow
+}  // namespace IREE
+}  // namespace iree_compiler
+}  // namespace mlir
+
 //===----------------------------------------------------------------------===//
 // TableGen definitions (intentionally last)
 //===----------------------------------------------------------------------===//
 
 #define GET_OP_CLASSES
 #include "iree/compiler/Dialect/Flow/IR/FlowOps.cpp.inc"
-
-}  // namespace Flow
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
diff --git a/iree/compiler/Dialect/Flow/IR/FlowOps.h b/iree/compiler/Dialect/Flow/IR/FlowOps.h
index a35a1ae..7cbba48 100644
--- a/iree/compiler/Dialect/Flow/IR/FlowOps.h
+++ b/iree/compiler/Dialect/Flow/IR/FlowOps.h
@@ -30,17 +30,7 @@
 #include "mlir/IR/SymbolTable.h"
 #include "mlir/Interfaces/SideEffectInterfaces.h"
 
-namespace mlir {
-namespace iree_compiler {
-namespace IREE {
-namespace Flow {
-
 #define GET_OP_CLASSES
 #include "iree/compiler/Dialect/Flow/IR/FlowOps.h.inc"
 
-}  // namespace Flow
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
-
 #endif  // IREE_COMPILER_DIALECT_FLOW_IR_FLOWOPS_H_
diff --git a/iree/compiler/Dialect/HAL/IR/HALBase.td b/iree/compiler/Dialect/HAL/IR/HALBase.td
index f3bb22f..4dd4c6d 100644
--- a/iree/compiler/Dialect/HAL/IR/HALBase.td
+++ b/iree/compiler/Dialect/HAL/IR/HALBase.td
@@ -23,7 +23,7 @@
 
 def HAL_Dialect : Dialect {
   let name = "hal";
-  let cppNamespace = "IREE::HAL";
+  let cppNamespace = "::mlir::iree_compiler::IREE::HAL";
 
   let summary = [{
     A dialect representing operations against the IREE HAL.
diff --git a/iree/compiler/Dialect/HAL/IR/HALOps.cpp b/iree/compiler/Dialect/HAL/IR/HALOps.cpp
index 540234b..7faa03b 100644
--- a/iree/compiler/Dialect/HAL/IR/HALOps.cpp
+++ b/iree/compiler/Dialect/HAL/IR/HALOps.cpp
@@ -1508,14 +1508,14 @@
   setNameFn(result(), "semaphore");
 }
 
+}  // namespace HAL
+}  // namespace IREE
+}  // namespace iree_compiler
+}  // namespace mlir
+
 //===----------------------------------------------------------------------===//
 // TableGen definitions (intentionally last)
 //===----------------------------------------------------------------------===//
 
 #define GET_OP_CLASSES
 #include "iree/compiler/Dialect/HAL/IR/HALOps.cpp.inc"
-
-}  // namespace HAL
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
diff --git a/iree/compiler/Dialect/HAL/IR/HALOps.h b/iree/compiler/Dialect/HAL/IR/HALOps.h
index e732e27..e9945a0 100644
--- a/iree/compiler/Dialect/HAL/IR/HALOps.h
+++ b/iree/compiler/Dialect/HAL/IR/HALOps.h
@@ -29,17 +29,7 @@
 #include "mlir/IR/SymbolTable.h"
 #include "mlir/Interfaces/SideEffectInterfaces.h"
 
-namespace mlir {
-namespace iree_compiler {
-namespace IREE {
-namespace HAL {
-
 #define GET_OP_CLASSES
 #include "iree/compiler/Dialect/HAL/IR/HALOps.h.inc"
 
-}  // namespace HAL
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
-
 #endif  // IREE_COMPILER_DIALECT_HAL_IR_HALOPS_H_
diff --git a/iree/compiler/Dialect/IREE/IR/IREEBase.td b/iree/compiler/Dialect/IREE/IR/IREEBase.td
index 6b640c2..2830a12 100644
--- a/iree/compiler/Dialect/IREE/IR/IREEBase.td
+++ b/iree/compiler/Dialect/IREE/IR/IREEBase.td
@@ -24,7 +24,7 @@
 // TODO(b/143787186): rename when old dialects are removed.
 def IREE_Dialect : Dialect {
   let name = "iree";
-  let cppNamespace = "IREE";
+  let cppNamespace = "::mlir::iree_compiler::IREE";
 
   let summary = [{
     A dialect used for types common across IREE subdialects.
diff --git a/iree/compiler/Dialect/IREE/IR/IREEOps.cpp b/iree/compiler/Dialect/IREE/IR/IREEOps.cpp
index 1c8e8c5..bf48b9f 100644
--- a/iree/compiler/Dialect/IREE/IR/IREEOps.cpp
+++ b/iree/compiler/Dialect/IREE/IR/IREEOps.cpp
@@ -150,9 +150,9 @@
   results.insert<ExpandUnfoldableConstantOp>(context);
 }
 
-#define GET_OP_CLASSES
-#include "iree/compiler/Dialect/IREE/IR/IREEOps.cpp.inc"
-
 }  // namespace IREE
 }  // namespace iree_compiler
 }  // namespace mlir
+
+#define GET_OP_CLASSES
+#include "iree/compiler/Dialect/IREE/IR/IREEOps.cpp.inc"
diff --git a/iree/compiler/Dialect/IREE/IR/IREEOps.h b/iree/compiler/Dialect/IREE/IR/IREEOps.h
index 06aa4da..be304e9 100644
--- a/iree/compiler/Dialect/IREE/IR/IREEOps.h
+++ b/iree/compiler/Dialect/IREE/IR/IREEOps.h
@@ -21,15 +21,7 @@
 #include "mlir/IR/StandardTypes.h"
 #include "mlir/Interfaces/SideEffectInterfaces.h"
 
-namespace mlir {
-namespace iree_compiler {
-namespace IREE {
-
 #define GET_OP_CLASSES
 #include "iree/compiler/Dialect/IREE/IR/IREEOps.h.inc"
 
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
-
 #endif  // IREE_COMPILER_DIALECT_IREE_IR_IREEOPS_H_
diff --git a/iree/compiler/Dialect/Modules/Check/IR/CheckOps.cpp b/iree/compiler/Dialect/Modules/Check/IR/CheckOps.cpp
index 64de628..52fb048 100644
--- a/iree/compiler/Dialect/Modules/Check/IR/CheckOps.cpp
+++ b/iree/compiler/Dialect/Modules/Check/IR/CheckOps.cpp
@@ -49,10 +49,10 @@
           context);
 }
 
-#define GET_OP_CLASSES
-#include "iree/compiler/Dialect/Modules/Check/IR/CheckOps.cpp.inc"
-
 }  // namespace Check
 }  // namespace IREE
 }  // namespace iree_compiler
 }  // namespace mlir
+
+#define GET_OP_CLASSES
+#include "iree/compiler/Dialect/Modules/Check/IR/CheckOps.cpp.inc"
diff --git a/iree/compiler/Dialect/Modules/Check/IR/CheckOps.h b/iree/compiler/Dialect/Modules/Check/IR/CheckOps.h
index 55c5c93..cd66f93 100644
--- a/iree/compiler/Dialect/Modules/Check/IR/CheckOps.h
+++ b/iree/compiler/Dialect/Modules/Check/IR/CheckOps.h
@@ -18,17 +18,7 @@
 #include "mlir/IR/OpDefinition.h"
 #include "mlir/IR/StandardTypes.h"
 
-namespace mlir {
-namespace iree_compiler {
-namespace IREE {
-namespace Check {
-
 #define GET_OP_CLASSES
 #include "iree/compiler/Dialect/Modules/Check/IR/CheckOps.h.inc"
 
-}  // namespace Check
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
-
 #endif  // IREE_COMPILER_DIALECT_MODULES_CHECK_IR_CHECK_OPS_H_
diff --git a/iree/compiler/Dialect/Modules/Check/IR/CheckOps.td b/iree/compiler/Dialect/Modules/Check/IR/CheckOps.td
index 6df6567..7286ba1 100644
--- a/iree/compiler/Dialect/Modules/Check/IR/CheckOps.td
+++ b/iree/compiler/Dialect/Modules/Check/IR/CheckOps.td
@@ -20,7 +20,7 @@
 
 def CHECK_Dialect : Dialect {
   let name = "check";
-  let cppNamespace = "IREE::Check";
+  let cppNamespace = "::mlir::iree_compiler::IREE::Check";
   let summary = [{
     A dialect implementing test assertions for IREE modules.
   }];
diff --git a/iree/compiler/Dialect/Modules/Strings/IR/Ops.cc b/iree/compiler/Dialect/Modules/Strings/IR/Ops.cc
index f20abc2..06aa097 100644
--- a/iree/compiler/Dialect/Modules/Strings/IR/Ops.cc
+++ b/iree/compiler/Dialect/Modules/Strings/IR/Ops.cc
@@ -23,15 +23,5 @@
 #include "mlir/Parser.h"
 #include "mlir/Transforms/DialectConversion.h"
 
-namespace mlir {
-namespace iree_compiler {
-namespace IREE {
-namespace Strings {
-
 #define GET_OP_CLASSES
 #include "iree/compiler/Dialect/Modules/Strings/IR/Ops.cc.inc"
-
-}  // namespace Strings
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
diff --git a/iree/compiler/Dialect/Modules/Strings/IR/Ops.h b/iree/compiler/Dialect/Modules/Strings/IR/Ops.h
index a76be5d..6020039 100644
--- a/iree/compiler/Dialect/Modules/Strings/IR/Ops.h
+++ b/iree/compiler/Dialect/Modules/Strings/IR/Ops.h
@@ -21,17 +21,7 @@
 #include "mlir/IR/OpDefinition.h"
 #include "mlir/Interfaces/SideEffectInterfaces.h"
 
-namespace mlir {
-namespace iree_compiler {
-namespace IREE {
-namespace Strings {
-
 #define GET_OP_CLASSES
 #include "iree/compiler/Dialect/Modules/Strings/IR/Ops.h.inc"
 
-}  // namespace Strings
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
-
 #endif  // IREE_COMPILER_DIALECT_MODULES_STRINGS_IR_OPS_H_
diff --git a/iree/compiler/Dialect/Modules/Strings/IR/Ops.td b/iree/compiler/Dialect/Modules/Strings/IR/Ops.td
index 7a1c346..4e2b44b 100644
--- a/iree/compiler/Dialect/Modules/Strings/IR/Ops.td
+++ b/iree/compiler/Dialect/Modules/Strings/IR/Ops.td
@@ -22,7 +22,7 @@
 
 def STRINGS_Dialect : Dialect {
   let name = "strings";
-  let cppNamespace = "IREE::Strings";
+  let cppNamespace = "::mlir::iree_compiler::IREE::Strings";
 
   let summary = [{
     A custom dialect supporting string operations.
diff --git a/iree/compiler/Dialect/Modules/TensorList/IR/TensorListBase.td b/iree/compiler/Dialect/Modules/TensorList/IR/TensorListBase.td
index 291298b..6fe79ce 100644
--- a/iree/compiler/Dialect/Modules/TensorList/IR/TensorListBase.td
+++ b/iree/compiler/Dialect/Modules/TensorList/IR/TensorListBase.td
@@ -19,7 +19,7 @@
 
 def TensorList_Dialect : Dialect {
   let name = "tensorlist";
-  let cppNamespace = "IREE::TensorList";
+  let cppNamespace = "::mlir::iree_compiler::IREE::TensorList";
 
   let summary = [{
     A dialect for implementing TensorFlow's TensorList data structure.
diff --git a/iree/compiler/Dialect/Modules/TensorList/IR/TensorListOps.cpp b/iree/compiler/Dialect/Modules/TensorList/IR/TensorListOps.cpp
index ebc1f91..04ea528 100644
--- a/iree/compiler/Dialect/Modules/TensorList/IR/TensorListOps.cpp
+++ b/iree/compiler/Dialect/Modules/TensorList/IR/TensorListOps.cpp
@@ -16,15 +16,5 @@
 
 #include "iree/compiler/Dialect/HAL/IR/HALTypes.h"
 
-namespace mlir {
-namespace iree_compiler {
-namespace IREE {
-namespace TensorList {
-
 #define GET_OP_CLASSES
 #include "iree/compiler/Dialect/Modules/TensorList/IR/TensorListOps.cpp.inc"
-
-}  // namespace TensorList
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
diff --git a/iree/compiler/Dialect/Modules/TensorList/IR/TensorListOps.h b/iree/compiler/Dialect/Modules/TensorList/IR/TensorListOps.h
index dae0ea5..d39ffa2 100644
--- a/iree/compiler/Dialect/Modules/TensorList/IR/TensorListOps.h
+++ b/iree/compiler/Dialect/Modules/TensorList/IR/TensorListOps.h
@@ -18,17 +18,7 @@
 #include "iree/compiler/Dialect/Modules/TensorList/IR/TensorListTypes.h"
 #include "mlir/IR/OpDefinition.h"
 
-namespace mlir {
-namespace iree_compiler {
-namespace IREE {
-namespace TensorList {
-
 #define GET_OP_CLASSES
 #include "iree/compiler/Dialect/Modules/TensorList/IR/TensorListOps.h.inc"
 
-}  // namespace TensorList
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
-
 #endif  // IREE_COMPILER_DIALECT_MODULES_TENSORLIST_IR_TENSORLISTOPS_H_
diff --git a/iree/compiler/Dialect/Sequence/IR/SequenceBase.td b/iree/compiler/Dialect/Sequence/IR/SequenceBase.td
index df97d6d..caedb75 100644
--- a/iree/compiler/Dialect/Sequence/IR/SequenceBase.td
+++ b/iree/compiler/Dialect/Sequence/IR/SequenceBase.td
@@ -25,7 +25,7 @@
 
 def SEQUENCE_Dialect : Dialect {
   let name = "sequence";
-  let cppNamespace = "IREE::Sequence";
+  let cppNamespace = "::mlir::iree_compiler::IREE::Sequence";
 
   let summary = [{
     A dialect designed to model iterable sequences.
diff --git a/iree/compiler/Dialect/Sequence/IR/SequenceOps.cpp b/iree/compiler/Dialect/Sequence/IR/SequenceOps.cpp
index 6da86c5..2631045 100644
--- a/iree/compiler/Dialect/Sequence/IR/SequenceOps.cpp
+++ b/iree/compiler/Dialect/Sequence/IR/SequenceOps.cpp
@@ -74,14 +74,14 @@
   return success();
 }
 
+}  // namespace Sequence
+}  // namespace IREE
+}  // namespace iree_compiler
+}  // namespace mlir
+
 //===----------------------------------------------------------------------===//
 // TableGen definitions (intentionally last)
 //===----------------------------------------------------------------------===//
 
 #define GET_OP_CLASSES
 #include "iree/compiler/Dialect/Sequence/IR/SequenceOps.cpp.inc"
-
-}  // namespace Sequence
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
diff --git a/iree/compiler/Dialect/Sequence/IR/SequenceOps.h b/iree/compiler/Dialect/Sequence/IR/SequenceOps.h
index d4804e6..9158370 100644
--- a/iree/compiler/Dialect/Sequence/IR/SequenceOps.h
+++ b/iree/compiler/Dialect/Sequence/IR/SequenceOps.h
@@ -18,17 +18,7 @@
 #include "iree/compiler/Dialect/Sequence/IR/SequenceDialect.h"
 #include "iree/compiler/Dialect/Sequence/IR/SequenceTypes.h"
 
-namespace mlir {
-namespace iree_compiler {
-namespace IREE {
-namespace Sequence {
-
 #define GET_OP_CLASSES
 #include "iree/compiler/Dialect/Sequence/IR/SequenceOps.h.inc"
 
-}  // namespace Sequence
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
-
 #endif  // IREE_COMPILER_DIALECT_SEQUENCE_IR_SEQUENCEOPS_H_
diff --git a/iree/compiler/Dialect/Shape/IR/ShapeBase.td b/iree/compiler/Dialect/Shape/IR/ShapeBase.td
index 17bb129..180c7ac 100644
--- a/iree/compiler/Dialect/Shape/IR/ShapeBase.td
+++ b/iree/compiler/Dialect/Shape/IR/ShapeBase.td
@@ -24,7 +24,7 @@
 // TODO(b/143787186): rename when old dialects are removed.
 def Shape_Dialect : Dialect {
   let name = "shapex";
-  let cppNamespace = "Shape";
+  let cppNamespace = "::mlir::iree_compiler::Shape";
 
   let summary = [{
     A dialect of helper ops for shapifying computations.
diff --git a/iree/compiler/Dialect/Shape/IR/ShapeOps.cpp b/iree/compiler/Dialect/Shape/IR/ShapeOps.cpp
index 1afc5ca..abe9c60 100644
--- a/iree/compiler/Dialect/Shape/IR/ShapeOps.cpp
+++ b/iree/compiler/Dialect/Shape/IR/ShapeOps.cpp
@@ -342,9 +342,9 @@
       verifyCompatibleShape(lhsRs.getAllDims(), rhsRs.getAllDims()));
 }
 
-#define GET_OP_CLASSES
-#include "iree/compiler/Dialect/Shape/IR/ShapeOps.cpp.inc"
-
 }  // namespace Shape
 }  // namespace iree_compiler
 }  // namespace mlir
+
+#define GET_OP_CLASSES
+#include "iree/compiler/Dialect/Shape/IR/ShapeOps.cpp.inc"
diff --git a/iree/compiler/Dialect/Shape/IR/ShapeOps.h b/iree/compiler/Dialect/Shape/IR/ShapeOps.h
index dda6de2..d3d71c5 100644
--- a/iree/compiler/Dialect/Shape/IR/ShapeOps.h
+++ b/iree/compiler/Dialect/Shape/IR/ShapeOps.h
@@ -35,11 +35,11 @@
 void populateFoldConversionPatterns(MLIRContext *context,
                                     OwningRewritePatternList &patterns);
 
-#define GET_OP_CLASSES
-#include "iree/compiler/Dialect/Shape/IR/ShapeOps.h.inc"
-
 }  // namespace Shape
 }  // namespace iree_compiler
 }  // namespace mlir
 
+#define GET_OP_CLASSES
+#include "iree/compiler/Dialect/Shape/IR/ShapeOps.h.inc"
+
 #endif  // IREE_COMPILER_DIALECT_SHAPE_IR_SHAPEOPS_H_
diff --git a/iree/compiler/Dialect/VM/IR/VMBase.td b/iree/compiler/Dialect/VM/IR/VMBase.td
index 0afa898..44836e6 100644
--- a/iree/compiler/Dialect/VM/IR/VMBase.td
+++ b/iree/compiler/Dialect/VM/IR/VMBase.td
@@ -23,7 +23,7 @@
 
 def VM_Dialect : Dialect {
   let name = "vm";
-  let cppNamespace = "IREE::VM";
+  let cppNamespace = "::mlir::iree_compiler::IREE::VM";
 
   let summary = [{
     A dialect representing operations against an abstract virtual machine.
diff --git a/iree/compiler/Dialect/VM/IR/VMOps.cpp b/iree/compiler/Dialect/VM/IR/VMOps.cpp
index cc23e39..6548173 100644
--- a/iree/compiler/Dialect/VM/IR/VMOps.cpp
+++ b/iree/compiler/Dialect/VM/IR/VMOps.cpp
@@ -1087,15 +1087,15 @@
   return destOperandsMutable();
 }
 
-//===----------------------------------------------------------------------===//
-// TableGen definitions (intentionally last)
-//===----------------------------------------------------------------------===//
-
-#define GET_OP_CLASSES
-#include "iree/compiler/Dialect/VM/IR/VMOpEncoder.cpp.inc"
-#include "iree/compiler/Dialect/VM/IR/VMOps.cpp.inc"
-
 }  // namespace VM
 }  // namespace IREE
 }  // namespace iree_compiler
 }  // namespace mlir
+
+//===----------------------------------------------------------------------===//
+// TableGen definitions (intentionally last)
+//===----------------------------------------------------------------------===//
+
+#include "iree/compiler/Dialect/VM/IR/VMOpEncoder.cpp.inc"
+#define GET_OP_CLASSES
+#include "iree/compiler/Dialect/VM/IR/VMOps.cpp.inc"
diff --git a/iree/compiler/Dialect/VM/IR/VMOps.h b/iree/compiler/Dialect/VM/IR/VMOps.h
index ab411b1..06b27a1 100644
--- a/iree/compiler/Dialect/VM/IR/VMOps.h
+++ b/iree/compiler/Dialect/VM/IR/VMOps.h
@@ -31,17 +31,7 @@
 #include "mlir/Interfaces/ControlFlowInterfaces.h"
 #include "mlir/Interfaces/SideEffectInterfaces.h"
 
-namespace mlir {
-namespace iree_compiler {
-namespace IREE {
-namespace VM {
-
 #define GET_OP_CLASSES
 #include "iree/compiler/Dialect/VM/IR/VMOps.h.inc"
 
-}  // namespace VM
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
-
 #endif  // IREE_COMPILER_DIALECT_VM_IR_VMOPS_H_
diff --git a/iree/compiler/Dialect/VM/Tools/VMOpEncoderGen.cpp b/iree/compiler/Dialect/VM/Tools/VMOpEncoderGen.cpp
index 724f316..d92af74 100644
--- a/iree/compiler/Dialect/VM/Tools/VMOpEncoderGen.cpp
+++ b/iree/compiler/Dialect/VM/Tools/VMOpEncoderGen.cpp
@@ -48,12 +48,13 @@
     if (encodingExprs.empty()) continue;
 
     Operator op(def);
+    Operator::NamespaceEmitter emitter(os, op);
     os << formatv(
         "LogicalResult {0}::encode(SymbolTable &syms, VMFuncEncoder &e) {{\n",
-        op.getQualCppClassName());
+        op.getCppClassName());
 
     for (auto &pair : prefixOpcodes) {
-      std::string traitName = (StringRef("OpTrait::IREE::VM::") +
+      std::string traitName = (StringRef("::mlir::OpTrait::IREE::VM::") +
                                pair.first.substr(strlen("Prefix")))
                                   .str();
       if (op.getTrait(traitName)) {
diff --git a/iree/compiler/Dialect/VMLA/IR/VMLABase.td b/iree/compiler/Dialect/VMLA/IR/VMLABase.td
index 7aad523..c12e2bc 100644
--- a/iree/compiler/Dialect/VMLA/IR/VMLABase.td
+++ b/iree/compiler/Dialect/VMLA/IR/VMLABase.td
@@ -24,7 +24,7 @@
 
 def VMLA_Dialect : Dialect {
   let name = "vmla";
-  let cppNamespace = "IREE::VMLA";
+  let cppNamespace = "::mlir::iree_compiler::IREE::VMLA";
 
   let summary = [{
     A dialect representing operations against the IREE VM-based backend.
diff --git a/iree/compiler/Dialect/VMLA/IR/VMLAOps.cpp b/iree/compiler/Dialect/VMLA/IR/VMLAOps.cpp
index f6e61b7..eefc949 100644
--- a/iree/compiler/Dialect/VMLA/IR/VMLAOps.cpp
+++ b/iree/compiler/Dialect/VMLA/IR/VMLAOps.cpp
@@ -24,19 +24,9 @@
 #include "mlir/IR/SymbolTable.h"
 #include "mlir/IR/TypeUtilities.h"
 
-namespace mlir {
-namespace iree_compiler {
-namespace IREE {
-namespace VMLA {
-
 //===----------------------------------------------------------------------===//
 // TableGen definitions (intentionally last)
 //===----------------------------------------------------------------------===//
 
 #define GET_OP_CLASSES
 #include "iree/compiler/Dialect/VMLA/IR/VMLAOps.cpp.inc"
-
-}  // namespace VMLA
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
diff --git a/iree/compiler/Dialect/VMLA/IR/VMLAOps.h b/iree/compiler/Dialect/VMLA/IR/VMLAOps.h
index 978de9a..179b96a 100644
--- a/iree/compiler/Dialect/VMLA/IR/VMLAOps.h
+++ b/iree/compiler/Dialect/VMLA/IR/VMLAOps.h
@@ -31,17 +31,7 @@
 #include "mlir/IR/SymbolTable.h"
 #include "mlir/Interfaces/SideEffectInterfaces.h"
 
-namespace mlir {
-namespace iree_compiler {
-namespace IREE {
-namespace VMLA {
-
 #define GET_OP_CLASSES
 #include "iree/compiler/Dialect/VMLA/IR/VMLAOps.h.inc"
 
-}  // namespace VMLA
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
-
 #endif  // IREE_COMPILER_DIALECT_VMLA_IR_VMLAOPS_H_
diff --git a/iree/samples/custom_modules/dialect/custom_dialect.cc b/iree/samples/custom_modules/dialect/custom_dialect.cc
index ac72408..17f487f 100644
--- a/iree/samples/custom_modules/dialect/custom_dialect.cc
+++ b/iree/samples/custom_modules/dialect/custom_dialect.cc
@@ -102,10 +102,10 @@
   }
 }
 
-#define GET_OP_CLASSES
-#include "iree/samples/custom_modules/dialect/custom_ops.cc.inc"
-
 }  // namespace Custom
 }  // namespace IREE
 }  // namespace iree_compiler
 }  // namespace mlir
+
+#define GET_OP_CLASSES
+#include "iree/samples/custom_modules/dialect/custom_ops.cc.inc"
diff --git a/iree/samples/custom_modules/dialect/custom_dialect.h b/iree/samples/custom_modules/dialect/custom_dialect.h
index 50d447c..b6b92ad 100644
--- a/iree/samples/custom_modules/dialect/custom_dialect.h
+++ b/iree/samples/custom_modules/dialect/custom_dialect.h
@@ -40,12 +40,12 @@
   using Base::Base;
 };
 
-#define GET_OP_CLASSES
-#include "iree/samples/custom_modules/dialect/custom_ops.h.inc"
-
 }  // namespace Custom
 }  // namespace IREE
 }  // namespace iree_compiler
 }  // namespace mlir
 
+#define GET_OP_CLASSES
+#include "iree/samples/custom_modules/dialect/custom_ops.h.inc"
+
 #endif  // IREE_SAMPLES_CUSTOM_MODULES_DIALECT_CUSTOM_DIALECT_H_
diff --git a/iree/samples/custom_modules/dialect/custom_ops.td b/iree/samples/custom_modules/dialect/custom_ops.td
index c791494..768b63b 100644
--- a/iree/samples/custom_modules/dialect/custom_ops.td
+++ b/iree/samples/custom_modules/dialect/custom_ops.td
@@ -21,7 +21,7 @@
 
 def CUSTOM_Dialect : Dialect {
   let name = "custom";
-  let cppNamespace = "IREE::Custom";
+  let cppNamespace = "::mlir::iree_compiler::IREE::Custom";
 
   let summary = [{
     A custom dialect demonstrating custom ops and implementations.
diff --git a/third_party/llvm-project b/third_party/llvm-project
index 7841e21..85763e0 160000
--- a/third_party/llvm-project
+++ b/third_party/llvm-project
@@ -1 +1 @@
-Subproject commit 7841e21c98495ba5e33e0d2507d985bd5b938445
+Subproject commit 85763e0758fbd238c81f233c6f9510e81c7de177
diff --git a/third_party/tensorflow b/third_party/tensorflow
index d59e3e5..ac057e4 160000
--- a/third_party/tensorflow
+++ b/third_party/tensorflow
@@ -1 +1 @@
-Subproject commit d59e3e53cf2c3ad8db48463d0331df2fb55626d6
+Subproject commit ac057e43ce538c871081cc5cfbc5362b2068e270