0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 15:00:51 +01:00

ircd::gpt::model: Add conf items for model/cache opts related.

This commit is contained in:
Jason Volk 2021-08-27 15:59:46 -07:00
parent a67b93b8c6
commit 3859a13293

View file

@ -42,6 +42,11 @@ namespace ircd::gpt::model
manifest[], manifest[],
manifest_h[]; manifest_h[];
extern conf::item<bool>
cache_locked,
cache_shared,
cache_hugepage;
extern conf::item<std::string> extern conf::item<std::string>
path, path,
cache_path, cache_path,
@ -81,6 +86,27 @@ ircd::gpt::model::manifest
{ "wte.weight.json", init_wte_weight }, { "wte.weight.json", init_wte_weight },
}; };
decltype(ircd::gpt::model::cache_locked)
ircd::gpt::model::cache_locked
{
{ "name", "ircd.gpt.model.cache.locked" },
{ "default", false },
};
decltype(ircd::gpt::model::cache_shared)
ircd::gpt::model::cache_shared
{
{ "name", "ircd.gpt.model.cache.shared" },
{ "default", false },
};
decltype(ircd::gpt::model::cache_hugepage)
ircd::gpt::model::cache_hugepage
{
{ "name", "ircd.gpt.model.cache.hugepage" },
{ "default", true },
};
decltype(ircd::gpt::model::cache_path) decltype(ircd::gpt::model::cache_path)
ircd::gpt::model::cache_path ircd::gpt::model::cache_path
{ {
@ -169,9 +195,9 @@ ircd::gpt::model::init_from_cache(const string_view &cache_path)
std::ios::in | std::ios::out std::ios::in | std::ios::out
}; };
map_opts.huge2mb = true; map_opts.locked = bool(cache_locked);
map_opts.locked = false; map_opts.shared = bool(cache_shared);
map_opts.shared = false; map_opts.huge2mb = bool(cache_hugepage);
default_model_shm = fs::map default_model_shm = fs::map
{ {
fd, map_opts, sizeof(decoder) fd, map_opts, sizeof(decoder)
@ -319,7 +345,7 @@ ircd::gpt::model::init_dataset(const string_view &path)
}; };
fs::map::opts map_opts; fs::map::opts map_opts;
map_opts.huge2mb = true; map_opts.huge2mb = bool(cache_hugepage);
default_dataset_shm = fs::map default_dataset_shm = fs::map
{ {
fd, map_opts, size fd, map_opts, size