Elffuss BraidHub

kikocis/kleidiai public

main · 2.4 KiBRawPermalink
1#
2# SPDX-FileCopyrightText: Copyright 2024-2026 Arm Limited and/or its affiliates <open-source-office@arm.com>
3#
4# SPDX-License-Identifier: Apache-2.0
5#
6
7load("@rules_cc//cc:defs.bzl", "cc_test")
8load(
9 "//:kai_defs.bzl",
10 "kai_cpu_bf16",
11 "kai_cpu_fp16",
12 "kai_cpu_neon",
13 "kai_cpu_sme",
14 "kai_cxx_library",
15 "kai_cxxopts",
16)
17
18package(default_testonly = 1)
19
20kai_cxx_library(
21 name = "common",
22 srcs = glob(
23 [
24 "common/*.cpp",
25 "common/*.S",
26 ],
27 exclude = ["common/sme.cpp"],
28 ),
29 hdrs = glob(
30 ["common/*.hpp"],
31 exclude = ["common/sme.hpp"],
32 ),
33 # compare.cpp requires fp16 and bf16 support
34 cpu_uarch = kai_cpu_bf16() + kai_cpu_fp16(),
35 textual_hdrs = [
36 "common/assembly.h",
37 ],
38 deps = ["@com_google_googletest//:gtest"],
39)
40
41kai_cxx_library(
42 name = "common_sme",
43 srcs = ["common/sme.cpp"],
44 hdrs = ["common/sme.hpp"],
45 # compare.cpp requires fp16 and bf16 support
46 cpu_uarch = kai_cpu_sme(),
47 deps = [
48 ":common",
49 ],
50)
51
52kai_cxx_library(
53 name = "reference",
54 srcs = glob(["reference/*.cpp"]),
55 hdrs = glob(["reference/*.hpp"]),
56 cpu_uarch = kai_cpu_neon(),
57 deps = [
58 ":common",
59 ],
60)
61
62kai_cxx_library(
63 name = "nextgen",
64 srcs = glob(
65 [
66 "nextgen/**/*.cpp",
67 ],
68 exclude = [
69 "nextgen/tests/*.cpp",
70 "nextgen/main.cpp",
71 ],
72 ),
73 hdrs = glob(["nextgen/**/*.hpp"]),
74 cpu_uarch = kai_cpu_neon(),
75 deps = [
76 ":common",
77 ":common_sme",
78 ":reference",
79 "//:kleidiai",
80 ],
81)
82
83cc_test(
84 name = "kleidiai_test",
85 srcs = glob([
86 "tests/*.cpp",
87 "nextgen/tests/*.cpp",
88 ]) + [
89 "nextgen/main.cpp",
90 ],
91 copts = kai_cxxopts(kai_cpu_neon()),
92 includes = [],
93 linkstatic = True,
94 visibility = ["//visibility:public"],
95 deps = [
96 ":nextgen",
97 "@com_google_googletest//:gtest",
98 ],
99)
100
101[cc_test(
102 # Remove prefix tests/ and suffix .cpp
103 name = test_file.split("/")[-1][:-4],
104 srcs = [
105 test_file,
106 "nextgen/main.cpp",
107 ],
108 copts = kai_cxxopts(kai_cpu_neon()),
109 includes = [],
110 linkstatic = True,
111 visibility = ["//visibility:public"],
112 deps = [
113 ":nextgen",
114 "@com_google_googletest//:gtest",
115 ],
116) for test_file in glob([
117 "tests/*.cpp",
118 "nextgen/tests/*.cpp",
119])]