File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
cpp/tensorrt_llm/batch_manager Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -2142,7 +2142,7 @@ SizeType32 KVCacheManager::getNeededBlocksOneStep(
21422142 return 0 ;
21432143 }
21442144
2145- auto const numCurrTokens = mSequences . at (req.mRequestId ).getNumTokens ();
2145+ auto const numCurrTokens = getSequence (req.mRequestId ).getNumTokens ();
21462146 auto const generatedTokens = numCurrTokens - req.getPromptLen ();
21472147 auto const maxTokensToAddToKVCache = req.mMaxNewTokens - generatedTokens;
21482148 auto const tokensPerStep = req.getNumDraftTokens () + 1 ;
@@ -2406,7 +2406,13 @@ void KVCacheManager::addSequence(
24062406void KVCacheManager::storeContextBlocks (LlmRequest const & llmRequest)
24072407{
24082408 auto const requestId = llmRequest.mRequestId ;
2409- if (mSequences .find (requestId) != mSequences .end ())
2409+ bool found = false ;
2410+ {
2411+ // protect the mSequences
2412+ std::scoped_lock lock (mSequencesMtx );
2413+ found = mSequences .find (requestId) != mSequences .end ();
2414+ }
2415+ if (found)
24102416 {
24112417 auto & sequence = getSequence (requestId);
24122418 if (mEnableBlockReuse && !llmRequest.isDummyRequest ())
You can’t perform that action at this time.
0 commit comments