[codegen] NFC: Restructure directories and clean up

This commits restructures CodeGen directories from:

- iree/compiler
  - Translation
    - CodeGenPasses
    - SPIRV
      - LinalgToSPIRV

into:

- iree/compiler
  - Conversion
    - HLOToLinalg
    - LinalgToSPIRV

Using Conversion is more aligned to MLIR terms given that
Translation means going from/to external formats there.

This commit also merges the register*() functions into
one file init_conversions.cpp.

PiperOrigin-RevId: 311366534
diff --git a/iree/compiler/Translation/SPIRV/BUILD b/iree/compiler/Conversion/BUILD
similarity index 81%
rename from iree/compiler/Translation/SPIRV/BUILD
rename to iree/compiler/Conversion/BUILD
index 6b363f3..35c6641 100644
--- a/iree/compiler/Translation/SPIRV/BUILD
+++ b/iree/compiler/Conversion/BUILD
@@ -18,12 +18,12 @@
 )
 
 cc_library(
-    name = "init_translations",
+    name = "init_conversions",
     hdrs = [
-        "init_translations.h",
+        "init_conversions.h",
     ],
     deps = [
-        "//iree/compiler/Translation/SPIRV/LinalgToSPIRV",
-        "@llvm-project//mlir:Pass",
+        "//iree/compiler/Conversion/HLOToLinalg",
+        "//iree/compiler/Conversion/LinalgToSPIRV",
     ],
 )
diff --git a/iree/compiler/Translation/SPIRV/CMakeLists.txt b/iree/compiler/Conversion/CMakeLists.txt
similarity index 82%
rename from iree/compiler/Translation/SPIRV/CMakeLists.txt
rename to iree/compiler/Conversion/CMakeLists.txt
index 62875c5..2c8244e 100644
--- a/iree/compiler/Translation/SPIRV/CMakeLists.txt
+++ b/iree/compiler/Conversion/CMakeLists.txt
@@ -16,11 +16,11 @@
 
 iree_cc_library(
   NAME
-    init_translations
+    init_conversions
   HDRS
-    "init_translations.h"
+    "init_conversions.h"
   DEPS
-    MLIRPass
-    iree::compiler::Translation::SPIRV::LinalgToSPIRV
+    iree::compiler::Conversion::HLOToLinalg
+    iree::compiler::Conversion::LinalgToSPIRV
   PUBLIC
 )
diff --git a/iree/compiler/Translation/CodegenUtils/BUILD b/iree/compiler/Conversion/CodegenUtils/BUILD
similarity index 100%
rename from iree/compiler/Translation/CodegenUtils/BUILD
rename to iree/compiler/Conversion/CodegenUtils/BUILD
diff --git a/iree/compiler/Translation/CodegenUtils/CMakeLists.txt b/iree/compiler/Conversion/CodegenUtils/CMakeLists.txt
similarity index 100%
rename from iree/compiler/Translation/CodegenUtils/CMakeLists.txt
rename to iree/compiler/Conversion/CodegenUtils/CMakeLists.txt
diff --git a/iree/compiler/Translation/CodegenUtils/MarkerUtils.cpp b/iree/compiler/Conversion/CodegenUtils/MarkerUtils.cpp
similarity index 96%
rename from iree/compiler/Translation/CodegenUtils/MarkerUtils.cpp
rename to iree/compiler/Conversion/CodegenUtils/MarkerUtils.cpp
index e6656a5..21b4fd2 100644
--- a/iree/compiler/Translation/CodegenUtils/MarkerUtils.cpp
+++ b/iree/compiler/Conversion/CodegenUtils/MarkerUtils.cpp
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "iree/compiler/Translation/CodegenUtils/MarkerUtils.h"
+#include "iree/compiler/Conversion/CodegenUtils/MarkerUtils.h"
 
 #include "mlir/Dialect/Linalg/Transforms/Transforms.h"
 #include "mlir/IR/Attributes.h"
