routed experts (h from expert_buf: every expert's matrix, stride bytes apart): to VRAM at p, or with an ExpertCache each one's address in host_of (the layer's row of the card's host addresses)
| 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) { |
| 304 | if (!host_of) { |
| 305 | w.p = put<uint8_t>(h, bytes); |
| 306 | return; |
| 307 | } |
| 308 | void* dp = nullptr; |
| 309 | if (store) dp = (void*) h; // the shared host memory has one address for the CPU and the cards |
| 310 | else ck(cudaHostGetDevicePointer(&dp, (void*) h, 0), "place: mapped pointer"); |
| 311 | for (size_t e = 0; e < bytes / stride; ++e) host_of[e] = (const char*) dp + e * stride; |
| 312 | } |
| 313 | // the card's ExpertCache: a slot for each resident expert (res) in its size's pool, filled from its host copy; the |
| 314 | // layers' tables. With arena_score (FNX_ARENA) the largest pool's slots go coldest first and are neither allocated |
| 315 | // nor filled here: the engine puts them in its arena (Engine::arena_fill); until then its experts point at RAM |