Merge branch 'google' into main-to-google
diff --git a/.gitmodules b/.gitmodules
index c6ec233..f5306b8 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -50,3 +50,6 @@
 [submodule "third_party/llvm-bazel"]
 	path = third_party/llvm-bazel
 	url = https://github.com/google/llvm-bazel.git
+[submodule "third_party/liburing"]
+	path = third_party/liburing
+	url = https://github.com/axboe/liburing.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7bf87db..ae9e25e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,7 +45,6 @@
 option(IREE_BUILD_SAMPLES "Builds IREE sample projects." ON)
 option(IREE_BUILD_DEBUGGER "Builds the IREE debugger app." OFF)
 option(IREE_BUILD_JAVA_BINDINGS "Builds the IREE java bindings." OFF)
-option(IREE_BUILD_EXPERIMENTAL "Builds experimental projects." OFF)
 option(IREE_BUILD_TENSORFLOW_COMPILER "Builds TensorFlow compiler frontend." OFF)
 option(IREE_BUILD_TFLITE_COMPILER "Builds the TFLite compiler frontend." OFF)
 option(IREE_BUILD_XLA_COMPILER "Builds TensorFlow XLA compiler frontend." OFF)
@@ -72,7 +71,18 @@
   option(IREE_BUILD_PYTHON_BINDINGS "Builds the IREE python bindings" OFF)
 endif()
 
-if(${IREE_BUILD_SAMPLES} OR ${IREE_BUILD_EXPERIMENTAL})
+#-------------------------------------------------------------------------------
+# Experimental project flags
+#-------------------------------------------------------------------------------
+
+option(IREE_BUILD_EXPERIMENTAL_MODEL_BUILDER "Builds experimental Model-Builder sub-project." OFF)
+option(IREE_BUILD_EXPERIMENTAL_REMOTING "Builds experimental remoting support." OFF)
+
+#-------------------------------------------------------------------------------
+# Derived flags based on primary options
+#-------------------------------------------------------------------------------
+
+if(${IREE_BUILD_SAMPLES} OR ${IREE_BUILD_EXPERIMENTAL_MODEL_BUILDER})
   set(IREE_BUILD_COMPILER ON CACHE BOOL "Build the IREE compiler for sample projects." FORCE)
 endif()
 
@@ -323,7 +333,7 @@
   set(_CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}")
 
   # experimental model builder uses vulkan runner.
-  if(${IREE_BUILD_EXPERIMENTAL})
+  if(${IREE_BUILD_EXPERIMENTAL_MODEL_BUILDER})
     set(MLIR_VULKAN_RUNNER_ENABLED ON)
   endif()
 
@@ -497,11 +507,7 @@
 add_subdirectory(iree/schemas)
 add_subdirectory(iree/testing)
 add_subdirectory(iree/test)
-
-if(${IREE_ENABLE_MLIR})
-  # The VM requires LLVM to build its op definitions.
-  add_subdirectory(iree/vm)
-endif()
+add_subdirectory(iree/vm)
 
 if(${IREE_BUILD_COMPILER})
   add_subdirectory(iree/compiler)
@@ -527,8 +533,19 @@
   add_subdirectory(iree/samples)
 endif()
 
-if(${IREE_BUILD_EXPERIMENTAL})
-  add_subdirectory(experimental)
+if(${IREE_BUILD_EXPERIMENTAL_MODEL_BUILDER})
+  add_subdirectory(experimental/ModelBuilder)
+endif()
+
+if(${IREE_BUILD_EXPERIMENTAL_REMOTING})
+  # NOTE: Currently liburing is only used by the experimental remoting
+  # support, so keeping it scoped here. If this broadens, then include along
+  # with other dependencies as normal.
+  if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+    message(STATUS "Enabling liburing")
+    add_subdirectory(build_tools/third_party/liburing EXCLUDE_FROM_ALL)
+  endif()
+  add_subdirectory(experimental/remoting)
 endif()
 
 if(${IREE_ENABLE_TENSORFLOW})
