lazycal commented on a change in pull request #10118:
URL: https://github.com/apache/tvm/pull/10118#discussion_r796951191



##########
File path: src/relay/op/nn/nn.cc
##########
@@ -283,14 +279,6 @@ InferCorrectLayoutOutput DensePackInferCorrectLayout(const 
Attrs& attrs,
                                                      const 
Array<tvm::relay::Type>& old_in_types) {
   auto params = attrs.as<DensePackAttrs>();
   ICHECK(params);
-  // Respect input layout, if explicitly specified (for example, "NW").
-  // However, a packed layout such as "NC8c" is not supported by dense_pack 
op. For such cases,
-  // we insert a layout transform "NC8c" -> "NC".
-  // We do not expect to get a packed layout like "NW8w", which is not 
compatitble with "NC",
-  // since packing is always done on the "C" axis.
-  if (new_in_layouts.size() > 0 && new_in_layouts[0].defined() && 
new_in_layouts[0].ndim() == 2) {
-    return InferCorrectLayoutOutput({new_in_layouts[0], 
params->weight_layout}, {"NC"}, attrs);
-  }
   return InferCorrectLayoutOutput({"NC", params->weight_layout}, {"NC"}, 
attrs);
 }

Review comment:
       I skimmed through your change in 
https://github.com/apache/tvm/commit/66ac4705aae9bec92047920c8a9273693cd48c44, 
and I think it is probably still needed. Mainly because when FTVMAlterOpLayout 
is defined but FInterCorrectLayout is not, the current code logic in 
https://github.com/apache/tvm/blob/6a274af9cb4e7baf6d9dd06f0fb38bea5ac3154a/src/relay/transforms/transform_layout.h#L310-L320
   will assume this OP accepts any layout. In the case of Dense, it only 
accepts 2D `data` tensor, and when the producer for `data` tensor changes its 
layout, we need an additional layout transform to convert it back, which is not 
handled in L310-L320.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to