Rework includes and directory names for samples. (#9177)

Refactoring after https://github.com/google/iree/pull/8958 shuffled these files around, aiming to remove custom logic in samples that we want users to be able to fork easily.

Paths are reverted from `iree_[sample_name]` back to `[sample_name]`

Includes changed to match:

| | |
| -- | -- |
| C++ includes before | `#include "iree_[sample_name]/[header_name].h"` |
| C++ includes now | `#include "samples/[sample_name]/[header_name].h"` |
| Another option | `#include "header_name.h"` 

The third option would require adding
```
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
```
to `target_include_directories()` (I already do that in the experimental web samples)
diff --git a/samples/BUILD b/samples/BUILD
index 6a18794..7b73871 100644
--- a/samples/BUILD
+++ b/samples/BUILD
@@ -11,10 +11,3 @@
 )
 
 exports_files(["lit.cfg.py"])
-
-cc_library(
-    name = "defs",
-    includes = [
-        ".",
-    ],
-)
diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt
index 9a976db..1e70c9d 100644
--- a/samples/CMakeLists.txt
+++ b/samples/CMakeLists.txt
@@ -5,12 +5,3 @@
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
 iree_add_all_subdirs()
-
-iree_cc_library(
-  NAME
-    defs
-  INCLUDES
-    ${CMAKE_CURRENT_SOURCE_DIR}
-    ${CMAKE_CURRENT_BINARY_DIR}
-  PUBLIC
-)
diff --git a/samples/README.md b/samples/README.md
index 92c628d..1053293 100644
--- a/samples/README.md
+++ b/samples/README.md
@@ -1,8 +1,3 @@
 # IREE Samples
 
 Also see the [iree-samples](https://github.com/google/iree-samples) repository.
-
-Note that for samples which include C/C++ code, the samples/ directory itself
-is added as an include directory if depending on the `defs` library.
-As such, samples that include headers should include "iree" in their name in
-some fashion so that paths are unique.
\ No newline at end of file
diff --git a/samples/iree_custom_modules/BUILD b/samples/custom_modules/BUILD
similarity index 94%
rename from samples/iree_custom_modules/BUILD
rename to samples/custom_modules/BUILD
index be20be0..bb1c284 100644
--- a/samples/iree_custom_modules/BUILD
+++ b/samples/custom_modules/BUILD
@@ -24,7 +24,6 @@
         "//runtime/src/iree/modules/hal",
         "//runtime/src/iree/vm",
         "//runtime/src/iree/vm:cc",
-        "//samples:defs",
     ],
 )
 
@@ -45,7 +44,7 @@
         "--iree-mlir-to-vm-bytecode-module",
         "--iree-hal-target-backends=vmvx",
     ],
-    translate_tool = "//samples/iree_custom_modules/dialect:custom-translate",
+    translate_tool = "//samples/custom_modules/dialect:custom-translate",
 )
 
 cc_test(
diff --git a/samples/iree_custom_modules/CMakeLists.txt b/samples/custom_modules/CMakeLists.txt
similarity index 91%
rename from samples/iree_custom_modules/CMakeLists.txt
rename to samples/custom_modules/CMakeLists.txt
index 19efc59..0153895 100644
--- a/samples/iree_custom_modules/CMakeLists.txt
+++ b/samples/custom_modules/CMakeLists.txt
@@ -1,6 +1,6 @@
 ################################################################################
 # Autogenerated by build_tools/bazel_to_cmake/bazel_to_cmake.py from           #
-# samples/iree_custom_modules/BUILD                                            #
+# samples/custom_modules/BUILD                                                 #
 #                                                                              #
 # Use iree_cmake_extra_content from iree/build_defs.oss.bzl to add arbitrary   #
 # CMake-only content.                                                          #
@@ -27,7 +27,6 @@
     iree::base::cc
     iree::hal
     iree::modules::hal
-    iree::samples::defs
     iree::vm
     iree::vm::cc
   PUBLIC
@@ -41,7 +40,7 @@
   C_IDENTIFIER
     "iree_samples_custom_modules_test_module"
   TRANSLATE_TOOL
-    iree_samples_iree_custom_modules_dialect_custom-translate
+    iree_samples_custom_modules_dialect_custom-translate
   FLAGS
     "--iree-mlir-to-vm-bytecode-module"
     "--iree-hal-target-backends=vmvx"
diff --git a/samples/iree_custom_modules/custom_modules_test.cc b/samples/custom_modules/custom_modules_test.cc
similarity index 98%
rename from samples/iree_custom_modules/custom_modules_test.cc
rename to samples/custom_modules/custom_modules_test.cc
index 6c2d687..b93c4ba 100644
--- a/samples/iree_custom_modules/custom_modules_test.cc
+++ b/samples/custom_modules/custom_modules_test.cc
@@ -15,8 +15,8 @@
 #include "iree/vm/api.h"
 #include "iree/vm/bytecode_module.h"
 #include "iree/vm/ref_cc.h"
-#include "iree_custom_modules/custom_modules_test_module_c.h"
-#include "iree_custom_modules/module.h"
+#include "samples/custom_modules/custom_modules_test_module_c.h"
+#include "samples/custom_modules/module.h"
 
 namespace {
 
diff --git a/samples/iree_custom_modules/custom_modules_test.mlir b/samples/custom_modules/custom_modules_test.mlir
similarity index 100%
rename from samples/iree_custom_modules/custom_modules_test.mlir
rename to samples/custom_modules/custom_modules_test.mlir
diff --git a/samples/iree_custom_modules/dialect/BUILD b/samples/custom_modules/dialect/BUILD
similarity index 97%
rename from samples/iree_custom_modules/dialect/BUILD
rename to samples/custom_modules/dialect/BUILD
index bf3cbeb..8b071d0 100644
--- a/samples/iree_custom_modules/dialect/BUILD
+++ b/samples/custom_modules/dialect/BUILD
@@ -47,7 +47,6 @@
         "//compiler/src/iree/compiler/Dialect/HAL/IR",
         "//compiler/src/iree/compiler/Dialect/Util/IR",
         "//compiler/src/iree/compiler/Dialect/VM/Conversion",
-        "//samples:defs",
         "@llvm-project//llvm:Support",
         "@llvm-project//mlir:IR",
         "@llvm-project//mlir:Parser",
@@ -88,7 +87,6 @@
     hdrs = ["init_dialect.h"],
     deps = [
         ":dialect",
-        "//samples:defs",
         "@llvm-project//mlir:IR",
     ],
 )
@@ -100,7 +98,6 @@
         ":init_dialect",
         "//compiler/src/iree/compiler/Tools:init_passes_and_dialects",
         "//compiler/src/iree/compiler/Tools:init_targets",
-        "//samples:defs",
         "@llvm-project//llvm:Support",
         "@llvm-project//mlir:IR",
         "@llvm-project//mlir:MlirOptLib",
@@ -122,7 +119,6 @@
         "//compiler/src/iree/compiler/Tools:init_translations",
         "//compiler/src/iree/compiler/Tools:init_xla_dialects",
         "//compiler/src/iree/compiler/Translation:IREEVM",
-        "//samples:defs",
         "@llvm-project//llvm:Support",
         "@llvm-project//mlir:IR",
         "@llvm-project//mlir:Pass",
diff --git a/samples/iree_custom_modules/dialect/CMakeLists.txt b/samples/custom_modules/dialect/CMakeLists.txt
similarity index 94%
rename from samples/iree_custom_modules/dialect/CMakeLists.txt
rename to samples/custom_modules/dialect/CMakeLists.txt
index bc226ea..08d1474 100644
--- a/samples/iree_custom_modules/dialect/CMakeLists.txt
+++ b/samples/custom_modules/dialect/CMakeLists.txt
@@ -1,6 +1,6 @@
 ################################################################################
 # Autogenerated by build_tools/bazel_to_cmake/bazel_to_cmake.py from           #
-# samples/iree_custom_modules/dialect/BUILD                                    #
+# samples/custom_modules/dialect/BUILD                                         #
 #                                                                              #
 # Use iree_cmake_extra_content from iree/build_defs.oss.bzl to add arbitrary   #
 # CMake-only content.                                                          #
@@ -34,7 +34,6 @@
     iree::compiler::Dialect::HAL::IR
     iree::compiler::Dialect::Util::IR
     iree::compiler::Dialect::VM::Conversion
-    iree::samples::defs
   PUBLIC
 )
 
@@ -71,7 +70,6 @@
   DEPS
     ::dialect
     MLIRIR
-    iree::samples::defs
   PUBLIC
 )
 
@@ -88,7 +86,6 @@
     MLIRSupport
     iree::compiler::Tools::init_passes_and_dialects
     iree::compiler::Tools::init_targets
-    iree::samples::defs
 )
 
 iree_cc_binary(
@@ -113,7 +110,6 @@
     iree::compiler::Tools::init_translations
     iree::compiler::Tools::init_xla_dialects
     iree::compiler::Translation::IREEVM
-    iree::samples::defs
 )
 
 ### BAZEL_TO_CMAKE_PRESERVES_ALL_CONTENT_BELOW_THIS_LINE ###
diff --git a/samples/iree_custom_modules/dialect/conversion_patterns.cc b/samples/custom_modules/dialect/conversion_patterns.cc
similarity index 94%
rename from samples/iree_custom_modules/dialect/conversion_patterns.cc
rename to samples/custom_modules/dialect/conversion_patterns.cc
index 4639952..6aeeacd 100644
--- a/samples/iree_custom_modules/dialect/conversion_patterns.cc
+++ b/samples/custom_modules/dialect/conversion_patterns.cc
@@ -4,11 +4,11 @@
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-#include "iree_custom_modules/dialect/conversion_patterns.h"
+#include "samples/custom_modules/dialect/conversion_patterns.h"
 
 #include "iree/compiler/Dialect/HAL/Conversion/ConversionTarget.h"
 #include "iree/compiler/Dialect/VM/Conversion/ImportUtils.h"
