| 266 | Store* store = nullptr; // the lab's holder: the shared memory instead of cudaMalloc / cudaHostAlloc |
| 267 | std::vector<void*>* track = nullptr; // a worker placing its experts: what it allocates (Model::free_experts) |
| 268 | template <typename T> T* put(const void* host, size_t bytes) { |
| 269 | void* d = nullptr; |
| 270 | if (store) d = store->dev(c.dev, bytes); |
| 271 | else ck(cudaMalloc(&d, bytes), "cudaMalloc"); |
| 272 | if (track) track->push_back(d); |
| 273 | ck(cudaMemcpy(d, host, bytes, cudaMemcpyDefault), "upload"); |
| 274 | c.bytes += bytes; |
| 275 | return (T*) d; |
| 276 | } |
| 277 | // a norm as the window reads it: exactly n floats. A tensor of another width would feed garbage rows silently; |
| 278 | // the whole tensor must match, so extra rows fail too (the window never reads them) |
| 279 | float* f32(const Tensor& t, size_t n) { |
nothing calls this directly
no test coverage detected