Ah...u are right, @giuseros sorry i mislead u. I remembered wrong before. We
will have one default value, it is 1 if i remember correctly. But even we could
have one value, the value is not trusted, because we haven’t tuned it. We maybe
could say we could fix it for 4 or 8, but I think it does
Maybe I am wrong, but are you sure that when `cfg.is_fallback` parameters like
`cfg['tile_co']` are not defined? We usually set them to some default values (I
think). But even if we don't set them, IIUC they will get "some" value among
the possible ones. Am I missing something?
---
[Visit
[quote="giuseros, post:11, topic:8253"]
What I am missing is why we don’t want to change the layout when
`cfg.is_fallback` . In that case, the strategy is defined
[/quote]
When we enter into fall back configuration means we don't find the
configuration of this workload in the tuning log. So li
Hi @FrozenGene,
I think I see why we don't want to change the layout for no workload (no
workload means we don't even know the strategy, I think). What I am missing is
why we don't want to change the layout when `cfg.is_fallback`. In that case,
the strategy is defined, so we know how the weigh
For alter_op_layout, we will alter the weight layout, normally we will change
the weight layout to 5D, the last dim is queried from our AutoTVM log file. For
example:
```
if topi_tmpl == "conv2d_nchw_spatial_pack.arm_cpu":
assert data_layout == "NCHW" and kernel_layout == "OIHW"
Hi @FrozenGene, @anijain2305
I can confirm that this works :partying_face:! Very good! Now we can implement
algorithms like QNNPack and let the tuner try them together! Thanks both guys!
As for the API change, I agree with @FrozenGene that maybe it would be cleaner
adding `tinfos` to the `
@giuseros @anijain2305 Let us accept one more argument like `alter_op_layout`
```
@tvm.target.generic_func
def conv2d_alter_layout(attrs, inputs, tinfos, out_type):
@tvm.target.generic_func
def qnn_conv2d_legalize(attrs, inputs, types):
"""Default legalization is None."""
return None
Sorry for late reply. Can you try this? tinfo is nothing but just te
placeholder.
~~~
diff --git a/python/tvm/relay/qnn/op/legalizations.py
b/python/tvm/relay/qnn/op/legalizations.py
index 50e5a02f8..8add434c1 100644
--- a/python/tvm/relay/qnn/op/legalizations.py
+++ b/python/tvm/relay/qnn/op/
I got a bit confused above, sorry. It is not about the `inputs` but about the
`tinfos`.
Just to avoid any additional confusion I tried to print the types of the
interesting variables
**conv2d_alter_op(attrs, inputs, tinfos, out_type)**
```
print(type(inputs[0]))
#
print(type(tinfos[0]))
@giuseros I doesn't run it, but according to my understanding, these two
functions's inputs should be the same type (tvm.relay.expr). For example,
inside the alter_op_layout function we have logic:
```
# HWIO -> OIHW
kernel_transform = relay.transpose(inputs[1], axes=[3, 2, 0, 1])
# alpha, al
Thanks for the reply, @FrozenGene!
The signatures of the two functions are:
```
def _alter_conv2d_layout(attrs, inputs, types, out_type):
```
```
def _qnn_conv2d_legalize_arm_cpu(attrs, inputs, types):
```
While they look similar, `inputs` in `_alter_conv2d_layout` contains actual
`Tensor`s
[quote="giuseros, post:1, topic:8253"]
`qnn_conv2d_legalize.register`
[/quote]
does code in `alter_op_layout` work?
```
best_plevel_impl, outs = relay.backend.compile_engine.select_implementation(
relay.op.get("nn.conv2d"), attrs, tinfos, out_type, target)
if best_plevel_impl.nam
cc @anijain2305 @ramana-arm @FrozenGene (we had this discussion before)
---
[Visit
Topic](https://discuss.tvm.apache.org/t/quantized-models-and-legalization-pass/8253/2)
to respond.
You are receiving this because you enabled mailing list mode.
To unsubscribe from these emails, [click
he
Hi all,
I am trying to improve quantized performance for memory bound operators (e.g.,
depthwise or 1x1 convolutions with small shapes).
### Bottom line question
Is there any way we can know the strategy picked by the autotuner during the
legalization pass of a quantized convolution (qnn.co
14 matches
Mail list logo