From 585f0c7f171c9a03f134a9b64d08e4b336fc584f Mon Sep 17 00:00:00 2001 From: Gregory Comer Date: Mon, 12 May 2025 14:26:45 -0700 Subject: [PATCH] Default to mmap load mode in module (#10827) Summary: We've seen a number of people hit issues with mlock as the default load mode. In particular, mlock will fail above a certain PTE size and may require elevated permissions on some systems. We should not default to using mlock and can leave at as an opt-in optimization. We could use file or mmap mode. I'm leaning towards mmap, as it can lead to lower peak resident memory size, which can be significant for larger models. Differential Revision: D74607072 --- extension/module/module.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extension/module/module.h b/extension/module/module.h index 0c4d4779bea..14d5b4294ae 100644 --- a/extension/module/module.h +++ b/extension/module/module.h @@ -53,7 +53,7 @@ class Module { */ explicit Module( const std::string& file_path, - const LoadMode load_mode = LoadMode::MmapUseMlock, + const LoadMode load_mode = LoadMode::File, std::unique_ptr event_tracer = nullptr); /** @@ -68,7 +68,7 @@ class Module { explicit Module( const std::string& file_path, const std::string& data_map_path, - const LoadMode load_mode = LoadMode::MmapUseMlock, + const LoadMode load_mode = LoadMode::File, std::unique_ptr event_tracer = nullptr); /** @@ -481,7 +481,7 @@ class Module { std::string file_path_; std::string data_map_path_; - LoadMode load_mode_{LoadMode::MmapUseMlock}; + LoadMode load_mode_{LoadMode::File}; std::shared_ptr program_; std::unique_ptr data_loader_; std::unique_ptr memory_allocator_;