Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cpp/include/tensorrt_llm/batch_manager/templatedTrie.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ class Node
auto itr = mNextNodes.find(nkey);
if (itr != mNextNodes.end())
{
// Sever the back-edge on the child before erasing its forward entry.
// A shared_ptr to the child may still be held elsewhere (e.g. by
// KVCacheBlock::mLookupNode), and without this step a later
// clearValue on that child would cascade-prune up through a stale
// mPrevNode and assert because this node's mNextNodes no longer
// contains it. Passing an empty NodePtr makes the orphan behave
// as a root: its own cascade-prune stops at itself.
itr->second->setPrevNode(NodePtr{});
mNextNodes.erase(itr);
auto const isRoot = mPrevNode.expired();
auto const canBeDeleted = !isRoot && mValue.empty() && mNextNodes.empty();
Expand Down
189 changes: 157 additions & 32 deletions tensorrt_llm/_torch/pyexecutor/scheduler/scheduler.py

Large diffs are not rendered by default.

Loading
Loading