-#include "iree_custom_modules/dialect/custom_dialect.h"
+#include "samples/custom_modules/dialect/custom_dialect.h"
 
 namespace mlir {
 namespace iree_compiler {
diff --git a/samples/iree_custom_modules/dialect/conversion_patterns.h b/samples/custom_modules/dialect/conversion_patterns.h
similarity index 100%
rename from samples/iree_custom_modules/dialect/conversion_patterns.h
rename to samples/custom_modules/dialect/conversion_patterns.h
diff --git a/samples/iree_custom_modules/dialect/custom-opt-main.cc b/samples/custom_modules/dialect/custom-opt-main.cc
similarity index 95%
rename from samples/iree_custom_modules/dialect/custom-opt-main.cc
rename to samples/custom_modules/dialect/custom-opt-main.cc
index b66e12e..a0be0fb 100644
--- a/samples/iree_custom_modules/dialect/custom-opt-main.cc
+++ b/samples/custom_modules/dialect/custom-opt-main.cc
@@ -13,10 +13,10 @@
 #include "iree/compiler/Tools/init_dialects.h"
 #include "iree/compiler/Tools/init_passes.h"
 #include "iree/compiler/Tools/init_targets.h"
-#include "iree_custom_modules/dialect/init_dialect.h"
 #include "llvm/Support/InitLLVM.h"
 #include "mlir/IR/Dialect.h"
 #include "mlir/Tools/mlir-opt/MlirOptMain.h"
+#include "samples/custom_modules/dialect/init_dialect.h"
 
 int main(int argc, char **argv) {
   llvm::InitLLVM y(argc, argv);
diff --git a/samples/iree_custom_modules/dialect/custom-translate-main.cc b/samples/custom_modules/dialect/custom-translate-main.cc
similarity index 98%
rename from samples/iree_custom_modules/dialect/custom-translate-main.cc
rename to samples/custom_modules/dialect/custom-translate-main.cc
index 67eadde..ec152fe 100644
--- a/samples/iree_custom_modules/dialect/custom-translate-main.cc
+++ b/samples/custom_modules/dialect/custom-translate-main.cc
@@ -17,7 +17,6 @@
 #include "iree/compiler/Tools/init_targets.h"
 #include "iree/compiler/Tools/init_translations.h"
 #include "iree/compiler/Tools/init_xla_dialects.h"
-#include "iree_custom_modules/dialect/init_dialect.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/SourceMgr.h"
@@ -30,6 +29,7 @@
 #include "mlir/Support/LogicalResult.h"
 #include "mlir/Support/ToolUtilities.h"
 #include "mlir/Tools/mlir-translate/Translation.h"
+#include "samples/custom_modules/dialect/init_dialect.h"
 
 static llvm::cl::opt<std::string> inputFilename(llvm::cl::Positional,
                                                 llvm::cl::desc("<input file>"),
diff --git a/samples/iree_custom_modules/dialect/custom.imports.mlir b/samples/custom_modules/dialect/custom.imports.mlir
similarity index 100%
rename from samples/iree_custom_modules/dialect/custom.imports.mlir
rename to samples/custom_modules/dialect/custom.imports.mlir
diff --git a/samples/iree_custom_modules/dialect/custom_dialect.cc b/samples/custom_modules/dialect/custom_dialect.cc
similarity index 91%
rename from samples/iree_custom_modules/dialect/custom_dialect.cc
rename to samples/custom_modules/dialect/custom_dialect.cc
index d370f3c..f2f7058 100644
--- a/samples/iree_custom_modules/dialect/custom_dialect.cc
+++ b/samples/custom_modules/dialect/custom_dialect.cc
@@ -4,17 +4,17 @@
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-#include "iree_custom_modules/dialect/custom_dialect.h"
+#include "samples/custom_modules/dialect/custom_dialect.h"
 
 #include "iree/compiler/Dialect/HAL/Conversion/ConversionDialectInterface.h"
 #include "iree/compiler/Dialect/VM/Conversion/ConversionDialectInterface.h"
-#include "iree_custom_modules/dialect/conversion_patterns.h"
-#include "iree_custom_modules/dialect/custom.imports.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "mlir/IR/DialectImplementation.h"
 #include "mlir/IR/SymbolTable.h"
 #include "mlir/Parser/Parser.h"
 #include "mlir/Transforms/DialectConversion.h"
+#include "samples/custom_modules/dialect/conversion_patterns.h"
+#include "samples/custom_modules/dialect/custom.imports.h"
 
 namespace mlir {
 namespace iree_compiler {
@@ -70,7 +70,7 @@
 
 #define GET_OP_LIST
   addOperations<
-#include "iree_custom_modules/dialect/custom_ops.cc.inc"
+#include "samples/custom_modules/dialect/custom_ops.cc.inc"
       >();
 }
 
@@ -101,4 +101,4 @@
 }  // namespace mlir
 
 #define GET_OP_CLASSES
-#include "iree_custom_modules/dialect/custom_ops.cc.inc"
+#include "samples/custom_modules/dialect/custom_ops.cc.inc"
diff --git a/samples/iree_custom_modules/dialect/custom_dialect.h b/samples/custom_modules/dialect/custom_dialect.h
similarity index 95%
rename from samples/iree_custom_modules/dialect/custom_dialect.h
rename to samples/custom_modules/dialect/custom_dialect.h
index 7d6aafe..7134e93 100644
--- a/samples/iree_custom_modules/dialect/custom_dialect.h
+++ b/samples/custom_modules/dialect/custom_dialect.h
@@ -38,6 +38,6 @@
 }  // namespace mlir
 
 #define GET_OP_CLASSES
-#include "iree_custom_modules/dialect/custom_ops.h.inc"
+#include "samples/custom_modules/dialect/custom_ops.h.inc"
 
 #endif  // IREE_SAMPLES_CUSTOM_MODULES_DIALECT_CUSTOM_DIALECT_H_
diff --git a/samples/iree_custom_modules/dialect/custom_ops.td b/samples/custom_modules/dialect/custom_ops.td
similarity index 100%
rename from samples/iree_custom_modules/dialect/custom_ops.td
rename to samples/custom_modules/dialect/custom_ops.td
diff --git a/samples/iree_custom_modules/dialect/init_dialect.h b/samples/custom_modules/dialect/init_dialect.h
similarity index 93%
rename from samples/iree_custom_modules/dialect/init_dialect.h
rename to samples/custom_modules/dialect/init_dialect.h
index bfc7eb1..117233b 100644
--- a/samples/iree_custom_modules/dialect/init_dialect.h
+++ b/samples/custom_modules/dialect/init_dialect.h
@@ -12,8 +12,8 @@
 #ifndef IREE_SAMPLES_CUSTOM_MODULES_DIALECT_INIT_DIALECT_H_
 #define IREE_SAMPLES_CUSTOM_MODULES_DIALECT_INIT_DIALECT_H_
 
-#include "iree_custom_modules/dialect/custom_dialect.h"
 #include "mlir/IR/Dialect.h"
+#include "samples/custom_modules/dialect/custom_dialect.h"
 
 namespace mlir {
 namespace iree_compiler {
diff --git a/samples/iree_custom_modules/dialect/test/BUILD b/samples/custom_modules/dialect/test/BUILD
similarity index 92%
rename from samples/iree_custom_modules/dialect/test/BUILD
rename to samples/custom_modules/dialect/test/BUILD
index d2bd44b..336503d 100644
--- a/samples/iree_custom_modules/dialect/test/BUILD
+++ b/samples/custom_modules/dialect/test/BUILD
@@ -24,7 +24,7 @@
     ),
     cfg = "//samples:lit.cfg.py",
     tools = [
-        "//samples/iree_custom_modules/dialect:custom-opt",
+        "//samples/custom_modules/dialect:custom-opt",
         "@llvm-project//llvm:FileCheck",
     ],
 )
diff --git a/samples/iree_custom_modules/dialect/test/CMakeLists.txt b/samples/custom_modules/dialect/test/CMakeLists.txt
similarity index 87%
rename from samples/iree_custom_modules/dialect/test/CMakeLists.txt
rename to samples/custom_modules/dialect/test/CMakeLists.txt
index 858871d..aa240b4 100644
--- a/samples/iree_custom_modules/dialect/test/CMakeLists.txt
+++ b/samples/custom_modules/dialect/test/CMakeLists.txt
@@ -1,6 +1,6 @@
 ################################################################################
 # Autogenerated by build_tools/bazel_to_cmake/bazel_to_cmake.py from           #
-# samples/iree_custom_modules/dialect/test/BUILD                               #
+# samples/custom_modules/dialect/test/BUILD                                    #
 #                                                                              #
 # Use iree_cmake_extra_content from iree/build_defs.oss.bzl to add arbitrary   #
 # CMake-only content.                                                          #
@@ -18,7 +18,7 @@
     "custom_ops.mlir"
   TOOLS
     FileCheck
-    iree::samples::iree_custom_modules::dialect::custom-opt
+    iree::samples::custom_modules::dialect::custom-opt
 )
 
 ### BAZEL_TO_CMAKE_PRESERVES_ALL_CONTENT_BELOW_THIS_LINE ###
diff --git a/samples/iree_custom_modules/dialect/test/conversion.mlir b/samples/custom_modules/dialect/test/conversion.mlir
similarity index 100%
rename from samples/iree_custom_modules/dialect/test/conversion.mlir
rename to samples/custom_modules/dialect/test/conversion.mlir
diff --git a/samples/iree_custom_modules/dialect/test/custom_ops.mlir b/samples/custom_modules/dialect/test/custom_ops.mlir
similarity index 100%
rename from samples/iree_custom_modules/dialect/test/custom_ops.mlir
rename to samples/custom_modules/dialect/test/custom_ops.mlir
diff --git a/samples/iree_custom_modules/module.cc b/samples/custom_modules/module.cc
similarity index 99%
rename from samples/iree_custom_modules/module.cc
rename to samples/custom_modules/module.cc
index 554ab87..a05ac27 100644
--- a/samples/iree_custom_modules/module.cc
+++ b/samples/custom_modules/module.cc
@@ -4,7 +4,7 @@
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-#include "iree_custom_modules/module.h"
+#include "samples/custom_modules/module.h"
 
 #include <atomic>
 #include <cstdint>
diff --git a/samples/iree_custom_modules/module.h b/samples/custom_modules/module.h
similarity index 100%
rename from samples/iree_custom_modules/module.h
rename to samples/custom_modules/module.h
diff --git a/samples/emitc_modules/CMakeLists.txt b/samples/emitc_modules/CMakeLists.txt
new file mode 100644
index 0000000..e650319
--- /dev/null
+++ b/samples/emitc_modules/CMakeLists.txt
@@ -0,0 +1,76 @@
+# Copyright 2020 The IREE Authors
+#
+# Licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+if(NOT IREE_ENABLE_EMITC)
+  return()
+endif()
+
+iree_c_module(
+  NAME
+    add_module
+  SRC
+    "add.mlir"
+  H_FILE_OUTPUT
+    "add_module.h"
+  FLAGS
+    "--iree-mlir-to-vm-c-module"
+    "--iree-hal-target-backends=vmvx"
+)
+
+iree_cc_test(
+  NAME
+    add_module_test
+  SRCS
+    "add_module_test.cc"
+  DEPS
+    ::add_module
+    iree::base
+    iree::base::cc
+    iree::testing::gtest
+    iree::testing::gtest_main
+    iree::vm
+    iree::vm::cc
+)
+
+iree_cc_test(
+  NAME
+    import_module_test
+  SRCS
+    "import_module_test.cc"
+  DEPS
+    ::import_module_a
+    ::import_module_b
+    iree::base
+    iree::base::cc
+    iree::testing::gtest
+    iree::testing::gtest_main
+    iree::vm
+    iree::vm::cc
+)
+
+iree_c_module(
+  NAME
+    import_module_a
+  SRC
+    "import_module_a.mlir"
+  H_FILE_OUTPUT
+    "import_module_a.h"
+  FLAGS
+    "--iree-mlir-to-vm-c-module"
+    "--iree-hal-target-backends=vmvx"
+)
+
+iree_c_module(
+  NAME
+    import_module_b
+  SRC
+    "import_module_b.mlir"
+  H_FILE_OUTPUT
+    "import_module_b.h"
+  FLAGS
+    "--iree-mlir-to-vm-c-module"
+    "--iree-hal-target-backends=vmvx"
+)
diff --git a/samples/iree_emitc_modules/add.mlir b/samples/emitc_modules/add.mlir
similarity index 100%
rename from samples/iree_emitc_modules/add.mlir
rename to samples/emitc_modules/add.mlir
diff --git a/samples/iree_emitc_modules/add_module_test.cc b/samples/emitc_modules/add_module_test.cc
similarity index 98%
rename from samples/iree_emitc_modules/add_module_test.cc
rename to samples/emitc_modules/add_module_test.cc
index c4ff57e..94a2b5c 100644
--- a/samples/iree_emitc_modules/add_module_test.cc
+++ b/samples/emitc_modules/add_module_test.cc
@@ -4,7 +4,7 @@
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-#include "iree_emitc_modules/add_module.h"
+#include "samples/emitc_modules/add_module.h"
 
 #include "iree/base/status_cc.h"
 #include "iree/testing/gtest.h"
diff --git a/samples/iree_emitc_modules/import_module_a.mlir b/samples/emitc_modules/import_module_a.mlir
similarity index 100%
rename from samples/iree_emitc_modules/import_module_a.mlir
rename to samples/emitc_modules/import_module_a.mlir
diff --git a/samples/iree_emitc_modules/import_module_b.mlir b/samples/emitc_modules/import_module_b.mlir
similarity index 100%
rename from samples/iree_emitc_modules/import_module_b.mlir
rename to samples/emitc_modules/import_module_b.mlir
diff --git a/samples/iree_emitc_modules/import_module_test.cc b/samples/emitc_modules/import_module_test.cc
similarity index 96%
rename from samples/iree_emitc_modules/import_module_test.cc
rename to samples/emitc_modules/import_module_test.cc
index 4455f08..658741e 100644
--- a/samples/iree_emitc_modules/import_module_test.cc
+++ b/samples/emitc_modules/import_module_test.cc
@@ -9,8 +9,8 @@
 #include "iree/testing/status_matchers.h"
 #include "iree/vm/api.h"
 #include "iree/vm/ref_cc.h"
-#include "iree_emitc_modules/import_module_a.h"
-#include "iree_emitc_modules/import_module_b.h"
+#include "samples/emitc_modules/import_module_a.h"
+#include "samples/emitc_modules/import_module_b.h"
 
 namespace iree {
 namespace {
diff --git a/samples/iree_emitc_modules/CMakeLists.txt b/samples/iree_emitc_modules/CMakeLists.txt
deleted file mode 100644
index 480ea71..0000000
--- a/samples/iree_emitc_modules/CMakeLists.txt
+++ /dev/null
@@ -1,78 +0,0 @@
-# Copyright 2020 The IREE Authors
-#
-# Licensed under the Apache License v2.0 with LLVM Exceptions.
-# See https://llvm.org/LICENSE.txt for license information.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-if(IREE_ENABLE_EMITC)
-  # Configures all iree_cc_* targets to take this implicit dep,
-  # which provides common includes and copts for this directory.
-  set(IREE_IMPLICIT_DEFS_CC_DEPS iree::samples::defs)
-
-  iree_c_module(
-    NAME
-      add_module
-    SRC
-      "add.mlir"
-    H_FILE_OUTPUT
-      "add_module.h"
-    FLAGS
-      "--iree-mlir-to-vm-c-module"
-      "--iree-hal-target-backends=vmvx"
-  )
-
-  iree_cc_test(
-    NAME
-      add_module_test
-    SRCS
-      "add_module_test.cc"
-    DEPS
-      ::add_module
-      iree::base
-      iree::base::cc
-      iree::testing::gtest
-      iree::testing::gtest_main
-      iree::vm
-      iree::vm::cc
-  )
-
-  iree_cc_test(
-    NAME
-      import_module_test
-    SRCS
-      "import_module_test.cc"
-    DEPS
-      ::import_module_a
-      ::import_module_b
-      iree::base
-      iree::base::cc
-      iree::testing::gtest
-      iree::testing::gtest_main
-      iree::vm
-      iree::vm::cc
-  )
-
-  iree_c_module(
-    NAME
-      import_module_a
-    SRC
-      "import_module_a.mlir"
-    H_FILE_OUTPUT
-      "import_module_a.h"
-    FLAGS
-      "--iree-mlir-to-vm-c-module"
-      "--iree-hal-target-backends=vmvx"
-  )
-
-  iree_c_module(
-    NAME
-      import_module_b
-    SRC
-      "import_module_b.mlir"
-    H_FILE_OUTPUT
-      "import_module_b.h"
-    FLAGS
-      "--iree-mlir-to-vm-c-module"
-      "--iree-hal-target-backends=vmvx"
-  )
-endif()
diff --git a/samples/iree_simple_embedding/BUILD b/samples/simple_embedding/BUILD
similarity index 96%
rename from samples/iree_simple_embedding/BUILD
rename to samples/simple_embedding/BUILD
index 22d6772..0bef44c 100644
--- a/samples/iree_simple_embedding/BUILD
+++ b/samples/simple_embedding/BUILD
@@ -50,9 +50,6 @@
         "--iree-mlir-to-vm-bytecode-module",
         "--iree-hal-target-backends=vmvx",
     ],
-    deps = [
-        "//samples:defs",
-    ],
 )
 
 native_test(
@@ -111,9 +108,6 @@
         "--iree-vm-bytecode-module-strip-source-map=true",
         "--iree-vm-emit-polyglot-zip=false",
     ],
-    deps = [
-        "//samples:defs",
-    ],
 )
 
 iree_bytecode_module(
@@ -132,9 +126,6 @@
         "--iree-vm-bytecode-module-strip-source-map=true",
         "--iree-vm-emit-polyglot-zip=false",
     ],
-    deps = [
-        "//samples:defs",
-    ],
 )
 
 iree_bytecode_module(
@@ -153,9 +144,6 @@
         "--iree-vm-bytecode-module-strip-source-map=true",
         "--iree-vm-emit-polyglot-zip=false",
     ],