diff --git a/SUBMODULE_VERSIONS b/SUBMODULE_VERSIONS
index 2d11c38..fc15b61 100644
--- a/SUBMODULE_VERSIONS
+++ b/SUBMODULE_VERSIONS
@@ -3,6 +3,7 @@
 63b254577ed77a8004a9be6ac707f3dccc4e1fd9 third_party/cpuinfo
 4fb0ff7069bd88ee85902f4d0bb62794e5f6d021 third_party/flatcc
 b1fbd33c06cdb0024c67733c6fdec2009d17b384 third_party/googletest
+88b845dee001723c4a0db1fe5477de735b6d3bb0 third_party/liburing
 b355c694790b8e69e1bb320db0c8a5047a5c382c third_party/llvm-bazel
 c3acda0798f9b10ac3187ad941bbd8af82fb84a1 third_party/llvm-project
 a438d3b2e9e2e4699b94787b7fb6e8b45d4e92c6 third_party/mlir-emitc
diff --git a/bindings/javatests/CMakeLists.txt b/bindings/javatests/CMakeLists.txt
index 268f43b..cec74ee 100644
--- a/bindings/javatests/CMakeLists.txt
+++ b/bindings/javatests/CMakeLists.txt
@@ -12,4 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+if (NOT ${IREE_BUILD_TESTS})
+  return()
+endif()
+
 add_subdirectory(com/google/iree)
diff --git a/bindings/javatests/com/google/iree/CMakeLists.txt b/bindings/javatests/com/google/iree/CMakeLists.txt
index 15f9896..1d983f2 100644
--- a/bindings/javatests/com/google/iree/CMakeLists.txt
+++ b/bindings/javatests/com/google/iree/CMakeLists.txt
@@ -12,25 +12,27 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-iree_bytecode_module(
-  NAME
-    simple_mul_bytecode_module
-  SRC
-    "simple_mul.mlir"
-  CC_NAMESPACE
-    "iree::java"
-  FLAGS
-    "-iree-mlir-to-vm-bytecode-module"
-    "-iree-hal-target-backends=vmla"
-)
+if(${IREE_BUILD_COMPILER})
+  iree_bytecode_module(
+    NAME
+      simple_mul_bytecode_module
+    SRC
+      "simple_mul.mlir"
+    CC_NAMESPACE
+      "iree::java"
+    FLAGS
+      "-iree-mlir-to-vm-bytecode-module"
+      "-iree-hal-target-backends=vmla"
+  )
 
-iree_cc_binary(
-  NAME
-    integration_test
-   SRCS
-    "integration_test.cc"
-  DEPS
-     bindings::java::com::google::iree::native::cc_wrappers
-     bindings::javatests::com::google::iree::simple_mul_bytecode_module_cc
-     iree::base::status
-)
+  iree_cc_binary(
+    NAME
+      integration_test
+     SRCS
+      "integration_test.cc"
+    DEPS
+       bindings::java::com::google::iree::native::cc_wrappers
+       bindings::javatests::com::google::iree::simple_mul_bytecode_module_cc
+       iree::base::status
+  )
+endif()
diff --git a/build_tools/cmake/external_cc_library.cmake b/build_tools/cmake/external_cc_library.cmake
index d9cd38e..88c0f82 100644
--- a/build_tools/cmake/external_cc_library.cmake
+++ b/build_tools/cmake/external_cc_library.cmake
@@ -130,13 +130,15 @@
         ${_RULE_COPTS}
         ${IREE_DEFAULT_COPTS}
     )
