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
Original file line number Diff line number Diff line change
Expand Up @@ -1512,13 +1512,13 @@ __device__ __forceinline__ void group_row_scaled_cast_body(
// Per-row encode (byte-identical to the single-tensor path): pass the
// per-expert amax base and a local row offset so amax[row_idx] indexes the
// expert-local row.
rowwise_scaling<ScaleType, USE_STOCHASTIC_ROUNDING, USE_FAST_MATH, ROW_SCALED_NVFP4>(
rowwise_scaling<ScaleType, 16, USE_STOCHASTIC_ROUNDING, USE_FAST_MATH, ROW_SCALED_NVFP4>(
sIn_ptr, sOut_ptr, sSFrowwise_ptr, /*S_enc_rowwise=*/1.0f, stage_Y, stage_X, buff_in,
buff_out, row_amax_base, static_cast<size_t>(local_row_base), static_cast<size_t>(M_t), rng,
random_uint4, rnd_idx);

if constexpr (RETURN_TRANSPOSE) {
colwise_scaling<ScaleType, USE_STOCHASTIC_ROUNDING, USE_FAST_MATH, ROW_SCALED_NVFP4>(
colwise_scaling<ScaleType, 16, USE_STOCHASTIC_ROUNDING, USE_FAST_MATH, ROW_SCALED_NVFP4>(
sIn_ptr, sOut_tr_ptr, sSFcolwise_ptr, /*S_enc_colwise=*/1.0f, stage_Y, stage_X, buff_in,
buff_out_tr, col_amax_base, static_cast<size_t>(block_offset_X), cols, rng, random_uint4,
rnd_idx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,15 @@ void quantize_transpose_impl(const Tensor &input, const Tensor *noop, Tensor *ou
}

if (!use_2d_quantization && (input.dtype() == DType::kBFloat16)) {
quantize_transpose_tuned_1D<ScaleType>(input, noop, output, quant_config, stream);
// The block size is a compile-time property of the kernel's tile arithmetic, while the scale
// dtype is only known at runtime here, so both instantiations are emitted and selected here.
// 16 reproduces the historical NVFP4 configuration; 32 is the MXFP4 block.
const DType scale_block_dtype = output->scale_inv.dtype;
if (scale_block_dtype == DType::kFloat8E8M0) {
quantize_transpose_tuned_1D<ScaleType, 32>(input, noop, output, quant_config, stream);
} else {
quantize_transpose_tuned_1D<ScaleType, 16>(input, noop, output, quant_config, stream);
}
return;
}

Expand Down
Loading
Loading