Issue description
Quantization of some pretrained GluonCV SSD models fails with segmentation fault.
Steps to reproduce the issue
- Prepare hardware and environment that meet the requirements for TVM
- Install MXNet 1.5.1 or 1.6.0, GluonCV 0.7.0, and the latest MKL-DNN library
- Build TVM with USE_MKLDNN ON
- Download pretrained model
ssd_512_resnet50_v1_voc
from GluonCV withgluoncv.model_zoo.get_model()
- Convert the model to a TVM Relay graph with
tvm.relay.frontend.from_mxnet()
- Quantize the model with
tvm.relay.quantize.quantize()
What’s the expected result?
- Quantization succeeds
What’s the actual result?
- Quantization fails with a segmentation fault
Additional details
- The error occurs in the function
tvm::relay::GetValidCountRel()
, in the calldshape.size()
wheredshape
is anArray
object representing the shape of an input tensor - Confirmed for models
ssd_512_resnet50_v1_voc
andssd_512_mobilenet1.0_voc
- Confirmed for TVM commits
0ea99698
and151f3f5a
- If
SimplifyInference
is removed from the list of passes applied inprerequisite_optimize()
called from the functiontvm.relay.quantize.quantize()
before the main quantization passes, quantization succeeds and inference may be successfully executed for TVM commit0ea99698
, whereas for TVM commit151f3f5a
quantization fails due to the issue Quantization fails with recent master commits of TVM
Suggested solutions
- Add support in TVM for quantization of the GluonCV pretrained models
ssd_512_resnet50_v1_voc
andssd_512_mobilenet1.0_voc