--bf16 doesn't work for convolutional layers
Open
@nvpohanh is already working on this.
Since Mar 17, 2024.
triaged
- Dominant language
- C++
- Stars
- 13.4k
- Forks
- 2.4k
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 2
Description
Do you have any plan to fix --bf16 option since it does not affect convolutional layers and those remain tf32? We succeeded bfloat16 quantization by setting precisionConstraints and layerPrecisions with wildcard. However, the performance is not the same as --fp16.
layer precisions from trtexec --onnx=tmp.onnx --bf16 TREx
| option | latency[ms] | FPS |
|---|---|---|
| none (tf32) | 347.6 | 184.1 |
| --fp16 | 255.9 | 250.1 |
| --fp16 --inputIOFormats=fp16:chw --outputIOFormats=fp16:chw | 151.5 | 422.3 |
| --bf16 | 348.2 | 183.8 |
| --bf16 --precisionConstraints=obey --layerPrecisions=/*:bf16 | 283.4 | 225.8 |
| --bf16 --precisionConstraints=obey --layerPrecisions=/*:bf16 --inputIOFormats=bf16:chw --outputIOFormats=bf16:chw | 177.8 | 360.0 |
Related issue; #3583
Environment
TensorRT Version:
TensorRT OSS v9.3.0
NVIDIA GPU:
RTX4090
NVIDIA Driver Version:
535.154.05
CUDA Version:
12.2
Operating System:
ubuntu22.04 docker
Relevant Files
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.