Commit Graph
3 Commits
Author SHA1 Message Date
Joseph Magly f75168f0b0 test(device): stub MPS and CUDA cache calls in the per-batch release test
The per-batch release test made device.is_mps() return true and then ran
the real free_gpu_memory(), which reached torch.mps.empty_cache() and
torch.mps.synchronize(). On an MPS-capable host this unmarked CPU test could
touch real accelerator state. Stub both MPS calls (and the CUDA cache calls
as a guard) and assert their call counts, so the release path is still
exercised without hardware.
2026-11-27 12:49:10 -05:00
Joseph Magly c2dcf113de perf(device): skip per-batch gc.collect in activation collection on CPU-only hosts
_collect_activations ran gc.collect() every 4 batches on every host (about 850 calls per refusal-pack probe), and each call costs more as the live heap grows. On CPU-only hosts the per-batch release is now skipped (new device.per_batch_release_needed()); with CUDA or MPS it is unchanged, and stage-boundary cleanup still collects everywhere. Tests pin the CPU skip and the accelerator release.

Refs #684
2026-11-26 17:35:55 -05:00
Joseph Magly b2878d5386 feat(gpu): allow per-call activation cache qualification
(cherry picked from commit 2e8c362430830f1b4ce23757b9a364596bcee6ac)

Adapted for upstream: _admit_phase does not exist upstream (grep finds no
definition in obliteratus/), so dropped the internal mock and rewrote the
main test to group model forwards per cache policy instead of assuming a
single two-prompt batch (upstream batches by available memory; on CPU-only
hosts each prompt runs its own forward). Kept docs/attention-cache-
qualification.md verbatim (no hostnames, receipts, or private refs; the
#95/#96/#97 refs are public issue numbers) and the
ci/test-risk-map.json registration, which matches the final test file name.
2026-10-05 18:08:18 -04:00