Performance: NVFP4 encoder slower than FP8 with TensorRT 11.4 on RTX PRO 6000 Blackwell, from copies and unfused quantize kernels around the FP4 GEMMs
Los mantenedores suelen responder en 6 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 8/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- performance
Línea de trabajo
Start by reproducing the NVFP4 and FP8 engine builds with the trtexec commands in the report and comparing the per-layer profile. The work centres on the Myelin kernels named in the report (__myl_SlicResh, __myl_TranMul, __myl_Dyna_...) and the Q/K/V layout feeding the fused MHA kernel, which the payload does not map to source files. Done would mean the NVFP4 engine no longer pays for those extra copies and unfused quantize kernels, which is a compiler-level change.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
BAAI/bge-reranker-v2-m3 (XLM-R large, 24 layers) with NVFP4 W4A4 (ModelOpt NVFP4_DEFAULT_CFG, Q/K/V exported as one MatMul to avoid the batch fault in #4879) runs 45% slower than its FP8 engine at 128 pairs × 320 tokens and 24% slower at 128 × 640. Its FP4 GEMMs are not the problem: at 1,140–1,500 TFLOPS they are 1.7–2.0× faster than the FP8 GEMMs of the FP8 engine, about what CUTLASS reaches on this GPU outside TensorRT. The kernels that TensorRT adds around them cost more than the GEMMs save.
Per-layer profile (trtexec --dumpProfile --separateProfileRun), ms per inference at 128 × 640, grouped by the operations in the Myelin kernel names:
| Kernel group | FP8 engine | NVFP4 engine |
|---|---|---|
| GEMMs | 69.2 | 38.9 |
| Q/K/V slicing, transposes and copies | 0.9 | 38.3 |
| FP4 dynamic quantize as its own kernel | 0 | 18.0 |
| residual add + LayerNorm (+ quantize) | 8.6 | 18.0 |
| GELU (+ quantize) | 15.5 | 21.6 |
| fused MHA | 66.5 | 63.2 |
| FP4 block-scale swizzle | 0 | 2.1 |
| total | 160.8 | 200.1 |
- Q/K/V layout. In the FP16 and FP8 engines the Q/K/V GEMM writes
[3, M, 1024]and_gemm_mha_v2reads it directly, with 2 data-movement kernels in the whole engine. With the FP4 GEMM (cutlass3x_sm120_bstensorop_s16864gemm_block_scaled_ue4m3xe2m1_...), the GEMM writes[M, 3072], and five Myelin kernels per layer build the head-major Q, Kᵀ and V for the MHA kernel (__myl_SlicResh,__myl_TranMul,__myl_ReshMove,__myl_SlicReshTranReshMove,__myl_SlicReshTranMulReshMove). Together they take 1.6 ms per layer, about as long as all four GEMMs of the layer. With Q/K/V as separate MatMuls, the three FP4 GEMMs are not horizontally fused either (6 GEMMs and 11 data-movement kernels per layer). - GELU and quantize. The FP4 dynamic quantize of the FFN-down input runs as its own kernel after GELU (
__myl_Dyna_..., 0.61 ms per layer), reading back the FP16 GELU output. FP8 fuses GELU and the quantize into one kernel. #4735 reports the same separate__myl_Dynakernel after a GEMM with a bias. - LayerNorm and quantize. LayerNorm fused with the FP4 dynamic quantize (
__myl_AddCastMeanSubMulMeanAddSqrtDivMulCast...Dyna_cuda_tile_...) takes 0.36 ms, twice the 0.17 ms of LayerNorm with the FP8 quantize. - TensorRT 11.3.0.99 and 11.4.0.106 produce the same kernel mix and the same times (83.1 / 199.4 ms at 128 × 320 / 128 × 640).
Without the extra kernels and with the quantize fused like FP8, the NVFP4 engine would take about 127 ms at 128 × 640, 21% less than FP8, instead of 24% more.
Environment
TensorRT Version: 11.4.0.106 (also 11.3.0.99)
NVIDIA GPU: RTX PRO 6000 Blackwell Server Edition (SM120)
NVIDIA Driver Version: 595.91.07
CUDA Version: 13.4
CUDNN Version: not used
Operating System: Ubuntu 24.04 (GCP g4-standard-48)
Python Version (if applicable): 3.12
PyTorch Version (if applicable): 2.14.1 (export only)
Baremetal or Container (if so, version): nvcr.io/nvidia/tritonserver:26.09-py3
Relevant Files
Model link: BAAI/bge-reranker-v2-m3, quantized with ModelOpt NVFP4_DEFAULT_CFG (classifier head excluded) and exported to ONNX with get_onnx_bytes_and_metadata(..., weights_dtype="fp16"). The ONNX files (about 700 MB each) can be shared on request.
Steps To Reproduce
Commands or scripts:
trtexec --onnx=model.onnx --saveEngine=model.plan --minShapes=input_ids:1x128,attention_mask:1x128 \
--optShapes=input_ids:32x640,attention_mask:32x640 --maxShapes=input_ids:128x768,attention_mask:128x768 \
--profilingVerbosity=detailed --skipInference
trtexec --loadEngine=model.plan --shapes=input_ids:128x640,attention_mask:128x640 \
--loadInputs=input_ids:ids.bin,attention_mask:mask.bin --warmUp=2000 --duration=10 --noDataTransfers \
--useSpinWait --separateProfileRun --dumpProfile --exportProfile=profile.json --exportLayerInfo=layers.json
Have you tried the latest release?: Yes, 11.4.0.106 behaves the same.
Can this model run on other frameworks? Yes; the PyTorch fake-quant model and the engines agree in accuracy. This report is about speed only.
- Lenguaje dominante
- C++
- Estrellas
- 13.5k
- Forks
- 2.4k
- Merge medio
- 6 d 21 h
- PR fusionados (30 d)
- 3
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de NVIDIA/TensorRT
-
Module:Polygraphy
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 6 días
-
Polygraphy NumPy Top-K sorts unsigned and minimum signed integers incorrectlyPosiblemente ocupada @0z5a la tomó hace 16 días. AbiertoModule:Polygraphy
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 6 días
-
Polygraphy INT32 comparison can overflow and falsely pass at zero tolerancePosiblemente ocupada @0z5a la tomó hace 16 días. AbiertoModule:Polygraphy
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 6 días
-
onnx-graphsurgeon: Graph.toposort() hits RecursionError when a graph has a local function and an If/Loop nodePosiblemente ocupada @gabortar la tomó hace 39 días. AbiertoModule:GraphSurgeon
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 6 días
-
Polygraphy parse_meta accepts a shape with a missing bracketPosiblemente ocupada @SashaMIT la tomó hace 51 días. AbiertoModule:Polygraphy
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 6 días
Todos los issues de NVIDIA/TensorRT
Issues similares
-
[UBSan] spawn_simulator passes null child_options.args to uv_spawn (execvp nonnull violation)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
tenstorrent/tt-umd#4017 ·
Los mantenedores suelen responder en 3 días
-
difficulty:easy func:gui prio:low type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
NatronGitHub/Natron#1538 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
hyprwm/hyprsunset#103 · 1 comentario ·
-
Feature request
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
qbittorrent/qBittorrent#25338 ·
Los mantenedores suelen responder en 2 días
-
Needs: Attention Needs: Version Info Platform: Android Platform: tvOS
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
react/react-native#60180 · 3 comentarios ·
Los mantenedores suelen responder en 2 días