[NFC] Remove the llvm-external-projects/iree-dialects directory (#24466) (#24612)
## Overview
Removes the `llvm-external-projects/iree-dialects` directory now that
nothing in the compiler or runtime depends on it.
This is the final step of #24466. The production dependencies were
retired in #24543 and predecessors:
- the softmax matcher was reimplemented natively in
`GlobalOptimization/RaiseSpecialOps`,
- `ErrorCheckingTrackingListener` was moved into `Codegen/Common/`,
- `DropSchedulePass` was moved into `Codegen/Common/`,
- the callback-matcher transform ops
(`transform.iree.register_match_callbacks` / `match_callback` /
`take_first` / `emit_remark`) and their tests were dropped.
## Changes
- Delete `llvm-external-projects/iree-dialects/`.
- Drop the `iree_llvm_add_external_project(mlir-iree-dialects ...)` call
from the top-level `CMakeLists.txt`.
- Remove the dead iree-dialects target conversion from `bazel_to_cmake`.
- Drop the `IREEDialects*` Python sources + include path from
`compiler/bindings/python/CMakeLists.txt`, the `_ireeDialects`
`CMakeExtension` from `compiler/setup.py`, and the `iree_dialects.rst`
API doc.
- Remove the `iree-dialects-doc` build step from the website doc
generator.
- Remove the "Test iree-dialects" CI steps and the `check-iree-dialects`
targets from the ASan/UBSan scripts (and the now-unused
`test_iree_dialects.sh`).
## Testing
- **Local (Windows + MSVC, Ninja, Release):** CMake configure is clean
after the external-project removal only `stablehlo` remains as an
external LLVM project and a full-tree grep finds zero dangling
references. The full `iree-opt` target builds, links, and runs
(`iree-opt --version` → LLVM 23.0.0git).
---------
Signed-off-by: Alex-Wengg <hanweng9@gmail.com>
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index cb3cd58..a109e4e 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -42,7 +42,6 @@
# llvm-external-projects
/llvm-external-projects/ @stellaraccident
-/llvm-external-projects/iree-dialects/ @MaheshRavishankar
# Other Top-Level Directories
/docs/ @ScottTodd
diff --git a/.github/workflows/ci_linux_arm64_clang.yml b/.github/workflows/ci_linux_arm64_clang.yml
index fcee1bc..1219a52 100644
--- a/.github/workflows/ci_linux_arm64_clang.yml
+++ b/.github/workflows/ci_linux_arm64_clang.yml
@@ -61,8 +61,6 @@
# (For now) QEMU is required to run tests with SME
IREE_ARM_SME_QEMU_AARCH64_BIN: /usr/bin/qemu-aarch64
run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}"
- - name: Test iree-dialects
- run: ./build_tools/cmake/test_iree_dialects.sh "${BUILD_DIR}"
- name: Post to Discord on Failure
uses: sarisia/actions-status-discord@eb045afee445dc055c18d3d90bd0f244fd062708 # v1.16.0
diff --git a/.github/workflows/ci_linux_x64_clang.yml b/.github/workflows/ci_linux_x64_clang.yml
index 80e19af..8d3ee18 100644
--- a/.github/workflows/ci_linux_x64_clang.yml
+++ b/.github/workflows/ci_linux_x64_clang.yml
@@ -41,7 +41,5 @@
run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}"
env:
CTEST_PARALLEL_LEVEL: 32
- - name: Test iree-dialects
- run: ./build_tools/cmake/test_iree_dialects.sh "${BUILD_DIR}"
# Alerting on failure is the responsibility of the calling job.
diff --git a/.gitignore b/.gitignore
index a8ab28f..3049da6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -102,9 +102,6 @@
# VS Code DevContainer
.devcontainer/docker-compose.yml
-# Local cache files
-llvm-external-projects/iree-dialects/.cache
-
# pkgci artifacts
artifacts/
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2792ff..d940c82 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -942,11 +942,6 @@
# Add external projects.
- message(STATUS "Configuring llvm-external-projects/mlir-iree-dialects")
- list(APPEND CMAKE_MESSAGE_INDENT " ")
- iree_llvm_add_external_project(mlir-iree-dialects ${CMAKE_CURRENT_SOURCE_DIR}/llvm-external-projects/iree-dialects)
- list(POP_BACK CMAKE_MESSAGE_INDENT)
-
if(IREE_INPUT_STABLEHLO)
message(STATUS "Configuring third_party/stablehlo")
list(APPEND CMAKE_MESSAGE_INDENT " ")
diff --git a/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py b/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py
index 297e05f..922e2f6 100644
--- a/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py
+++ b/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py
@@ -225,10 +225,6 @@
label = target.rsplit(":")[-1]
return [f"iree_cuda::{label}"]
- def _convert_iree_dialects_target(self, target):
- # Just take the target name as-is.
- return [target.rsplit(":")[-1]]
-
def _convert_to_cmake_path(self, bazel_path_fragment: str) -> str:
cmake_path = bazel_path_fragment
# Bazel `//iree/base` -> CMake `iree::base`
@@ -282,8 +278,6 @@
def _convert_iree_core_target(self, target):
iree_core_repo = self._repo_alias("@iree_core")
- if target.startswith(f"{iree_core_repo}//llvm-external-projects/iree-dialects"):
- return self._convert_iree_dialects_target(target)
# IREE root paths map to package names based on explicit rules.
# * src/iree/ directories (compiler/src/iree/ and runtime/src/iree/)
diff --git a/build_tools/cmake/build_and_test_asan.sh b/build_tools/cmake/build_and_test_asan.sh
index 48fe470..7b5068a 100755
--- a/build_tools/cmake/build_and_test_asan.sh
+++ b/build_tools/cmake/build_and_test_asan.sh
@@ -124,8 +124,4 @@
--label-exclude "${label_exclude_regex}"
echo "::endgroup::"
-echo "::group::Running llvm-external-projects tests"
-cmake --build . --target check-iree-dialects -- -k 0
-echo "::endgroup::"
-
popd
diff --git a/build_tools/cmake/build_and_test_ubsan.sh b/build_tools/cmake/build_and_test_ubsan.sh
index 2c993f7..b1e7ed5 100755
--- a/build_tools/cmake/build_and_test_ubsan.sh
+++ b/build_tools/cmake/build_and_test_ubsan.sh
@@ -82,7 +82,3 @@
echo "::group::Running tests"
build_tools/cmake/ctest_all.sh "${BUILD_DIR}"
echo "::endgroup::"
-
-echo "::group::Running llvm-external-projects tests"
-cmake --build "${BUILD_DIR?}" --target check-iree-dialects -- -k 0
-echo "::endgroup::"
diff --git a/build_tools/cmake/test_iree_dialects.sh b/build_tools/cmake/test_iree_dialects.sh
deleted file mode 100755
index 10959bb..0000000
--- a/build_tools/cmake/test_iree_dialects.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-
-# Copyright 2024 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
-
-# Run the check-iree-dialects tests under llvm-external-projects..
-
-set -euo pipefail
-
-BUILD_DIR="$1"
-
-echo "*** Running llvm-external-projects tests ***"
-echo "------------------"
-cmake --build ${BUILD_DIR} --target check-iree-dialects -- -k 0
diff --git a/compiler/bindings/python/CMakeLists.txt b/compiler/bindings/python/CMakeLists.txt
index 8e5a331..35c70da 100644
--- a/compiler/bindings/python/CMakeLists.txt
+++ b/compiler/bindings/python/CMakeLists.txt
@@ -32,7 +32,6 @@
include_directories(
"${IREE_SOURCE_DIR}/compiler/src"
"${IREE_SOURCE_DIR}/compiler/bindings/c"
- "${IREE_SOURCE_DIR}/llvm-external-projects/iree-dialects/include"
"${IREE_SOURCE_DIR}/third_party/llvm-project/mlir/include"
"${IREE_SOURCE_DIR}/third_party/stablehlo/include"
"${IREE_SOURCE_DIR}/third_party/stablehlo"
@@ -260,10 +259,6 @@
MLIRPythonSources.Dialects.transform.interpreter
MLIRPythonSources.Dialects.vector
MLIRPythonSources.Dialects.vector_transform
-
- # iree-dialects project.
- IREEDialectsPythonExtensions
- IREEDialectsPythonSources
)
add_mlir_python_modules(IREECompilerPythonModules
diff --git a/compiler/setup.py b/compiler/setup.py
index a6ec75a..b0e243c 100644
--- a/compiler/setup.py
+++ b/compiler/setup.py
@@ -503,9 +503,6 @@
},
ext_modules=[
CMakeExtension("iree.compiler._mlir_libs._mlir", py_limited_api=_is_abi3_build),
- CMakeExtension(
- "iree.compiler._mlir_libs._ireeDialects", py_limited_api=_is_abi3_build
- ),
# TODO: MHLO has been broken for a while so disabling. If re-enabling,
# it also needs to be enabled on the build side.
# CMakeExtension("iree.compiler._mlir_libs._mlirHlo"),
diff --git a/compiler/src/iree/compiler/README.md b/compiler/src/iree/compiler/README.md
index a25f011..15cc55e 100644
--- a/compiler/src/iree/compiler/README.md
+++ b/compiler/src/iree/compiler/README.md
@@ -30,11 +30,9 @@
Noteworthy compiler components _not_ included here include:
```
-├── compiler/plugins/
-│ └── input/ (Input dialect support plugins)
-│ └── target/ (HAL target backend plugins)
-└── llvm-external-projects/
- └── iree-dialects/ (IREE dialects for other projects to target)
+└── compiler/plugins/
+ └── input/ (Input dialect support plugins)
+ └── target/ (HAL target backend plugins)
```
Additional input/target/etc. plugins may also be defined out-of-tree.
diff --git a/docs/api_docs/python/compiler/index.rst b/docs/api_docs/python/compiler/index.rst
index 80d3b91..7190de0 100644
--- a/docs/api_docs/python/compiler/index.rst
+++ b/docs/api_docs/python/compiler/index.rst
@@ -9,6 +9,5 @@
tools.rst
build.rst
mlir.rst
- iree_dialects.rst
iree_input_dialect.rst
mlir_dialects.rst
diff --git a/docs/api_docs/python/compiler/iree_dialects.rst b/docs/api_docs/python/compiler/iree_dialects.rst
deleted file mode 100644
index a591eea..0000000
--- a/docs/api_docs/python/compiler/iree_dialects.rst
+++ /dev/null
@@ -1,18 +0,0 @@
-IREE Dialects
-==================
-
-`iree_codegen` dialect
-----------------------
-
-.. automodule:: iree.compiler.dialects.iree_codegen
- :imported-members:
- :members:
- :undoc-members:
-
-`iree_gpu` dialect
-------------------
-
-.. automodule:: iree.compiler.dialects.iree_gpu
- :imported-members:
- :members:
- :undoc-members:
diff --git a/docs/website/generate_extra_files.sh b/docs/website/generate_extra_files.sh
index 034e56b..df1a31f 100755
--- a/docs/website/generate_extra_files.sh
+++ b/docs/website/generate_extra_files.sh
@@ -24,14 +24,13 @@
source ${REPO_ROOT}/build_tools/cmake/setup_build.sh
source ${REPO_ROOT}/build_tools/cmake/setup_ccache.sh
-# Build `iree-doc` and `iree-dialects-doc` CMake targets. This requires the LLVM
-# submodule and can take several minutes with an empty cache, as it builds
-# `iree-tblgen` and `mlir-tblgen`.
+# Build the `iree-doc` CMake target. This requires the LLVM submodule and can
+# take several minutes with an empty cache, as it builds `iree-tblgen` and
+# `mlir-tblgen`.
cmake -G Ninja \
-B "${BUILD_DIR}" "${REPO_ROOT}" \
-DIREE_BUILD_DOCS=ON
cmake --build "${BUILD_DIR}" --target iree-doc
-cmake --build "${BUILD_DIR}" --target iree-dialects-doc
if (( IREE_USE_CCACHE == 1 )); then
ccache --show-stats
diff --git a/llvm-external-projects/iree-dialects/.clang-format b/llvm-external-projects/iree-dialects/.clang-format
deleted file mode 100644
index 897bb99..0000000
--- a/llvm-external-projects/iree-dialects/.clang-format
+++ /dev/null
@@ -1,3 +0,0 @@
-BasedOnStyle: LLVM
-AlwaysBreakTemplateDeclarations: Yes
-InsertBraces: Yes
diff --git a/llvm-external-projects/iree-dialects/.clang-tidy b/llvm-external-projects/iree-dialects/.clang-tidy
deleted file mode 100644
index eb0b9c2..0000000
--- a/llvm-external-projects/iree-dialects/.clang-tidy
+++ /dev/null
@@ -1,80 +0,0 @@
-HeaderFilterRegex: '.*'
-ExcludeHeaderFilterRegex: '.*/llvm/include/.*|.*/mlir/include/.*|.*/llvm-project/include/.*|.*\.inc$'
-Checks: >
- -*,
- clang-diagnostic-*,
- llvm-*,
- -llvm-header-guard,
- -llvm-include-order,
- -llvm-prefer-static-over-anonymous-namespace,
- misc-*,
- -misc-const-correctness,
- -misc-include-cleaner,
- -misc-no-recursion,
- -misc-non-private-member-variables-in-classes,
- -misc-unused-parameters,
- -misc-use-anonymous-namespace,
- -misc-use-internal-linkage,
- -misc-override-with-different-visibility,
- bugprone-*,
- -bugprone-assignment-in-if-condition,
- -bugprone-derived-method-shadowing-base-method,
- -bugprone-easily-swappable-parameters,
- -bugprone-crtp-constructor-accessibility,
- -bugprone-implicit-widening-of-multiplication-result,
- -bugprone-narrowing-conversions,
- -bugprone-unchecked-optional-access,
- modernize-use-bool-literals,
- modernize-loop-convert,
- modernize-make-unique,
- modernize-raw-string-literal,
- modernize-use-equals-default,
- modernize-use-default-member-init,
- modernize-min-max-use-initializer-list,
- modernize-use-nullptr,
- modernize-use-override,
- modernize-use-using,
- performance-*,
- -performance-enum-size,
- readability-avoid-const-params-in-decls,
- readability-const-return-type,
- readability-container-contains,
- readability-container-size-empty,
- readability-identifier-naming,
- readability-inconsistent-declaration-parameter-name,
- readability-misleading-indentation,
- readability-redundant-casting,
- readability-redundant-control-flow,
- readability-redundant-inline-specifier,
- readability-redundant-smartptr-get,
- readability-redundant-typename,
- readability-redundant-void-arg,
- readability-simplify-boolean-expr,
- readability-simplify-subscript-expr,
- readability-use-anyofallof
-
-CheckOptions:
- - key: readability-identifier-naming.ClassCase
- value: CamelCase
- - key: readability-identifier-naming.EnumCase
- value: CamelCase
- - key: readability-identifier-naming.FunctionCase
- value: camelBack
- - key: readability-identifier-naming.MemberCase
- value: camelBack
- - key: readability-identifier-naming.MemberIgnoredRegexp
- value: '.*_|^[A-Z]+$'
- - key: readability-identifier-naming.ParameterCase
- value: camelBack
- - key: readability-identifier-naming.UnionCase
- value: CamelCase
- - key: readability-identifier-naming.VariableCase
- value: camelBack
- - key: readability-identifier-naming.ParameterIgnoredRegexp
- value: 'LevelOrType|^[A-Z]+$'
- - key: readability-identifier-naming.VariableIgnoredRegexp
- value: 'DebugType|^[A-Z][A-Z0-9_]*$'
- - key: readability-redundant-member-init.IgnoreBaseInCopyConstructors
- value: 1
- - key: modernize-use-default-member-init.UseAssignment
- value: 1
diff --git a/llvm-external-projects/iree-dialects/.gitignore b/llvm-external-projects/iree-dialects/.gitignore
deleted file mode 100644
index 84c048a..0000000
--- a/llvm-external-projects/iree-dialects/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build/
diff --git a/llvm-external-projects/iree-dialects/BUILD.bazel b/llvm-external-projects/iree-dialects/BUILD.bazel
deleted file mode 100644
index 811772b..0000000
--- a/llvm-external-projects/iree-dialects/BUILD.bazel
+++ /dev/null
@@ -1,70 +0,0 @@
-load("@rules_cc//cc:defs.bzl", "cc_binary")
-
-package(
- default_visibility = ["//visibility:public"],
- features = ["layering_check"],
- licenses = ["notice"],
-)
-
-exports_files(glob(
- ["python/*.cpp"],
- allow_empty = True,
-))
-
-################################################################################
-# Package-by-package filegroup exports.
-# Some tools can make use of such non-nested groups.
-################################################################################
-
-filegroup(
- name = "python_dialects",
- srcs = glob(
- ["python/iree/compiler/dialects/**/*.py"],
- allow_empty = True,
- ),
-)
-
-################################################################################
-# Tools
-################################################################################
-
-cc_binary(
- name = "iree-dialects-opt",
- srcs = [
- "tools/iree-dialects-opt/iree-dialects-opt.cpp",
- ],
- tags = ["hostonly"],
- deps = [
- "@llvm-project//llvm:Support",
- "@llvm-project//mlir:AffineDialect",
- "@llvm-project//mlir:ArithDialect",
- "@llvm-project//mlir:AsyncDialect",
- "@llvm-project//mlir:BufferizationTransformOps",
- "@llvm-project//mlir:ControlFlowDialect",
- "@llvm-project//mlir:FuncDialect",
- "@llvm-project//mlir:FuncExtensions",
- "@llvm-project//mlir:FunctionInterfaces",
- "@llvm-project//mlir:IR",
- "@llvm-project//mlir:LLVMDialect",
- "@llvm-project//mlir:LLVMIRTransforms",
- "@llvm-project//mlir:LinalgDialect",
- "@llvm-project//mlir:LinalgTransformOps",
- "@llvm-project//mlir:LinalgTransforms",
- "@llvm-project//mlir:MemRefDialect",
- "@llvm-project//mlir:MemRefTransforms",
- "@llvm-project//mlir:MlirOptLib",
- "@llvm-project//mlir:PDLDialect",
- "@llvm-project//mlir:PDLInterpDialect",
- "@llvm-project//mlir:SCFDialect",
- "@llvm-project//mlir:SCFTransformOps",
- "@llvm-project//mlir:SCFTransforms",
- "@llvm-project//mlir:Support",
- "@llvm-project//mlir:TensorDialect",
- "@llvm-project//mlir:TensorTransformOps",
- "@llvm-project//mlir:TransformDialect",
- "@llvm-project//mlir:TransformPDLExtension",
- "@llvm-project//mlir:TransformUtils",
- "@llvm-project//mlir:Transforms",
- "@llvm-project//mlir:VectorTransformOps",
- ],
-)
diff --git a/llvm-external-projects/iree-dialects/CMakeLists.txt b/llvm-external-projects/iree-dialects/CMakeLists.txt
deleted file mode 100644
index c021b8a..0000000
--- a/llvm-external-projects/iree-dialects/CMakeLists.txt
+++ /dev/null
@@ -1,62 +0,0 @@
-if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
-message(FATAL_ERROR
- "This project is intended to be built as part of LLVM via "
- "-DLLVM_EXTERNAL_PROJECTS=iree-dialects "
- "-DLLVM_EXTERNAL_IREE_DIALECTS_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}")
-endif()
-
-option(MLIR_ENABLE_BINDINGS_PYTHON "Enables MLIR Python Bindings" OFF)
-
-set(IREE_DIALECTS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-set(IREE_DIALECTS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
-message(STATUS "Building iree-dialects project at ${IREE_DIALECTS_SOURCE_DIR} (into ${IREE_DIALECTS_BINARY_DIR})")
-
-# TODO: Needed for tablegen. Remove.
-include_directories(SYSTEM ${MLIR_INCLUDE_DIRS})
-include_directories(SYSTEM ${IREE_DIALECTS_SOURCE_DIR}/include)
-
-function(iree_dialects_target_includes target)
- set(_DIRS
- ${MLIR_INCLUDE_DIRS}
- ${IREE_DIALECTS_SOURCE_DIR}/include
- ${IREE_DIALECTS_BINARY_DIR}/include
- )
- # In LLVM parlance, the actual target may just be an interface and may not
- # be responsible for actually compiling anything. The corresponding obj.
- # target, when present, is just used for compilation and does not
- # contribute to the interface properties.
- # TODO: Normalize this upstream.
- set_property(TARGET ${target} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
- $<BUILD_INTERFACE:${_DIRS}>)
- if(TARGET obj.${target})
- set_property(TARGET ${target} APPEND PROPERTY INCLUDE_DIRECTORIES
- $<BUILD_INTERFACE:${_DIRS}>)
- endif()
-endfunction()
-
-# Configure CMake and tablegen.
-list(APPEND CMAKE_MODULE_PATH ${MLIR_CMAKE_DIR})
-list(APPEND CMAKE_MODULE_PATH ${LLVM_CMAKE_DIR})
-add_custom_target(iree-dialects-doc)
-
-include(TableGen)
-include(AddLLVM)
-include(AddMLIR)
-
-################################################################################
-# Setup python.
-################################################################################
-
-if(MLIR_ENABLE_BINDINGS_PYTHON)
- include(MLIRDetectPythonEnv)
- mlir_configure_python_dev_packages()
-endif()
-
-add_subdirectory(include)
-add_subdirectory(lib)
-add_subdirectory(test)
-add_subdirectory(tools)
-
-if(MLIR_ENABLE_BINDINGS_PYTHON)
- add_subdirectory(python)
-endif()
diff --git a/llvm-external-projects/iree-dialects/README.md b/llvm-external-projects/iree-dialects/README.md
deleted file mode 100644
index 90b89dc..0000000
--- a/llvm-external-projects/iree-dialects/README.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# IREE Dialects Project
-
-Sources for IREE's public dialects (containing ops/types/attributes that are
-unique to IREE and can appear in compiler inputs).
-
-This project is intended to be used via LLVM's external projects setup:
-
-* `-DLLVM_EXTERNAL_PROJECTS=iree-dialects`
-* `-DLLVM_EXTERNAL_IREE_DIALECTS_SOURCE_DIR={this_directory}`
-
-It depends on the `mlir` project.
diff --git a/llvm-external-projects/iree-dialects/build_tools/build_standalone.sh b/llvm-external-projects/iree-dialects/build_tools/build_standalone.sh
deleted file mode 100755
index 6200473..0000000
--- a/llvm-external-projects/iree-dialects/build_tools/build_standalone.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-# Copyright 2021 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
-
-# Simple script that does a CMake configure of this project as an external
-# LLVM project so it can be tested in isolation to larger assemblies.
-# This is meant for CI's and project maintainers.
-
-set -eu -o errtrace
-
-project_dir="$(cd $(dirname $0)/.. && pwd)"
-repo_root="$(cd "$project_dir"/../.. && pwd)"
-llvm_project_dir="$repo_root/third_party/llvm-project"
-build_dir="$project_dir/build"
-
-cmake -GNinja -B"$build_dir" "$llvm_project_dir/llvm" \
- -DCMAKE_BUILD_TYPE=Release \
- -DLLVM_ENABLE_PROJECTS=mlir \
- -DLLVM_EXTERNAL_PROJECTS=iree-dialects \
- -DLLVM_EXTERNAL_IREE_DIALECTS_SOURCE_DIR="$project_dir" \
- -DMLIR_ENABLE_BINDINGS_PYTHON=ON
-
-cd "$build_dir"
-ninja tools/iree-dialects/all
diff --git a/llvm-external-projects/iree-dialects/docs/Dialect/IREEPyDM/LowerToIREE.md b/llvm-external-projects/iree-dialects/docs/Dialect/IREEPyDM/LowerToIREE.md
deleted file mode 100644
index 6768a3d..0000000
--- a/llvm-external-projects/iree-dialects/docs/Dialect/IREEPyDM/LowerToIREE.md
+++ /dev/null
@@ -1,102 +0,0 @@
-# Lowering IREEPyDM to IREE
-
-At the top-level, a program expressed in IREEPyDM ("PyDM") can be lowered to
-IREE via the overall conversion pass `-convert-iree-pydm-to-iree`; however,
-additional steps are needed to link a runtime library, etc.
-
-This document provides application notes for how the conversion is
-implemented.
-
-## Type Conversion
-
-Generally, types in PyDM map 1:1 with IREE types in a way which facilitates
-a direct conversion.
-
-## `object` and `object<type>` records
-
-Objects map to IREE variant lists (`!iree.list<?>`) of N elements, where the
-elements are laid out as:
-
-* [0]: Type Code - i32 representing the type code of the object.
-* [1] (optional): Data corresponding to the type.
-* [2] (optional): i64 TypeID - if the `id()` function has been evaluated for
- this object, then this element will contain the unique id.
-
-### Type Codes
-
-The special type code `0` means "not assigned", which is distinct from `None`.
-Other built-in types correspond to the `BuiltinTypeCode` enum in the dialect.
-
-The following specifies the contents of the `data` field (1) of the object
-record, per type code:
-
-* `None`: No contents
-* `Tuple`: An `!iree.list` of objects
-* `List`: An `!iree.list` of objects
-* `Str`: TODO: needs to be a union of i8/i16/i32 codepoint array
-* `Bytes`: TODO: should be a memory buffer of some kind
-* `ExceptionResult`: TODO: should hold a boxed exception of some kind
-* `Type`: An object representing the type
-* `Bool`: Implementation defined `iree_vm_value_type_t` field (typically
- `iree_vm_value_type_t.i8`).
-* `Integer`: Implementation defined `iree_vm_value_type_t` field (typically
- `iree_vm_value_type_t.i32`).
-* `Real`: Implementation defined `iree_vm_value_type_t` field (typically
- `iree_vm_value_type_t.f32`).
-* `Complex`: TODO
-* `Integer1` / `UInteger1`: `iree_vm_value_type_t.i8`
-* `Integer2` / `UInteger2`: `iree_vm_value_type_t.i16`
-* `Integer4` / `UInteger4`: `iree_vm_value_type_t.i32
-* `Integer8` / `UInteger8`: `iree_vm_value_type_t.i64
-* `Float2` : `iree_vm_value_type_t.i16` with bit value of an IEEE FP16
-* `Float4` : `iree_vm_value_type_t.f32`
-* `Float8` : `iree_vm_value_type_t.f64`
-* `BFloat2` : `iree_vm_value_type_t.i16` with bit value of a BFloat16 (thanks
- Google).
-* `Complex4` : TODO
-* `Complex8` : TODO
-* `Object` (and custom): An object record, as described here
-
-### Mutability
-
-The VM enforces no immutability constraints on the object records here (i.e.
-they are just lists). If the compiler believes that it can recycle an object,
-it is free to resize it appropriately and re-assign its contents. In this
-way, things like closure cells and free variable cells can just be
-allocated object records that that compiler completely reassigns the contents
-of on assignment.
-
-## Unboxed values
-
-All values can exist in the program unboxed and will have a VM IR type which
-corresponds to their runtime variant form (i.e. `!iree.list`, `i32`, etc).
-
-## `!iree_pydm.exception_result`
-
-The `exception_result` type is returned from every PyDM function indicating
-whether the call completed successfully or in an error state. We encode it as
-a signed `i32` value at runtime, where:
-
-* `0` : indicates normal termination.
-* `<0` : signals one of a predefined list of primitive exception types
- which do not contain any detail (i.e. `ValueException` analog).
-* `>0` : is an index into a global exception lookup table with slots
- corresponding to logical threads of execution.
-
-### Pre-defined exception codes:
-
-* `-1` : `StopIteration` - Standard exception which indicates exhaustion of
- an iterator.
-* `-2` : `StopAsyncIteration` - Standard exception which indicates exhaustion
- of an async iterator.
-* `-3` : `RuntimeError` - general catch-all failure exception class.
-* `-4` : `ValueError`
-* `-5` : `NotImplementedError`
-* `-6` : `KeyError`
-* `-7` : `IndexError`
-* `-8` : `AttributeError`
-* `-9` : `TypeError`
-* `-10` : `UnboundLocalError`
-
-These pre-defined exception codes are allocated when the compiler has a need
-to raise or interoperate with an exception category.
diff --git a/llvm-external-projects/iree-dialects/include/CMakeLists.txt b/llvm-external-projects/iree-dialects/include/CMakeLists.txt
deleted file mode 100644
index aa87602..0000000
--- a/llvm-external-projects/iree-dialects/include/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-add_subdirectory(iree-dialects)
diff --git a/llvm-external-projects/iree-dialects/include/iree-dialects/CMakeLists.txt b/llvm-external-projects/iree-dialects/include/iree-dialects/CMakeLists.txt
deleted file mode 100644
index e69de29..0000000
--- a/llvm-external-projects/iree-dialects/include/iree-dialects/CMakeLists.txt
+++ /dev/null
diff --git a/llvm-external-projects/iree-dialects/lib/CMakeLists.txt b/llvm-external-projects/iree-dialects/lib/CMakeLists.txt
deleted file mode 100644
index e69de29..0000000
--- a/llvm-external-projects/iree-dialects/lib/CMakeLists.txt
+++ /dev/null
diff --git a/llvm-external-projects/iree-dialects/python/CMakeLists.txt b/llvm-external-projects/iree-dialects/python/CMakeLists.txt
deleted file mode 100644
index 488e512..0000000
--- a/llvm-external-projects/iree-dialects/python/CMakeLists.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-include(AddMLIRPython)
-
-# Specifies that all MLIR packages are co-located under npcomp.
-# TODO: Add an upstream cmake param for this vs having a global here.
-add_compile_definitions("MLIR_PYTHON_PACKAGE_PREFIX=iree.compiler.")
-
-################################################################################
-# Sources
-################################################################################
-
-declare_mlir_python_sources(IREEDialectsPythonSources)
-declare_mlir_python_sources(IREEDialectsPythonExtensions)
-
-declare_mlir_python_sources(IREEDialectsPythonSources.Dialects
- ADD_TO_PARENT IREEDialectsPythonSources
-)
-
-################################################################################
-# Extensions
-################################################################################
-
-declare_mlir_python_extension(IREEDialectsPythonExtensions.Main
- MODULE_NAME _ireeDialects
- ADD_TO_PARENT IREEDialectsPythonExtensions
- PYTHON_BINDINGS_LIBRARY nanobind
- SOURCES
- IREEDialectsModule.cpp
- EMBED_CAPI_LINK_LIBS
- MLIRCAPITransformDialect
- PRIVATE_LINK_LIBS
- LLVMSupport
-)
-
-################################################################################
-# Generate packages and shared library
-# Downstreams typically will not use these, but they are useful for local
-# testing.
-################################################################################
-
-set(_source_components
- # TODO: Core is now implicitly building/registering all dialects, increasing
- # build burden by ~5x. Make it stop.
- MLIRPythonExtension.RegisterEverything
-
- IREEDialectsPythonExtensions
- IREEDialectsPythonSources
- MLIRPythonSources.Core
- MLIRPythonSources.Dialects.builtin
- MLIRPythonSources.Dialects.cf
- MLIRPythonSources.Dialects.func
- MLIRPythonSources.Dialects.pdl
- MLIRPythonSources.Dialects.transform
-)
-
-add_mlir_python_common_capi_library(IREEDialectsAggregateCAPI
- INSTALL_COMPONENT IREEDialectsPythonModules
- INSTALL_DESTINATION python_packages/iree_dialects/mlir/_mlir_libs
- OUTPUT_DIRECTORY "${IREE_DIALECTS_BINARY_DIR}/python_packages/iree_dialects/iree/compiler/_mlir_libs"
- RELATIVE_INSTALL_ROOT "../../../.."
- DECLARED_SOURCES
- ${_source_components}
-)
-
-add_mlir_python_modules(IREEDialectsPythonModules
- ROOT_PREFIX "${IREE_DIALECTS_BINARY_DIR}/python_packages/iree_dialects/iree/compiler"
- INSTALL_PREFIX "python_packages/iree_dialects/iree/compiler"
- DECLARED_SOURCES
- ${_source_components}
- COMMON_CAPI_LINK_LIBS
- IREEDialectsAggregateCAPI
- )
diff --git a/llvm-external-projects/iree-dialects/python/IREEDialectsModule.cpp b/llvm-external-projects/iree-dialects/python/IREEDialectsModule.cpp
deleted file mode 100644
index 10a50f8..0000000
--- a/llvm-external-projects/iree-dialects/python/IREEDialectsModule.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2021 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
-
-#include "mlir-c/BuiltinAttributes.h"
-#include "mlir-c/BuiltinTypes.h"
-#include "mlir-c/Diagnostics.h"
-#include "mlir-c/Dialect/Transform.h"
-#include "mlir-c/RegisterEverything.h"
-#include "mlir/Bindings/Python/NanobindAdaptors.h"
-
-namespace py = nanobind;
-using namespace mlir::python::nanobind_adaptors;
-
-NB_MODULE(_ireeDialects, m) {
- m.doc() = "iree-dialects main python extension";
-
- auto irModule = py::module_::import_(MAKE_MLIR_PYTHON_QUALNAME("ir"));
- auto typeClass = irModule.attr("Type");
-
- //===--------------------------------------------------------------------===//
- // TransformDialect
- //===--------------------------------------------------------------------===//
- auto transform_m = m.def_submodule("transform");
-
- transform_m.def(
- "register_dialect",
- [](MlirContext context, bool load) {
- MlirDialectHandle handle = mlirGetDialectHandle__transform__();
- mlirDialectHandleRegisterDialect(handle, context);
- if (load) {
- mlirDialectHandleLoadDialect(handle, context);
- }
- },
- py::arg("context") = py::none(), py::arg("load") = true);
-}
diff --git a/llvm-external-projects/iree-dialects/test/CMakeLists.txt b/llvm-external-projects/iree-dialects/test/CMakeLists.txt
deleted file mode 100644
index cdff103..0000000
--- a/llvm-external-projects/iree-dialects/test/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-llvm_canonicalize_cmake_booleans(
- MLIR_ENABLE_BINDINGS_PYTHON
-)
-
-configure_lit_site_cfg(
- ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
- ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
- MAIN_CONFIG
- ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
-)
-
-set(IREE_DIALECTS_TEST_DEPENDS
- FileCheck count not
- iree-dialects-opt
- )
-
-if(MLIR_ENABLE_BINDINGS_PYTHON)
- list(APPEND IREE_DIALECTS_TEST_DEPENDS
- IREEDialectsPythonModules
- )
-endif()
-
-add_lit_testsuite(check-iree-dialects "Running the iree-dialects regression tests"
- ${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS ${IREE_DIALECTS_TEST_DEPENDS}
- )
-set_target_properties(check-iree-dialects PROPERTIES FOLDER "Tests")
-
-add_lit_testsuites(IREE_DIALECTS ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${IREE_DIALECTS_TEST_DEPENDS})
diff --git a/llvm-external-projects/iree-dialects/test/dummy.py b/llvm-external-projects/iree-dialects/test/dummy.py
deleted file mode 100644
index 0aca93d..0000000
--- a/llvm-external-projects/iree-dialects/test/dummy.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# RUN: %PYTHON %s
-
-# This test does nothing. It is just here so that if python bindings tests
-# are excluded, the test suite is not empty.
diff --git a/llvm-external-projects/iree-dialects/test/lit.cfg.py b/llvm-external-projects/iree-dialects/test/lit.cfg.py
deleted file mode 100644
index e49da96..0000000
--- a/llvm-external-projects/iree-dialects/test/lit.cfg.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# -*- Python -*-
-# Copyright 2021 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
-
-import os
-import platform
-import re
-import subprocess
-import tempfile
-
-import lit.formats
-import lit.util
-
-from lit.llvm import llvm_config
-from lit.llvm.subst import ToolSubst
-from lit.llvm.subst import FindTool
-
-# Configuration file for the 'lit' test runner.
-
-# name: The name of this test suite.
-config.name = "IREE_DIALECTS"
-
-config.test_format = lit.formats.ShTest(
- execute_external=not llvm_config.use_lit_shell,
- force_execute_external=not llvm_config.use_lit_shell,
-)
-
-# suffixes: A list of file extensions to treat as test files.
-config.suffixes = [".mlir", ".py"]
-
-# test_source_root: The root path where tests are located.
-config.test_source_root = os.path.dirname(__file__)
-
-# test_exec_root: The root path where tests should be run.
-config.test_exec_root = os.path.join(config.iree_dialects_obj_root, "test")
-
-config.substitutions.append(("%PATH%", config.environment["PATH"]))
-config.substitutions.append(("%shlibext", config.llvm_shlib_ext))
-config.substitutions.append(
- ("%resources_dir", os.path.join(config.iree_dialects_obj_root, "resources"))
-)
-
-llvm_config.with_system_environment(["HOME", "INCLUDE", "LIB", "TMP", "TEMP"])
-
-# llvm_config.use_default_substitutions()
-
-# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
-# subdirectories contain auxiliary inputs for various tests in their parent
-# directories.
-config.excludes = [
- "Inputs",
- "Examples",
- "CMakeLists.txt",
- "README.txt",
- "LICENSE.txt",
- "lit.cfg.py",
- "lit.site.cfg.py",
-]
-
-# test_source_root: The root path where tests are located.
-config.test_source_root = os.path.dirname(__file__)
-
-# test_exec_root: The root path where tests should be run.
-config.test_exec_root = os.path.join(config.iree_dialects_obj_root, "test")
-config.standalone_tools_dir = os.path.join(config.iree_dialects_obj_root, "bin")
-
-# Tweak the PATH to include the tools dir.
-llvm_config.with_environment("PATH", config.llvm_tools_binary_dir, append_path=True)
-
-tool_dirs = [config.llvm_tools_binary_dir]
-tools = [
- ToolSubst("%PYTHON", config.python_executable, unresolved="ignore"),
- ToolSubst("iree-dialects-opt"),
-]
-
-llvm_config.add_tool_substitutions(tools, tool_dirs)
-
-if config.enable_bindings_python:
- llvm_config.with_environment(
- "PYTHONPATH",
- [
- os.path.join(
- config.iree_dialects_obj_root, "python_packages", "iree_dialects"
- ),
- ],
- append_path=True,
- )
diff --git a/llvm-external-projects/iree-dialects/test/lit.site.cfg.py.in b/llvm-external-projects/iree-dialects/test/lit.site.cfg.py.in
deleted file mode 100644
index 3f1cc11..0000000
--- a/llvm-external-projects/iree-dialects/test/lit.site.cfg.py.in
+++ /dev/null
@@ -1,18 +0,0 @@
-@LIT_SITE_CFG_IN_HEADER@
-
-import sys
-
-config.enable_bindings_python = @MLIR_ENABLE_BINDINGS_PYTHON@
-config.iree_dialects_obj_root = "@IREE_DIALECTS_BINARY_DIR@"
-config.llvm_tools_binary_dir = "@LLVM_TOOLS_BINARY_DIR@"
-config.llvm_shlib_dir = "@SHLIBDIR@"
-config.llvm_shlib_ext = "@SHLIBEXT@"
-config.llvm_exe_ext = "@EXEEXT@"
-config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
-config.python_executable = sys.executable
-
-import lit.llvm
-lit.llvm.initialize(lit_config, config)
-
-# Let the main config do the real work.
-lit_config.load_config(config, "@IREE_DIALECTS_SOURCE_DIR@/test/lit.cfg.py")
diff --git a/llvm-external-projects/iree-dialects/tools/CMakeLists.txt b/llvm-external-projects/iree-dialects/tools/CMakeLists.txt
deleted file mode 100644
index 3bed1e2..0000000
--- a/llvm-external-projects/iree-dialects/tools/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-add_subdirectory(iree-dialects-opt)
diff --git a/llvm-external-projects/iree-dialects/tools/iree-dialects-opt/CMakeLists.txt b/llvm-external-projects/iree-dialects/tools/iree-dialects-opt/CMakeLists.txt
deleted file mode 100644
index 7d699b5..0000000
--- a/llvm-external-projects/iree-dialects/tools/iree-dialects-opt/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-set(LIBS
- # Core dialects.
- MLIRAffineDialect
- MLIRArithDialect
- MLIRAsyncDialect
- MLIRBufferizationTransformOps
- MLIRControlFlowDialect
- MLIRDialect
- MLIRFuncDialect
- MLIRFuncInlinerExtension
- MLIRIndexToLLVM
- MLIRLinalgDialect
- MLIRLinalgTransformOps
- MLIRLLVMDialect
- MLIRLLVMIRTransforms
- MLIRMemRefDialect
- MLIRMemRefTransforms
- MLIROptLib
- MLIRPDLDialect
- MLIRPDLInterpDialect
- MLIRSCFDialect
- MLIRSCFTransformOps
- MLIRSCFTransforms
- MLIRTensorDialect
- MLIRTensorTransformOps
- MLIRTransformPDLExtension
- MLIRTransforms
- MLIRVectorTransformOps
-)
-
-add_llvm_executable(iree-dialects-opt
- iree-dialects-opt.cpp
-
- DEPENDS
- ${LIBS}
-)
-target_link_libraries(iree-dialects-opt PRIVATE ${LIBS})
diff --git a/llvm-external-projects/iree-dialects/tools/iree-dialects-opt/iree-dialects-opt.cpp b/llvm-external-projects/iree-dialects/tools/iree-dialects-opt/iree-dialects-opt.cpp
deleted file mode 100644
index 2824d30..0000000
--- a/llvm-external-projects/iree-dialects/tools/iree-dialects-opt/iree-dialects-opt.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2021 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
-
-#include "mlir/Dialect/Affine/IR/AffineOps.h"
-#include "mlir/Dialect/Arith/IR/Arith.h"
-#include "mlir/Dialect/Async/IR/Async.h"
-#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h"
-#include "mlir/Dialect/Func/Extensions/InlinerExtension.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
-#include "mlir/Dialect/LLVMIR/Transforms/InlinerInterfaceImpl.h"
-#include "mlir/Dialect/Linalg/IR/Linalg.h"
-#include "mlir/Dialect/Linalg/TransformOps/DialectExtension.h"
-#include "mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.h"
-#include "mlir/Dialect/Linalg/Transforms/TilingInterfaceImpl.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/MemRef/Transforms/Passes.h"
-#include "mlir/Dialect/MemRef/Transforms/Transforms.h"
-#include "mlir/Dialect/PDL/IR/PDL.h"
-#include "mlir/Dialect/PDLInterp/IR/PDLInterp.h"
-#include "mlir/Dialect/SCF/IR/SCF.h"
-#include "mlir/Dialect/SCF/TransformOps/SCFTransformOps.h"
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
-#include "mlir/Dialect/Tensor/IR/Tensor.h"
-#include "mlir/Dialect/Tensor/TransformOps/TensorTransformOps.h"
-#include "mlir/Dialect/Transform/IR/TransformDialect.h"
-#include "mlir/Dialect/Transform/PDLExtension/PDLExtension.h"
-#include "mlir/Dialect/Vector/TransformOps/VectorTransformOps.h"
-#include "mlir/IR/AsmState.h"
-#include "mlir/IR/Dialect.h"
-#include "mlir/Tools/mlir-opt/MlirOptMain.h"
-#include "mlir/Transforms/Passes.h"
-#include <mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.h>
-
-using namespace mlir;
-
-int main(int argc, char **argv) {
- registerAsmPrinterCLOptions();
- registerMLIRContextCLOptions();
-
- DialectRegistry registry;
- registry.insert<
- // clang-format off
- // Upstream dialects
- mlir::async::AsyncDialect,
- mlir::arith::ArithDialect,
- mlir::affine::AffineDialect,
- mlir::cf::ControlFlowDialect,
- mlir::func::FuncDialect,
- mlir::linalg::LinalgDialect,
- mlir::memref::MemRefDialect,
- mlir::pdl::PDLDialect,
- mlir::pdl_interp::PDLInterpDialect,
- mlir::scf::SCFDialect,
- mlir::tensor::TensorDialect,
- mlir::transform::TransformDialect,
- mlir::vector::VectorDialect
- // clang-format on
- >();
-
- // Core dialect passes.
- memref::registerMemRefPasses();
- registerTransformsPasses();
- registerSCFPasses();
-
- // External models.
- mlir::func::registerInlinerExtension(registry);
- mlir::LLVM::registerInlinerInterface(registry);
- mlir::linalg::registerTilingInterfaceExternalModels(registry);
-
- mlir::bufferization::registerTransformDialectExtension(registry);
- mlir::linalg::registerTransformDialectExtension(registry);
- mlir::scf::registerTransformDialectExtension(registry);
- mlir::tensor::registerFindPayloadReplacementOpInterfaceExternalModels(
- registry);
- mlir::tensor::registerTransformDialectExtension(registry);
- mlir::vector::registerTransformDialectExtension(registry);
-
- // Dialect extensions.
- transform::registerPDLExtension(registry);
-
- return mlir::asMainReturnCode(mlir::MlirOptMain(
- argc, argv, "MLIR modular optimizer driver\n", registry));
-}