NVIDIA / NVIDIA/TensorRT

--bf16 doesn't work for convolutional layers

Open
#3,718 6 comments 0 reactions 1 assignee View on GitHub

@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

image

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

tmp.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.