Skip to content

Commit 83d4a42

Browse files
committed
Implement __lt__ as required for heapq.heapify.
1 parent fc22312 commit 83d4a42

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

shortfin/python/shortfin_apps/llm/components/kvcache/trie_attention_cache.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ def __eq__(self, other: object) -> bool:
9090
"""Nodes are equal only if they are the same object."""
9191
return self is other
9292

93+
def __lt__(self, other):
94+
"""Sort nodes by their memory address."""
95+
return id(self) < id(other)
96+
9397

9498
class TriePagedAttentionCacheAllocation(PageAllocation):
9599
"""Represents a page allocation in the trie-based cache.

0 commit comments

Comments
 (0)