Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc1c53b6

Browse files
committed
fix kernel launch parameter under large num_tokens
Signed-off-by: Pengbo Wang <221450789+pengbowang-nv@users.noreply.github.com>
1 parent5b1e7c9 commitc1c53b6

File tree

1 file changed

+4
-4
lines changed
  • cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe

1 file changed

+4
-4
lines changed

‎cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/DevKernel.cu‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,14 @@ void run(Data const& data, void* stream)
186186
if (data.mUseDeepSeekFp8)
187187
{
188188
intconst numThreads =128;
189-
constdim3grid(data.innerDim /128, data.topK, data.numTokens);
189+
constdim3grid(data.innerDim /128, data.topK,std::min(8192,data.numTokens));
190190

191191
LAUNCH(data, activationDeepSeekKernel, grid, numThreads,0, stream);
192192
}
193193
else
194194
{
195195
intconst numThreads =256;
196-
constdim3grid(data.innerDim /128, data.topK, data.numTokens);
196+
constdim3grid(data.innerDim /128, data.topK,std::min(8192,data.numTokens));
197197

198198
LAUNCH(data, activationKernel, grid, numThreads,0, stream);
199199
}
@@ -371,7 +371,7 @@ void run(Data const& data, void* stream)
371371
constexprint VecSize =4;
372372
intconst numThreads =128;
373373
intconst numBlocksX = (data.hiddenDimSf / VecSize -1 + numThreads) / numThreads;
374-
intconst numBlocksY = data.numTokens;
374+
intconst numBlocksY =std::min(8192,data.numTokens);
375375
dim3numBlocks(numBlocksX, numBlocksY);
376376
#defineCONVERT_FP4_SF_LAUNCH(LayoutSrc, LayoutDst) \
377377
if (data.sfLayoutSrc == tg::SfLayout::LayoutSrc && data.sfLayoutDst == tg::SfLayout::LayoutDst) \
@@ -457,7 +457,7 @@ void run(Data const& data, void* stream)
457457
{
458458
intconst numThreads =256;
459459
intconst numBlocksX = (data.hiddenDim -1 + numThreads) / numThreads;
460-
intconst numBlocksY = data.numTokens;
460+
intconst numBlocksY =std::min(8192,data.numTokens);
461461
dim3numBlocks(numBlocksX, numBlocksY);
462462

463463
LAUNCH(data, permuteKernel, numBlocks, numThreads,0, stream);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp