Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions llama/addon/AddonContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ AddonContext::AddonContext(const Napi::CallbackInfo& info) : Napi::ObjectWrap<Ad

context_params = llama_context_default_params();
context_params.n_ctx = 4096;
context_params.n_threads = std::max(cpu_get_num_math(), 1);
context_params.n_threads = std::max(common_cpu_get_num_math(), 1);
context_params.n_threads_batch = context_params.n_threads;
context_params.no_perf = true;
context_params.swa_full = false;
Expand Down Expand Up @@ -745,7 +745,7 @@ Napi::Value AddonContext::SetThreads(const Napi::CallbackInfo& info) {

const auto threads = info[0].As<Napi::Number>().Int32Value();
const auto resolvedThreads = threads == 0
? std::max((int32_t)std::thread::hardware_concurrency(), std::max(cpu_get_num_math(), 1))
? std::max((int32_t)std::thread::hardware_concurrency(), std::max(common_cpu_get_num_math(), 1))
: threads;

if (llama_n_threads(ctx) != resolvedThreads) {
Expand Down
2 changes: 1 addition & 1 deletion llama/addon/addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Napi::Value addonGetSupportsMlock(const Napi::CallbackInfo& info) {
}

Napi::Value addonGetMathCores(const Napi::CallbackInfo& info) {
return Napi::Number::New(info.Env(), cpu_get_num_math());
return Napi::Number::New(info.Env(), common_cpu_get_num_math());
}

Napi::Value addonGetBlockSizeForGgmlType(const Napi::CallbackInfo& info) {
Expand Down