NVIDIA / NVIDIA/TensorRT

Subject: Forcing NHWC Layout for Convolutions in Mixed CNN-Transformer Graphs (TensorRT 10.10 - Blackwell)

Open
#4,677 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Module:Engine Build
Dominant language
C++
Stars
13.4k
Forks
2.4k
Avg merge
5d 3h
Merged PRs (30d)
2

Description

Environment:

GPU: NVIDIA RTX 5070 (Blackwell)

TensorRT Version: 10.10

Workflow: PyTorch -> TensorRT Model Optimizer (Q/DQ) -> ONNX -> TensorRT Engine

Architecture Overview: My model follows this sequence: RGB Input → Backbone (CNN) → BiFPN (CNN) → Transformer → 3D Deconvolution.

The Problem: Currently, TensorRT defaults the Backbone and BiFPN stages to NCHW (Channel First). However, the Transformer and Deconv3D stages naturally operate in NHWC (Channel Last). This mismatch introduces "Reformat" (transpose) nodes in the final engine, creating significant latency overhead and breaking potential fusions.

Despite using the TensorRT Model Optimizer to maximize fusions with Q/DQ nodes, I haven't been able to force the entire graph into a unified NHWC layout. Given that Blackwell Tensor Cores are highly efficient with interleaved data, maintaining NHWC throughout would be ideal.

Technical Questions:

Enforcing NHWC for Convolutions: In TensorRT 10.10, is there a way to explicitly constrain the builder to select NHWC tactics for the initial CNN stages? Can this be done via the IAlgorithmSelector or a specific flag in the Model Optimizer?

CUTLASS Integration: I am aware CUTLASS offers high-performance NHWC convolution kernels. Does TensorRT 10.10 automatically leverage these for Blackwell when NHWC is preferred, or should I implement a custom plugin to guarantee this layout?

Q/DQ Influence on Layout: Does the placement of Q/DQ nodes by the Model Optimizer restrict the tactic selection to NCHW for standard convolutions? How can I ensure that quantization doesn't "lock" the model into an inefficient layout?

Graph Surgeon vs. Native TRT: Would it be more effective to use onnx-graphsurgeon to manually inject transposes and "trick" the builder into NHWC, or is there a more "native" way to handle this within the TensorRT 10.x API?

I am looking for the most efficient way to achieve a zero-reformat pipeline. If other frameworks (like Torch-TensorRT) offer better layout control for this specific use case, I am open to suggestions.

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.

Research direction

No repository files or tests are named. Start by reviewing the TensorRT 10.10 builder and IAlgorithmSelector entry points, Model Optimizer Q/DQ behavior, and the proposed onnx-graphsurgeon and Torch-TensorRT alternatives. Done would be a settled recommendation for achieving or rejecting a zero-reformat NHWC pipeline.

Written by the indexing model from the issue text.

Assessment

Tech stack
pytorch
Domain
machine-learning, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.