From 2643808228204b43575cdfa3505dbaf067ea1111 Mon Sep 17 00:00:00 2001 From: Siddartha Pothapragada Date: Fri, 30 Oct 2026 09:52:55 -0700 Subject: [PATCH] Register quantized out variants for the `test_passes` target Summary: `test_skipped_conv_keeps_its_weight_dequantize_on_cpu`, added by the diff-train import in D128333373 (pytorch/executorch#23915), is land-blocking with: RuntimeError: Missing out variants: {'quantized_decomposed::dequantize_per_channel'} It is the first test in `test_passes.py` that both leaves a `quantized_decomposed.dequantize_per_channel` node on CPU and then calls `edge.to_executorch()`. The out-variant pass resolves `dequantize_per_channel.out` through the AOT operator registry. `QnnQuantizer` populates that registry by importing `executorch.kernels.quantized`, which `torch.ops.load_library`s a `quantized_ops_aot_lib` shipped in the pip package; under Buck no such library is on disk, the import fails, and `quantizer.py` swallows it into a `logging.info`. That is why the test is green on GitHub and red here, and why only the `emit=True` case fails while its `emit=False` sibling passes. The imported partitioner change is not at fault: every graph assertion in the test passes, and the failure is at the emission step alone. Preload `//executorch/kernels/quantized:custom_ops_generated_lib` so those out variants are registered, as the comparable `python_test` targets under `exir/tests`, `backends/arm` and `backends/nxp` already do. No Python change, so `fbcode` stays a faithful copy of the upstream commit. Guarded on `runtime.is_oss`, like the other internal-only deps in this file. The OSS `test-qnn-buck-build-linux` job runs `buck2 build //backends/qualcomm/...`, which builds this target's PAR and would resolve `preload_deps`; `custom_ops_generated_lib` needs `:quantized_operators_aten`, which `get_aten_mode_options()` defines only in aten mode, so unguarded this would break that signal. Nothing is lost: that job only builds, never runs, and the OSS pytest path gets the registration from the import above. Reviewed By: JacobSzwejbka Differential Revision: D128621515 --- backends/qualcomm/tests/BUCK | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backends/qualcomm/tests/BUCK b/backends/qualcomm/tests/BUCK index 2711a33afae..7676953c093 100644 --- a/backends/qualcomm/tests/BUCK +++ b/backends/qualcomm/tests/BUCK @@ -90,6 +90,14 @@ fbcode_target(_kind = runtime.python_test, "LD_LIBRARY_PATH": "$(location fbsource//third-party/qualcomm/qnn/qnn-{0}:qnn_offline_compile_libs)".format(get_qnn_library_version()), "QNN_SDK_ROOT": "$(location fbsource//third-party/qualcomm/qnn/qnn-{0}:__dir__)".format(get_qnn_library_version()), }, + # Puts the quantized_decomposed out variants in the AOT operator registry, so + # a test that leaves a q/dq node on CPU can reach to_executorch(). OSS gets + # them from QnnQuantizer's import of executorch.kernels.quantized, and could + # not build this lib regardless: it needs :quantized_operators_aten, which + # get_aten_mode_options() leaves out of the OSS graph. + preload_deps = [] if runtime.is_oss else [ + "//executorch/kernels/quantized:custom_ops_generated_lib", + ], deps = [ ":models", "fbsource//third-party/pypi/expecttest:expecttest", # @manual