What does QEngines do in TorchModule.mm?
mjjimenez opened this issue · 2 comments
mjjimenez commented
What do these lines do?
HelloWorld > TorchModule.mm
auto qengines = at::globalContext().supportedQEngines();
if (std::find(qengines.begin(), qengines.end(), at::QEngine::QNNPACK) != qengines.end()) {
at::globalContext().setQEngine(at::QEngine::QNNPACK);
}
I can't find any references to QEngines in the Pytorch Aten C++ docs here https://pytorch.org/cppdocs/api/namespace_at.html#namespace-at
jerryzh168 commented
We have integrated both qnnpack and fbgemm backend in PyTorch, both of them can execute quantized ops but typically fbgemm runs faster in server and qnnpack runs faster in mobile, so we need to set appropriate qengines before execution to get best performance. This is setting the qengine to qnnpack when it is supported.
mjjimenez commented
Thanks for the explanation @jerryzh168 ! I'll close this now.