diff --git a/BUILD.bazel b/BUILD.bazel index 4dc8c62..e8797cb 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -409,6 +409,7 @@ cc_library( "//compression:compress", "@highway//:hwy", "@highway//:nanobenchmark", + "@highway//:topology", ], ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0efece1..84910cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -FetchContent_Declare(highway GIT_REPOSITORY https://github.com/google/highway.git GIT_TAG 0ca297227a373710e76dd45e0ad4d68adb6928fe EXCLUDE_FROM_ALL) +FetchContent_Declare(highway GIT_REPOSITORY https://github.com/google/highway.git GIT_TAG 2b565e87d50b151660494624af532ac0b6076c79 EXCLUDE_FROM_ALL) FetchContent_MakeAvailable(highway) ## Note: absl needs to be installed by sentencepiece. This will only happen if diff --git a/MODULE.bazel b/MODULE.bazel index ee63456..8d30ce7 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -17,7 +17,7 @@ bazel_dep(name = "google_benchmark", version = "1.8.5") # Require a more recent version. git_override( module_name = "highway", - commit = "0ca297227a373710e76dd45e0ad4d68adb6928fe", + commit = "2b565e87d50b151660494624af532ac0b6076c79", remote = "https://github.com/google/highway", ) diff --git a/evals/benchmark_helper.cc b/evals/benchmark_helper.cc index 8bfc015..435dce0 100644 --- a/evals/benchmark_helper.cc +++ b/evals/benchmark_helper.cc @@ -36,6 +36,7 @@ #include "util/args.h" #include "util/threading.h" #include "hwy/base.h" +#include "hwy/contrib/thread_pool/topology.h" #include "hwy/highway.h" #include "hwy/per_target.h" // VectorBytes #include "hwy/timer.h" @@ -215,6 +216,25 @@ void LogSpeedStats(double time_start, size_t total_tokens) { << " [" << tok_sec << " tokens / sec" << "]\n"; } +std::string CacheString() { + const hwy::Cache* caches = hwy::DataCaches(); + if (caches == nullptr) return "cache unknown"; + char buf[200]; + // Do not print cores_sharing because that is visible from the topology. + const int len = + snprintf(buf, sizeof(buf), "L1 %uK=%u*%u@%u, L2 %uK=%u*%u@%u ", + caches[1].size_kib, caches[1].sets, caches[1].bytes_per_line, + caches[1].associativity, caches[2].size_kib, caches[2].sets, + caches[2].bytes_per_line, caches[2].associativity); + HWY_ASSERT(len >= 24); + if (caches[3].size_kib != 0) { + snprintf(buf + len, sizeof(buf) - len, "L3 %uK=%u*%u@%u", + caches[3].size_kib, caches[3].sets, caches[3].bytes_per_line, + caches[3].associativity); + } + return buf; +} + void ShowConfig(LoaderArgs& loader, InferenceArgs& inference, AppArgs& app, NestedPools& pools) { loader.Print(app.verbosity); @@ -230,15 +250,15 @@ void ShowConfig(LoaderArgs& loader, InferenceArgs& inference, AppArgs& app, fprintf(stderr, "Date & Time : %s" // dt includes \n "CPU : %s\n" - "CPU topology : %s, %s\n" + "CPU topology : %s, %s, %s\n" "Instruction set : %s (%zu bits)\n" "Compiled config : %s\n" "Weight Type : %s\n" "EmbedderInput Type : %s\n", dt, cpu100, pools.TopologyString(), pools.PinString(), - hwy::TargetName(hwy::DispatchedTarget()), hwy::VectorBytes() * 8, - CompiledConfig(), StringFromType(loader.Info().weight), - TypeName()); + CacheString().c_str(), hwy::TargetName(hwy::DispatchedTarget()), + hwy::VectorBytes() * 8, CompiledConfig(), + StringFromType(loader.Info().weight), TypeName()); } } diff --git a/examples/hello_world/CMakeLists.txt b/examples/hello_world/CMakeLists.txt index 292c80c..0679aa5 100644 --- a/examples/hello_world/CMakeLists.txt +++ b/examples/hello_world/CMakeLists.txt @@ -17,7 +17,7 @@ project(hello_world) set(CMAKE_CXX_STANDARD_REQUIRED ON) include(FetchContent) -FetchContent_Declare(highway GIT_REPOSITORY https://github.com/google/highway.git GIT_TAG da250571a45826b21eebbddc1e50d0c1137dee5f) +FetchContent_Declare(highway GIT_REPOSITORY https://github.com/google/highway.git GIT_TAG 2b565e87d50b151660494624af532ac0b6076c79) FetchContent_MakeAvailable(highway) FetchContent_Declare(sentencepiece GIT_REPOSITORY https://github.com/google/sentencepiece GIT_TAG 53de76561cfc149d3c01037f0595669ad32a5e7c) FetchContent_MakeAvailable(sentencepiece)