-    target_link_libraries(${_NAME}
-      PUBLIC
-        ${_RULE_DEPS}
+    target_link_options(${_NAME}
       PRIVATE
         ${IREE_DEFAULT_LINKOPTS}
         ${_RULE_LINKOPTS}
     )
+    target_link_libraries(${_NAME}
+      PUBLIC
+        ${_RULE_DEPS}
+    )
     target_compile_definitions(${_NAME}
       PUBLIC
         ${_RULE_DEFINES}
@@ -169,10 +171,13 @@
         ${IREE_DEFAULT_COPTS}
         ${_RULE_COPTS}
     )
-    target_link_libraries(${_NAME}
+    target_link_options(${_NAME}
       INTERFACE
         ${IREE_DEFAULT_LINKOPTS}
         ${_RULE_LINKOPTS}
+    )
+    target_link_libraries(${_NAME}
+      INTERFACE
         ${_RULE_DEPS}
     )
     iree_add_data_dependencies(NAME ${_NAME} DATA ${_RULE_DATA})
diff --git a/build_tools/cmake/iree_cc_library.cmake b/build_tools/cmake/iree_cc_library.cmake
index fc7cb5d..41738dc 100644
--- a/build_tools/cmake/iree_cc_library.cmake
+++ b/build_tools/cmake/iree_cc_library.cmake
@@ -128,14 +128,15 @@
         ${IREE_DEFAULT_COPTS}
         ${_RULE_COPTS}
     )
-
-    target_link_libraries(${_NAME}
-      PUBLIC
-        ${_RULE_DEPS}
+    target_link_options(${_NAME}
       PRIVATE
         ${IREE_DEFAULT_LINKOPTS}
         ${_RULE_LINKOPTS}
     )
+    target_link_libraries(${_NAME}
+      PUBLIC
+        ${_RULE_DEPS}
+    )
 
     iree_add_data_dependencies(NAME ${_NAME} DATA ${_RULE_DATA})
     target_compile_definitions(${_NAME}
@@ -168,12 +169,15 @@
         ${IREE_DEFAULT_COPTS}
         ${_RULE_COPTS}
     )
-    target_link_libraries(${_NAME}
+    target_link_options(${_NAME}
       INTERFACE
         ${IREE_DEFAULT_LINKOPTS}
-        ${_RULE_DEPS}
         ${_RULE_LINKOPTS}
     )
+    target_link_libraries(${_NAME}
+      INTERFACE
+        ${_RULE_DEPS}
+    )
     iree_add_data_dependencies(NAME ${_NAME} DATA ${_RULE_DATA})
     target_compile_definitions(${_NAME}
       INTERFACE
diff --git a/build_tools/cmake/iree_check_test.cmake b/build_tools/cmake/iree_check_test.cmake
index 2974a93..96cdfa8 100644
--- a/build_tools/cmake/iree_check_test.cmake
+++ b/build_tools/cmake/iree_check_test.cmake
@@ -36,6 +36,8 @@
     return()
   endif()
 
+  # When *not* cross compiling, respect the IREE_BUILD_COMPILER option.
+  # Cross compilation uses its own "IREE_HOST_BUILD_COMPILER" option.
   if(NOT IREE_BUILD_COMPILER AND NOT CMAKE_CROSSCOMPILING)
     return()
   endif()
@@ -184,6 +186,10 @@
     return()
   endif()
 
+  # Note: we could check IREE_BUILD_COMPILER here, but cross compilation makes
+  # that a little tricky. Instead, we let iree_check_test handle the checks,
+  # meaning this function may run some configuration but generate no targets.
+
   cmake_parse_arguments(
     _RULE
     ""
diff --git a/build_tools/cmake/iree_cross_compile.cmake b/build_tools/cmake/iree_cross_compile.cmake
index 4257410..7bb8ab9 100644
--- a/build_tools/cmake/iree_cross_compile.cmake
+++ b/build_tools/cmake/iree_cross_compile.cmake
@@ -87,7 +87,6 @@
   iree_to_bool(_CONFIG_BUILD_DEBUGGER "${IREE_${CONFIG_NAME}_BUILD_DEBUGGER}")
   iree_to_bool(_CONFIG_BUILD_PYTHON_BINDINGS "${IREE_${CONFIG_NAME}_BUILD_PYTHON_BINDINGS}")
   iree_to_bool(_CONFIG_BUILD_JAVA_BINDINGS "${IREE_${CONFIG_NAME}_BUILD_JAVA_BINDINGS}")
-  iree_to_bool(_CONFIG_BUILD_EXPERIMENTAL "${IREE_${CONFIG_NAME}_BUILD_EXPERIMENTAL}")
   iree_to_bool(_CONFIG_BUILD_TENSORFLOW_COMPILER "${IREE_${CONFIG_NAME}_BUILD_TENSORFLOW_COMPILER}")
 
   # Escape semicolons in the targets list so that CMake doesn't expand them to
diff --git a/build_tools/cmake/iree_lit_test.cmake b/build_tools/cmake/iree_lit_test.cmake
index 1a80cb4..e6974b9 100644
--- a/build_tools/cmake/iree_lit_test.cmake
+++ b/build_tools/cmake/iree_lit_test.cmake
@@ -35,6 +35,14 @@
     return()
   endif()
 
+  # When *not* cross compiling, respect the IREE_BUILD_COMPILER option.
+  # Cross compilation uses its own "IREE_HOST_BUILD_COMPILER" option.
+  # Note: lit tests are not *required* to be "compiler" tests, but we only use
+  # them for compiler tests in practice.
+  if(NOT IREE_BUILD_COMPILER AND NOT CMAKE_CROSSCOMPILING)
+    return()
+  endif()
+
   cmake_parse_arguments(
     _RULE
     ""
@@ -112,6 +120,10 @@
     return()
   endif()
 
+  # Note: we could check IREE_BUILD_COMPILER here, but cross compilation makes
+  # that a little tricky. Instead, we let iree_check_test handle the checks,
+  # meaning this function may run some configuration but generate no targets.
+
   cmake_parse_arguments(
     _RULE
     ""
diff --git a/build_tools/third_party/liburing/.clang-format b/build_tools/third_party/liburing/.clang-format
new file mode 100644
index 0000000..7968b43
--- /dev/null
+++ b/build_tools/third_party/liburing/.clang-format
@@ -0,0 +1,3 @@
+DisableFormat: true
+SortIncludes: false
+
diff --git a/build_tools/third_party/liburing/CMakeLists.txt b/build_tools/third_party/liburing/CMakeLists.txt
new file mode 100644
index 0000000..da4f232
--- /dev/null
+++ b/build_tools/third_party/liburing/CMakeLists.txt
@@ -0,0 +1,37 @@
+# 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.
+
+set(LIBURING_ROOT "${IREE_ROOT_DIR}/third_party/liburing/src/")
+
+external_cc_library(
+  PACKAGE
+    liburing
+  NAME
+    liburing
+  ROOT
+    ${LIBURING_ROOT}
+  INCLUDES
+    ${LIBURING_ROOT}/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/default_config/src/include
+  SRCS
+    "queue.c"
+    "register.c"
+    "setup.c"
+    "syscall.c"
+    "syscall.h"
+  HDRS
+    "include/liburing.h"
+    "include/liburing/barrier.h"
+    "include/liburing/io_uring.h"
+)
diff --git a/build_tools/third_party/liburing/default_config/config-host.h b/build_tools/third_party/liburing/default_config/config-host.h
new file mode 100644
index 0000000..21af714
--- /dev/null
+++ b/build_tools/third_party/liburing/default_config/config-host.h
@@ -0,0 +1,9 @@
+/*
+ * Automatically generated by configure - do not modify
+ * Configured with: * '/home/stella/src/iree/build_tools/third_party/liburing/../../../third_party/liburing/configure'
+ */
+#define CONFIG_HAVE_KERNEL_RWF_T
+#define CONFIG_HAVE_KERNEL_TIMESPEC
+#define CONFIG_HAVE_STATX
+#define CONFIG_HAVE_CXX
+#define CONFIG_HAVE_UCONTEXT
diff --git a/build_tools/third_party/liburing/default_config/config-host.mak b/build_tools/third_party/liburing/default_config/config-host.mak
new file mode 100644
index 0000000..a024aee
--- /dev/null
+++ b/build_tools/third_party/liburing/default_config/config-host.mak
@@ -0,0 +1,16 @@
+# Automatically generated by configure - do not modify
+# Configured with: '/home/stella/src/iree/build_tools/third_party/liburing/../../../third_party/liburing/configure'
+prefix=/usr
+includedir=/usr/include
+libdir=/usr/lib
+libdevdir=/usr/lib
+relativelibdir=
+mandir=/usr/man
+datadir=/usr/share
+CONFIG_HAVE_KERNEL_RWF_T=y
+CONFIG_HAVE_KERNEL_TIMESPEC=y
+CONFIG_HAVE_STATX=y
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_UCONTEXT=y
+CC=clang-10
+CXX=clang++-10
diff --git a/build_tools/third_party/liburing/default_config/src/include/liburing/compat.h b/build_tools/third_party/liburing/default_config/src/include/liburing/compat.h
new file mode 100644
index 0000000..2e46c5f
--- /dev/null
+++ b/build_tools/third_party/liburing/default_config/src/include/liburing/compat.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: MIT */
+#ifndef LIBURING_COMPAT_H
+#define LIBURING_COMPAT_H
+
+#include <linux/time_types.h>
+
+#include <inttypes.h>
+
+struct open_how {
+	uint64_t	flags;
+	uint64_t	mode;
+	uint64_t	resolve;
+};
+
+#endif
diff --git a/build_tools/third_party/liburing/update_config.sh b/build_tools/third_party/liburing/update_config.sh
new file mode 100755
index 0000000..666b0fd
--- /dev/null
+++ b/build_tools/third_party/liburing/update_config.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# 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.
+
+# Runs the liburing configure script to update compat headers here.
+# At the time of this writing, this facility is very simple and ok to just
+# snapshot (which will need to be done for cross-compilation anyway). If this
+# ever changes, something more exotic than a manual update will need to be
+# done.
+
+this_dir="$(cd $(dirname $0) && pwd)"
+liburing_dir="$this_dir/../../../third_party/liburing"
+
+if ! [ -d "$liburing_dir" ]; then
+  echo "ERROR: Could not find directory $liburing_dir"
+  exit 1
+fi
+
+# The configure script outputs files into the current directory and a
+# src/include/liburing directory, matching the source tree.
+config_dir="$this_dir/default_config"
+mkdir -p "$config_dir/src/include/liburing"
+cd "$config_dir"
+
+if ! bash "$liburing_dir/configure"; then
+  echo "ERROR: Could not configure"
+  exit 2
+fi
diff --git a/experimental/CMakeLists.txt b/experimental/CMakeLists.txt
deleted file mode 100644
index 92557d4..0000000
--- a/experimental/CMakeLists.txt
+++ /dev/null
@@ -1,19 +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.
-
-# NOTE: not all projects require a cmake build. If you are adding a directory
-# that is only expected to build with bazel (such as something depending on
-# TensorFlow) you can ignore cmake.
-#
-iree_add_all_subdirs()
diff --git a/experimental/BUILD b/experimental/remoting/CMakeLists.txt
similarity index 80%
rename from experimental/BUILD
rename to experimental/remoting/CMakeLists.txt
index 0e6ae3d..0ca47f8 100644
--- a/experimental/BUILD
+++ b/experimental/remoting/CMakeLists.txt
@@ -11,9 +11,3 @@
 # 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.
-
-package(
-    default_visibility = ["//visibility:public"],
-    features = ["layering_check"],
-    licenses = ["notice"],  # Apache 2.0
-)
diff --git a/experimental/remoting/README.md b/experimental/remoting/README.md
new file mode 100644
index 0000000..cee8ec3
--- /dev/null
+++ b/experimental/remoting/README.md
@@ -0,0 +1,5 @@
+# Experimental support for IREE remoting
+
+Building a remoting layer for IREE is a relatively large project. This
+directory contains prototype-quality code that is intended to graduate into
+such an effort once the approach stabilizes.
diff --git a/iree/base/wait_handle_poll.c b/iree/base/wait_handle_poll.c
index 2ba2eb1..0af174d 100644
--- a/iree/base/wait_handle_poll.c
+++ b/iree/base/wait_handle_poll.c
@@ -56,13 +56,13 @@
     // One or more events set.
     *out_signaled_count = rv;
     return iree_ok_status();
-  } else if (rv == 0) {
-    // Timeout; no events set.
-    return iree_status_from_code(IREE_STATUS_DEADLINE_EXCEEDED);
   } else if (IREE_UNLIKELY(rv < 0)) {
     return iree_make_status(iree_status_code_from_errno(errno),
                             "poll failure %d", errno);
   }
+  // rv == 0
+  // Timeout; no events set.
+  return iree_status_from_code(IREE_STATUS_DEADLINE_EXCEEDED);
 }
 #elif IREE_WAIT_API == IREE_WAIT_API_PPOLL
 static iree_status_t iree_syscall_poll(struct pollfd* fds, nfds_t nfds,
@@ -105,13 +105,13 @@
     // One or more events set.
     *out_signaled_count = rv;
     return iree_ok_status();
-  } else if (rv == 0) {
-    // Timeout; no events set.
-    return iree_status_from_code(IREE_STATUS_DEADLINE_EXCEEDED);
-  } else {
+  } else if (rv < 0) {
     return iree_make_status(iree_status_code_from_errno(errno),
                             "ppoll failure %d", errno);
   }
+  // rv == 0
+  // Timeout; no events set.
+  return iree_status_from_code(IREE_STATUS_DEADLINE_EXCEEDED);
 }
 #else
 #error "unsupported IREE_WAIT_API value"
diff --git a/iree/modules/strings/BUILD b/iree/modules/strings/BUILD
index fcb1a40..da6012d 100644
--- a/iree/modules/strings/BUILD
+++ b/iree/modules/strings/BUILD
@@ -1,3 +1,4 @@
+load("//iree:build_defs.oss.bzl", "iree_cmake_extra_content")
 load("//iree/tools:compilation.bzl", "iree_bytecode_module")
 
 package(
@@ -31,6 +32,15 @@
     ],
 )
 
+iree_cmake_extra_content(
+    content = """
+if (NOT ${IREE_BUILD_COMPILER} OR NOT ${IREE_BUILD_TESTS})
+  return()
+endif()
+""",
+    inline = True,
+)
+
 cc_test(
     name = "strings_module_test",
     srcs = ["strings_module_test.cc"],
diff --git a/iree/modules/strings/CMakeLists.txt b/iree/modules/strings/CMakeLists.txt
index 5aac9ba..4dcbcf0 100644
--- a/iree/modules/strings/CMakeLists.txt
+++ b/iree/modules/strings/CMakeLists.txt
@@ -38,6 +38,10 @@
   PUBLIC
 )
 
+if (NOT ${IREE_BUILD_COMPILER} OR NOT ${IREE_BUILD_TESTS})
+  return()
+endif()
+
 iree_cc_test(
   NAME
     strings_module_test
diff --git a/iree/modules/tensorlist/BUILD b/iree/modules/tensorlist/BUILD
index 74deecd..86f1c2a 100644
--- a/iree/modules/tensorlist/BUILD
+++ b/iree/modules/tensorlist/BUILD
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+load("//iree:build_defs.oss.bzl", "iree_cmake_extra_content")
 load("//iree/tools:compilation.bzl", "iree_bytecode_module")
 
 package(
@@ -20,6 +21,32 @@
     licenses = ["notice"],  # Apache 2.0
 )
 
+cc_library(
+    name = "native_module",
+    srcs = ["native_module.cc"],
+    hdrs = ["native_module.h"],
+    deps = [
+        "//iree/base:api",
+        "//iree/base:ref_ptr",
+        "//iree/base:status",
+        "//iree/hal:api",
+        "//iree/modules/hal",
+        "//iree/vm",
+        "//iree/vm:cc",
+        "@com_google_absl//absl/container:inlined_vector",
+        "@com_google_absl//absl/types:span",
+    ],
+)
+
+iree_cmake_extra_content(
+    content = """
+if (NOT ${IREE_BUILD_COMPILER} OR NOT ${IREE_BUILD_TESTS})
+  return()
+endif()
+""",
+    inline = True,
+)
+
 iree_bytecode_module(
     name = "tensorlist_test_module",
     src = "tensorlist_test.mlir",
@@ -49,20 +76,3 @@
         "@com_google_absl//absl/types:span",
     ],
 )
-
-cc_library(
-    name = "native_module",
-    srcs = ["native_module.cc"],
-    hdrs = ["native_module.h"],
-    deps = [
-        "//iree/base:api",
-        "//iree/base:ref_ptr",
-        "//iree/base:status",
-        "//iree/hal:api",
-        "//iree/modules/hal",
-        "//iree/vm",
-        "//iree/vm:cc",
-        "@com_google_absl//absl/container:inlined_vector",
-        "@com_google_absl//absl/types:span",
-    ],
-)
diff --git a/iree/modules/tensorlist/CMakeLists.txt b/iree/modules/tensorlist/CMakeLists.txt
index 1092601..a82e5f5 100644
--- a/iree/modules/tensorlist/CMakeLists.txt
+++ b/iree/modules/tensorlist/CMakeLists.txt
@@ -14,6 +14,30 @@
 
 iree_add_all_subdirs()
 
+iree_cc_library(
+  NAME
+    native_module
+  HDRS
+    "native_module.h"
+  SRCS
+    "native_module.cc"
+  DEPS
+    absl::inlined_vector
+    absl::span
+    iree::base::api
+    iree::base::ref_ptr
+    iree::base::status
+    iree::hal::api
+    iree::modules::hal
+    iree::vm
+    iree::vm::cc
+  PUBLIC
+)
+
+if (NOT ${IREE_BUILD_COMPILER} OR NOT ${IREE_BUILD_TESTS})
+  return()
+endif()
+
 iree_bytecode_module(
   NAME
     tensorlist_test_module
@@ -49,23 +73,3 @@
     iree::vm::bytecode_module
     iree::vm::cc
 )
-
-iree_cc_library(
-  NAME
-    native_module
-  HDRS
-    "native_module.h"
-  SRCS
-    "native_module.cc"
-  DEPS
-    absl::inlined_vector
-    absl::span
-    iree::base::api
-    iree::base::ref_ptr
-    iree::base::status
-    iree::hal::api
-    iree::modules::hal
-    iree::vm
-    iree::vm::cc
-  PUBLIC
-)
diff --git a/iree/vm/BUILD b/iree/vm/BUILD
index e613f40..17d82ab 100644
--- a/iree/vm/BUILD
+++ b/iree/vm/BUILD
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+load("//iree:build_defs.oss.bzl", "iree_cmake_extra_content")
 load("//iree/tools:compilation.bzl", "iree_bytecode_module")
 
 package(
@@ -212,6 +213,13 @@
 #     ],
 # )
 
+iree_cmake_extra_content(
+    content = """
+if(${IREE_BUILD_COMPILER} AND ${IREE_BUILD_TESTS})
+""",
+    inline = True,
+)
+
 cc_test(
     name = "bytecode_module_test",
     srcs = [
@@ -271,6 +279,13 @@
     flags = ["-iree-vm-ir-to-bytecode-module"],
 )
 
+iree_cmake_extra_content(
+    content = """
+endif()
+""",
+    inline = True,
+)
+
 #===------------------------------------------------------------------------===#
 # Emit-C modules
 #===------------------------------------------------------------------------===#
diff --git a/iree/vm/CMakeLists.txt b/iree/vm/CMakeLists.txt
index dd6d63e..88c3fb7 100644
--- a/iree/vm/CMakeLists.txt
+++ b/iree/vm/CMakeLists.txt
@@ -177,6 +177,8 @@
   PUBLIC
 )
 
+if(${IREE_BUILD_COMPILER} AND ${IREE_BUILD_TESTS})
+
 iree_cc_test(
   NAME
     bytecode_module_test
@@ -247,6 +249,8 @@
   PUBLIC
 )
 
+endif()
+
 iree_cc_library(
   NAME
     c_funcs
diff --git a/iree/vm/test/BUILD b/iree/vm/test/BUILD
index 616efd0..b2ed44d 100644
--- a/iree/vm/test/BUILD
+++ b/iree/vm/test/BUILD
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+load("//iree:build_defs.oss.bzl", "iree_cmake_extra_content")
 load("//iree/tools:compilation.bzl", "iree_bytecode_module")
 load("//build_tools/embed_data:build_defs.bzl", "cc_embed_data")
 
@@ -21,6 +22,15 @@
     licenses = ["notice"],  # Apache 2.0
 )
 
+iree_cmake_extra_content(
+    content = """
+if (NOT ${IREE_BUILD_COMPILER} OR NOT ${IREE_BUILD_TESTS})
+  return()
+endif()
+""",
+    inline = True,
+)
+
 cc_embed_data(
     name = "all_bytecode_modules_cc",
     srcs = [
diff --git a/iree/vm/test/CMakeLists.txt b/iree/vm/test/CMakeLists.txt
index 282b4cf..3f86f3f 100644
--- a/iree/vm/test/CMakeLists.txt
+++ b/iree/vm/test/CMakeLists.txt
@@ -14,6 +14,10 @@
 
 iree_add_all_subdirs()
 
+if (NOT ${IREE_BUILD_COMPILER} OR NOT ${IREE_BUILD_TESTS})
+  return()
+endif()
+
 iree_cc_embed_data(
   NAME
     all_bytecode_modules_cc
diff --git a/third_party/liburing b/third_party/liburing
new file mode 160000
index 0000000..88b845d
--- /dev/null
+++ b/third_party/liburing
@@ -0,0 +1 @@
+Subproject commit 88b845dee001723c4a0db1fe5477de735b6d3bb0