Repository navigation
Conversation
operator.ne, operator.and_ and operator.or_ on symbolic sizes had no executorch_prim op, so to_executorch() failed with an invalid target. Add ne.Scalar, and sym_and.Scalar and sym_or.Scalar for two bools, and reject a bitwise & or | between SymInts in the edge verifier instead of lowering it to a kernel that would fail at run time.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/25911
Note: Links to docs will display an error until the docs builds have been completed.
|
Contributor
Author
|
@pytorchbot label "release notes: ops & kernels" |
This branch has not been deployed
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
operator.ne,operator.and_andoperator.or_on symbolic sizes had noexecutorch_primop, soto_executorch()failed withinvalid target for call_function(reproduction in #25910). This addsexecutorch_prim::ne.Scalar, on the model ofeq.Scalar, andsym_and.Scalar/sym_or.Scalar, which take two bools likesym_nottakes one.A bitwise
&or|between two SymInts is still not supported: the edge verifier now rejects it into_edge(), as it already does for floatsym_max/sym_min, instead of letting it lower to a kernel that would fail at run time.This adds entries next to the ones #25773 adds for
floor; whichever lands second, I will rebase it.Fixes #25910
Test plan
test_emit_sym_ne_and_orexports a model using the three operators on a dynamic size, checks they are in the graph, lowers it with the default config and runs it for sizes that make each predicate true and false.test_int_sym_and_or_rejectedchecks the verifier error. The C++ tests check the kernels and theirInvalidTypeerrors. Before the change the Python tests failed and the C++ tests did not find the kernels.pytest exir runtime/test kernels/quantized/testfails only where it already fails on main in my build (XNNPACK and demo backends, not built).This PR was authored with the help of Claude Code (Anthropic); I reviewed and tested it.
cc @nil-is-all