blob: 34ace600ce1a46a0c395029274dfcadd028d01b6 [file] [log] [blame]
Geoffrey Martin-Noble552d3f82021-05-25 17:56:09 -07001# Copyright 2019 The IREE Authors
Geoffrey Martin-Noblebb37bb82019-11-06 14:35:36 -08002#
Geoffrey Martin-Noble552d3f82021-05-25 17:56:09 -07003# Licensed under the Apache License v2.0 with LLVM Exceptions.
4# See https://llvm.org/LICENSE.txt for license information.
5# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Geoffrey Martin-Noblebb37bb82019-11-06 14:35:36 -08006
Scott Todd44f95f82022-06-01 09:59:32 -07007# Tools IREE provides for compiling, executing, and benchmarking programs, as
8# well as other utilities.
9#
10# Only binary targets and their associated main files should go in this
11# directory. Library targets and header files should be placed in the
12# appropriate subtree, e.g. `compiler/src/iree/compiler/Tools/`.
13#
14# Programs with a dependency on the compiler are not designed to run on device
15# platforms (e.g. Android), so they are tagged "hostonly".
Stella Laurenzobd659a12019-10-23 10:17:48 -070016
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -070017load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_binary", "iree_runtime_cc_binary")
18
Stella Laurenzobd659a12019-10-23 10:17:48 -070019package(
20 default_visibility = ["//visibility:public"],
Geoffrey Martin-Noble083ac8e2020-07-15 20:10:49 -070021 features = ["layering_check"],
Stella Laurenzobd659a12019-10-23 10:17:48 -070022 licenses = ["notice"], # Apache 2.0
23)
24
Scott Toddf57ab752022-05-23 10:36:44 -070025exports_files(["lit.cfg.py"])
26
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -070027iree_runtime_cc_binary(
Geoffrey Martin-Noble34190262020-02-06 10:43:58 -080028 name = "iree-benchmark-module",
Geoffrey Martin-Noble0a6b9cc2020-09-22 20:17:05 -070029 srcs = ["iree-benchmark-module-main.cc"],
Geoffrey Martin-Noble34190262020-02-06 10:43:58 -080030 deps = [
Stella Laurenzo9bde61b2022-04-21 15:37:14 -070031 "//runtime/src/iree/base",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -070032 "//runtime/src/iree/base/internal:flags",
33 "//runtime/src/iree/hal",
Ben Vanike9ae9632022-10-04 08:13:30 -070034 "//runtime/src/iree/modules/hal:types",
Ben Vanik007109f2022-08-03 07:26:50 -070035 "//runtime/src/iree/tooling:context_util",
Ben Vanik097d8262022-06-09 11:35:04 -070036 "//runtime/src/iree/tooling:device_util",
Ben Vanik7958fc92023-01-12 08:45:32 -080037 "//runtime/src/iree/tooling:vm_util",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -070038 "//runtime/src/iree/vm",
Ben Vanik01353432020-11-17 03:15:40 -080039 "@com_google_benchmark//:benchmark",
40 ],
Geoffrey Martin-Noble34190262020-02-06 10:43:58 -080041)
42
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -070043iree_runtime_cc_binary(
Ben Vanik50e46cd2021-06-28 10:19:35 -070044 name = "iree-benchmark-trace",
45 srcs = ["iree-benchmark-trace-main.c"],
46 deps = [
Stella Laurenzo9bde61b2022-04-21 15:37:14 -070047 "//runtime/src/iree/base",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -070048 "//runtime/src/iree/base/internal:atomic_slist",
Ben Vanik12b771f2023-03-08 12:27:45 -080049 "//runtime/src/iree/base/internal:file_io",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -070050 "//runtime/src/iree/base/internal:flags",
Ben Vanik1c59c112022-06-08 09:13:34 -070051 "//runtime/src/iree/base/internal:path",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -070052 "//runtime/src/iree/hal",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -070053 "//runtime/src/iree/testing:benchmark",
Ben Vanik097d8262022-06-09 11:35:04 -070054 "//runtime/src/iree/tooling:device_util",
55 "//runtime/src/iree/tooling:trace_replay",
Ben Vanik12b771f2023-03-08 12:27:45 -080056 "//runtime/src/iree/tooling:vm_util",
Ben Vanik097d8262022-06-09 11:35:04 -070057 "//runtime/src/iree/tooling:yaml_util",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -070058 "//runtime/src/iree/vm",
Ben Vanik50e46cd2021-06-28 10:19:35 -070059 "@com_github_yaml_libyaml//:yaml",
60 ],
61)
62
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -070063iree_runtime_cc_binary(
inho9606995d0b72021-01-05 17:07:16 +090064 name = "iree-check-module",
65 testonly = True,
66 srcs = ["iree-check-module-main.cc"],
67 deps = [
Stella Laurenzo9bde61b2022-04-21 15:37:14 -070068 "//runtime/src/iree/base",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -070069 "//runtime/src/iree/base/internal:file_io",
70 "//runtime/src/iree/base/internal:flags",
71 "//runtime/src/iree/hal",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -070072 "//runtime/src/iree/modules/check",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -070073 "//runtime/src/iree/testing:gtest",
Ben Vanikbcec0b52022-08-06 08:45:46 -070074 "//runtime/src/iree/tooling:context_util",
Ben Vanik7859d632022-10-24 14:37:28 -070075 "//runtime/src/iree/tooling:device_util",
Ben Vanik7958fc92023-01-12 08:45:32 -080076 "//runtime/src/iree/tooling:vm_util",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -070077 "//runtime/src/iree/vm",
Ben Vanikcf49d692023-02-24 20:24:09 -080078 "//runtime/src/iree/vm/bytecode:module",
inho9606995d0b72021-01-05 17:07:16 +090079 ],
80)
81
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -070082iree_runtime_cc_binary(
Ben Vanik0635b092023-03-28 13:03:38 -070083 name = "iree-cpuinfo",
84 srcs = ["iree-cpuinfo.c"],
85 deps = [
86 "//runtime/src/iree/base",
87 "//runtime/src/iree/base/internal:cpu",
88 "//runtime/src/iree/schemas:cpu_data",
89 ],
90)
91
92iree_runtime_cc_binary(
Ben Vanikc319c2d2023-02-24 18:18:47 -080093 name = "iree-dump-instruments",
94 srcs = ["iree-dump-instruments-main.c"],
95 deps = [
96 "//runtime/src/iree/base",
97 "//runtime/src/iree/base/internal:file_io",
98 "//runtime/src/iree/base/internal/flatcc:parsing",
99 "//runtime/src/iree/schemas/instruments",
100 "//runtime/src/iree/schemas/instruments:dispatch_def_c_fbs",
101 ],
102)
103
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -0700104iree_runtime_cc_binary(
Ben Vanik3555f142019-12-30 13:44:41 -0800105 name = "iree-dump-module",
Ben Vanik35bc9a12022-03-09 09:05:58 -0800106 srcs = ["iree-dump-module-main.c"],
Ben Vanik3555f142019-12-30 13:44:41 -0800107 deps = [
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700108 "//runtime/src/iree/base",
109 "//runtime/src/iree/base/internal:file_io",
Ben Vanik163547a2023-05-15 11:59:13 -0700110 "//runtime/src/iree/base/internal:flags",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700111 "//runtime/src/iree/base/internal/flatcc:debugging",
Ben Vanik163547a2023-05-15 11:59:13 -0700112 "//runtime/src/iree/base/internal/flatcc:parsing",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700113 "//runtime/src/iree/schemas:bytecode_module_def_c_fbs",
Ben Vanikcf49d692023-02-24 20:24:09 -0800114 "//runtime/src/iree/vm/bytecode:module",
Ben Vanik3555f142019-12-30 13:44:41 -0800115 ],
116)
117
Ben Vanik0635b092023-03-28 13:03:38 -0700118iree_runtime_cc_binary(
119 name = "iree-fatelf",
120 srcs = ["iree-fatelf.c"],
121 deps = [
122 "//runtime/src/iree/base",
123 "//runtime/src/iree/base/internal:file_io",
124 "//runtime/src/iree/base/internal:path",
125 "//runtime/src/iree/hal/local/elf:elf_module",
126 ],
127)
128
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -0700129iree_compiler_cc_binary(
Scott Todd44f95f82022-06-01 09:59:32 -0700130 name = "iree-opt",
Geoffrey Martin-Noble0a6b9cc2020-09-22 20:17:05 -0700131 srcs = ["iree-opt-main.cc"],
Scott Todd44f95f82022-06-01 09:59:32 -0700132 tags = ["hostonly"],
Stella Laurenzobd659a12019-10-23 10:17:48 -0700133 deps = [
Stella Laurenzo309dc5b2023-02-22 23:07:43 -0800134 "//compiler/bindings/c:headers",
Stella Laurenzo6dd9de82023-03-07 19:02:25 -0800135 "//compiler/src/iree/compiler/API:Impl",
Marius Brehler2301fcb2020-04-16 14:35:17 -0700136 ],
Ben Vanik52245042019-12-13 14:20:00 -0800137)
138
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -0700139iree_compiler_cc_binary(
Scott Todd111be2e2021-06-10 12:56:53 -0700140 name = "iree-mlir-lsp-server",
141 srcs = ["iree-mlir-lsp-server.cc"],
142 deps = [
Stella Laurenzo309dc5b2023-02-22 23:07:43 -0800143 "//compiler/bindings/c:headers",
Stella Laurenzo6dd9de82023-03-07 19:02:25 -0800144 "//compiler/src/iree/compiler/API:Impl",
Scott Todd111be2e2021-06-10 12:56:53 -0700145 ],
146)
147
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -0700148# The only place we cross the streams between compiler and runtime. This
149# includes a JIT compiler step and uses neither of the iree_*_cc_binary rules,
150# but rather directly depends on both the compiler and runtime include rules.
Ben Vanik493b0e22020-11-17 20:47:11 -0800151cc_binary(
Stella Laurenzobd659a12019-10-23 10:17:48 -0700152 name = "iree-run-mlir",
Geoffrey Martin-Noble0a6b9cc2020-09-22 20:17:05 -0700153 srcs = ["iree-run-mlir-main.cc"],
Geoffrey Martin-Noble48efde62020-03-23 13:23:44 -0700154 tags = ["hostonly"],
Stella Laurenzobd659a12019-10-23 10:17:48 -0700155 deps = [
Stella Laurenzod318c542023-04-27 17:08:22 -0700156 "//compiler/bindings/c:headers",
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -0700157 "//compiler/src:defs",
Stella Laurenzod318c542023-04-27 17:08:22 -0700158 "//compiler/src/iree/compiler/API:Impl",
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -0700159 "//runtime/src:runtime_defines",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700160 "//runtime/src/iree/base",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700161 "//runtime/src/iree/base/internal:flags",
162 "//runtime/src/iree/hal",
Ben Vanik007109f2022-08-03 07:26:50 -0700163 "//runtime/src/iree/tooling:context_util",
Ben Vanik097d8262022-06-09 11:35:04 -0700164 "//runtime/src/iree/tooling:device_util",
Stella Laurenzod318c542023-04-27 17:08:22 -0700165 "//runtime/src/iree/tooling:run_module",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700166 "//runtime/src/iree/vm",
Ben Vanik01353432020-11-17 03:15:40 -0800167 ],
Geoffrey Martin-Noblee64004d2020-02-03 16:13:46 -0800168)
169
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -0700170iree_runtime_cc_binary(
Geoffrey Martin-Noblee64004d2020-02-03 16:13:46 -0800171 name = "iree-run-module",
Stella Laurenzod318c542023-04-27 17:08:22 -0700172 srcs = ["iree-run-module-main.c"],
Geoffrey Martin-Noblee64004d2020-02-03 16:13:46 -0800173 deps = [
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700174 "//runtime/src/iree/base",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700175 "//runtime/src/iree/base/internal:flags",
176 "//runtime/src/iree/hal",
Ben Vanik007109f2022-08-03 07:26:50 -0700177 "//runtime/src/iree/tooling:context_util",
Stella Laurenzod318c542023-04-27 17:08:22 -0700178 "//runtime/src/iree/tooling:run_module",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700179 "//runtime/src/iree/vm",
Ben Vanik01353432020-11-17 03:15:40 -0800180 ],
Ben Vanik5f24fb52019-12-23 15:50:56 -0800181)
182
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -0700183iree_runtime_cc_binary(
Ben Vanikabe6c762021-06-27 21:57:07 -0700184 name = "iree-run-trace",
185 srcs = ["iree-run-trace-main.c"],
186 deps = [
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700187 "//runtime/src/iree/base",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700188 "//runtime/src/iree/base/internal:flags",
Ben Vanik1c59c112022-06-08 09:13:34 -0700189 "//runtime/src/iree/base/internal:path",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700190 "//runtime/src/iree/hal",
Ben Vanik097d8262022-06-09 11:35:04 -0700191 "//runtime/src/iree/tooling:device_util",
192 "//runtime/src/iree/tooling:trace_replay",
Ben Vanike91401e2023-03-06 18:05:09 -0800193 "//runtime/src/iree/tooling:vm_util",
Ben Vanik097d8262022-06-09 11:35:04 -0700194 "//runtime/src/iree/tooling:yaml_util",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700195 "//runtime/src/iree/vm",
Ben Vanikabe6c762021-06-27 21:57:07 -0700196 "@com_github_yaml_libyaml//:yaml",
197 ],
198)
199
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -0700200iree_runtime_cc_binary(
bjacobce5ee952021-11-01 22:41:10 -0400201 name = "iree-e2e-matmul-test",
202 srcs = ["iree-e2e-matmul-test.c"],
203 deps = [
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700204 "//runtime/src/iree/base",
Manish Gupta0a6cdf02022-11-08 22:12:02 -0800205 "//runtime/src/iree/base/internal",
bjacob27ded292022-09-06 16:02:33 -0400206 "//runtime/src/iree/base/internal:cpu",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700207 "//runtime/src/iree/base/internal:flags",
Ben Vanik1c59c112022-06-08 09:13:34 -0700208 "//runtime/src/iree/base/internal:path",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700209 "//runtime/src/iree/hal",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700210 "//runtime/src/iree/modules/hal",
Ben Vanik097d8262022-06-09 11:35:04 -0700211 "//runtime/src/iree/tooling:device_util",
212 "//runtime/src/iree/tooling:trace_replay",
213 "//runtime/src/iree/tooling:yaml_util",
Stella Laurenzo9bde61b2022-04-21 15:37:14 -0700214 "//runtime/src/iree/vm",
bjacobce5ee952021-11-01 22:41:10 -0400215 "@com_github_yaml_libyaml//:yaml",
216 ],
217)
218
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -0700219iree_compiler_cc_binary(
Ben Vanik7a6fa7a2019-11-06 14:01:41 -0800220 name = "iree-tblgen",
Ben Vanikd4bb8712020-11-16 05:52:30 -0800221 srcs = [
Stella Laurenzoae708152023-06-22 21:51:59 -0700222 "iree-tblgen.cpp",
Stella Laurenzo41a2ceb2022-04-29 12:49:36 -0700223 "//compiler/src/iree/compiler/Dialect/VM/Tools:GenSrcs",
Ben Vanikd4bb8712020-11-16 05:52:30 -0800224 ],
Geoffrey Martin-Noble48efde62020-03-23 13:23:44 -0700225 tags = ["hostonly"],
Ben Vanik7a6fa7a2019-11-06 14:01:41 -0800226 deps = [
Geoffrey Martin-Noblef5b323e2021-01-12 18:32:08 -0800227 "//build_tools:default_linkopts",
Ben Vanikd4bb8712020-11-16 05:52:30 -0800228 "@llvm-project//llvm:Support",
229 "@llvm-project//llvm:TableGen",
Jacques Pienaar641453c2019-12-30 07:56:43 -0800230 "@llvm-project//mlir:MlirTableGenMain",
231 "@llvm-project//mlir:Support",
232 "@llvm-project//mlir:TableGen",
Ben Vanik7a6fa7a2019-11-06 14:01:41 -0800233 ],
234)
235
Geoffrey Martin-Noble0948bc82023-03-15 17:27:34 -0700236iree_compiler_cc_binary(
Stella Laurenzo7f2972c2022-03-19 14:09:43 -0700237 name = "iree-compile",
238 srcs = ["iree-compile-main.cc"],
Stella Laurenzoae1c3a22022-03-17 11:17:58 -0700239 tags = ["hostonly"],
240 deps = [
Stella Laurenzo309dc5b2023-02-22 23:07:43 -0800241 "//compiler/bindings/c:headers",
Stella Laurenzo6dd9de82023-03-07 19:02:25 -0800242 "//compiler/src/iree/compiler/API:Impl",
Stella Laurenzoae1c3a22022-03-17 11:17:58 -0700243 ],
244)