Skip to content

Commit 983f5ac

Browse files
committed
address comments
Signed-off-by: leslie-fang25 <[email protected]>
1 parent 7bd8572 commit 983f5ac

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

cpp/tensorrt_llm/kernels/quantization.cu

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,8 @@ void invokeFP4Quantization(int b, int m, int n, T const* input, float const* SFS
147147
// The number of blocks for m. The m dimension will be padded to 128 for swizzled layout.
148148
int numBlocksForM = layout == QuantizationSFLayout::SWIZZLED ? PadUpFn(m, 128) : m;
149149
int gridSize = std::min(numBlocksForM, multiProcessorCount * numBlocksPerSM);
150-
if (gridSize == 0)
151-
{
152-
gridSize = 1;
153-
}
150+
// Ensure gridSize is not zero.
151+
gridSize = std::max(1, gridSize);
154152
dim3 grid(gridSize);
155153

156154
// Launch the cvt kernel.
@@ -171,10 +169,8 @@ void invokeFP4Quantization(int b, int m, int n, T const* input, float const* SFS
171169
// The number of blocks for m. The m dimension will be padded to 128 for swizzled layout.
172170
int numBlocksForM = layout == QuantizationSFLayout::SWIZZLED ? PadUpFn(m, 128) : m;
173171
int gridSize = std::min(numBlocksForM, multiProcessorCount * numBlocksPerSM);
174-
if (gridSize == 0)
175-
{
176-
gridSize = 1;
177-
}
172+
// Ensure gridSize is not zero.
173+
gridSize = std::max(1, gridSize);
178174
dim3 grid(gridSize);
179175

180176
// Launch the cvt kernel.

0 commit comments

Comments
 (0)