File size: 1,451 Bytes
d1a84ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Vector that always aligns its data to the cache line of the host machine.

licenses(["notice"])

cc_library(
    name = "cache_aligned_vector",
    hdrs = [
        "cache_aligned_vector.h",
    ],
    visibility = [
        "//sparse_matmul:__subpackages__",
    ],
    deps = [
        ":aligned_malloc",
        "//sparse_matmul/numerics:fast_transcendentals",
        "//sparse_matmul/numerics:types",
        "//sparse_matmul/os:coop_threads",
        "@com_google_absl//absl/strings:str_format",
    ],
)

cc_test(
    name = "cachealignedvector_test",
    size = "small",
    srcs = [
        "cachealignedvector_test.cc",
    ],
    copts = [
        "-DFAST_TRANSCENDENTALS",
        "-DSIGMOID_AS_TANH",
    ],
    deps = [
        ":cache_aligned_vector",
        "//sparse_matmul/numerics:test_utils",
        "//sparse_matmul/os:coop_threads",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_binary(
    name = "cachealignedvector_benchmark",
    srcs = [
        "cachealignedvector_benchmark.cc",
    ],
    copts = [
        "-DFAST_TRANSCENDENTALS",
        "-DSIGMOID_AS_TANH",
        "-DACCURATE_TRANSCENDENTAL_APPROX",
    ],
    deps = [
        ":cache_aligned_vector",
        "@com_github_google_benchmark//:benchmark",
        "@com_github_google_benchmark//:benchmark_main",
    ],
)

cc_library(
    name = "aligned_malloc",
    srcs = ["aligned_malloc.cc"],
    hdrs = [
        "aligned_malloc.h",
    ],
)