Skip to content

[hipDNN] Add warning when conv wgrad/dgrad infers output tensor with groups=1 assumption #5259

@BrianHarrisonAMD

Description

@BrianHarrisonAMD

Problem

ConvolutionWgradNode::infer_properties_node() and ConvolutionDgradNode::infer_properties_node() silently assume groups = 1 when inferring output tensor dimensions. This produces incorrect results for grouped convolutions.

The group count is normally computed from tensor dimension ratios (e.g., X.C / W.C), but when the output tensor is the unknown being inferred, this creates a circular dependency — the group count cannot be determined without the output dimensions.

Both files already document this with the comment: "Impossible to infer group count without dw/dx dimensions. Therefore, assume groups = 1."

Impact

  • Wgrad (ConvolutionWgradNode.hpp): DW[1] is inferred as C_in instead of C_in/G
  • Dgrad (ConvolutionDgradNode.hpp): DX[1] is inferred as C_in_per_group instead of C_in_per_group * G

For standard (non-grouped) convolutions, the inference is correct. The issue only affects grouped convolutions where the user relies on dimension inference.

Note: ConvolutionFpropNode does not have this issue because output channels are always W[0] regardless of group count.

Requested Changes

  1. Add #include "hipdnn_frontend/Logging.hpp" to both ConvolutionWgradNode.hpp and ConvolutionDgradNode.hpp
  2. Emit a HIPDNN_FE_LOG_WARN when output dimensions are inferred, warning that groups=1 is assumed and the result may be incorrect for grouped convolutions
  3. Update documentation in the graph.hpp public header and the convolution node headers (ConvolutionWgradNode.hpp, ConvolutionDgradNode.hpp) to document this limitation — specifically that output tensor dimension inference assumes non-grouped convolution, and users performing grouped convolutions should provide explicit output tensor dimensions

Files

  • projects/hipdnn/frontend/include/hipdnn_frontend/node/ConvolutionWgradNode.hpp
  • projects/hipdnn/frontend/include/hipdnn_frontend/node/ConvolutionDgradNode.hpp
  • projects/hipdnn/frontend/include/hipdnn_frontend/graph.hpp (documentation update)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions