| # 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 |
| |
| # Implementations for iree/base/. |
| # These are not part of the IREE API. Though they may be used by external |
| # projects their API may change at any time. |
| |
| load("//build_tools/bazel:build_defs.oss.bzl", "iree_cmake_extra_content", "iree_runtime_cc_binary", "iree_runtime_cc_fuzz", "iree_runtime_cc_library", "iree_runtime_cc_test") |
| load("//build_tools/bazel:cc_binary_benchmark.bzl", "cc_binary_benchmark") |
| load("//build_tools/bazel:iree_lit_test.bzl", "iree_lit_test_suite") |
| |
| package( |
| default_visibility = ["//visibility:public"], |
| features = ["layering_check"], |
| licenses = ["notice"], # Apache 2.0 |
| ) |
| |
| #===------------------------------------------------------------------------===# |
| # Core headers (internal) |
| #===------------------------------------------------------------------------===# |
| # Put files here that large percentages of the code include only; adding |
| # infrequently used files here will cause extraneous large rebuilds. |
| |
| iree_runtime_cc_library( |
| name = "internal", |
| srcs = [ |
| "atomics_clang.h", |
| "atomics_disabled.h", |
| "atomics_gcc.h", |
| "atomics_msvc.h", |
| ], |
| hdrs = [ |
| "atomics.h", |
| "debugging.h", |
| "inline_array.h", |
| "math.h", |
| ], |
| deps = [ |
| "//runtime/src/iree/base:core_headers", |
| ], |
| ) |
| |
| iree_runtime_cc_test( |
| name = "atomics_test", |
| srcs = ["atomics_test.cc"], |
| deps = [ |
| ":internal", |
| "//runtime/src/iree/base:core_headers", |
| "//runtime/src/iree/testing:gtest", |
| "//runtime/src/iree/testing:gtest_main", |
| ], |
| ) |
| |
| iree_runtime_cc_test( |
| name = "math_test", |
| srcs = ["math_test.cc"], |
| deps = [ |
| ":internal", |
| "//runtime/src/iree/testing:gtest", |
| "//runtime/src/iree/testing:gtest_main", |
| ], |
| ) |
| |
| #===------------------------------------------------------------------------===# |
| # Utilities |
| #===------------------------------------------------------------------------===# |
| |
| iree_runtime_cc_library( |
| name = "arena", |
| srcs = ["arena.c"], |
| hdrs = ["arena.h"], |
| deps = [ |
| ":atomic_slist", |
| ":internal", |
| "//runtime/src/iree/base", |
| ], |
| ) |
| |
| iree_runtime_cc_library( |
| name = "atomic_slist", |
| srcs = ["atomic_slist.c"], |
| hdrs = ["atomic_slist.h"], |
| deps = [ |
| ":internal", |
| "//runtime/src/iree/base:core_headers", |
| "//runtime/src/iree/base/threading", |
| ], |
| ) |
| |
| iree_runtime_cc_test( |
| name = "atomic_slist_test", |
| srcs = ["atomic_slist_test.cc"], |
| deps = [ |
| ":atomic_slist", |
| "//runtime/src/iree/testing:gtest", |
| "//runtime/src/iree/testing:gtest_main", |
| ], |
| ) |
| |
| iree_runtime_cc_library( |
| name = "atomic_freelist", |
| hdrs = ["atomic_freelist.h"], |
| deps = [ |
| ":internal", |
| "//runtime/src/iree/base", |
| "//runtime/src/iree/base:core_headers", |
| ], |
| ) |
| |
| iree_runtime_cc_test( |
| name = "atomic_freelist_test", |
| srcs = ["atomic_freelist_test.cc"], |
| deps = [ |
| ":atomic_freelist", |
| ":memory", |
| "//runtime/src/iree/testing:gtest", |
| "//runtime/src/iree/testing:gtest_main", |
| ], |
| ) |
| |
| cc_binary_benchmark( |
| name = "atomic_freelist_benchmark", |
| srcs = ["atomic_freelist_benchmark.cc"], |
| deps = [ |
| ":atomic_freelist", |
| ":memory", |
| "//runtime/src/iree/testing:benchmark_main", |
| "@com_google_benchmark//:benchmark", |
| ], |
| ) |
| |
| iree_runtime_cc_library( |
| name = "cpu", |
| srcs = ["cpu.c"], |
| hdrs = ["cpu.h"], |
| deps = [ |
| "//runtime/src/iree/base", |
| "//runtime/src/iree/base:core_headers", |
| "//runtime/src/iree/schemas:cpu_data", |
| ], |
| ) |
| |
| iree_runtime_cc_library( |
| name = "dynamic_library", |
| srcs = [ |
| "dynamic_library_posix.c", |
| "dynamic_library_win32.c", |
| ], |
| hdrs = ["dynamic_library.h"], |
| deps = [ |
| ":internal", |
| ":path", |
| "//build_tools:dl", |
| "//build_tools:pthreads", |
| "//runtime/src/iree/base", |
| "//runtime/src/iree/base/threading", |
| ], |
| ) |
| |
| iree_runtime_cc_library( |
| name = "flags", |
| srcs = ["flags.c"], |
| hdrs = ["flags.h"], |
| deps = [ |
| ":internal", |
| "//runtime/src/iree/base", |
| "//runtime/src/iree/io:file_handle", |
| ], |
| ) |
| |
| iree_runtime_cc_binary( |
| name = "flags_demo", |
| testonly = True, |
| srcs = ["flags_demo.c"], |
| deps = [ |
| ":flags", |
| "//runtime/src/iree/base", |
| ], |
| ) |
| |
| iree_lit_test_suite( |
| name = "flags_test", |
| srcs = ["flags_test.txt"], |
| cfg = "//runtime:lit.cfg.py", |
| tags = ["hostonly"], |
| tools = [ |
| ":flags_demo", |
| "@llvm-project//llvm:FileCheck", |
| ], |
| ) |
| |
| iree_runtime_cc_library( |
| name = "fpu_state", |
| srcs = ["fpu_state.c"], |
| hdrs = ["fpu_state.h"], |
| deps = [ |
| ":internal", |
| "//runtime/src/iree/base", |
| "//runtime/src/iree/base:core_headers", |
| ], |
| ) |
| |
| cc_binary_benchmark( |
| name = "fpu_state_benchmark", |
| srcs = ["fpu_state_benchmark.cc"], |
| deps = [ |
| ":fpu_state", |
| "//runtime/src/iree/base", |
| "//runtime/src/iree/testing:benchmark", |
| "//runtime/src/iree/testing:benchmark_main", |
| ], |
| ) |
| |
| iree_runtime_cc_test( |
| name = "fpu_state_test", |
| srcs = ["fpu_state_test.cc"], |
| tags = ["requires-dtz"], |
| deps = [ |
| ":fpu_state", |
| "//runtime/src/iree/testing:gtest", |
| "//runtime/src/iree/testing:gtest_main", |
| ], |
| ) |
| |
| iree_runtime_cc_library( |
| name = "json", |
| srcs = ["json.c"], |
| hdrs = ["json.h"], |
| deps = [ |
| ":unicode", |
| "//runtime/src/iree/base", |
| ], |
| ) |
| |
| iree_runtime_cc_test( |
| name = "json_test", |
| srcs = ["json_test.cc"], |
| deps = [ |
| ":json", |
| "//runtime/src/iree/testing:gtest", |
| "//runtime/src/iree/testing:gtest_main", |
| ], |
| ) |
| |
| iree_runtime_cc_library( |
| name = "memory", |
| srcs = ["memory.c"], |
| hdrs = ["memory.h"], |
| deps = [ |
| ":internal", |
| "//runtime/src/iree/base", |
| ], |
| ) |
| |
| iree_runtime_cc_library( |
| name = "path", |
| srcs = ["path.c"], |
| hdrs = ["path.h"], |
| deps = [ |
| "//runtime/src/iree/base", |
| "//runtime/src/iree/base:core_headers", |
| ], |
| ) |
| |
| iree_runtime_cc_test( |
| name = "path_test", |
| srcs = [ |
| "path_test.cc", |
| ], |
| deps = [ |
| ":path", |
| "//runtime/src/iree/base:core_headers", |
| "//runtime/src/iree/testing:gtest", |
| "//runtime/src/iree/testing:gtest_main", |
| ], |
| ) |
| |
| iree_runtime_cc_library( |
| name = "prng", |
| hdrs = ["prng.h"], |
| deps = [ |
| ":internal", |
| "//runtime/src/iree/base:core_headers", |
| ], |
| ) |
| |
| iree_runtime_cc_test( |
| name = "prng_test", |
| srcs = ["prng_test.cc"], |
| deps = [ |
| ":prng", |
| "//runtime/src/iree/testing:gtest", |
| "//runtime/src/iree/testing:gtest_main", |
| ], |
| ) |
| |
| iree_runtime_cc_library( |
| name = "span", |
| hdrs = ["span.h"], |
| ) |
| |
| iree_runtime_cc_library( |
| name = "time", |
| srcs = [ |
| "time.c", |
| ], |
| hdrs = [ |
| "time.h", |
| ], |
| deps = [ |
| "//runtime/src/iree/base:core_headers", |
| ], |
| ) |
| |
| iree_runtime_cc_library( |
| name = "unicode", |
| srcs = [ |
| "unicode.c", |
| "unicode_tables.c", |
| ], |
| hdrs = ["unicode.h"], |
| deps = [ |
| "//runtime/src/iree/base", |
| ], |
| ) |
| |
| iree_runtime_cc_fuzz( |
| name = "unicode_fuzz", |
| srcs = ["unicode_fuzz.cc"], |
| deps = [ |
| ":unicode", |
| ], |
| ) |
| |
| iree_runtime_cc_test( |
| name = "unicode_test", |
| srcs = ["unicode_test.cc"], |
| deps = [ |
| ":unicode", |
| "//runtime/src/iree/testing:gtest", |
| "//runtime/src/iree/testing:gtest_main", |
| ], |
| ) |
| |
| iree_runtime_cc_library( |
| name = "wait_handle", |
| srcs = [ |
| "wait_handle.c", |
| "wait_handle_emscripten.c", |
| "wait_handle_epoll.c", |
| "wait_handle_impl.h", |
| "wait_handle_inproc.c", |
| "wait_handle_kqueue.c", |
| "wait_handle_null.c", |
| "wait_handle_poll.c", |
| "wait_handle_posix.c", |
| "wait_handle_posix.h", |
| "wait_handle_win32.c", |
| ], |
| hdrs = ["wait_handle.h"], |
| deps = [ |
| "//runtime/src/iree/base", |
| "//runtime/src/iree/base:core_headers", |
| "//runtime/src/iree/base/threading", |
| ], |
| ) |
| |
| iree_runtime_cc_test( |
| name = "wait_handle_test", |
| srcs = ["wait_handle_test.cc"], |
| deps = [ |
| ":wait_handle", |
| "//runtime/src/iree/testing:gtest", |
| "//runtime/src/iree/testing:gtest_main", |
| ], |
| ) |
| |
| #===------------------------------------------------------------------------===# |
| # Utilities with thread dependencies |
| #===------------------------------------------------------------------------===# |
| |
| iree_cmake_extra_content( |
| content = """ |
| if(NOT IREE_ENABLE_THREADING) |
| return() |
| endif() |
| """, |
| inline = True, |
| ) |
| |
| iree_runtime_cc_library( |
| name = "event_pool", |
| srcs = ["event_pool.c"], |
| hdrs = ["event_pool.h"], |
| deps = [ |
| ":internal", |
| ":wait_handle", |
| "//runtime/src/iree/base", |
| "//runtime/src/iree/base:core_headers", |
| "//runtime/src/iree/base/threading", |
| ], |
| ) |