forked from iree-org/iree
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate StableHLO input conversion to a compiler plugin. (iree-org#15568
) Progress on iree-org#15468 StableHLO-specific changes: * Added `input_stablehlo` plugin at `compiler/plugins/input/StableHLO/stablehlo-iree/` * Moved StableHLO input conversion code into the plugin * Note file paths: `stablehlo-iree/Conversion` is used instead of `stablehlo-iree/InputConversion` to save on lengths * Torch and TOSA both have fewer characters and do not have a `InputConversion/Preprocessing/` subfolder so they don't hit the same limit Cleanup now that all input dialect conversion is handled via plugins consistently: * Deleted `init_input_dialects.[h, cc]` and `init_input_passes.[h, cc]` * Removed dialect-specific code paths from `compiler/Pipelines/[Pipelines, Options].cpp` * Generated more `CMakeList.txt` files from `BUILD.bazel` files (input dialect dependencies and source files are organized into plugins with their own top-level filtering) * Added `auto_input_conversion.mlir` tests for each input plugin that use `--compile-to=input` to show how the "auto" input type handles their dialects
- Loading branch information
Showing
109 changed files
with
556 additions
and
601 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright 2023 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 | ||
|
||
package( | ||
default_visibility = ["//visibility:public"], | ||
features = ["layering_check"], | ||
licenses = ["notice"], # Apache 2.0 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2023 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 | ||
|
||
set(IREE_PACKAGE_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}") | ||
set(IREE_PACKAGE_ROOT_PREFIX "") | ||
set(IREE_COMPILER_TABLEGEN_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}") | ||
|
||
add_library(stablehlo-iree_compiler_defs INTERFACE) | ||
target_include_directories(stablehlo-iree_compiler_defs | ||
INTERFACE | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
) | ||
|
||
# Configures all iree_cc_* targets to take this implicit dep, | ||
# which provides common includes and copts for the tree. | ||
set(IREE_IMPLICIT_DEFS_CC_DEPS stablehlo-iree_compiler_defs) | ||
|
||
add_subdirectory(stablehlo-iree) |
39 changes: 39 additions & 0 deletions
39
compiler/plugins/input/StableHLO/stablehlo-iree/BUILD.bazel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright 2023 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 | ||
|
||
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library", "iree_compiler_register_plugin") | ||
|
||
package( | ||
default_visibility = ["//visibility:public"], | ||
features = ["layering_check"], | ||
licenses = ["notice"], # Apache 2.0 | ||
) | ||
|
||
iree_compiler_register_plugin( | ||
plugin_id = "input_stablehlo", | ||
target = ":registration", | ||
) | ||
|
||
iree_compiler_cc_library( | ||
name = "registration", | ||
srcs = [ | ||
"PluginRegistration.cpp", | ||
], | ||
copts = [ | ||
"-Icompiler/plugins/input/StableHLO", | ||
"-I$(GENDIR)/compiler/plugins/input/StableHLO", | ||
], | ||
deps = [ | ||
"//compiler/plugins/input/StableHLO/stablehlo-iree/Conversion", | ||
"//compiler/src/iree/compiler/PluginAPI", | ||
"@llvm-project//mlir:ConversionPasses", | ||
"@llvm-project//mlir:IR", | ||
"@llvm-project//mlir:Pass", | ||
"@llvm-project//mlir:Transforms", | ||
"@stablehlo//:chlo_ops", | ||
"@stablehlo//:stablehlo_ops", | ||
], | ||
) |
22 changes: 22 additions & 0 deletions
22
compiler/plugins/input/StableHLO/stablehlo-iree/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
iree_add_all_subdirs() | ||
|
||
iree_compiler_register_plugin( | ||
PLUGIN_ID | ||
input_stablehlo | ||
TARGET | ||
::registration | ||
) | ||
|
||
iree_cc_library( | ||
NAME | ||
registration | ||
SRCS | ||
"PluginRegistration.cpp" | ||
DEPS | ||
MLIRIR | ||
MLIRPass | ||
MLIRTransforms | ||
iree::compiler::PluginAPI | ||
stablehlo-iree::Conversion::Conversion | ||
PUBLIC | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.