diff --git a/iree/compiler/Translation/CodegenUtils/MarkerUtils.h b/iree/compiler/Conversion/CodegenUtils/MarkerUtils.h
similarity index 100%
rename from iree/compiler/Translation/CodegenUtils/MarkerUtils.h
rename to iree/compiler/Conversion/CodegenUtils/MarkerUtils.h
diff --git a/iree/compiler/Translation/CodegenPasses/BUILD b/iree/compiler/Conversion/HLOToLinalg/BUILD
similarity index 90%
rename from iree/compiler/Translation/CodegenPasses/BUILD
rename to iree/compiler/Conversion/HLOToLinalg/BUILD
index 83b0647..2203708 100644
--- a/iree/compiler/Translation/CodegenPasses/BUILD
+++ b/iree/compiler/Conversion/HLOToLinalg/BUILD
@@ -12,16 +12,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Utilities for working with IREE MLIR types.
-load("//build_tools/bazel:tblgen.bzl", "gentbl")
-
 package(
     default_visibility = ["//visibility:public"],
     licenses = ["notice"],  # Apache 2.0
 )
 
 cc_library(
-    name = "CodegenPasses",
+    name = "HLOToLinalg",
     srcs = [
         "DecomposeHLOClamp.cpp",
         "HLOToLinalgOnBuffers.cpp",
@@ -34,11 +31,11 @@
         "Passes.h",
     ],
     deps = [
+        "//iree/compiler/Conversion/CodegenUtils",
         "//iree/compiler/Dialect/HAL/IR",
         "//iree/compiler/Dialect/HAL/IR:HALDialect",
         "//iree/compiler/Dialect/IREE/IR",
         "//iree/compiler/Dialect/Shape/IR",
-        "//iree/compiler/Translation/CodegenUtils",
         "@llvm-project//llvm:support",
         "@llvm-project//mlir:IR",
         "@llvm-project//mlir:LinalgOps",
diff --git a/iree/compiler/Translation/CodegenPasses/CMakeLists.txt b/iree/compiler/Conversion/HLOToLinalg/CMakeLists.txt
similarity index 94%
rename from iree/compiler/Translation/CodegenPasses/CMakeLists.txt
rename to iree/compiler/Conversion/HLOToLinalg/CMakeLists.txt
index a41b14f..f0b63a9 100644
--- a/iree/compiler/Translation/CodegenPasses/CMakeLists.txt
+++ b/iree/compiler/Conversion/HLOToLinalg/CMakeLists.txt
@@ -16,7 +16,7 @@
 
 iree_cc_library(
   NAME
-    CodegenPasses
+    HLOToLinalg
   HDRS
     "Passes.h"
   SRCS
@@ -36,11 +36,11 @@
     MLIRStandardOps
     MLIRSupport
     MLIRTransforms
+    iree::compiler::Conversion::CodegenUtils
     iree::compiler::Dialect::HAL::IR
     iree::compiler::Dialect::HAL::IR::HALDialect
     iree::compiler::Dialect::IREE::IR
     iree::compiler::Dialect::Shape::IR
-    iree::compiler::Translation::CodegenUtils
     tensorflow::mlir_xla
   PUBLIC
 )
diff --git a/iree/compiler/Translation/CodegenPasses/DecomposeHLOClamp.cpp b/iree/compiler/Conversion/HLOToLinalg/DecomposeHLOClamp.cpp
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/DecomposeHLOClamp.cpp
rename to iree/compiler/Conversion/HLOToLinalg/DecomposeHLOClamp.cpp
diff --git a/iree/compiler/Translation/CodegenPasses/HLOToLinalgOnBuffers.cpp b/iree/compiler/Conversion/HLOToLinalg/HLOToLinalgOnBuffers.cpp
similarity index 99%
rename from iree/compiler/Translation/CodegenPasses/HLOToLinalgOnBuffers.cpp
rename to iree/compiler/Conversion/HLOToLinalg/HLOToLinalgOnBuffers.cpp
index ff97774..84d3b27 100644
--- a/iree/compiler/Translation/CodegenPasses/HLOToLinalgOnBuffers.cpp
+++ b/iree/compiler/Conversion/HLOToLinalg/HLOToLinalgOnBuffers.cpp
@@ -22,11 +22,11 @@
 
 #include <cstddef>
 
+#include "iree/compiler/Conversion/CodegenUtils/MarkerUtils.h"
+#include "iree/compiler/Conversion/HLOToLinalg/Passes.h"
 #include "iree/compiler/Dialect/HAL/IR/HALOps.h"
 #include "iree/compiler/Dialect/IREE/IR/IREEOps.h"
 #include "iree/compiler/Dialect/Shape/IR/ShapeOps.h"
-#include "iree/compiler/Translation/CodegenPasses/Passes.h"
-#include "iree/compiler/Translation/CodegenUtils/MarkerUtils.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/SmallVector.h"
diff --git a/iree/compiler/Translation/CodegenPasses/HLOToLinalgOnTensors.cpp b/iree/compiler/Conversion/HLOToLinalg/HLOToLinalgOnTensors.cpp
similarity index 98%
rename from iree/compiler/Translation/CodegenPasses/HLOToLinalgOnTensors.cpp
rename to iree/compiler/Conversion/HLOToLinalg/HLOToLinalgOnTensors.cpp
index ef4b1f9..269c6f5 100644
--- a/iree/compiler/Translation/CodegenPasses/HLOToLinalgOnTensors.cpp
+++ b/iree/compiler/Conversion/HLOToLinalg/HLOToLinalgOnTensors.cpp
@@ -21,7 +21,7 @@
 //===----------------------------------------------------------------------===//
 #include <memory>
 
-#include "iree/compiler/Translation/CodegenPasses/Passes.h"
+#include "iree/compiler/Conversion/HLOToLinalg/Passes.h"
 #include "mlir/Dialect/Linalg/IR/LinalgOps.h"
 #include "mlir/Dialect/StandardOps/IR/Ops.h"
 #include "mlir/IR/Attributes.h"
diff --git a/iree/compiler/Translation/CodegenPasses/LinalgFusion.cpp b/iree/compiler/Conversion/HLOToLinalg/LinalgFusion.cpp
similarity index 98%
rename from iree/compiler/Translation/CodegenPasses/LinalgFusion.cpp
rename to iree/compiler/Conversion/HLOToLinalg/LinalgFusion.cpp
index d341b46..dfc4b73 100644
--- a/iree/compiler/Translation/CodegenPasses/LinalgFusion.cpp
+++ b/iree/compiler/Conversion/HLOToLinalg/LinalgFusion.cpp
@@ -18,7 +18,7 @@
 // operation.
 //
 //===----------------------------------------------------------------------===//
-#include "iree/compiler/Translation/CodegenPasses/Passes.h"
+#include "iree/compiler/Conversion/HLOToLinalg/Passes.h"
 #include "mlir/Dialect/Linalg/IR/LinalgOps.h"
 #include "mlir/Dialect/Linalg/Passes.h"
 #include "mlir/Dialect/Linalg/Transforms/Transforms.h"
diff --git a/iree/compiler/Translation/CodegenPasses/Passes.cpp b/iree/compiler/Conversion/HLOToLinalg/Passes.cpp
similarity index 94%
rename from iree/compiler/Translation/CodegenPasses/Passes.cpp
rename to iree/compiler/Conversion/HLOToLinalg/Passes.cpp
index 0817196..41ed128 100644
--- a/iree/compiler/Translation/CodegenPasses/Passes.cpp
+++ b/iree/compiler/Conversion/HLOToLinalg/Passes.cpp
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "iree/compiler/Translation/CodegenPasses/Passes.h"
+#include "iree/compiler/Conversion/HLOToLinalg/Passes.h"
 
 #include "mlir/Pass/PassManager.h"
 
diff --git a/iree/compiler/Translation/CodegenPasses/Passes.h b/iree/compiler/Conversion/HLOToLinalg/Passes.h
similarity index 87%
rename from iree/compiler/Translation/CodegenPasses/Passes.h
rename to iree/compiler/Conversion/HLOToLinalg/Passes.h
index c196a83..94ba7b2 100644
--- a/iree/compiler/Translation/CodegenPasses/Passes.h
+++ b/iree/compiler/Conversion/HLOToLinalg/Passes.h
@@ -17,8 +17,8 @@
 // IREE specific passes used in the XLA to Linalg conversion
 //
 //===----------------------------------------------------------------------===//
-#ifndef IREE_COMPILER_TRANSLATION_CODEGENPASSES_PASSES_H_
-#define IREE_COMPILER_TRANSLATION_CODEGENPASSES_PASSES_H_
+#ifndef IREE_COMPILER_CONVERSION_HLOTOLINALG_PASSES_H_
+#define IREE_COMPILER_CONVERSION_HLOTOLINALG_PASSES_H_
 #include <memory>
 
 #include "mlir/IR/Function.h"
@@ -63,15 +63,7 @@
 /// IREE::HAL::ExecutableTargetOp.
 void addHLOToLinalgOnBuffersPasses(OpPassManager &pm);
 
-/// Register all Codegen passes
-inline void registerCodegenPasses() {
-  createDecomposeHLOClampPass();
-  createHLOToLinalgOnBuffersPass();
-  createHLOToLinalgOnTensorsPass();
-  createLinalgOnTensorsFusionPass();
-}
-
 }  // namespace iree_compiler
 }  // namespace mlir
 
-#endif  // IREE_COMPILER_TRANSLATION_CODEGENPASSES_PASSES_H_
+#endif  // IREE_COMPILER_CONVERSION_HLOTOLINALG_PASSES_H_
diff --git a/iree/compiler/Translation/CodegenPasses/ResolveShapeOps.cpp b/iree/compiler/Conversion/HLOToLinalg/ResolveShapeOps.cpp
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/ResolveShapeOps.cpp
rename to iree/compiler/Conversion/HLOToLinalg/ResolveShapeOps.cpp
diff --git a/iree/compiler/Translation/CodegenPasses/test/BUILD b/iree/compiler/Conversion/HLOToLinalg/test/BUILD
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/test/BUILD
rename to iree/compiler/Conversion/HLOToLinalg/test/BUILD
diff --git a/iree/compiler/Translation/CodegenPasses/test/CMakeLists.txt b/iree/compiler/Conversion/HLOToLinalg/test/CMakeLists.txt
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/test/CMakeLists.txt
rename to iree/compiler/Conversion/HLOToLinalg/test/CMakeLists.txt
diff --git a/iree/compiler/Translation/CodegenPasses/test/arithmetic_ops.mlir b/iree/compiler/Conversion/HLOToLinalg/test/arithmetic_ops.mlir
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/test/arithmetic_ops.mlir
rename to iree/compiler/Conversion/HLOToLinalg/test/arithmetic_ops.mlir
diff --git a/iree/compiler/Translation/CodegenPasses/test/const_fusion.mlir b/iree/compiler/Conversion/HLOToLinalg/test/const_fusion.mlir
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/test/const_fusion.mlir
rename to iree/compiler/Conversion/HLOToLinalg/test/const_fusion.mlir
diff --git a/iree/compiler/Translation/CodegenPasses/test/constant.mlir b/iree/compiler/Conversion/HLOToLinalg/test/constant.mlir
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/test/constant.mlir
rename to iree/compiler/Conversion/HLOToLinalg/test/constant.mlir
diff --git a/iree/compiler/Translation/CodegenPasses/test/conv.mlir b/iree/compiler/Conversion/HLOToLinalg/test/conv.mlir
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/test/conv.mlir
rename to iree/compiler/Conversion/HLOToLinalg/test/conv.mlir
diff --git a/iree/compiler/Translation/CodegenPasses/test/decompose_hlo_clamp.mlir b/iree/compiler/Conversion/HLOToLinalg/test/decompose_hlo_clamp.mlir
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/test/decompose_hlo_clamp.mlir
rename to iree/compiler/Conversion/HLOToLinalg/test/decompose_hlo_clamp.mlir
diff --git a/iree/compiler/Translation/CodegenPasses/test/dot.mlir b/iree/compiler/Conversion/HLOToLinalg/test/dot.mlir
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/test/dot.mlir
rename to iree/compiler/Conversion/HLOToLinalg/test/dot.mlir
diff --git a/iree/compiler/Translation/CodegenPasses/test/dynamic_shape.mlir b/iree/compiler/Conversion/HLOToLinalg/test/dynamic_shape.mlir
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/test/dynamic_shape.mlir
rename to iree/compiler/Conversion/HLOToLinalg/test/dynamic_shape.mlir
diff --git a/iree/compiler/Translation/CodegenPasses/test/exp.mlir b/iree/compiler/Conversion/HLOToLinalg/test/exp.mlir
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/test/exp.mlir
rename to iree/compiler/Conversion/HLOToLinalg/test/exp.mlir
diff --git a/iree/compiler/Translation/CodegenPasses/test/linalg_tensor_to_buffer.mlir b/iree/compiler/Conversion/HLOToLinalg/test/linalg_tensor_to_buffer.mlir
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/test/linalg_tensor_to_buffer.mlir
rename to iree/compiler/Conversion/HLOToLinalg/test/linalg_tensor_to_buffer.mlir
diff --git a/iree/compiler/Translation/CodegenPasses/test/pad.mlir b/iree/compiler/Conversion/HLOToLinalg/test/pad.mlir
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/test/pad.mlir
rename to iree/compiler/Conversion/HLOToLinalg/test/pad.mlir
diff --git a/iree/compiler/Translation/CodegenPasses/test/pw_linalg_fusion.mlir b/iree/compiler/Conversion/HLOToLinalg/test/pw_linalg_fusion.mlir
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/test/pw_linalg_fusion.mlir
rename to iree/compiler/Conversion/HLOToLinalg/test/pw_linalg_fusion.mlir
diff --git a/iree/compiler/Translation/CodegenPasses/test/reduce.mlir b/iree/compiler/Conversion/HLOToLinalg/test/reduce.mlir
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/test/reduce.mlir
rename to iree/compiler/Conversion/HLOToLinalg/test/reduce.mlir
diff --git a/iree/compiler/Translation/CodegenPasses/test/reduce_window.mlir b/iree/compiler/Conversion/HLOToLinalg/test/reduce_window.mlir
similarity index 100%
rename from iree/compiler/Translation/CodegenPasses/test/reduce_window.mlir
rename to iree/compiler/Conversion/HLOToLinalg/test/reduce_window.mlir
diff --git a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/BUILD b/iree/compiler/Conversion/LinalgToSPIRV/BUILD
similarity index 92%
rename from iree/compiler/Translation/SPIRV/LinalgToSPIRV/BUILD
rename to iree/compiler/Conversion/LinalgToSPIRV/BUILD
index ec393ef..85eb247 100644
--- a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/BUILD
+++ b/iree/compiler/Conversion/LinalgToSPIRV/BUILD
@@ -23,18 +23,17 @@
         "ConvertToGPUPass.cpp",
         "ConvertToSPIRVPass.cpp",
         "LinalgTileAndFusePass.cpp",
