Skip to content

Commit 26175ae

Browse files
committed
NOCOMMIT: log peak mem usage and swapouts to debug test-llava-runner
Attempting to test my theory that the timestamp gaps in #8180 are caused by swapping. ghstack-source-id: e2aa5b0 ghstack-comment-id: 2634969596 Pull Request resolved: #8192
1 parent a3455d9 commit 26175ae

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

examples/models/llama/source_transformation/quantized_kv_cache.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,11 @@ def replace_kv_cache_with_quantized_kv_cache(module):
205205
# This is needed to ensure that custom ops are registered
206206
from executorch.extension.llm.custom_ops import custom_ops # noqa: F401
207207

208+
import resource
209+
maxrss = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
210+
nswap = resource.getrusage(resource.RUSAGE_SELF).ru_nswap
208211
logging.warning(
209-
"Replacing KVCache with QuantizedKVCache. This modifies the model in place."
212+
f"Replacing KVCache with QuantizedKVCache. This modifies the model in place. (HACK: maxrss: {maxrss} nswap: {nswap})"
210213
)
211214
for name, child in module.named_children():
212215
if isinstance(child, KVCache) or isinstance(child, CustomKVCache):
@@ -270,8 +273,11 @@ def replace_kv_cache_with_custom_kv_cache(module):
270273
This is because the custom op treats second dim as sequence dim.
271274
Future work: support [B, H, S, D]
272275
"""
276+
import resource
277+
maxrss = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
278+
nswap = resource.getrusage(resource.RUSAGE_SELF).ru_nswap
273279
logging.warning(
274-
"Replacing KVCache with CustomKVCache. This modifies the model in place."
280+
f"Replacing KVCache with CustomKVCache. This modifies the model in place. (HACK: maxrss: {maxrss} nswap: {nswap})"
275281
)
276282
for name, child in module.named_children():
277283
if isinstance(child, KVCache):

0 commit comments

Comments
 (0)