Commit ba729cfc authored by Paul Fultz II's avatar Paul Fultz II Committed by mvermeulen
Browse files

Disable fusion when winograd is used except for 3x3 (#364)

* Disable fusion when winograd is used except for 3x3

* Formatting
parent 7221e973
...@@ -13,6 +13,8 @@ namespace migraphx { ...@@ -13,6 +13,8 @@ namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
namespace gpu { namespace gpu {
MIGRAPHX_DECLARE_ENV_VAR(MIGRAPHX_DISABLE_MIOPEN_FUSION)
struct fusion struct fusion
{ {
using op_t = miopenFusionOpDescriptor_t; using op_t = miopenFusionOpDescriptor_t;
...@@ -127,6 +129,8 @@ MIGRAPHX_PRED_MATCHER(bias_shape, instruction_ref ins) ...@@ -127,6 +129,8 @@ MIGRAPHX_PRED_MATCHER(bias_shape, instruction_ref ins)
MIGRAPHX_PRED_MATCHER(fusable_conv, instruction_ref ins) MIGRAPHX_PRED_MATCHER(fusable_conv, instruction_ref ins)
{ {
if(enabled(MIGRAPHX_DISABLE_MIOPEN_FUSION{}))
return false;
if(ins->name() != "gpu::convolution") if(ins->name() != "gpu::convolution")
return false; return false;
if(ins->get_shape().type() != shape::float_type) if(ins->get_shape().type() != shape::float_type)
...@@ -139,6 +143,10 @@ MIGRAPHX_PRED_MATCHER(fusable_conv, instruction_ref ins) ...@@ -139,6 +143,10 @@ MIGRAPHX_PRED_MATCHER(fusable_conv, instruction_ref ins)
if(wei.lens()[1] > 512 and conv.algo != miopenConvolutionFwdAlgoWinograd) if(wei.lens()[1] > 512 and conv.algo != miopenConvolutionFwdAlgoWinograd)
return false; return false;
auto op = conv.op; auto op = conv.op;
// Dont fuse winograd for non-3x3s since there is no fused windograd for those configs
if(conv.algo == miopenConvolutionFwdAlgoWinograd and wei.lens()[2] != 3 and
wei.lens()[3] != 3 and op.stride == make_array<size_t>(1, 1))
return false;
return contains({{0, 0}, {1, 1}, {2, 2}}, op.padding) and return contains({{0, 0}, {1, 1}, {2, 2}}, op.padding) and
contains({{0, 0}, {1, 1}}, op.stride) and op.dilation == make_array<size_t>(1, 1); contains({{0, 0}, {1, 1}}, op.stride) and op.dilation == make_array<size_t>(1, 1);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment