| # Copyright 2019 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 | |
| # Tools IREE provides for compiling, executing, and benchmarking programs, as | |
| # well as other utilities. | |
| # | |
| # Only binary targets and their associated main files should go in this | |
| # directory. Library targets and header files should be placed in the | |
| # appropriate subtree, e.g. `compiler/src/iree/compiler/Tools/`. | |
| # | |
| # Programs with a dependency on the compiler are not designed to run on device | |
| # platforms (e.g. Android), so they are tagged "hostonly". | |
| load("@rules_cc//cc:defs.bzl", "cc_binary") | |
| load("//build_tools/bazel:build_defs.oss.bzl", "IREE_COMPILER_TOOL_LINKOPTS", "iree_compiler_cc_binary", "iree_runtime_cc_binary") | |
| package( | |
| default_visibility = ["//visibility:public"], | |
| features = ["layering_check"], | |
| licenses = ["notice"], # Apache 2.0 | |
| ) | |
| exports_files([ | |
| "iree-profile-render", | |
| "lit.cfg.py", | |
| ]) | |
| iree_runtime_cc_binary( | |
| name = "iree-as-module", | |
| srcs = ["iree-as-module-main.c"], | |
| deps = [ | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/io:file_handle", | |
| "//runtime/src/iree/vm/bytecode/assembler", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-benchmark-executable", | |
| srcs = ["iree-benchmark-executable-main.c"], | |
| deps = [ | |
| "//runtime/src/iree/async", | |
| "//runtime/src/iree/async/util:proactor_pool", | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/threading", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/hal", | |
| "//runtime/src/iree/io:file_handle", | |
| "//runtime/src/iree/modules/hal:types", | |
| "//runtime/src/iree/testing:benchmark", | |
| "//runtime/src/iree/tooling:device_util", | |
| "//runtime/src/iree/tooling:function_io", | |
| "//runtime/src/iree/vm", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-benchmark-module", | |
| srcs = ["iree-benchmark-module-main.cc"], | |
| deps = [ | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/hal", | |
| "//runtime/src/iree/hal/replay:recorder", | |
| "//runtime/src/iree/hal/utils:statistics_sink", | |
| "//runtime/src/iree/modules/hal:types", | |
| "//runtime/src/iree/tooling:context_util", | |
| "//runtime/src/iree/tooling:device_util", | |
| "//runtime/src/iree/tooling:function_io", | |
| "//runtime/src/iree/tooling:function_util", | |
| "//runtime/src/iree/tooling:process_results", | |
| "//runtime/src/iree/vm", | |
| "@com_google_benchmark//:benchmark", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-check-module", | |
| testonly = True, | |
| srcs = ["iree-check-module-main.cc"], | |
| deps = [ | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/hal", | |
| "//runtime/src/iree/hal/replay:recorder", | |
| "//runtime/src/iree/modules/check", | |
| "//runtime/src/iree/testing:gtest", | |
| "//runtime/src/iree/tooling:context_util", | |
| "//runtime/src/iree/tooling:device_util", | |
| "//runtime/src/iree/vm", | |
| "//runtime/src/iree/vm/bytecode:module", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-convert-parameters", | |
| srcs = ["iree-convert-parameters-main.c"], | |
| deps = [ | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/hal", | |
| "//runtime/src/iree/io:file_handle", | |
| "//runtime/src/iree/io:parameter_index", | |
| "//runtime/src/iree/io:scope_map", | |
| "//runtime/src/iree/io/formats/irpa", | |
| "//runtime/src/iree/tooling:parameter_util", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-cpuinfo", | |
| srcs = ["iree-cpuinfo.c"], | |
| deps = [ | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/internal:cpu", | |
| "//runtime/src/iree/schemas:cpu_data", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-create-parameters", | |
| srcs = ["iree-create-parameters-main.c"], | |
| deps = [ | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/hal", | |
| "//runtime/src/iree/io:file_handle", | |
| "//runtime/src/iree/io:parameter_index", | |
| "//runtime/src/iree/io:scope_map", | |
| "//runtime/src/iree/io:stream", | |
| "//runtime/src/iree/io/formats/irpa", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-dump-instruments", | |
| srcs = ["iree-dump-instruments-main.c"], | |
| deps = [ | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/internal/flatcc:parsing", | |
| "//runtime/src/iree/io:file_handle", | |
| "//runtime/src/iree/schemas/instruments", | |
| "//runtime/src/iree/schemas/instruments:dispatch_def_c_fbs", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-dump-module", | |
| srcs = ["iree-dump-module-main.c"], | |
| deps = [ | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/internal/flatcc:debugging", | |
| "//runtime/src/iree/base/internal/flatcc:parsing", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/io:file_handle", | |
| "//runtime/src/iree/schemas:bytecode_module_def_c_fbs", | |
| "//runtime/src/iree/vm", | |
| "//runtime/src/iree/vm/bytecode:module", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-dump-parameters", | |
| srcs = ["iree-dump-parameters-main.c"], | |
| deps = [ | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/io:file_handle", | |
| "//runtime/src/iree/io:parameter_index", | |
| "//runtime/src/iree/io:scope_map", | |
| "//runtime/src/iree/tooling:parameter_util", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-dump-replay", | |
| srcs = ["iree-dump-replay-main.c"], | |
| deps = [ | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/hal/replay:dump", | |
| "//runtime/src/iree/io:file_handle", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-run-replay", | |
| srcs = ["iree-run-replay-main.c"], | |
| deps = [ | |
| "//runtime/src/iree/async", | |
| "//runtime/src/iree/async/util:proactor_pool", | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/hal", | |
| "//runtime/src/iree/hal/replay:execute", | |
| "//runtime/src/iree/io:file_handle", | |
| "//runtime/src/iree/tooling:device_util", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-benchmark-replay", | |
| srcs = ["iree-benchmark-replay-main.cc"], | |
| deps = [ | |
| "//runtime/src/iree/async", | |
| "//runtime/src/iree/async/util:proactor_pool", | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/hal", | |
| "//runtime/src/iree/hal/replay:execute", | |
| "//runtime/src/iree/io:file_handle", | |
| "//runtime/src/iree/tooling:device_util", | |
| "@com_google_benchmark//:benchmark", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-encode-parameters", | |
| srcs = ["iree-encode-parameters-main.c"], | |
| deps = [ | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/hal", | |
| "//runtime/src/iree/hal/replay:recorder", | |
| "//runtime/src/iree/io:file_handle", | |
| "//runtime/src/iree/io:parameter_index", | |
| "//runtime/src/iree/io:parameter_index_provider", | |
| "//runtime/src/iree/io:scope_map", | |
| "//runtime/src/iree/io:stream", | |
| "//runtime/src/iree/io/formats/irpa", | |
| "//runtime/src/iree/modules/hal", | |
| "//runtime/src/iree/tooling:context_util", | |
| "//runtime/src/iree/tooling:function_util", | |
| "//runtime/src/iree/tooling:parameter_util", | |
| "//runtime/src/iree/vm", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-fatelf", | |
| srcs = ["iree-fatelf.c"], | |
| deps = [ | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/internal:path", | |
| "//runtime/src/iree/hal/local/elf:elf_module", | |
| "//runtime/src/iree/io:file_handle", | |
| ], | |
| ) | |
| iree_compiler_cc_binary( | |
| name = "iree-opt", | |
| srcs = ["iree-opt-main.cc"], | |
| linkopts = IREE_COMPILER_TOOL_LINKOPTS, | |
| tags = ["hostonly"], | |
| deps = [ | |
| "//compiler/bindings/c:headers", | |
| "//compiler/src/iree/compiler/API:Impl", | |
| ], | |
| ) | |
| iree_compiler_cc_binary( | |
| name = "iree-mlir-lsp-server", | |
| srcs = ["iree-mlir-lsp-server.cc"], | |
| linkopts = IREE_COMPILER_TOOL_LINKOPTS, | |
| deps = [ | |
| "//compiler/bindings/c:headers", | |
| "//compiler/src/iree/compiler/API:Impl", | |
| ], | |
| ) | |
| # The only place we cross the streams between compiler and runtime. This | |
| # includes a JIT compiler step and uses neither of the iree_*_cc_binary rules, | |
| # but rather directly depends on both the compiler and runtime include rules. | |
| cc_binary( | |
| name = "iree-run-mlir", | |
| srcs = ["iree-run-mlir-main.cc"], | |
| linkopts = IREE_COMPILER_TOOL_LINKOPTS, | |
| tags = ["hostonly"], | |
| deps = [ | |
| "//compiler/bindings/c:headers", | |
| "//compiler/src:defs", | |
| "//compiler/src/iree/compiler/API:Impl", | |
| "//runtime/src:runtime_defines", | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/hal", | |
| "//runtime/src/iree/tooling:context_util", | |
| "//runtime/src/iree/tooling:device_util", | |
| "//runtime/src/iree/tooling:run_module", | |
| "//runtime/src/iree/vm", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-run-module", | |
| srcs = ["iree-run-module-main.c"], | |
| deps = [ | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/hal", | |
| "//runtime/src/iree/tooling:context_util", | |
| "//runtime/src/iree/tooling:run_module", | |
| "//runtime/src/iree/vm", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-profile", | |
| srcs = ["iree-profile-main.c"], | |
| defines = select({ | |
| "//runtime/src/iree/hal/drivers:amdgpu_enabled": ["IREE_PROFILE_HAVE_AMDGPU_ATT=1"], | |
| "//conditions:default": ["IREE_PROFILE_HAVE_AMDGPU_ATT=0"], | |
| }), | |
| deps = [ | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/tooling/profile:commands", | |
| "//runtime/src/iree/tooling/profile:help", | |
| ] + select({ | |
| "//runtime/src/iree/hal/drivers:amdgpu_enabled": ["//runtime/src/iree/tooling/profile/att"], | |
| "//conditions:default": [], | |
| }), | |
| ) | |
| iree_compiler_cc_binary( | |
| name = "iree-tblgen", | |
| srcs = [ | |
| "iree-tblgen.cpp", | |
| "//compiler/src/iree/compiler/Dialect/VM/Tools:GenSrcs", | |
| ], | |
| tags = ["hostonly"], | |
| deps = [ | |
| "@llvm-project//llvm:Support", | |
| "@llvm-project//llvm:TableGen", | |
| "@llvm-project//mlir:MlirTableGenMain", | |
| "@llvm-project//mlir:Support", | |
| "@llvm-project//mlir:TableGen", | |
| ], | |
| ) | |
| iree_runtime_cc_binary( | |
| name = "iree-tokenize", | |
| srcs = ["iree-tokenize-main.c"], | |
| deps = [ | |
| "//runtime/src/iree/base", | |
| "//runtime/src/iree/base/internal:json", | |
| "//runtime/src/iree/base/tooling:flags", | |
| "//runtime/src/iree/io:file_handle", | |
| "//runtime/src/iree/tokenizer", | |
| "//runtime/src/iree/tokenizer/format/huggingface:tokenizer_json", | |
| "//runtime/src/iree/tokenizer/format/tiktoken", | |
| "//runtime/src/iree/tokenizer/vocab", | |
| ], | |
| ) | |
| iree_compiler_cc_binary( | |
| name = "iree-compile", | |
| srcs = ["iree-compile-main.cc"], | |
| linkopts = IREE_COMPILER_TOOL_LINKOPTS, | |
| tags = ["hostonly"], | |
| deps = [ | |
| "//compiler/bindings/c:headers", | |
| "//compiler/src/iree/compiler/API:Impl", | |
| ], | |
| ) | |
| iree_compiler_cc_binary( | |
| name = "iree-link", | |
| srcs = ["iree-link-main.cc"], | |
| tags = ["hostonly"], | |
| deps = [ | |
| "//compiler/bindings/c:headers", | |
| "//compiler/src/iree/compiler/API:Impl", | |
| ], | |
| ) | |
| iree_compiler_cc_binary( | |
| name = "iree-reduce", | |
| srcs = ["iree-reduce.cc"], | |
| linkopts = IREE_COMPILER_TOOL_LINKOPTS, | |
| tags = ["hostonly"], | |
| deps = [ | |
| "//compiler/bindings/c:headers", | |
| "//compiler/src/iree/compiler/API:Impl", | |
| ], | |
| ) |