-        "LowerToSPIRV.cpp",
+        "Passes.cpp",
     ],
     hdrs = [
-        "LowerToSPIRV.h",
         "Passes.h",
     ],
     deps = [
+        "//iree/compiler/Conversion/CodegenUtils",
+        "//iree/compiler/Conversion/HLOToLinalg",
         "//iree/compiler/Dialect/HAL/IR",
         "//iree/compiler/Dialect/IREE/IR",
         "//iree/compiler/Dialect/Shape/Transforms",
-        "//iree/compiler/Translation/CodegenPasses",
-        "//iree/compiler/Translation/CodegenUtils",
         "@llvm-project//llvm:support",
         "@llvm-project//mlir:Affine",
         "@llvm-project//mlir:AffineToStandardTransforms",
diff --git a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/CMakeLists.txt b/iree/compiler/Conversion/LinalgToSPIRV/CMakeLists.txt
similarity index 89%
rename from iree/compiler/Translation/SPIRV/LinalgToSPIRV/CMakeLists.txt
rename to iree/compiler/Conversion/LinalgToSPIRV/CMakeLists.txt
index 2c5adee..8d74bae 100644
--- a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/CMakeLists.txt
+++ b/iree/compiler/Conversion/LinalgToSPIRV/CMakeLists.txt
@@ -18,13 +18,12 @@
   NAME
     LinalgToSPIRV
   HDRS
-    "LowerToSPIRV.h"
     "Passes.h"
   SRCS
     "ConvertToGPUPass.cpp"
     "ConvertToSPIRVPass.cpp"
     "LinalgTileAndFusePass.cpp"
-    "LowerToSPIRV.cpp"
+    "Passes.cpp"
   DEPS
     LLVMSupport
     MLIRAffineOps
@@ -44,11 +43,11 @@
     MLIRStandardToSPIRVTransforms
     MLIRSupport
     MLIRTransforms
+    iree::compiler::Conversion::CodegenUtils
+    iree::compiler::Conversion::HLOToLinalg
     iree::compiler::Dialect::HAL::IR
     iree::compiler::Dialect::IREE::IR
     iree::compiler::Dialect::Shape::Transforms
-    iree::compiler::Translation::CodegenPasses
-    iree::compiler::Translation::CodegenUtils
     tensorflow::mlir_xla
   PUBLIC
 )
diff --git a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/ConvertToGPUPass.cpp b/iree/compiler/Conversion/LinalgToSPIRV/ConvertToGPUPass.cpp
similarity index 98%
rename from iree/compiler/Translation/SPIRV/LinalgToSPIRV/ConvertToGPUPass.cpp
rename to iree/compiler/Conversion/LinalgToSPIRV/ConvertToGPUPass.cpp
index bbc0c9d..7043624 100644
--- a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/ConvertToGPUPass.cpp
+++ b/iree/compiler/Conversion/LinalgToSPIRV/ConvertToGPUPass.cpp
@@ -17,8 +17,8 @@
 // Partition computation within dispatch function to workgroups/workitems.
 //
 //===----------------------------------------------------------------------===//
-#include "iree/compiler/Translation/CodegenUtils/MarkerUtils.h"
-#include "iree/compiler/Translation/SPIRV/LinalgToSPIRV/Passes.h"
+#include "iree/compiler/Conversion/CodegenUtils/MarkerUtils.h"
+#include "iree/compiler/Conversion/LinalgToSPIRV/Passes.h"
 #include "mlir/Conversion/AffineToStandard/AffineToStandard.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/GPU/GPUDialect.h"
@@ -394,7 +394,7 @@
 
   MLIRContext *context = &getContext();
   ConversionTarget target(*context);
-  // Ater this pass Linalg and loop.parallel ops should be gone.
+  // After this pass Linalg and loop.parallel ops should be gone.
   target.addIllegalOp<scf::ParallelOp>();
   target.addIllegalDialect<linalg::LinalgDialect>();
   // Reshape ops are treated legal since they just change the way the underlying
diff --git a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/ConvertToSPIRVPass.cpp b/iree/compiler/Conversion/LinalgToSPIRV/ConvertToSPIRVPass.cpp
similarity index 100%
rename from iree/compiler/Translation/SPIRV/LinalgToSPIRV/ConvertToSPIRVPass.cpp
rename to iree/compiler/Conversion/LinalgToSPIRV/ConvertToSPIRVPass.cpp
diff --git a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/LinalgTileAndFusePass.cpp b/iree/compiler/Conversion/LinalgToSPIRV/LinalgTileAndFusePass.cpp
similarity index 98%
rename from iree/compiler/Translation/SPIRV/LinalgToSPIRV/LinalgTileAndFusePass.cpp
rename to iree/compiler/Conversion/LinalgToSPIRV/LinalgTileAndFusePass.cpp
index aa71484..d0374ca 100644
--- a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/LinalgTileAndFusePass.cpp
+++ b/iree/compiler/Conversion/LinalgToSPIRV/LinalgTileAndFusePass.cpp
@@ -17,8 +17,9 @@
 // Implements a pass to tile and fuse linalg operations on buffers.
 //
 //===----------------------------------------------------------------------===//
-#include "iree/compiler/Translation/CodegenUtils/MarkerUtils.h"
-#include "iree/compiler/Translation/SPIRV/LinalgToSPIRV/Passes.h"
+
+#include "iree/compiler/Conversion/CodegenUtils/MarkerUtils.h"
+#include "iree/compiler/Conversion/LinalgToSPIRV/Passes.h"
 #include "mlir/Dialect/Linalg/IR/LinalgOps.h"
 #include "mlir/Dialect/Linalg/Transforms/Transforms.h"
 #include "mlir/Dialect/SPIRV/TargetAndABI.h"
diff --git a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/LowerToSPIRV.cpp b/iree/compiler/Conversion/LinalgToSPIRV/Passes.cpp
similarity index 96%
rename from iree/compiler/Translation/SPIRV/LinalgToSPIRV/LowerToSPIRV.cpp
rename to iree/compiler/Conversion/LinalgToSPIRV/Passes.cpp
index 07d98e2..7c2df95 100644
--- a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/LowerToSPIRV.cpp
+++ b/iree/compiler/Conversion/LinalgToSPIRV/Passes.cpp
@@ -12,17 +12,16 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-//===- LowerToSPIRV.cpp - Lower from XLA to Linalg to SPIR-V dialect-------===//
+//===- Passes.cpp - Pipeline from HLO to Linalg to SPIR-V -----------------===//
 //
 // Implementation of conversion from XLA-HLO to Linalg to SPIR-V dialect.
 //
 //===----------------------------------------------------------------------===//
 
-#include "iree/compiler/Translation/SPIRV/LinalgToSPIRV/LowerToSPIRV.h"
+#include "iree/compiler/Conversion/LinalgToSPIRV/Passes.h"
 
+#include "iree/compiler/Conversion/HLOToLinalg/Passes.h"
 #include "iree/compiler/Dialect/Shape/Transforms/Passes.h"
