Repository navigation
Conversation
…, and Samsung conv1d
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22373
Note: Links to docs will display an error until the docs builds have been completed.
|
@pytorchbot label "release notes: none" |
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Thanks @AxelNoun, running CI again |
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Thanks ! @nil-is-all |
|
Thanks @nil-is-all. I triaged the 6 failures on 12c3858. All of them are already present on the merge base df6147a, none come from this PR:
The workflows check out the PR head rather than a merge with main, so re-running on 12c3858 would reproduce the same six reds, since the fixes only landed after df6147a. Happy to merge main in (500849b is green on all of these) if you'd prefer a green run; otherwise this should be reviewable as is. @digantdesai, could you take a look? |
Hi @AxelNoun, I agree the CI failures seem irrelevant. Would like to get a final OK from @digantdesai and then merge. Thanks for the ping |
| quant_params.axis = 0 | ||
| else: | ||
| assert f"Unsupported weight per channel quantization axis for depthwise conv2d / conv_transpose2d : {quant_params.axis}, expecting 0 / 1." | ||
| check_or_raise( |
There was a problem hiding this comment.
shoudln't we use 'why()'?
There was a problem hiding this comment.
why() here is WhyNoPartition (exir/backend/utils.py), and every call to it in this backend sits in partition/config/*.py, or in a pass that receives it as an argument: it logs a reason and the caller returns False, so the node is left on CPU. define_tensor runs after partitioning, at serialization time, so there is no why in scope and nothing left to decline. The options here are to raise or to serialize a wrong axis silently. I used the helper this file already uses (four other check_or_raise calls), and op_conv2d.py performs these same two axis checks one level up (lines 88 and 93), which is why this else should be unreachable on the conv2d path.
Your question did surface two things, though.
First, check_or_raise(False, ...) is the only literal-False call in the repo. Happy to give it a real condition, which also drops the else:
check_or_raise(
quant_params.axis in (0, 1),
f"Unsupported weight per channel quantization axis for depthwise conv2d / conv_transpose2d : {quant_params.axis}, expecting 0 / 1.",
)
if quant_params.axis == 0:
quant_params.axis = len(dims) - 1
else:
quant_params.axis = 0Second, ConvolutionConfig.check_constraints uses why() for the transpose per-channel axis (gemm_configs.py:406), but there is no equivalent gate for the depthwise one. A per-channel depthwise conv with axis != 0 is therefore partitioned and then raises at op_conv2d.py:93, instead of staying on CPU. The axis is read verbatim from the dequant node's 4th arg (quant_params.py:272), so a quantizer other than XNNPACKQuantizer can produce it. Would you like that why() gate added here, or kept out of this PR (which only makes dead guards fire) and done as a follow-up?
|
Please rebase, and make sure CI is green. Thanks. |
…ecks # Conflicts: # export/export.py
|
@digantdesai I merged Two checks are red. Neither is related to the change, which touches three Python files and adds one test, with no Android or C++ code:
|
Summary
Error-guard sites that construct a failure which cannot actually fire. This PR inserts the missing
raise(or replaces an always-trueassertwith the file's existingcheck_or_raise) so the documented failure mode is the one callers see.Updated for
mainat 5e21c13: the twoExportSessionguards were fixed upstream in the meantime by #21748, so the only code change left inexport/export.pyis the message typo. The regression tests for those two guards are kept, since nothing else covers them.maintodayexport/export.pyExportSession.print_delegation_inforaise(#21748). Remaining here: the message says "atleast", and no test pins either guard.ExportSessionis inexecutorch.export.__all__and is@experimental. A pipeline with no lowering stage, or one that listsTO_EDGE_TRANSFORM_AND_LOWER/TO_BACKENDwithout having run it, reaches each guard. This PR fixes the wording and addsexport/tests/test_print_delegation_info.pyfor both.backends/xnnpack/operators/node_visitor.pyper-channel axiselseassert f"Unsupported weight per channel quantization axis ...": the f-string is always truthy, so the assertion never fires. Anassertwould also disappear underpython -O.swap_in_out_for_weights=Trueisbackends/xnnpack/operators/op_conv2d.py:102, and that visitor alreadycheck_or_raises the axis to0(depthwise) or1(transpose) beforedefine_tensor. This change restores a guard that can actually raise if thatelseis ever entered; it does not fix a mis-serialized.pteon the current conv2d path.backends/samsung/_passes/conv1d_to_conv2d.pyupdate_kernelelseRuntimeError("Weight of 1d conv should be constant tensor or Parameter obj")is built and discarded;weight_node.meta["val"]is still unsqueezed.mainby #22725). Theelseis the leftover for a weight that is none of those. This change only makes that documentedRuntimeErroractually raise if the branch is entered.Test plan
Tests cover only the two reachable
ExportSessionguards. There is intentionally no test for the XNNPACKelseand none for the Samsungelse: both are unreachable on a normal export, and a test that injects that state would exercise a situation the production callers do not produce.export/testsis already inpytest.initestpaths:Measured on 89cf698 (merge of
main5e21c13), CPython 3.12, torch 2.15.0.dev20261004+cpu:export/tests/test_print_delegation_info.py: 2 passed.git checkout origin/main -- export/export.py, same run:AssertionError: 'at least one of the lowering stages' not found in 'No delegation info available, atleast one of the lowering stages should be present', 1 failed / 1 passed.pytest export/tests --ignore=export/tests/test_target_recipes.py: 8 failed / 172 passed on this branch, and the same 8 failed / 170 passed onmainalone. The 8 are a local-environment gap (exir/_serialize/program.fbsis copied in by the build, which this checkout has not run), not a regression.test_target_recipes.pydoes not collect locally (nocoremltools).CI
Merged
maininto the branch. The conflict inexport/export.pywas resolved in favour ofmain's_raise_if_releasedcall, keeping the typo fix. The six reds triaged earlier on 12c3858 came from the merge base and their upstream fixes (#22802, #22754) are now in this branch.Two checks are still red on 89cf698, neither of them from this change:
pull / android / run-emulator: the emulator boots (sys.boot_completedreturns 1), andreactivecircus/android-emulator-runnerthen fails on its own post-bootadb shell input keyevent 82withcmd: Failure calling service input: Broken pipe (32), exit code 224. That step runs before the job script, and the log carries no output fromscripts/run_android_emulator.sh. The same job also failed onmainat efc7f2e when checked on 2026-10-06, and passed on the sevenmainruns before it.MLTEC_elastic - GitHubPOC(NXP Bamboo): outside this repository's workflows, and red on other PRs too, not just this one: of eight open PRs untouched since 2026-10-05, two carry this status and both are red. Here the status wentpendingat 2026-10-05T07:01:25Z andfailureone second later, which reads as a trigger-side failure rather than anything built from this branch, but the build log is on an internal host so I cannot confirm that from here.This change touches three Python files and adds one test.
cc @nil-is-all @digantdesai