-    deps = [
-        "//samples:defs",
-    ],
 )
 
 iree_bytecode_module(
@@ -172,9 +160,6 @@
         "--iree-vm-bytecode-module-strip-source-map=true",
         "--iree-vm-emit-polyglot-zip=false",
     ],
-    deps = [
-        "//samples:defs",
-    ],
 )
 
 iree_bytecode_module(
@@ -190,9 +175,6 @@
         "--iree-vm-bytecode-module-strip-source-map=true",
         "--iree-vm-emit-polyglot-zip=false",
     ],
-    deps = [
-        "//samples:defs",
-    ],
 )
 
 native_test(
@@ -278,9 +260,6 @@
         "--iree-hal-target-backends=vulkan-spirv",
         "--iree-llvm-debug-symbols=false",
     ],
-    deps = [
-        "//samples:defs",
-    ],
 )
 
 native_test(
diff --git a/samples/iree_simple_embedding/CMakeLists.txt b/samples/simple_embedding/CMakeLists.txt
similarity index 95%
rename from samples/iree_simple_embedding/CMakeLists.txt
rename to samples/simple_embedding/CMakeLists.txt
index 737491b..c992e06 100644
--- a/samples/iree_simple_embedding/CMakeLists.txt
+++ b/samples/simple_embedding/CMakeLists.txt
@@ -1,6 +1,6 @@
 ################################################################################
 # Autogenerated by build_tools/bazel_to_cmake/bazel_to_cmake.py from           #
-# samples/iree_simple_embedding/BUILD                                          #
+# samples/simple_embedding/BUILD                                               #
 #                                                                              #
 # Use iree_cmake_extra_content from iree/build_defs.oss.bzl to add arbitrary   #
 # CMake-only content.                                                          #
@@ -42,8 +42,6 @@
     "--iree-input-type=mhlo"
     "--iree-mlir-to-vm-bytecode-module"
     "--iree-hal-target-backends=vmvx"
-  DEPS
-    iree::samples::defs
   PUBLIC
 )
 
@@ -96,8 +94,6 @@
     "--iree-llvm-debug-symbols=false"
     "--iree-vm-bytecode-module-strip-source-map=true"
     "--iree-vm-emit-polyglot-zip=false"
-  DEPS
-    iree::samples::defs
   PUBLIC
 )
 
@@ -119,8 +115,6 @@
     "--iree-llvm-debug-symbols=false"
     "--iree-vm-bytecode-module-strip-source-map=true"
     "--iree-vm-emit-polyglot-zip=false"
-  DEPS
-    iree::samples::defs
   PUBLIC
 )
 
@@ -142,8 +136,6 @@
     "--iree-llvm-debug-symbols=false"
     "--iree-vm-bytecode-module-strip-source-map=true"
     "--iree-vm-emit-polyglot-zip=false"
-  DEPS
-    iree::samples::defs
   PUBLIC
 )
 
@@ -163,8 +155,6 @@
     "--iree-llvm-debug-symbols=false"
     "--iree-vm-bytecode-module-strip-source-map=true"
     "--iree-vm-emit-polyglot-zip=false"
-  DEPS
-    iree::samples::defs
   PUBLIC
 )
 
@@ -183,8 +173,6 @@
     "--iree-llvm-debug-symbols=false"
     "--iree-vm-bytecode-module-strip-source-map=true"
     "--iree-vm-emit-polyglot-zip=false"