-#include "iree/compiler/Translation/CodegenPasses/Passes.h"
-#include "iree/compiler/Translation/SPIRV/LinalgToSPIRV/Passes.h"
 #include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.h"
 #include "mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h"
 #include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h"
diff --git a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/Passes.h b/iree/compiler/Conversion/LinalgToSPIRV/Passes.h
similarity index 71%
rename from iree/compiler/Translation/SPIRV/LinalgToSPIRV/Passes.h
rename to iree/compiler/Conversion/LinalgToSPIRV/Passes.h
index fc2fa88..1f69d32 100644
--- a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/Passes.h
+++ b/iree/compiler/Conversion/LinalgToSPIRV/Passes.h
@@ -12,8 +12,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#ifndef IREE_COMPILER_TRANSLATION_SPIRV_LINALGTOSPIRV_PASSES_H_
-#define IREE_COMPILER_TRANSLATION_SPIRV_LINALGTOSPIRV_PASSES_H_
+#ifndef IREE_COMPILER_CONVERSION_LINALGTOSPIRV_PASSES_H_
+#define IREE_COMPILER_CONVERSION_LINALGTOSPIRV_PASSES_H_
 
 #include "mlir/Pass/Pass.h"
 
@@ -39,7 +39,16 @@
 /// corresponding SPIR-V ops.
 std::unique_ptr<OperationPass<ModuleOp>> createConvertToSPIRVPass();
 
+/// Populates passes needed to lower a XLA HLO op to SPIR-V dialect via the
+/// structured ops path. The pass manager `pm` in here operate on the module
+/// within the IREE::HAL::ExecutableOp. The `workGroupSize` can be used to
+/// control the work group size used in the code generation and is intended for
+/// testing purposes only. The pass pipeline will set an appropriate workgroup
+/// size.
+void buildSPIRVTransformPassPipeline(OpPassManager &pm,
+                                     ArrayRef<int64_t> workGroupSize);
+
 }  // namespace iree_compiler
 }  // namespace mlir
 
-#endif  // IREE_COMPILER_TRANSLATION_SPIRV_LINALGTOSPIRV_PASSES_H_
+#endif  // IREE_COMPILER_CONVERSION_LINALGTOSPIRV_PASSES_H_
diff --git a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/test/BUILD b/iree/compiler/Conversion/LinalgToSPIRV/test/BUILD
similarity index 100%
rename from iree/compiler/Translation/SPIRV/LinalgToSPIRV/test/BUILD
rename to iree/compiler/Conversion/LinalgToSPIRV/test/BUILD
diff --git a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/test/CMakeLists.txt b/iree/compiler/Conversion/LinalgToSPIRV/test/CMakeLists.txt
similarity index 100%
rename from iree/compiler/Translation/SPIRV/LinalgToSPIRV/test/CMakeLists.txt
rename to iree/compiler/Conversion/LinalgToSPIRV/test/CMakeLists.txt
diff --git a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/test/convert_to_spirv.mlir b/iree/compiler/Conversion/LinalgToSPIRV/test/convert_to_spirv.mlir
similarity index 100%
rename from iree/compiler/Translation/SPIRV/LinalgToSPIRV/test/convert_to_spirv.mlir
rename to iree/compiler/Conversion/LinalgToSPIRV/test/convert_to_spirv.mlir
diff --git a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/test/linalg_tile_and_fuse.mlir b/iree/compiler/Conversion/LinalgToSPIRV/test/linalg_tile_and_fuse.mlir
similarity index 100%
rename from iree/compiler/Translation/SPIRV/LinalgToSPIRV/test/linalg_tile_and_fuse.mlir
rename to iree/compiler/Conversion/LinalgToSPIRV/test/linalg_tile_and_fuse.mlir
diff --git a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/test/loop_to_gpu.mlir b/iree/compiler/Conversion/LinalgToSPIRV/test/loop_to_gpu.mlir
similarity index 100%
rename from iree/compiler/Translation/SPIRV/LinalgToSPIRV/test/loop_to_gpu.mlir
rename to iree/compiler/Conversion/LinalgToSPIRV/test/loop_to_gpu.mlir
diff --git a/iree/compiler/Conversion/init_conversions.h b/iree/compiler/Conversion/init_conversions.h
new file mode 100644
index 0000000..0445d53
--- /dev/null
+++ b/iree/compiler/Conversion/init_conversions.h
@@ -0,0 +1,48 @@
+// Copyright 2020 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef IREE_COMPILER_CONVERSION_INIT_CONVERSIONS_H_
+#define IREE_COMPILER_CONVERSION_INIT_CONVERSIONS_H_
+
+#include "iree/compiler/Conversion/HLOToLinalg/Passes.h"
+#include "iree/compiler/Conversion/LinalgToSPIRV/Passes.h"
+
+namespace mlir {
+namespace iree_compiler {
+
+// These functions should be called before creating any MLIRContext if one
+// expects all the possible conversions to be made available to the context
+// automatically.
+
+inline void registerHLOToLinalgPasses() {
+  createDecomposeHLOClampPass();
+  createHLOToLinalgOnBuffersPass();
+  createHLOToLinalgOnTensorsPass();
+  createLinalgOnTensorsFusionPass();
+}
+
+inline void registerLinalgToSPIRVPasses() {
+  static bool init_once = []() {
+    // LinalgToSPIRV
+    createConvertToGPUPass();
+    createLinalgTileAndFusePass();
+    return true;
+  }();
+  (void)init_once;
+}
+
+}  // namespace iree_compiler
+}  // namespace mlir
+
+#endif  // IREE_COMPILER_CONVERSION_INIT_CONVERSIONS_H_
diff --git a/iree/compiler/Dialect/HAL/Target/LLVM/BUILD b/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
index efcb744..cc23d62 100644
--- a/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
+++ b/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
@@ -28,12 +28,12 @@
     deps = [
         ":LLVMIRPasses",
         ":LLVMTargetOptions",
+        "//iree/compiler/Conversion/HLOToLinalg",
         "//iree/compiler/Dialect/Flow/IR",
         "//iree/compiler/Dialect/HAL/IR",
         "//iree/compiler/Dialect/HAL/IR:HALDialect",
         "//iree/compiler/Dialect/HAL/Target",
         "//iree/compiler/Dialect/IREE/IR",
-        "//iree/compiler/Translation/CodegenPasses",
         "//iree/schemas:llvmir_executable_def_cc_fbs",
         "@llvm-project//llvm:core",
         "@llvm-project//llvm:support",
diff --git a/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt b/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt
index 7d330b0..8926f58 100644
--- a/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt
@@ -38,12 +38,12 @@
     MLIRSupport
     MLIRTargetLLVMIR
     MLIRTransforms
+    iree::compiler::Conversion::HLOToLinalg
     iree::compiler::Dialect::Flow::IR
     iree::compiler::Dialect::HAL::IR
     iree::compiler::Dialect::HAL::IR::HALDialect
     iree::compiler::Dialect::HAL::Target
     iree::compiler::Dialect::IREE::IR
-    iree::compiler::Translation::CodegenPasses
     iree::schemas::llvmir_executable_def_cc_fbs
   PUBLIC
 )
diff --git a/iree/compiler/Dialect/HAL/Target/LLVM/LLVMTarget.cpp b/iree/compiler/Dialect/HAL/Target/LLVM/LLVMTarget.cpp
index 3741395..e221b9e 100644
--- a/iree/compiler/Dialect/HAL/Target/LLVM/LLVMTarget.cpp
+++ b/iree/compiler/Dialect/HAL/Target/LLVM/LLVMTarget.cpp
@@ -14,13 +14,13 @@
 
 #include "iree/compiler/Dialect/HAL/Target/LLVM/LLVMTarget.h"
 
+#include "iree/compiler/Conversion/HLOToLinalg/Passes.h"
 #include "iree/compiler/Dialect/Flow/IR/FlowOps.h"
 #include "iree/compiler/Dialect/HAL/IR/HALDialect.h"
 #include "iree/compiler/Dialect/HAL/IR/HALOps.h"
 #include "iree/compiler/Dialect/HAL/Target/LLVM/LLVMIRPasses.h"
 #include "iree/compiler/Dialect/HAL/Target/TargetRegistry.h"
 #include "iree/compiler/Dialect/IREE/IR/IREEOps.h"
-#include "iree/compiler/Translation/CodegenPasses/Passes.h"
 #include "iree/schemas/llvmir_executable_def_generated.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/ScopeExit.h"
