Expand fbcode buck test coverage for arm backend (58→162 test targets) (#18817)#18817
Expand fbcode buck test coverage for arm backend (58→162 test targets) (#18817)#18817digantdesai wants to merge 2 commits intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18817
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ You can merge normally! (4 Unrelated Failures)As of commit 4141453 with merge base 75ba558 ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@digantdesai has exported this pull request. If you are a Meta employee, you can view the originating Diff in D96521268. |
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
Expands the Arm backend’s Buck-based pytest coverage in fbcode by enumerating many more existing test files, and aligns Conv3D lowering with the common tosa_serializer import style used throughout the Arm backend.
Changes:
- Greatly expands
backends/arm/test/targets.bzlto include many moreops/,quantizer/, andmisc/pytest targets (with some explicitly disabled and annotated). - Updates Conv3D TOSA lowering to import
tosa_serializerdirectly.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| backends/arm/test/targets.bzl | Adds many more pytest targets for Arm backend tests and documents known exclusions. |
| backends/arm/operators/op_tosa_conv3d.py | Switches Conv3D visitor to import tosa_serializer directly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Operators | ||
| test_files += [ | ||
| "ops/test_abs.py", | ||
| "ops/test_add.py", | ||
| "ops/test_addmm.py", | ||
| "ops/test_amax.py", |
There was a problem hiding this comment.
The PR description/title claims this adds “all available” tests from ops/, quantizer/, and misc/, but this target list still omits many existing tests in those directories (e.g., ops/test_acos.py, ops/test_any.py, misc/test_high_rank_permute_view_invariants.py, etc.). Either update the description to reflect that this is a curated subset, or switch to native.glob(["ops/test_.py"], ...) / native.glob(["misc/test_.py"], ...) with an explicit exclusion list so coverage doesn’t silently drift as new tests are added.
| "quantizer/test_conv_relu_fusing.py", | ||
| "quantizer/test_generic_annotater.py", | ||
| "quantizer/test_partial_quantization.py", | ||
| # "quantizer/test_preserve_kwargs.py", # needs executorch.backends.test.harness.stages (no BUCK target) |
There was a problem hiding this comment.
This exclusion reason appears incorrect: executorch.backends.test.harness.stages is included in the public Buck target //executorch/backends/test/harness:tester (which is already a dependency of //executorch/backends/arm/test:arm_tester_lib). If quantizer/test_preserve_kwargs.py is being skipped for another reason (e.g., failures), please update the comment; otherwise it looks like it should be enabled to increase coverage.
| # "quantizer/test_preserve_kwargs.py", # needs executorch.backends.test.harness.stages (no BUCK target) | |
| "quantizer/test_preserve_kwargs.py", |
| "misc/test_extract_io_params_tosa.py", | ||
| # "misc/test_int64.py", # 5 failures: int64 overflow/chain handling issues | ||
| # "misc/test_lifted_tensor.py", # needs executorch.backends.test.harness.stages (no BUCK target) | ||
| "misc/test_mixed_fp_bf16_partition.py", |
There was a problem hiding this comment.
Same as above for this exclusion: executorch.backends.test.harness.stages has a Buck target (//executorch/backends/test/harness:tester) and is already pulled in transitively via //executorch/backends/arm/test:arm_tester. If this test is disabled due to failures/flake, please update the comment accordingly; otherwise consider enabling it to match the stated goal of expanding coverage.
68a6157 to
d6432e8
Compare
pytorch#18817) Summary: Expand the arm backend test coverage in fbcode by adding all available test files from ops/, quantizer/, and misc/ directories to targets.bzl. Reviewed By: 3l1 Differential Revision: D96521268
Summary: The pybindings code handled bool and int scalar inputs but was missing support for float (Python float → C++ double). This caused failures when running models like Addmm that take float alpha/beta parameters, throwing 'Unsupported python type <class float>'. Added py::isinstance<py::float_> handling to convert Python floats to EValue(double) in both the portable and XNNPACK input processing paths. Differential Revision: D99845426
pytorch#18817) Summary: Expand the arm backend test coverage in fbcode by adding all available test files from ops/, quantizer/, and misc/ directories to targets.bzl. Reviewed By: 3l1 Differential Revision: D96521268
d6432e8 to
d59afd6
Compare
pytorch#18817) Summary: Pull Request resolved: pytorch#18817 Expand the arm backend test coverage in fbcode by adding all available test files from ops/, quantizer/, and misc/ directories to targets.bzl. Reviewed By: 3l1 Differential Revision: D96521268
d59afd6 to
4141453
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (2)
extension/pybindings/pybindings.cpp:1145
- Same issue here: the error message says inputs should be a flat list of tensors, but this conversion path supports None/bool/int/float scalars too. Updating the message to reflect supported types will make failures easier to debug.
cpp_inputs.push_back(EValue(py::cast<double>(python_input)));
} else {
throw std::runtime_error(
"Unsupported python type " + type_str +
". Ensure that inputs are passed as a flat list of tensors.");
extension/pybindings/pybindings.cpp:815
- The thrown error message is now misleading: this input conversion accepts tensors plus None/bool/int/float, but the message says "Ensure that inputs are passed as a flat list of tensors." Consider updating it to list the supported scalar types (and/or mention that non-tensor scalars are supported) so users aren’t misdirected when they pass an unsupported type.
cpp_inputs.push_back(EValue(py::cast<double>(python_input)));
} else {
throw std::runtime_error(
"Unsupported python type " + type_str +
". Ensure that inputs are passed as a flat list of tensors.");
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } else if (py::isinstance<py::float_>(python_input)) { | ||
| cpp_inputs.push_back(EValue(py::cast<double>(python_input))); | ||
| } else { |
There was a problem hiding this comment.
This PR’s description is focused on expanding Arm backend Buck test targets, but this hunk also changes the Python bindings’ accepted input types (python float → EValue(double)). Please update the PR description to mention this behavior change, or split it into a separate PR if it’s unrelated to the test target expansion.
| "misc/test_bn_relu_folding_qat.py", | ||
| "misc/test_call_operator_submodule.py", | ||
| "misc/test_compile_spec.py", |
There was a problem hiding this comment.
misc/test_compile_spec.py is listed twice in test_files (once earlier in the misc section and again here). Because target names are derived from the basename, this will attempt to define the same Buck target (compile_spec) twice and fail. Remove the duplicate or de-duplicate test_files before the loop.
| "deprecation/test_arm_compile_spec_deprecation.py", | ||
| "misc/test_partition_decomposed_quantized_ops.py", | ||
| "misc/test_pass_pipeline_config.py", | ||
| "misc/test_pass_required_order.py", | ||
| "misc/test_qat_training_loop.py", |
There was a problem hiding this comment.
misc/test_pass_pipeline_config.py is already included in the earlier "Misc tests" list, and is added again here. Since test_name is based on the basename, this will create a duplicate Buck rule name (pass_pipeline_config) and break the build. Remove one occurrence or ensure test_files is unique before generating targets.
| "misc/test_tosa_dialect_conv2d.py", | ||
| "misc/test_tosa_dialect_dw_conv2d.py", | ||
| "misc/test_tosa_dialect_shape_ops.py", | ||
| "misc/test_tosa_spec.py", | ||
| ] |
There was a problem hiding this comment.
misc/test_tosa_spec.py is already included in the "Misc tests" list and is added again here. This results in defining the same Buck target name (tosa_spec) twice. Remove the duplicate entry or de-duplicate test_files before iterating.
| def _get_tosa_op(self): | ||
| import serializer.tosa_serializer as ts # type: ignore | ||
| import tosa_serializer as ts | ||
|
|
||
| return ts.Op.CONV3D |
There was a problem hiding this comment.
This PR description says it only updates targets.bzl to expand test coverage, but this file also changes runtime behavior by switching the Conv3D lowering import path. Please reflect this in the PR description (or move it into a separate change) so reviewers understand the additional functional impact.
| # Operators | ||
| test_files += [ | ||
| "ops/test_abs.py", | ||
| "ops/test_add.py", | ||
| "ops/test_addmm.py", | ||
| "ops/test_amax.py", | ||
| "ops/test_amin.py", |
There was a problem hiding this comment.
The PR description says it adds all available tests from ops/, quantizer/, and misc/, but there are existing test files in backends/arm/test/ops/ (e.g. ops/test_acos.py, ops/test_arange.py, etc.) that are not included or called out as intentionally excluded. Either add the remaining tests (with comments for known exclusions) or adjust the description to match what’s actually being covered.
Summary:
Expand the arm backend test coverage in fbcode by adding all available
test files from ops/, quantizer/, and misc/ directories to targets.bzl.
Reviewed By: 3l1
Differential Revision: D96521268