Skip to content

Commit 550fde8

Browse files
committed
Fix -sot: mirror output_norm to split context for all devices
Ikawrakow's review: output norm tensors remain on buft_output.buft (the per-device offload buft) instead of being on the split context. With -sot, the output weight IS split across devices, but the norm weights stay on a single device and never get mirrored. Fix: in get_context_for_tensor(), when split_output_tensor is on, route output_norm (and output_norm_bias, output.bias) to ctx_output_split (= split_buft context). This puts them in split_tensors so prepare_split_tensors(-1, ...) at tensor-load time creates per-device mirrored copies. build_output() already handles output_norm->extra correctly: line 2107 checks for it and line 2115 uses per-device norm copies when available.
1 parent 9a6dd84 commit 550fde8

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/llama-load-tensors.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,9 @@ ggml_context * create_tensors_helper::get_context_for_tensor(ggml_context * ctx,
447447
if (name == "output.weight" || name == "output_extra.weight") {
448448
return ctx;
449449
}
450+
if (name.find("output_norm") == 0 || name.find(".output_norm") != std::string::npos || name == "output.bias") {
451+
return ctx_output_split;
452+
}
450453
}
451454
for (auto & o : overrides) {
452455
if (std::regex_search(name, o.first)) {

0 commit comments

Comments
 (0)