diff --git a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD
index bc1aae9..b8f3360 100644
--- a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD
+++ b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD
@@ -26,13 +26,13 @@
         "VulkanSPIRVTarget.h",
     ],
     deps = [
+        "//iree/compiler/Conversion/HLOToLinalg",
+        "//iree/compiler/Conversion/LinalgToSPIRV",
         "//iree/compiler/Dialect/Flow/IR",
         "//iree/compiler/Dialect/HAL/Target",
         "//iree/compiler/Dialect/IREE/IR",
         "//iree/compiler/Dialect/Vulkan/IR",
         "//iree/compiler/Dialect/Vulkan/Utils",
-        "//iree/compiler/Translation/CodegenPasses",
-        "//iree/compiler/Translation/SPIRV/LinalgToSPIRV",
         "//iree/schemas:spirv_executable_def_cc_fbs",
         "@com_github_google_flatbuffers//:flatbuffers",
         "@llvm-project//llvm:support",
diff --git a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt
index 80d5f4e..2212e20 100644
--- a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt
@@ -32,13 +32,13 @@
     MLIRSupport
     MLIRTransforms
     flatbuffers
+    iree::compiler::Conversion::HLOToLinalg
+    iree::compiler::Conversion::LinalgToSPIRV
     iree::compiler::Dialect::Flow::IR
     iree::compiler::Dialect::HAL::Target
     iree::compiler::Dialect::IREE::IR
     iree::compiler::Dialect::Vulkan::IR
     iree::compiler::Dialect::Vulkan::Utils
-    iree::compiler::Translation::CodegenPasses
-    iree::compiler::Translation::SPIRV::LinalgToSPIRV
     iree::schemas::spirv_executable_def_cc_fbs
     tensorflow::mlir_xla
   PUBLIC
diff --git a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/VulkanSPIRVTarget.cpp b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/VulkanSPIRVTarget.cpp
index e00a53c..053097f 100644
--- a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/VulkanSPIRVTarget.cpp
+++ b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/VulkanSPIRVTarget.cpp
@@ -17,12 +17,12 @@
 #include <map>
 
 #include "flatbuffers/flatbuffers.h"
+#include "iree/compiler/Conversion/HLOToLinalg/Passes.h"
+#include "iree/compiler/Conversion/LinalgToSPIRV/Passes.h"
 #include "iree/compiler/Dialect/Flow/IR/FlowOps.h"
 #include "iree/compiler/Dialect/HAL/Target/TargetRegistry.h"
 #include "iree/compiler/Dialect/Vulkan/IR/VulkanAttributes.h"
 #include "iree/compiler/Dialect/Vulkan/Utils/TargetEnvUtils.h"
-#include "iree/compiler/Translation/CodegenPasses/Passes.h"
-#include "iree/compiler/Translation/SPIRV/LinalgToSPIRV/LowerToSPIRV.h"
 #include "iree/schemas/spirv_executable_def_generated.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/ScopeExit.h"
diff --git a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/LowerToSPIRV.h b/iree/compiler/Translation/SPIRV/LinalgToSPIRV/LowerToSPIRV.h
deleted file mode 100644
index f78fd2f..0000000
--- a/iree/compiler/Translation/SPIRV/LinalgToSPIRV/LowerToSPIRV.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2020 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef IREE_COMPILER_TRANSLATION_SPIRV_LINALGTOSPIRV_LOWERTOSPIRV_H_
-#define IREE_COMPILER_TRANSLATION_SPIRV_LINALGTOSPIRV_LOWERTOSPIRV_H_
-
-#include "mlir/Pass/PassManager.h"
-
-namespace mlir {
-namespace iree_compiler {
-
-/// Populates passes needed to lower a XLA HLO op to SPIR-V dialect via the
-/// structured ops path. The pass manager `pm` in here operate on the module
-/// within the IREE::HAL::ExecutableOp. The `workGroupSize` can be used to
-/// control the work group size used in the code generation and is intended for
-/// testing purposes only. The pass pipeline will set an appropriate workgroup
-/// size.
-void buildSPIRVTransformPassPipeline(OpPassManager &pm,
-                                     ArrayRef<int64_t> workGroupSize);
-
-}  // namespace iree_compiler
-}  // namespace mlir
-
-#endif  // IREE_COMPILER_TRANSLATION_SPIRV_XLATOLINALGSPIRV_LOWERTOSPIRV_H_
diff --git a/iree/compiler/Translation/SPIRV/init_translations.h b/iree/compiler/Translation/SPIRV/init_translations.h
deleted file mode 100644
index 6413ee3..0000000
--- a/iree/compiler/Translation/SPIRV/init_translations.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2020 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef IREE_COMPILER_TRANSLATION_SPIRV_INIT_TRANSLATIONS_H_
-#define IREE_COMPILER_TRANSLATION_SPIRV_INIT_TRANSLATIONS_H_
-
-#include "iree/compiler/Translation/SPIRV/LinalgToSPIRV/Passes.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-namespace iree_compiler {
-
-// This function should be called before creating any MLIRContext if one
-// expects all the possible translations to be made available to the context
-// automatically.
-inline void registerSPRIVTranslation() {
-  static bool init_once = []() {
-    // LinalgToSPIRV
-    createConvertToGPUPass();
-    createLinalgTileAndFusePass();
-    return true;
-  }();
-  (void)init_once;
-}
-
-}  // namespace iree_compiler
-}  // namespace mlir
-
-#endif  // IREE_COMPILER_TRANSLATION_SPIRV_INIT_TRANSLATIONS_H_
diff --git a/iree/samples/custom_modules/dialect/BUILD b/iree/samples/custom_modules/dialect/BUILD
index 1c9101d..b810667 100644
--- a/iree/samples/custom_modules/dialect/BUILD
+++ b/iree/samples/custom_modules/dialect/BUILD
@@ -93,6 +93,8 @@
     srcs = ["custom_opt.cc"],
     deps = [
         ":init_dialect",
+        "//iree/compiler/Conversion:init_conversions",
+        "//iree/compiler/Conversion/HLOToLinalg",
         "//iree/compiler/Dialect/Flow/Analysis",
         "//iree/compiler/Dialect/Flow/IR",
         "//iree/compiler/Dialect/Flow/Transforms",
@@ -114,8 +116,6 @@
         "//iree/compiler/Dialect/VMLA/Transforms",
         "//iree/compiler/Dialect/Vulkan/IR",
         "//iree/compiler/Translation:IREEVM",
-        "//iree/compiler/Translation/CodegenPasses",
-        "//iree/compiler/Translation/SPIRV:init_translations",
         "//iree/tools:init_compiler_modules",
         "//iree/tools:init_passes_and_dialects",
         "//iree/tools:init_targets",
@@ -135,10 +135,10 @@
     srcs = ["custom_translate.cc"],
     deps = [
         ":init_dialect",
+        "//iree/compiler/Conversion:init_conversions",
         "//iree/compiler/Dialect/VM/Target:init_targets",
         "//iree/compiler/Dialect/VM/Target/Bytecode",
         "//iree/compiler/Translation:IREEVM",
-        "//iree/compiler/Translation/SPIRV:init_translations",
         "//iree/tools:init_compiler_modules",
         "//iree/tools:init_passes_and_dialects",
         "//iree/tools:init_targets",
diff --git a/iree/samples/custom_modules/dialect/CMakeLists.txt b/iree/samples/custom_modules/dialect/CMakeLists.txt
index a8d7407..d8883a1 100644
--- a/iree/samples/custom_modules/dialect/CMakeLists.txt
+++ b/iree/samples/custom_modules/dialect/CMakeLists.txt
@@ -91,6 +91,8 @@
     MLIROptLib
     MLIRPass
     MLIRSupport
+    iree::compiler::Conversion::HLOToLinalg
+    iree::compiler::Conversion::init_conversions
     iree::compiler::Dialect::Flow::Analysis
     iree::compiler::Dialect::Flow::IR
     iree::compiler::Dialect::Flow::Transforms
@@ -111,9 +113,7 @@
     iree::compiler::Dialect::VMLA::Conversion::VMLAToVM
     iree::compiler::Dialect::VMLA::Transforms
     iree::compiler::Dialect::Vulkan::IR
-    iree::compiler::Translation::CodegenPasses
     iree::compiler::Translation::IREEVM
-    iree::compiler::Translation::SPIRV::init_translations
     iree::tools::init_compiler_modules
     iree::tools::init_passes_and_dialects
     iree::tools::init_targets
@@ -136,10 +136,10 @@
     MLIRSCFTransforms
     MLIRSupport
     MLIRTranslation
+    iree::compiler::Conversion::init_conversions
     iree::compiler::Dialect::VM::Target::Bytecode
     iree::compiler::Dialect::VM::Target::init_targets
     iree::compiler::Translation::IREEVM
-    iree::compiler::Translation::SPIRV::init_translations
     iree::tools::init_compiler_modules
     iree::tools::init_passes_and_dialects
     iree::tools::init_targets
diff --git a/iree/samples/custom_modules/dialect/custom_opt.cc b/iree/samples/custom_modules/dialect/custom_opt.cc
index abfdda1..63d209c 100644
--- a/iree/samples/custom_modules/dialect/custom_opt.cc
+++ b/iree/samples/custom_modules/dialect/custom_opt.cc
@@ -18,9 +18,9 @@
 // We need this entry function because we want to register the custom
 // dialect, which is missing in IREE's opt main entry function.
 
+#include "iree/compiler/Conversion/HLOToLinalg/Passes.h"
+#include "iree/compiler/Conversion/init_conversions.h"
 #include "iree/compiler/Dialect/HAL/Conversion/Passes.h"
-#include "iree/compiler/Translation/CodegenPasses/Passes.h"
-#include "iree/compiler/Translation/SPIRV/init_translations.h"
 #include "iree/samples/custom_modules/dialect/init_dialect.h"
 #include "iree/tools/init_compiler_modules.h"
 #include "iree/tools/init_dialects.h"
@@ -78,8 +78,8 @@
   mlir::iree_compiler::registerAllIreePasses();
   mlir::iree_compiler::registerHALConversionPasses();
   mlir::iree_compiler::registerHALTargetBackends();
-  mlir::iree_compiler::registerSPRIVTranslation();
-  mlir::iree_compiler::registerCodegenPasses();
+  mlir::iree_compiler::registerLinalgToSPIRVPasses();
+  mlir::iree_compiler::registerHLOToLinalgPasses();
   llvm::InitLLVM y(argc, argv);
 
   // Register MLIRContext command-line options like
diff --git a/iree/samples/custom_modules/dialect/custom_translate.cc b/iree/samples/custom_modules/dialect/custom_translate.cc
index f7b80eb..4841635 100644
--- a/iree/samples/custom_modules/dialect/custom_translate.cc
+++ b/iree/samples/custom_modules/dialect/custom_translate.cc
@@ -18,8 +18,8 @@
 // We need this entry function because we want to register the custom
 // dialect, which is missing in IREE's translation main entry function.
 
+#include "iree/compiler/Conversion/init_conversions.h"
 #include "iree/compiler/Dialect/VM/Target/init_targets.h"
-#include "iree/compiler/Translation/SPIRV/init_translations.h"
 #include "iree/samples/custom_modules/dialect/init_dialect.h"
 #include "iree/tools/init_compiler_modules.h"
 #include "iree/tools/init_dialects.h"
@@ -66,7 +66,7 @@
   mlir::iree_compiler::registerVMTargets();
   mlir::registerMlirTranslations();
   mlir::iree_compiler::registerIreeTranslations();
-  mlir::iree_compiler::registerSPRIVTranslation();
+  mlir::iree_compiler::registerLinalgToSPIRVPasses();
 
   // Register MLIRContext command-line options like
   // -mlir-print-op-on-diagnostic.
diff --git a/iree/tools/BUILD b/iree/tools/BUILD
index 691bd42..222f92c 100644
--- a/iree/tools/BUILD
+++ b/iree/tools/BUILD
@@ -166,6 +166,8 @@
         ":init_passes_and_dialects",
         ":init_targets",
         ":init_xla_dialects",
+        "//iree/compiler/Conversion:init_conversions",
+        "//iree/compiler/Conversion/HLOToLinalg",
         "//iree/compiler/Dialect/Flow/Analysis",
         "//iree/compiler/Dialect/Flow/IR",
         "//iree/compiler/Dialect/Flow/Transforms",
@@ -187,8 +189,6 @@
         "//iree/compiler/Dialect/VMLA/Transforms",
         "//iree/compiler/Dialect/Vulkan/IR",
         "//iree/compiler/Translation:IREEVM",
-        "//iree/compiler/Translation/CodegenPasses",
-        "//iree/compiler/Translation/SPIRV:init_translations",
         "@llvm-project//llvm:support",
         "@llvm-project//mlir:IR",
         "@llvm-project//mlir:MlirOptLib",
@@ -284,10 +284,10 @@
         ":init_targets",
         ":init_translations",
         ":init_xla_dialects",
+        "//iree/compiler/Conversion:init_conversions",
         "//iree/compiler/Dialect/VM/Target:init_targets",
         "//iree/compiler/Dialect/VM/Target/Bytecode",
         "//iree/compiler/Translation:IREEVM",
-        "//iree/compiler/Translation/SPIRV:init_translations",
         "@llvm-project//llvm:support",
         "@llvm-project//mlir:IR",
         "@llvm-project//mlir:Pass",
diff --git a/iree/tools/CMakeLists.txt b/iree/tools/CMakeLists.txt
index deebe5a..96bf28d 100644
--- a/iree/tools/CMakeLists.txt
+++ b/iree/tools/CMakeLists.txt
@@ -209,6 +209,8 @@
       MLIROptLib
       MLIRPass
       MLIRSupport
+      iree::compiler::Conversion::init_conversions
+      iree::compiler::Conversion::HLOToLinalg
       iree::compiler::Dialect::Flow::Analysis
       iree::compiler::Dialect::Flow::IR
       iree::compiler::Dialect::Flow::Transforms
@@ -229,8 +231,6 @@
       iree::compiler::Dialect::VMLA::Transforms
       iree::compiler::Dialect::Vulkan::IR
       iree::compiler::Translation::IREEVM
-      iree::compiler::Translation::SPIRV::init_translations
-      iree::compiler::Translation::CodegenPasses
       tensorflow::mlir_xla
     PUBLIC
   )
@@ -302,10 +302,10 @@
       MLIRPass
       MLIRSupport
       MLIRTranslation
+      iree::compiler::Conversion::init_conversions
       iree::compiler::Dialect::VM::Target::Bytecode
       iree::compiler::Dialect::VM::Target::init_targets
       iree::compiler::Translation::IREEVM
-      iree::compiler::Translation::SPIRV::init_translations
     PUBLIC
   )
 
