Skip to content

Commit

Permalink
Enhancements to recompiles logs (#130043)
Browse files Browse the repository at this point in the history
Summary:
----

- We now record on CacheEntry what the compile id that populated it was, so now we can say why a specific frame was rejected
- Add structured log for recompiles under name artifact "recompile_reasons". As it stands, it's not terribly structured, but this was the easiest thing I could do to start
- Slightly reformat multi-reason printing; since we only report one guard failure seems better to have it as a single line

Example output:

```
V0703 10:34:13.273000 140345997743104 torch/_dynamo/guards.py:2590] [0/1] [__recompiles] Recompiling function f in /data/users/ezyang/a/pytorch/b.py:3
V0703 10:34:13.273000 140345997743104 torch/_dynamo/guards.py:2590] [0/1] [__recompiles]     triggered by the following guard failure(s):
V0703 10:34:13.273000 140345997743104 torch/_dynamo/guards.py:2590] [0/1] [__recompiles]     - 0/0: tensor 'L['x']' size mismatch at index 0. expected 4, actual 5
```

Signed-off-by: Edward Z. Yang <[email protected]>

X-link: pytorch/pytorch#130043
Approved by: https://github.com/anijain2305

Reviewed By: izaitsevfb

Differential Revision: D59554320

Pulled By: ezyang

fbshipit-source-id: fac47afc2c903d8d25144e95c41a30c492019a1e
  • Loading branch information
ezyang authored and facebook-github-bot committed Jul 10, 2024
1 parent 643fa34 commit b74c016
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions userbenchmark/dynamo/dynamobench/_dynamo/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
is_generator,
transform_code_object,
)
from .guards import CheckFunctionManager, GuardedCode
from .guards import CheckFunctionManager, CompileId, GuardedCode
from .utils import same

unsupported = eval_frame.unsupported
Expand Down Expand Up @@ -163,7 +163,7 @@ def insert_nops(instructions, code_options):
f_code=frame.f_code,
)

return GuardedCode(code, CheckFunctionManager(graph).check_fn)
return GuardedCode(code, CheckFunctionManager(graph).check_fn, CompileId(0, 0))


class CompileCounter:
Expand Down

0 comments on commit b74c016

Please sign in to comment.