-  DEPS
-    iree::samples::defs
   PUBLIC
 )
 
@@ -260,8 +248,6 @@
     "--iree-mlir-to-vm-bytecode-module"
     "--iree-hal-target-backends=vulkan-spirv"
     "--iree-llvm-debug-symbols=false"
-  DEPS
-    iree::samples::defs
   PUBLIC
 )
 
diff --git a/samples/iree_simple_embedding/README.md b/samples/simple_embedding/README.md
similarity index 100%
rename from samples/iree_simple_embedding/README.md
rename to samples/simple_embedding/README.md
diff --git a/samples/iree_simple_embedding/device_cuda.c b/samples/simple_embedding/device_cuda.c
similarity index 94%
rename from samples/iree_simple_embedding/device_cuda.c
rename to samples/simple_embedding/device_cuda.c
index 0e273f4..62c233a 100644
--- a/samples/iree_simple_embedding/device_cuda.c
+++ b/samples/simple_embedding/device_cuda.c
@@ -13,7 +13,7 @@
 #include "iree/hal/cuda/registration/driver_module.h"
 
 // Compiled module embedded here to avoid file IO:
-#include "iree_simple_embedding/simple_embedding_test_bytecode_module_cuda_c.h"
+#include "samples/simple_embedding/simple_embedding_test_bytecode_module_cuda_c.h"
 
 iree_status_t create_sample_device(iree_allocator_t host_allocator,
                                    iree_hal_device_t** out_device) {
diff --git a/samples/iree_simple_embedding/device_dylib.c b/samples/simple_embedding/device_dylib.c
similarity index 90%
rename from samples/iree_simple_embedding/device_dylib.c
rename to samples/simple_embedding/device_dylib.c
index 0e19c33..2321437 100644
--- a/samples/iree_simple_embedding/device_dylib.c
+++ b/samples/simple_embedding/device_dylib.c
@@ -16,9 +16,9 @@
 #include "iree/task/api.h"
 
 // Compiled module embedded here to avoid file IO:
-#include "iree_simple_embedding/simple_embedding_test_bytecode_module_dylib_arm_64_c.h"
-#include "iree_simple_embedding/simple_embedding_test_bytecode_module_dylib_riscv_64_c.h"
-#include "iree_simple_embedding/simple_embedding_test_bytecode_module_dylib_x86_64_c.h"
+#include "samples/simple_embedding/simple_embedding_test_bytecode_module_dylib_arm_64_c.h"
+#include "samples/simple_embedding/simple_embedding_test_bytecode_module_dylib_riscv_64_c.h"
+#include "samples/simple_embedding/simple_embedding_test_bytecode_module_dylib_x86_64_c.h"
 
 iree_status_t create_sample_device(iree_allocator_t host_allocator,
                                    iree_hal_device_t** out_device) {
diff --git a/samples/iree_simple_embedding/device_embedded_sync.c b/samples/simple_embedding/device_embedded_sync.c
similarity index 85%
rename from samples/iree_simple_embedding/device_embedded_sync.c
rename to samples/simple_embedding/device_embedded_sync.c
index d400394..b4bc118 100644
--- a/samples/iree_simple_embedding/device_embedded_sync.c
+++ b/samples/simple_embedding/device_embedded_sync.c
@@ -16,15 +16,15 @@
 
 // Compiled module embedded here to avoid file IO:
 #if IREE_ARCH_ARM_32
-#include "iree_simple_embedding/simple_embedding_test_bytecode_module_dylib_arm_32_c.h"
+#include "samples/simple_embedding/simple_embedding_test_bytecode_module_dylib_arm_32_c.h"
 #elif IREE_ARCH_ARM_64
-#include "iree_simple_embedding/simple_embedding_test_bytecode_module_dylib_arm_64_c.h"
+#include "samples/simple_embedding/simple_embedding_test_bytecode_module_dylib_arm_64_c.h"
 #elif IREE_ARCH_RISCV_32
-#include "iree_simple_embedding/simple_embedding_test_bytecode_module_dylib_riscv_32_c.h"
+#include "samples/simple_embedding/simple_embedding_test_bytecode_module_dylib_riscv_32_c.h"
 #elif IREE_ARCH_RISCV_64
-#include "iree_simple_embedding/simple_embedding_test_bytecode_module_dylib_riscv_64_c.h"
+#include "samples/simple_embedding/simple_embedding_test_bytecode_module_dylib_riscv_64_c.h"
 #elif IREE_ARCH_X86_64
-#include "iree_simple_embedding/simple_embedding_test_bytecode_module_dylib_x86_64_c.h"
+#include "samples/simple_embedding/simple_embedding_test_bytecode_module_dylib_x86_64_c.h"
 #endif
 
 iree_status_t create_sample_device(iree_allocator_t host_allocator,
diff --git a/samples/iree_simple_embedding/device_vmvx_sync.c b/samples/simple_embedding/device_vmvx_sync.c
similarity index 95%
rename from samples/iree_simple_embedding/device_vmvx_sync.c
rename to samples/simple_embedding/device_vmvx_sync.c
index 417c48d..0683405 100644
--- a/samples/iree_simple_embedding/device_vmvx_sync.c
+++ b/samples/simple_embedding/device_vmvx_sync.c
@@ -15,7 +15,7 @@
 #include "iree/hal/local/sync_device.h"
 
 // Compiled module embedded here to avoid file IO:
-#include "iree_simple_embedding/simple_embedding_test_bytecode_module_vmvx_c.h"
+#include "samples/simple_embedding/simple_embedding_test_bytecode_module_vmvx_c.h"
 
 iree_status_t create_sample_device(iree_allocator_t host_allocator,
                                    iree_hal_device_t** out_device) {
diff --git a/samples/iree_simple_embedding/device_vulkan.c b/samples/simple_embedding/device_vulkan.c
similarity index 94%
rename from samples/iree_simple_embedding/device_vulkan.c
rename to samples/simple_embedding/device_vulkan.c
index e0a6004..dce0b9f 100644
--- a/samples/iree_simple_embedding/device_vulkan.c
+++ b/samples/simple_embedding/device_vulkan.c
@@ -13,7 +13,7 @@
 #include "iree/hal/vulkan/registration/driver_module.h"
 
 // Compiled module embedded here to avoid file IO:
-#include "iree_simple_embedding/simple_embedding_test_bytecode_module_vulkan_c.h"
+#include "samples/simple_embedding/simple_embedding_test_bytecode_module_vulkan_c.h"
 
 iree_status_t create_sample_device(iree_allocator_t host_allocator,
                                    iree_hal_device_t** out_device) {
diff --git a/samples/iree_simple_embedding/simple_embedding.c b/samples/simple_embedding/simple_embedding.c
similarity index 100%
rename from samples/iree_simple_embedding/simple_embedding.c
rename to samples/simple_embedding/simple_embedding.c
diff --git a/samples/iree_simple_embedding/simple_embedding_test.mlir b/samples/simple_embedding/simple_embedding_test.mlir
similarity index 100%
rename from samples/iree_simple_embedding/simple_embedding_test.mlir
rename to samples/simple_embedding/simple_embedding_test.mlir
diff --git a/samples/iree_static_library/CMakeLists.txt b/samples/static_library/CMakeLists.txt
similarity index 96%
rename from samples/iree_static_library/CMakeLists.txt
rename to samples/static_library/CMakeLists.txt
index 72cc04b..d3d1d7d 100644
--- a/samples/iree_static_library/CMakeLists.txt
+++ b/samples/static_library/CMakeLists.txt
@@ -10,11 +10,6 @@
   return()
 endif()
 
-
-# Configures all iree_cc_* targets to take this implicit dep,
-# which provides common includes and copts for this directory.
-set(IREE_IMPLICIT_DEFS_CC_DEPS iree::samples::defs)
-
 # Set iree-compile binary.
 set(_COMPILE_TOOL_EXECUTABLE $<TARGET_FILE:iree_tools_iree-compile>)
 
diff --git a/samples/iree_static_library/README.md b/samples/static_library/README.md
similarity index 100%
rename from samples/iree_static_library/README.md
rename to samples/static_library/README.md
diff --git a/samples/iree_static_library/create_bytecode_module.c b/samples/static_library/create_bytecode_module.c
similarity index 94%
rename from samples/iree_static_library/create_bytecode_module.c
rename to samples/static_library/create_bytecode_module.c
index 1689015..4e5c5e7 100644
--- a/samples/iree_static_library/create_bytecode_module.c
+++ b/samples/static_library/create_bytecode_module.c
@@ -6,7 +6,7 @@
 #include <stdio.h>
 
 #include "iree/vm/bytecode_module.h"
-#include "iree_static_library/simple_mul_c.h"
+#include "samples/static_library/simple_mul_c.h"
 
 // A function to create the bytecode module.
 iree_status_t create_module(iree_vm_module_t** module) {
diff --git a/samples/iree_static_library/create_c_module.c b/samples/static_library/create_c_module.c
similarity index 89%
rename from samples/iree_static_library/create_c_module.c
rename to samples/static_library/create_c_module.c
index 8a1b1a4..683aead 100644
--- a/samples/iree_static_library/create_c_module.c
+++ b/samples/static_library/create_c_module.c
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 #include <stdio.h>
 
-#include "iree_static_library/simple_mul_emitc.h"
+#include "samples/static_library/simple_mul_emitc.h"
 
 // A function to create the C module.
 iree_status_t create_module(iree_vm_module_t** module) {
diff --git a/samples/iree_static_library/simple_mul.mlir b/samples/static_library/simple_mul.mlir
similarity index 100%
rename from samples/iree_static_library/simple_mul.mlir
rename to samples/static_library/simple_mul.mlir
diff --git a/samples/iree_static_library/static_library_demo.c b/samples/static_library/static_library_demo.c
similarity index 100%
rename from samples/iree_static_library/static_library_demo.c
rename to samples/static_library/static_library_demo.c
diff --git a/samples/iree_static_library/static_library_demo_c_test.txt b/samples/static_library/static_library_demo_c_test.txt
similarity index 100%
rename from samples/iree_static_library/static_library_demo_c_test.txt
rename to samples/static_library/static_library_demo_c_test.txt
diff --git a/samples/iree_static_library/static_library_demo_test.txt b/samples/static_library/static_library_demo_test.txt
similarity index 100%
rename from samples/iree_static_library/static_library_demo_test.txt
rename to samples/static_library/static_library_demo_test.txt
diff --git a/samples/iree_vision_inference/CMakeLists.txt b/samples/vision_inference/CMakeLists.txt
similarity index 90%
rename from samples/iree_vision_inference/CMakeLists.txt
rename to samples/vision_inference/CMakeLists.txt
index 7b9f17f..2da2ffa 100644
--- a/samples/iree_vision_inference/CMakeLists.txt
+++ b/samples/vision_inference/CMakeLists.txt
@@ -20,8 +20,6 @@
     "--iree-input-type=mhlo"
     "--iree-mlir-to-vm-bytecode-module"
     "--iree-hal-target-backends=dylib-llvm-aot"
-  DEPS
-    iree::samples::defs
   PUBLIC
 )
 
@@ -33,7 +31,7 @@
   SRCS
     "iree-run-mnist-module.c"
   DATA
-    "samples/iree_vision_inference/mnist_test.png"
+    "samples/vision_inference/mnist_test.png"
   DEPS
     ::mnist_bytecode_module_c
     iree::runtime
@@ -49,7 +47,7 @@
     ::iree-run-mnist-module
     FileCheck
   DATA
-    "mnist_test.png"
+    "samples/vision_inference/mnist_test.png"
   LABELS
     "hostonly"
 )
diff --git a/samples/iree_vision_inference/iree-run-mnist-module.c b/samples/vision_inference/iree-run-mnist-module.c
similarity index 98%
rename from samples/iree_vision_inference/iree-run-mnist-module.c
rename to samples/vision_inference/iree-run-mnist-module.c
index b7a9cb8..117666e 100644
--- a/samples/iree_vision_inference/iree-run-mnist-module.c
+++ b/samples/vision_inference/iree-run-mnist-module.c
@@ -12,7 +12,7 @@
 
 #include "iree/runtime/api.h"
 #include "iree/tools/utils/image_util.h"
-#include "iree_vision_inference/mnist_bytecode_module_c.h"
+#include "samples/vision_inference/mnist_bytecode_module_c.h"
 
 iree_status_t Run(const iree_string_view_t image_path) {
   iree_runtime_instance_options_t instance_options;
diff --git a/samples/iree_vision_inference/mnist_test.png b/samples/vision_inference/mnist_test.png
similarity index 100%
rename from samples/iree_vision_inference/mnist_test.png
rename to samples/vision_inference/mnist_test.png
Binary files differ
diff --git a/samples/iree_vision_inference/mnist_test.txt b/samples/vision_inference/mnist_test.txt
similarity index 100%
rename from samples/iree_vision_inference/mnist_test.txt
rename to samples/vision_inference/mnist_test.txt