diff --git a/iree/tools/opt_main.cc b/iree/tools/opt_main.cc
index 6c39f6c..c90f04c 100644
--- a/iree/tools/opt_main.cc
+++ b/iree/tools/opt_main.cc
@@ -17,9 +17,9 @@
 // Based on mlir-opt but without registering passes and dialects we don't care
 // about.
 
+#include "iree/compiler/Conversion/HLOToLinalg/Passes.h"
+#include "iree/compiler/Conversion/init_conversions.h"
 #include "iree/compiler/Dialect/HAL/Conversion/Passes.h"
-#include "iree/compiler/Translation/CodegenPasses/Passes.h"
-#include "iree/compiler/Translation/SPIRV/init_translations.h"
 #include "iree/tools/init_compiler_modules.h"
 #include "iree/tools/init_dialects.h"
 #include "iree/tools/init_passes.h"
@@ -74,8 +74,8 @@
   mlir::iree_compiler::registerAllIreePasses();
   mlir::iree_compiler::registerHALConversionPasses();
   mlir::iree_compiler::registerHALTargetBackends();
-  mlir::iree_compiler::registerSPRIVTranslation();
-  mlir::iree_compiler::registerCodegenPasses();
+  mlir::iree_compiler::registerLinalgToSPIRVPasses();
+  mlir::iree_compiler::registerHLOToLinalgPasses();
   llvm::InitLLVM y(argc, argv);
 
   // Register MLIRContext command-line options like
diff --git a/iree/tools/translate_main.cc b/iree/tools/translate_main.cc
index 9b5988c..788c4c4 100644
--- a/iree/tools/translate_main.cc
+++ b/iree/tools/translate_main.cc
@@ -17,8 +17,8 @@
 // We need this entry function because we want to register PassManager CLI
 // options, which is missing in MLIR's translation main entry function.
 
+#include "iree/compiler/Conversion/init_conversions.h"
 #include "iree/compiler/Dialect/VM/Target/init_targets.h"
-#include "iree/compiler/Translation/SPIRV/init_translations.h"
 #include "iree/tools/init_compiler_modules.h"
 #include "iree/tools/init_dialects.h"
 #include "iree/tools/init_targets.h"
@@ -62,7 +62,7 @@
   mlir::iree_compiler::registerVMTargets();
   mlir::registerMlirTranslations();
   mlir::iree_compiler::registerIreeTranslations();
-  mlir::iree_compiler::registerSPRIVTranslation();
+  mlir::iree_compiler::registerLinalgToSPIRVPasses();
 
   // Register MLIRContext command-line options like
   // -mlir-print-op-on-diagnostic.