hybrid-llama/turboquant/common/build-info.cpp.in

46 lines
1.4 KiB
C++

#include "build-info.h"
#include <cstdio>
#include <string>
int LLAMA_BUILD_NUMBER = @LLAMA_BUILD_NUMBER@;
char const * LLAMA_COMMIT = "@LLAMA_BUILD_COMMIT@";
char const * LLAMA_COMPILER = "@BUILD_COMPILER@";
char const * LLAMA_BUILD_TARGET = "@BUILD_TARGET@";
char const * TURBOQUANT_VERSION = "@TURBOQUANT_VERSION@";
int llama_build_number(void) {
return LLAMA_BUILD_NUMBER;
}
const char * llama_commit(void) {
return LLAMA_COMMIT;
}
const char * llama_compiler(void) {
return LLAMA_COMPILER;
}
const char * llama_build_target(void) {
return LLAMA_BUILD_TARGET;
}
const char * turboquant_version(void) {
return TURBOQUANT_VERSION;
}
const char * llama_build_info(void) {
// Upstream "b<N>-<commit>" format on purpose: this string is the OpenAI
// API `system_fingerprint` and clients (incl. the Atomic-Chat plugin's
// b-number feature gates) parse it. The turboquant semver is exposed via
// turboquant_version() and the --version output instead.
static std::string s = "b" + std::to_string(LLAMA_BUILD_NUMBER) + "-" + LLAMA_COMMIT;
return s.c_str();
}
void llama_print_build_info(void) {
fprintf(stderr, "%s: turboquant = %s\n", __func__, turboquant_version());
fprintf(stderr, "%s: build = %d (%s)\n", __func__, llama_build_number(), llama_commit());
fprintf(stderr, "%s: built with %s for %s\n", __func__, llama_compiler(), llama_build_target());
}