Skip to content

Commit

Permalink
[BugFix] Fix ConvDirectNaiveConvFwd not applicable after #3213 (#3284)
Browse files Browse the repository at this point in the history
  • Loading branch information
averinevg authored Oct 1, 2024
1 parent 53a0b11 commit c233b80
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/conv/problem_description.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,24 @@ std::string ProblemDescription::GetAlphaBetaCaseStr() const
}
}

void ProblemDescription::HeuristicUpdateLayouts()
{
static const std::vector<std::string> supported_layouts = {"NCHW", "NHWC", "CHWN", "NCDHW"};

for(const std::string& layout : supported_layouts)
{
if(in.IsPossibleLayout4D5D(layout) && out.IsPossibleLayout4D5D(layout) &&
weights.IsPossibleLayout4D5D(layout))
{
in_layout = layout;
weights_layout = layout;
out_layout = layout;
return;
}
}
// If we did not find consistent layout, leave them as-is
}

void ProblemDescription::MakeNetworkConfig(std::string& conf_key) const
{
std::ostringstream ss;
Expand Down
3 changes: 3 additions & 0 deletions src/include/miopen/conv/problem_description.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ struct MIOPEN_INTERNALS_EXPORT ProblemDescription : ProblemDescriptionBase
beta(beta_),
alpha_beta_case(ClassifyAlphaBeta(alpha, beta))
{
HeuristicUpdateLayouts();
}

// Conv descriptor getters
Expand Down Expand Up @@ -368,6 +369,8 @@ struct MIOPEN_INTERNALS_EXPORT ProblemDescription : ProblemDescriptionBase
out.AllLengthsFitIntoInt();
}

void HeuristicUpdateLayouts();

void MakeNetworkConfig(std::string& conf_key) const;

NetworkConfig MakeNetworkConfig() const override
Expand Down

0 comments on commit c233b80

Please sign in to comment.