Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix line invalidation speed #891

Merged
merged 21 commits into from
Dec 3, 2024
Merged

Fix line invalidation speed #891

merged 21 commits into from
Dec 3, 2024

Conversation

sternj
Copy link
Collaborator

@sternj sternj commented Nov 24, 2024

Fixes #889

  • A user noticed a major slowdown when trying to import Pytorch. We tracked this down to overly eager calling of the PyEval_SetTrace callback in
    callee frames of "relevant" code. In pre-3.12, there's an easy short-circuiting process. Still a WIP because I'm still hunting down a better solution for 3.12.
  • Fixed issue where PyEval_SetTrace was invoked on the wrong frame.
  • Added smoketests for counting n_mallocs in light of previous issues

TODO:

  • Disable instrumentation in child frames in Python 3.12



test/line_attribution_tests/line_after_final_alloc.py Dismissed Show dismissed Hide dismissed
test/line_attribution_tests/line_after_final_alloc.py Dismissed Show dismissed Hide dismissed
test/line_attribution_tests/loop_below_threshold.py Dismissed Show dismissed Hide dismissed
test/line_attribution_tests/loop_with_multiple_lines.py Dismissed Show dismissed Hide dismissed
test/line_attribution_tests/loop_with_one_alloc.py Dismissed Show dismissed Hide dismissed
test/line_attribution_tests/loop_with_two_allocs.py Dismissed Show dismissed Hide dismissed
test/test_line_invalidation.py Fixed Show fixed Hide fixed
test/test_line_invalidation.py Fixed Show fixed Hide fixed
src/include/sampleheap.hpp Fixed Show fixed Hide fixed
test/smoketest_line_invalidation.py Fixed Show fixed Hide fixed
test/smoketest_line_invalidation.py Dismissed Show dismissed Hide dismissed
src/include/sampleheap.hpp Dismissed Show dismissed Hide dismissed
@sternj sternj changed the title WIP: fix line invalidation speed Fix line invalidation speed Dec 2, 2024
src/include/sampleheap.hpp Fixed Show fixed Hide fixed
@sternj sternj force-pushed the improve_line_invalidation branch from a2a9691 to 54c21f2 Compare December 3, 2024 18:27
@emeryberger emeryberger merged commit a4d6f46 into master Dec 3, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extra slow pytorch imports (~30s)
2 participants