Raise inoperative error guards in ExportSession, XNNPACK node_visitor, and Samsung conv1d - #22373
Open
AxelNoun wants to merge 1 commit into
Open
Raise inoperative error guards in ExportSession, XNNPACK node_visitor, and Samsung conv1d#22373AxelNoun wants to merge 1 commit into
AxelNoun wants to merge 1 commit into
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.
|
Contributor
Author
@pytorchbot label "release notes: none" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four error-guard sites construct a failure that 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.export/export.pyExportSession.print_delegation_info, empty lowering-stage setRuntimeError(...)is built and discarded;lowering_stage[0]then raisesIndexError: list index out of rangeExportSessionis inexecutorch.export.__all__and is@experimental. Callingprint_delegation_info()on a session whose pipeline has no lowering stage hits this path.export/export.pyprint_delegation_info, lowering stage listed but not runRuntimeError(...)is built and discarded;None.get_context(...)then raisesAttributeError: 'NoneType' object has no attribute 'get_context'TO_EDGE_TRANSFORM_AND_LOWER(orTO_BACKEND) but has not run that stage hits this path.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.elseis the leftover for a weight that is none of those. This change only makes that documentedRuntimeErroractually raise if the branch is entered.print_delegation_infoalso corrects the message "atleast" → "at least".Test plan
Tests are included only for the two reachable sites (F3a). There is intentionally no test for the XNNPACK
else(F2) and none for the Samsungelse(F3b): 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/tests/test_print_delegation_info.pycovers the twoExportSessionguards (export/testsis already inpytest.initestpaths):On
6755ea388ce6d2249d26f568c286a153ccba4883:IndexError: list index out of rangeandAttributeError: 'NoneType' object has no attribute 'get_context'RuntimeErrorand the documented messagesF2:
op_conv2d.pyalready rejectsaxis ∉ {0, 1}beforedefine_tensor. No AST test and no injected-axis test is in this PR.F3b: a normal Parameter / lifted-constant conv1d does not enter the
else. No monkeypatch test is in this PR. The change only restores theRuntimeErrorthe source already spelled out, if that branch is ever entered.A separate, two-line cleanup (duplicate dataclass fields in
examples/models/llama/model_args.pyandexir/serde/schema.py) is available asdiffere-f4.patchif a follow-up PR is wanted; it is not part of this change.