Initial build boilerplate for experimental remoting directory. (#4313)
* Changes the existing IREE_BUILD_EXPERIMENTAL option to IREE_BUILD_EXPERIMENTAL_MODEL_BUILDER.
* Adds an IREE_BUILD_EXPERIMENTAL_REMOTING option.
* Adds a liburing dependency (only enabled for now if IREE_BUILD_EXPERIMENTAL_REMOTING).
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 4915a0f..4fa0e1d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,7 +44,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)
@@ -76,7 +75,18 @@
# https://github.com/google/iree/tree/main/build_tools/cmake/iree_cross_compile.cmake:iree_cross_compile_invoke
# )
-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()
@@ -327,7 +337,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()
@@ -527,8 +537,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 ff02ec4..4aa47ae 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
fdf47794a75e7d2bb9e54c80de22b9261ef2179e third_party/llvm-bazel
1b97cdf885d6455841280b8da858835e641ee941 third_party/llvm-project
a438d3b2e9e2e4699b94787b7fb6e8b45d4e92c6 third_party/mlir-emitc
diff --git a/build_tools/cmake/iree_cross_compile.cmake b/build_tools/cmake/iree_cross_compile.cmake
index 581f3d2..446649d 100644
--- a/build_tools/cmake/iree_cross_compile.cmake
+++ b/build_tools/cmake/iree_cross_compile.cmake
@@ -86,7 +86,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/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/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