| # Copyright 2020 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_cmake_extra_content", "iree_runtime_cc_library", "iree_runtime_cc_test") |
| load("//build_tools/bazel:cc_binary_benchmark.bzl", "cc_binary_benchmark") |
| |
| package( |
| default_visibility = ["//visibility:public"], |
| features = ["layering_check"], |
| licenses = ["notice"], # Apache 2.0 |
| ) |
| |
| iree_cmake_extra_content( |
| content = """ |
| # Task-based executor requires threading support. |
| if(NOT IREE_ENABLE_THREADING) |
| return() |
| endif() |
| """, |
| ) |
| |
| iree_cmake_extra_content( |
| content = """ |
| # cpuinfo can be conditionally disabled when it is not supported. |
| # If disabled then by default the task system will use 1 thread. |
| set(IREE_CPUINFO_TARGET) |
| if(IREE_ENABLE_CPUINFO) |
| set(IREE_CPUINFO_TARGET cpuinfo) |
| endif() |
| """, |
| inline = True, |
| ) |
| |
| iree_runtime_cc_library( |
| name = "api", |
| srcs = ["api.c"], |
| hdrs = ["api.h"], |
| deps = [ |
| ":task", |
| "//runtime/src/iree/base", |
| "//runtime/src/iree/base/internal", |
| "//runtime/src/iree/base/tooling:flags", |
| ], |
| ) |
| |
| iree_runtime_cc_library( |
| name = "task", |
| srcs = [ |
| "executor.c", |
| "executor_impl.h", |
| "process.c", |
| "scope.c", |
| "topology.c", |
| "topology_cpuinfo.c", |
| "topology_darwin.c", |
| "topology_fallback.c", |
| "topology_sysfs.c", |
| "topology_wasm.c", |
| "topology_win32.c", |
| "worker.c", |
| "worker.h", |
| ], |
| hdrs = [ |
| "affinity_set.h", |
| "executor.h", |
| "process.h", |
| "scope.h", |
| "topology.h", |
| "tuning.h", |
| ], |
| deps = [ |
| "//runtime/src/iree/base", |
| "//runtime/src/iree/base/internal", |
| "//runtime/src/iree/base/internal:atomic_slist", |
| "//runtime/src/iree/base/internal:cpu", |
| "//runtime/src/iree/base/internal:fpu_state", |
| "//runtime/src/iree/base/internal:prng", |
| "//runtime/src/iree/base/internal:sysfs", |
| "//runtime/src/iree/base/threading", |
| "//runtime/src/iree/base/threading:thread", |
| ], |
| ) |
| |
| iree_runtime_cc_test( |
| name = "process_test", |
| srcs = ["process_test.cc"], |
| deps = [ |
| ":task", |
| "//runtime/src/iree/base", |
| "//runtime/src/iree/testing:gtest", |
| "//runtime/src/iree/testing:gtest_main", |
| ], |
| ) |
| |
| iree_runtime_cc_test( |
| name = "executor_test", |
| srcs = ["executor_test.cc"], |
| deps = [ |
| ":task", |
| "//runtime/src/iree/base", |
| "//runtime/src/iree/testing:gtest", |
| "//runtime/src/iree/testing:gtest_main", |
| ], |
| ) |
| |
| iree_runtime_cc_test( |
| name = "topology_test", |
| srcs = ["topology_test.cc"], |
| deps = [ |
| ":task", |
| "//runtime/src/iree/base", |
| "//runtime/src/iree/testing:gtest", |
| "//runtime/src/iree/testing:gtest_main", |
| ], |
| ) |
| |
| cc_binary_benchmark( |
| name = "executor_benchmark", |
| srcs = ["executor_benchmark.cc"], |
| deps = [ |
| ":task", |
| "//runtime/src/iree/base", |
| "//runtime/src/iree/testing:benchmark_main", |
| "@com_google_benchmark//:benchmark", |
| ], |
| ) |