Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/vmaware.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1966,10 +1966,10 @@
};

// this forces the compiler to calculate the hash when initializing the array while staying C++11 compatible
struct Entry {
struct thread_entry {

Check failure on line 1969 in src/vmaware.hpp

View workflow job for this annotation

GitHub Actions / Analyze (cpp, gcc-14, Ninja Multi-Config, Debug, ON)

redefinition of 'thread_entry'
u32 hash;
u32 threads;
constexpr Entry(const char* m, u32 t) : hash(ConstexprHash::get(m)), threads(t) {}
constexpr thread_entry(const char* m, u32 t) : hash(ConstexprHash::get(m)), threads(t) {}
};

enum class CpuType {
Expand All @@ -1979,7 +1979,7 @@
};

// 4 arguments to stay compliant with x64 __fastcall (just in case)
[[nodiscard]] static bool verify_thread_count(const Entry* db, size_t db_size, size_t max_model_len, CpuType type) {
[[nodiscard]] static bool verify_thread_count(const thread_entry* db, size_t db_size, size_t max_model_len, CpuType type) {
// to save a few cycles
struct hasher {
static u32 crc32_sw(u32 crc, char data) {
Expand Down Expand Up @@ -2671,7 +2671,7 @@
// umap is not an option because it cannot be constexpr
// constexpr is respected here even in c++ 11 and static solves stack overflow
// c arrays have less construction overhead than std::array
static constexpr util::Entry thread_database[] = {
static constexpr util::thread_entry thread_database[] = {
// i3 series
{ "i3-1000G1", 4 },
{ "i3-1000G4", 4 },
Expand Down Expand Up @@ -3630,7 +3630,7 @@

static constexpr size_t MAX_INTEL_MODEL_LEN = 16;

return util::verify_thread_count(thread_database, sizeof(thread_database) / sizeof(util::Entry), MAX_INTEL_MODEL_LEN, util::CpuType::INTEL_I);
return util::verify_thread_count(thread_database, sizeof(thread_database) / sizeof(util::thread_entry), MAX_INTEL_MODEL_LEN, util::CpuType::INTEL_I);
#endif
}

Expand All @@ -3648,7 +3648,7 @@
// umap is not an option because it cannot be constexpr
// constexpr is respected here even in c++ 11 and static solves stack overflow
// c arrays have less construction overhead than std::array
static constexpr util::Entry thread_database[] = {
static constexpr util::thread_entry thread_database[] = {
// Xeon D
{ "D-1518", 8 },
{ "D-1520", 8 },
Expand Down Expand Up @@ -3786,7 +3786,7 @@

static constexpr size_t MAX_XEON_MODEL_LEN = 16;

return util::verify_thread_count(thread_database, sizeof(thread_database) / sizeof(util::Entry), MAX_XEON_MODEL_LEN, util::CpuType::INTEL_XEON);
return util::verify_thread_count(thread_database, sizeof(thread_database) / sizeof(util::thread_entry), MAX_XEON_MODEL_LEN, util::CpuType::INTEL_XEON);
#endif
}

Expand All @@ -3803,7 +3803,7 @@
#else
// Database is reduced to identifying suffixes (last token of the original strings)
// for example handles "ryzen 5 3600" by matching "3600", which is unique in context
static constexpr util::Entry thread_database[] = {
static constexpr util::thread_entry thread_database[] = {
// 3015/3020
{ "3015ce", 4 },
{ "3015e", 4 },
Expand Down Expand Up @@ -4316,7 +4316,7 @@

static constexpr size_t MAX_AMD_MODEL_LEN = 24; // "threadripper" is long

return util::verify_thread_count(thread_database, sizeof(thread_database) / sizeof(util::Entry), MAX_AMD_MODEL_LEN, util::CpuType::INTEL_XEON);
return util::verify_thread_count(thread_database, sizeof(thread_database) / sizeof(util::thread_entry), MAX_AMD_MODEL_LEN, util::CpuType::INTEL_XEON);
#endif
}

Expand Down
Loading