Skip to content

Commit 0c1a2ea

Browse files
committed
Guard for single device build
Signed-off-by: Patrice Castonguay <[email protected]>
1 parent 1332536 commit 0c1a2ea

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cpp/tensorrt_llm/batch_manager/kvCacheEventManager.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ KVCacheEventManager::KVCacheEventManager(size_t maxKVEventEntries, std::optional
5656
!mAttentionDpSize.has_value(), "If attention DP rank is not set, the attention DP size must not be set");
5757
}
5858
mWorkerThread = std::thread([this]() { this->worker(); });
59+
#if ENABLE_MULTI_DEVICE
5960
if (mAttentionDpRank)
6061
{
6162
mExchangeAttentionDpThread = std::thread([this]() { this->exchangeAttentionDpThread(); });
6263
}
64+
#endif
6365
};
6466

6567
KVCacheEventManager::~KVCacheEventManager()
@@ -68,10 +70,12 @@ KVCacheEventManager::~KVCacheEventManager()
6870
mPendingEmptyCV.notify_all();
6971
mEmptyCV.notify_all();
7072
mWorkerThread.join();
73+
#if ENABLE_MULTI_DEVICE
7174
if (mAttentionDpRank)
7275
{
7376
mExchangeAttentionDpThread.join();
7477
}
78+
#endif
7579
}
7680

7781
void KVCacheEventManager::enqueueCreatedEvent(
@@ -154,6 +158,7 @@ void KVCacheEventManager::flush()
154158

155159
void KVCacheEventManager::exchangeAttentionDpThread()
156160
{
161+
#if ENABLE_MULTI_DEVICE
157162
while (true)
158163
{
159164
TLLM_CHECK(mAttentionDpRank);
@@ -202,6 +207,9 @@ void KVCacheEventManager::exchangeAttentionDpThread()
202207
std::this_thread::sleep_for(std::chrono::milliseconds(mAttentionDpEventsGatherPeriodMs));
203208
}
204209
}
210+
#else
211+
TLLM_THROW("Multi device support is disabled.");
212+
#endif
205213
}
206214

207215
void KVCacheEventManager::worker()

0 commit comments

Comments
 (0)