| 599 | } |
| 600 | |
| 601 | void SessionLoopScratch::free() { |
| 602 | // Restores the caller's affinity on every path, including teardown: a library that silently leaves its |
| 603 | // caller's thread nailed to one core is worse than one that never pinned at all. |
| 604 | if (pinned) { |
| 605 | strata::kernels::cpu::restore_thread_affinity(pinned_core); |
| 606 | pinned = false; |
| 607 | pinned_core = {}; |
| 608 | } |
| 609 | if (probe != nullptr) { cudaEventDestroy(probe); probe = nullptr; } |
| 610 | if (y_miss != nullptr) { cudaFreeHost(y_miss); y_miss = nullptr; } |
| 611 | parts_bytes = 0; |
| 612 | } |
| 613 | |
| 614 | bool session_loop(const ModelGeometry& g, int64_t pos, int32_t pos_base, SessionState& s, SessionGraphs& gr, |
| 615 | PoolFn pool, HitFn hits, void* user, bool overlap, void* stream, std::string& err, |