MCPcopy Create free account
hub / github.com/Niko1221/Strata / lock_tables

Function lock_tables

engine/src/split/src/model.cpp:215–231  ·  view source on GitHub ↗

The host-read tables locked in RAM as far as this machine lets the engine (memlock.hpp): the memory-lock limit raised as far as the hard limit allows, the free RAM respected, the parts locked in the order given, the rest read into memory by the same 16 threads. Never a failed start because of the lock. Returns the one log line (empty when everything is locked); it is printed here too.

Source from the content-addressed store, hash-verified

213// respected, the parts locked in the order given, the rest read into memory by the same 16 threads. Never a failed start because of the lock. Returns the one log
214// line (empty when everything is locked); it is printed here too.
215std::string lock_tables(const std::vector<const Tensor*>& ts) {
216 std::vector<LockPart> parts;
217 uint64_t want = 0;
218 for (const Tensor* t : ts) {
219 LockPart p;
220 p.name = t->name.c_str();
221 p.data = t->data;
222 p.nbytes = t->nbytes;
223 parts.push_back(p);
224 want += lock_page_ceil(t->nbytes) + kLockPage;
225 }
226 const LockEnv env = read_lock_env(want);
227 const LockOutcome out = lock_parts(parts, env);
228 const std::string line = lock_line(parts, out);
229 if (!line.empty()) std::fprintf(stderr, "%s\n", line.c_str());
230 return line;
231}
232
233// the stager's groups for load_card: group l every tensor of layer l, group NL the output head's. The head is read
234// through the page cache: the draft layer (Mtp) takes its rows of output.weight from the mapping after the load

Callers 1

ModelMethod · 0.85

Calls 6

lock_page_ceilFunction · 0.85
read_lock_envFunction · 0.85
lock_partsFunction · 0.85
lock_lineFunction · 0.85
push_backMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected