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

Method expert_buf

engine/src/split/src/model.cpp:288–300  ·  view source on GitHub ↗

where a tensor's routed experts are assembled: with an ExpertCache (host_of) their mapped page-locked host copy, else tmp

Source from the content-addressed store, hash-verified

286 // where a tensor's routed experts are assembled: with an ExpertCache (host_of) their mapped page-locked host copy,
287 // else tmp
288 uint8_t* expert_buf(size_t bytes, const char** host_of, std::vector<uint8_t>& tmp) {
289 if (!host_of) {
290 tmp.resize(bytes);
291 return tmp.data();
292 }
293 void* hp = nullptr;
294 const cudaError_t err = store ? (hp = store->host(c.dev, bytes), cudaSuccess) : cudaHostAlloc(&hp, bytes, cudaHostAllocMapped);
295 if (err != cudaSuccess)
296 throw std::runtime_error("place: " + std::to_string(bytes >> 20) + " MiB of page-locked host memory for experts: " +
297 cudaGetErrorString(err));
298 c.host_bytes += bytes;
299 return (uint8_t*) hp;
300 }
301 // routed experts (h from expert_buf: every expert's matrix, stride bytes apart): to VRAM at p, or with an
302 // ExpertCache each one's address in host_of (the layer's row of the card's host addresses)
303 void place(DW& w, const uint8_t* h, size_t bytes, size_t stride, const char** host_of) {

Callers

nothing calls this directly

Calls 6

cudaHostAllocFunction · 0.50
to_stringFunction · 0.50
cudaGetErrorStringFunction · 0.50
resizeMethod · 0.45
dataMethod · 0.45
hostMethod · 0.45

Tested by

no test coverage detected