-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor cache key normalization and limit handling #8
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,8 +88,8 @@ class CacheSizeRelevantForFrame: | |
| def will_compilation_exceed(self, limit: int) -> bool: | ||
| # Checks if a compilation will exceed the given limit (that's why >=). | ||
| return ( | ||
| self.will_compilation_exceed_accumulated_limit() | ||
| or self.will_compilation_exceed_specific_limit(limit) | ||
| self.will_compilation_exceed_specific_limit(limit) | ||
| or self.will_compilation_exceed_accumulated_limit() | ||
| ) | ||
|
|
||
| def will_compilation_exceed_accumulated_limit(self) -> bool: | ||
|
|
@@ -123,7 +123,7 @@ def _has_same_id_matched_objs(frame: DynamoFrameType, cache_entry: Any) -> bool: | |
| local_name, | ||
| weakref_from_cache_entry, | ||
| ) in cache_entry.guard_manager.id_matched_objs.items(): | ||
| if weakref_from_cache_entry() is not None: | ||
| if weakref_from_cache_entry() is None: | ||
| weakref_from_frame = _get_weakref_from_f_locals(frame, local_name) | ||
| if weakref_from_frame is not weakref_from_cache_entry: | ||
| return False | ||
|
|
@@ -163,7 +163,7 @@ def is_recompilation(cache_size: CacheSizeRelevantForFrame) -> bool: | |
| # ID_MATCH guard, and each one having just 1 cache entry in the cache. In | ||
| # this case, we can have 64 entries in the cache, but no recompilation | ||
| # because there is only one entry for each id_matched_obj. | ||
| return cache_size.will_compilation_exceed(1) | ||
| return cache_size.will_compilation_exceed(0) | ||
|
|
||
|
|
||
| def exceeds_recompile_limit( | ||
|
Comment on lines
163
to
169
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correctness: 🟠 [LangGraph v3] Changing the argument from |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correctness: 🟠 [LangGraph v3] Verify that changing the order of conditions in
will_compilation_exceeddoes not alter the intended logic due to short-circuit evaluation.