Skip to content

Commit

Permalink
Minor cleanup, Windows+Bazel build fixes
Browse files Browse the repository at this point in the history
add app.h comment
compress-inl: remove unused typedef
gemma-inl: add missing HWY_ATTR
separate sum-inl.h and basics.h headers
update include pragmas
update dot_test thresholds
update Highway version in Bazel for HWY_RCAST_ALIGNED fix
PiperOrigin-RevId: 684398826
  • Loading branch information
jan-wassenberg authored and copybara-github committed Oct 10, 2024
1 parent a570e3f commit 0641fed
Show file tree
Hide file tree
Showing 19 changed files with 441 additions and 369 deletions.
177 changes: 94 additions & 83 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,39 @@ licenses(["notice"])

exports_files(["LICENSE"])

cc_library(
name = "basics",
hdrs = ["util/basics.h"],
deps = [
"@highway//:hwy",
],
)

cc_library(
name = "allocator",
hdrs = ["util/allocator.h"],
deps = [
"@hwy//:hwy",
"@highway//:hwy",
],
)

cc_library(
name = "test_util",
hdrs = ["util/test_util.h"],
deps = [
"@hwy//:hwy",
"@hwy//:hwy_test_util",
"@hwy//:stats",
"@highway//:hwy",
"@highway//:hwy_test_util",
"@highway//:stats",
],
)

cc_library(
name = "threading",
hdrs = ["util/threading.h"],
deps = [
"@hwy//:hwy",
"@hwy//:thread_pool",
"@hwy//:topology",
"@highway//:hwy",
"@highway//:thread_pool",
"@highway//:topology",
],
)

Expand All @@ -54,8 +62,8 @@ cc_test(
deps = [
":threading",
"@googletest//:gtest_main",
"@hwy//:hwy",
"@hwy//:hwy_test_util",
"@highway//:hwy",
"@highway//:hwy_test_util",
],
)

Expand All @@ -66,23 +74,25 @@ cc_library(
],
textual_hdrs = [
"ops/dot-inl.h",
"ops/sum-inl.h",
"ops/fp_arith-inl.h",
"ops/matmul-inl.h",
"ops/matvec-inl.h",
"ops/ops-inl.h",
],
deps = [
":allocator",
":basics",
":threading",
"//compression:compress",
"//compression:sfp",
"@hwy//:algo",
"@hwy//:dot",
"@hwy//:hwy",
"@hwy//:math",
"@hwy//:matvec",
"@hwy//:profiler",
"@hwy//:thread_pool",
"@highway//:algo",
"@highway//:dot",
"@highway//:hwy",
"@highway//:math",
"@highway//:matvec",
"@highway//:profiler",
"@highway//:thread_pool",
],
)

Expand All @@ -104,12 +114,12 @@ cc_test(
"@googletest//:gtest_main", # buildcleaner: keep
"//compression:compress",
"//compression:test_util",
"@hwy//:hwy",
"@hwy//:hwy_test_util",
"@hwy//:nanobenchmark", #buildcleaner: keep
"@hwy//:profiler",
"@hwy//:stats",
"@hwy//:thread_pool",
"@highway//:hwy",
"@highway//:hwy_test_util",
"@highway//:nanobenchmark", #buildcleaner: keep
"@highway//:profiler",
"@highway//:stats",
"@highway//:thread_pool",
],
)

Expand All @@ -129,9 +139,9 @@ cc_test(
":test_util",
"@googletest//:gtest_main", # buildcleaner: keep
"//compression:compress",
"@hwy//:hwy",
"@hwy//:hwy_test_util",
"@hwy//:nanobenchmark", #buildcleaner: keep
"@highway//:hwy",
"@highway//:hwy_test_util",
"@highway//:nanobenchmark", #buildcleaner: keep
],
)

Expand All @@ -147,10 +157,10 @@ cc_test(
":ops",
"@googletest//:gtest_main", # buildcleaner: keep
"//compression:compress",
"@hwy//:hwy",
"@hwy//:hwy_test_util",
"@hwy//:nanobenchmark",
"@hwy//:thread_pool",
"@highway//:hwy",
"@highway//:hwy_test_util",
"@highway//:nanobenchmark",
"@highway//:thread_pool",
],
)

Expand All @@ -167,10 +177,10 @@ cc_test(
":threading",
"@googletest//:gtest_main", # buildcleaner: keep
"//compression:compress",
"@hwy//:hwy",
"@hwy//:hwy_test_util",
"@hwy//:nanobenchmark",
"@hwy//:thread_pool",
"@highway//:hwy",
"@highway//:hwy_test_util",
"@highway//:nanobenchmark",
"@highway//:thread_pool",
],
)

Expand All @@ -183,8 +193,8 @@ cc_library(
],
deps = [
"//compression:compress",
"@hwy//:hwy", # base.h
"@hwy//:thread_pool",
"@highway//:hwy", # base.h
"@highway//:thread_pool",
],
)

Expand All @@ -197,10 +207,10 @@ cc_library(
":common",
"//compression:compress",
"//compression:io",
"@hwy//:hwy",
"@hwy//:profiler",
"@hwy//:stats",
"@hwy//:thread_pool",
"@highway//:hwy",
"@highway//:profiler",
"@highway//:stats",
"@highway//:thread_pool",
],
)

Expand All @@ -211,9 +221,9 @@ cc_library(
deps = [
":common",
"//compression:io",
"@hwy//:hwy",
"@hwy//:nanobenchmark", # timer
"@hwy//:profiler",
"@highway//:hwy",
"@highway//:nanobenchmark", # timer
"@highway//:profiler",
"@com_google_sentencepiece//:sentencepiece_processor",
],
)
Expand All @@ -224,7 +234,7 @@ cc_library(
hdrs = ["gemma/kv_cache.h"],
deps = [
":common",
"@hwy//:hwy",
"@highway//:hwy",
],
)

Expand Down Expand Up @@ -271,6 +281,7 @@ cc_library(
],
deps = [
":allocator",
":basics",
":common",
":ops",
":tokenizer",
Expand All @@ -279,13 +290,13 @@ cc_library(
":threading",
"//compression:io",
"//paligemma:image",
"@hwy//:hwy",
"@hwy//:bit_set",
"@hwy//:matvec",
"@hwy//:nanobenchmark", # timer
"@hwy//:profiler",
"@hwy//:thread_pool",
"@hwy//:topology",
"@highway//:hwy",
"@highway//:bit_set",
"@highway//:matvec",
"@highway//:nanobenchmark", # timer
"@highway//:profiler",
"@highway//:thread_pool",
"@highway//:topology",
],
)

Expand All @@ -297,7 +308,7 @@ cc_library(
":common",
":gemma_lib",
":ops",
"@hwy//:hwy",
"@highway//:hwy",
],
)

Expand All @@ -306,7 +317,7 @@ cc_library(
hdrs = ["util/args.h"],
deps = [
"//compression:io",
"@hwy//:hwy",
"@highway//:hwy",
],
)

Expand All @@ -319,9 +330,9 @@ cc_library(
":gemma_lib",
":threading",
"//compression:io",
"@hwy//:hwy",
"@hwy//:thread_pool",
"@hwy//:topology",
"@highway//:hwy",
"@highway//:thread_pool",
"@highway//:topology",
],
)

Expand All @@ -338,12 +349,12 @@ cc_library(
":kv_cache",
":threading",
# Placeholder for internal dep, do not remove.,
"@benchmark//:benchmark",
"@google_benchmark//:benchmark",
"//compression:compress",
"@hwy//:hwy",
"@hwy//:nanobenchmark",
"@hwy//:thread_pool",
"@hwy//:topology",
"@highway//:hwy",
"@highway//:nanobenchmark",
"@highway//:thread_pool",
"@highway//:topology",
],
)

Expand All @@ -362,8 +373,8 @@ cc_test(
":gemma_lib",
":tokenizer",
"@googletest//:gtest_main",
"@hwy//:hwy",
"@hwy//:hwy_test_util",
"@highway//:hwy",
"@highway//:hwy_test_util",
],
)

Expand All @@ -379,9 +390,9 @@ cc_binary(
":threading",
# Placeholder for internal dep, do not remove.,
"//paligemma:image",
"@hwy//:hwy",
"@hwy//:profiler",
"@hwy//:thread_pool",
"@highway//:hwy",
"@highway//:profiler",
"@highway//:thread_pool",
],
)

Expand All @@ -396,9 +407,9 @@ cc_binary(
":cross_entropy",
":gemma_lib",
"//compression:io",
"@hwy//:hwy",
"@hwy//:nanobenchmark",
"@hwy//:thread_pool",
"@highway//:hwy",
"@highway//:nanobenchmark",
"@highway//:thread_pool",
"@nlohmann_json//:json",
],
)
Expand All @@ -408,7 +419,7 @@ cc_binary(
srcs = ["evals/benchmarks.cc"],
deps = [
":benchmark_helper",
"@benchmark//:benchmark",
"@google_benchmark//:benchmark",
],
)

Expand All @@ -423,8 +434,8 @@ cc_binary(
":benchmark_helper",
":gemma_lib",
"//compression:io",
"@hwy//:hwy",
"@hwy//:thread_pool",
"@highway//:hwy",
"@highway//:thread_pool",
"@nlohmann_json//:json",
],
)
Expand All @@ -438,9 +449,9 @@ cc_binary(
":benchmark_helper",
":gemma_lib",
"//compression:io",
"@hwy//:hwy",
"@hwy//:profiler",
"@hwy//:thread_pool",
"@highway//:hwy",
"@highway//:profiler",
"@highway//:thread_pool",
"@nlohmann_json//:json",
],
)
Expand Down Expand Up @@ -481,9 +492,9 @@ cc_library(
":ops",
":prompt",
":weights",
"@hwy//:dot",
"@hwy//:hwy", # base.h
"@hwy//:thread_pool",
"@highway//:dot",
"@highway//:hwy", # base.h
"@highway//:thread_pool",
],
)

Expand Down Expand Up @@ -543,9 +554,9 @@ cc_test(
":sampler",
"@googletest//:gtest_main",
"//compression:weights_raw",
"@hwy//:hwy",
"@hwy//:hwy_test_util",
"@hwy//:thread_pool",
"@highway//:hwy",
"@highway//:hwy_test_util",
"@highway//:thread_pool",
],
)

Expand All @@ -558,8 +569,8 @@ cc_library(
":common",
":weights",
"//compression:compress",
"@hwy//:hwy",
"@hwy//:thread_pool",
"@highway//:hwy",
"@highway//:thread_pool",
],
)

Expand All @@ -582,6 +593,6 @@ cc_test(
":threading",
":weights",
"@googletest//:gtest_main",
"@hwy//:thread_pool",
"@highway//:thread_pool",
],
)
Loading

0 comments on commit 0641fed

Please sign in to comment.