Skip to content

Commit

Permalink
[WASI-NN] ggml: force set ngl=1 on macOS to enable Metal (WasmEdge#3102)
Browse files Browse the repository at this point in the history
Signed-off-by: hydai <[email protected]>
  • Loading branch information
hydai committed Dec 20, 2023
1 parent cc038b4 commit 2498ccb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plugins/wasi_nn/ggml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ Expect<ErrNo> parseMetadata(Graph &GraphRef, const std::string &Metadata,
return ErrNo::InvalidArgument;
}
}
#ifdef __APPLE__
// Whatever the `n-gpu-layers` is given, we will always set the ngl to 1 on
// macOS to forcely enabled Metal.
GraphRef.NGPULayers = 1; // Force enabled Metal on macOS
#endif

// The context parameters.
if (Doc.at_key("ctx-size").error() == simdjson::SUCCESS) {
Expand Down

0 comments on commit 2498ccb

Please sign in to comment.