Skip to content

Commit fa72aa3

Browse files
committed
don't try to unmap_fragment on hugepages/numa
1 parent 7faf58a commit fa72aa3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/llama-model-loader.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,9 +1132,18 @@ bool llama_model_loader::load_all_data(
11321132
for (uint32_t idx = 0; idx < mappings.size(); idx++) {
11331133
const auto & mmap_used = mmaps_used.at(idx);
11341134
auto & mapping = mappings.at(idx);
1135-
mapping->unmap_fragment(0, mmap_used.first);
1136-
if (mmap_used.second != 0) {
1137-
mapping->unmap_fragment(mmap_used.second, mapping->size());
1135+
1136+
// Check if this mapping uses NUMA mirroring
1137+
// If so, skip the unmap_fragment calls as cleanup is handled in the destructor
1138+
bool is_numa_mirrored = false;
1139+
#ifdef GGML_NUMA_MIRROR
1140+
is_numa_mirrored = true;
1141+
#endif
1142+
if (!is_numa_mirrored) {
1143+
mapping->unmap_fragment(0, mmap_used.first);
1144+
if (mmap_used.second != 0) {
1145+
mapping->unmap_fragment(mmap_used.second, mapping->size());
1146+
}
11381147
}
11391148
}
11401149
}

0 commit comments

Comments
 (0)