No, it is more complicated than that.
Currently our DNNL backends has two patterns, one for conv + relu and another 
for conv + bias + relu:

https://github.com/apache/incubator-tvm/blob/master/python/tvm/relay/op/contrib/dnnl.py#L84-L86

Suppose we use optional to represent the two patterns. We would have one 
pattern named "fused_conv", let's say, that can match both conv + bias and conv 
+ bias + relu.

In the current infra, the DNNL backend would receive a composite function with 
attribute "fused_conv", and the subgraph is either conv + bias or conv + bias + 
relu, depending on whether bias is matched. To tell the difference, we need 
`IsOp(relu->args[0], "nn.bias_add")`. 

In my use case, I have four optionals to match "qconv + hswish", so I'd need 
four `IsOp(...)` calls. It would be really nice if the composite attribute 
tells me which optionals are matched ("conv_relu" or "conv_bias_relu", rather 
than "fused_conv").

A user can associate a list of optional op names for each pattern, and 
`MergeComposite` pass can compare the matched fragement with optional names to 
come up with a good attribute.





---
[Visit 
Topic](https://discuss.tvm.ai/t/byoc-use-pattern-language-to-create-composite-functions/6727/7)
 to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.ai/email/unsubscribe/ad4478b2e009fb3cafc65d6a30b61a6b6d72ca6427229705d1c3c3a1dc0f37af).

Reply via email to