-
Notifications
You must be signed in to change notification settings - Fork 799
Qualcomm AI Engine Direct - add pass for extra padding then maxpool2d #16534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary:
The padding value used in max_pool2d operations differs between PyTorch and QNN implementations.
PyTorch uses negative infinity, while QNN uses zero. To ensure consistent max_pool2d output across both frameworks,
we handle this by padding tensor with constant in advance then doing max_pool2d without constant padding.
Test plans:
python backends/qualcomm/tests/test_qnn_delegate.py TestQNNQuantizedOperator.test_qnn_backend_max_pool2d -b build-android -H ${HOST} -s ${SN} -m ${CHIPID}
python backends/qualcomm/tests/test_qnn_delegate.py TestQNNFloatingPointOperator.test_qnn_backend_max_pool2d -b build-android -H ${HOST} -s ${SN} -m ${CHIPID}
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/16534
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit f3c142d with merge base 47dc1de ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pytorchbot label "release notes: qualcomm" |
|
Due to the padding value used in max_pool2d operations differs between PyTorch and QNN implementations. This pass will improve this situation. Please take a look. Thanks. |
|
Hey can you address the lintrunner error? |
Sure. |
|
@pytorchbot label "release notes: qualcomm" |
Qualcomm AI Engine Direct - add pass for extra padding then maxpool2d
Summary:
The padding value used in max_pool2d operations differs between PyTorch and QNN implementations. PyTorch uses negative infinity, while QNN uses zero. To ensure consistent max_pool2d output across both frameworks, we handle this by padding tensor with constant in advance then doing max_pool2d without constant padding. Note that for the quantization flow, we set quant_min as the padding value. If, at runtime, there is a value smaller than quant_min, it could result in an accuracy drop.
Test plans:
python backends/qualcomm/tests/test_qnn_delegate.py TestQNNQuantizedOperator.test_qnn_backend_max_pool2d -b build-android -H ${HOST} -s ${SN} -m ${CHIPID}
python backends/qualcomm/tests/test_qnn_delegate.py TestQNNFloatingPointOperator.test_qnn_backend_max_pool2d -b build-android -H ${HOST} -s ${SN} -m ${CHIPID}