-
Notifications
You must be signed in to change notification settings - Fork 109
Open
Description
import thunder
import torch
def foo(x, y):
return x + y
tfoo = thunder.jit(foo)
tcfoo = torch.compile(foo, dynamic=False)
x = torch.randn(10)
for i in range(10):
tfoo(x, i)
tcfoo(x, i)
print("Cache Misses:", thunder.cache_misses(tfoo))Output
W1021 10:44:18.989000 2926727 torch/_dynamo/convert_frame.py:1355] [0/8] torch._dynamo hit config.recompile_limit (8)
W1021 10:44:18.989000 2926727 torch/_dynamo/convert_frame.py:1355] [0/8] function: 'foo' (/opt/pytorch/lightning-thunder/test_thunder_recompile.py:4)
W1021 10:44:18.989000 2926727 torch/_dynamo/convert_frame.py:1355] [0/8] last reason: 0/7: y == 7 # return x + y # pt/pytorch/lightning-thunder/test_thunder_recompile.py:5 in foo
W1021 10:44:18.989000 2926727 torch/_dynamo/convert_frame.py:1355] [0/8] To log all recompilation reasons, use TORCH_LOGS="recompiles".
W1021 10:44:18.989000 2926727 torch/_dynamo/convert_frame.py:1355] [0/8] To diagnose recompilation issues, see https://pytorch.org/docs/main/torch.compiler_troubleshooting.html
Cache Misses: 10It would be nice if thunder will also warn when there are a lot of recompiles.
Metadata
Metadata
Assignees
Labels
No labels