[Common] Use wide instructions in SR to reduce issue-bound bottleneck - #3357
[Common] Use wide instructions in SR to reduce issue-bound bottleneck#3357janekb04 wants to merge 2 commits into
Conversation
Signed-off-by: Jan Bielak <jbielak@nvidia.com>
|
@Oleg-Goncharov @ksivaman, I think you might be interested in reviewing. |
Greptile SummaryThe PR optimizes NVFP4 stochastic rounding by reducing the instruction count while preserving the existing arithmetic.
Confidence Score: 5/5The PR appears safe to merge, with no concrete correctness, compatibility, or security failures identified. The new wide PTX operations preserve the prior arithmetic, and the packed floating-point instruction is limited to compatible architecture-specific paths. Important Files Changed
Reviews (1): Last reviewed commit: "Merge branch 'main' into wide_instructio..." | Re-trigger Greptile |
|
/te-ci |
Oleg-Goncharov
left a comment
There was a problem hiding this comment.
LGTM. I would just check whether static_cast<uint64_t>(a) * b generates the same SASS as mul.wide.u32.
| return a * b; | ||
| // Returns uint64_t(a) * b in two uint32 halves | ||
| uint64_t product; | ||
| asm("mul.wide.u32 %0, %1, %2;" : "=l"(product) : "r"(a), "r"(b)); |
There was a problem hiding this comment.
Is inline PTX necessary here? Could we simply use:
uint64_t product = static_cast<uint64_t>(a) * b;
and let the compiler generate the appropriate instruction?
Description
Optimizes the performance of stochastic rounding kernel by using wider instructions.
A simple benchmark shows a 4-10% throughput improvement on a B200 for the NVFP4 specialized 1D quantization kernel in SR mode. The SR kernel is issue-bound, so using fewer, wider instructions, improves performance.
Type of change
Changes
Please list the changes introduced in this PR:
mul.wide.u32is used explicitly, as I noticed, while working on [Common] Experimental CuTeDSL NVFP4 backend #3223 that the multiply and add would not get automatically fused into an FMA.mul_cvt_bf16_to_fp4_8x_stochastic_rounding, usemul.f32x2to halve the number ofmulinstructions.Checklist:
Raw results