where a tensor's routed experts are assembled: with an ExpertCache (host_of) their mapped page-locked host copy, else tmp
| 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) { |
nothing calls this directly
no test coverage detected