mirror of https://github.com/google/gemma.cpp.git
Print cache info and update Highway version for that
PiperOrigin-RevId: 702318451
This commit is contained in:
parent
f74d496879
commit
6a34e9c547
|
|
@ -409,6 +409,7 @@ cc_library(
|
||||||
"//compression:compress",
|
"//compression:compress",
|
||||||
"@highway//:hwy",
|
"@highway//:hwy",
|
||||||
"@highway//:nanobenchmark",
|
"@highway//:nanobenchmark",
|
||||||
|
"@highway//:topology",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS 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)
|
FetchContent_MakeAvailable(highway)
|
||||||
|
|
||||||
## Note: absl needs to be installed by sentencepiece. This will only happen if
|
## Note: absl needs to be installed by sentencepiece. This will only happen if
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ bazel_dep(name = "google_benchmark", version = "1.8.5")
|
||||||
# Require a more recent version.
|
# Require a more recent version.
|
||||||
git_override(
|
git_override(
|
||||||
module_name = "highway",
|
module_name = "highway",
|
||||||
commit = "0ca297227a373710e76dd45e0ad4d68adb6928fe",
|
commit = "2b565e87d50b151660494624af532ac0b6076c79",
|
||||||
remote = "https://github.com/google/highway",
|
remote = "https://github.com/google/highway",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
#include "util/args.h"
|
#include "util/args.h"
|
||||||
#include "util/threading.h"
|
#include "util/threading.h"
|
||||||
#include "hwy/base.h"
|
#include "hwy/base.h"
|
||||||
|
#include "hwy/contrib/thread_pool/topology.h"
|
||||||
#include "hwy/highway.h"
|
#include "hwy/highway.h"
|
||||||
#include "hwy/per_target.h" // VectorBytes
|
#include "hwy/per_target.h" // VectorBytes
|
||||||
#include "hwy/timer.h"
|
#include "hwy/timer.h"
|
||||||
|
|
@ -215,6 +216,25 @@ void LogSpeedStats(double time_start, size_t total_tokens) {
|
||||||
<< " [" << tok_sec << " tokens / sec" << "]\n";
|
<< " [" << 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,
|
void ShowConfig(LoaderArgs& loader, InferenceArgs& inference, AppArgs& app,
|
||||||
NestedPools& pools) {
|
NestedPools& pools) {
|
||||||
loader.Print(app.verbosity);
|
loader.Print(app.verbosity);
|
||||||
|
|
@ -230,15 +250,15 @@ void ShowConfig(LoaderArgs& loader, InferenceArgs& inference, AppArgs& app,
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Date & Time : %s" // dt includes \n
|
"Date & Time : %s" // dt includes \n
|
||||||
"CPU : %s\n"
|
"CPU : %s\n"
|
||||||
"CPU topology : %s, %s\n"
|
"CPU topology : %s, %s, %s\n"
|
||||||
"Instruction set : %s (%zu bits)\n"
|
"Instruction set : %s (%zu bits)\n"
|
||||||
"Compiled config : %s\n"
|
"Compiled config : %s\n"
|
||||||
"Weight Type : %s\n"
|
"Weight Type : %s\n"
|
||||||
"EmbedderInput Type : %s\n",
|
"EmbedderInput Type : %s\n",
|
||||||
dt, cpu100, pools.TopologyString(), pools.PinString(),
|
dt, cpu100, pools.TopologyString(), pools.PinString(),
|
||||||
hwy::TargetName(hwy::DispatchedTarget()), hwy::VectorBytes() * 8,
|
CacheString().c_str(), hwy::TargetName(hwy::DispatchedTarget()),
|
||||||
CompiledConfig(), StringFromType(loader.Info().weight),
|
hwy::VectorBytes() * 8, CompiledConfig(),
|
||||||
TypeName<EmbedderInputT>());
|
StringFromType(loader.Info().weight), TypeName<EmbedderInputT>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ project(hello_world)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
include(FetchContent)
|
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_MakeAvailable(highway)
|
||||||
FetchContent_Declare(sentencepiece GIT_REPOSITORY https://github.com/google/sentencepiece GIT_TAG 53de76561cfc149d3c01037f0595669ad32a5e7c)
|
FetchContent_Declare(sentencepiece GIT_REPOSITORY https://github.com/google/sentencepiece GIT_TAG 53de76561cfc149d3c01037f0595669ad32a5e7c)
|
||||||
FetchContent_MakeAvailable(sentencepiece)
|
FetchContent_MakeAvailable(sentencepiece)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue