Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inappropriate detection of dynamic dimensions in executorch/backends/xnnpack/operators/op_squeeze.py #5794

Open
ezyang opened this issue Oct 1, 2024 · 1 comment
Assignees
Labels
module: xnnpack Issues related to xnnpack delegation

Comments

@ezyang
Copy link
Contributor

ezyang commented Oct 1, 2024

🐛 Describe the bug

You have this logic:

        num_dynamic_dims = 0
        for dim in dynamic_shape:
            if isinstance(dim, torch.SymInt):
                num_dynamic_dims += 1
                new_shape.append(0)
            else:
                new_shape.append(dim)

        check_or_raise(
            num_dynamic_dims <= 1,
            "XNNPACK reshape only supports 1 dynamic dimension. This may occur when ",
        )

This is not the right way to detect how many dynamic dimensions are going into the squeeze call. For one, you could potentially have a SymInt which internally contains a constant int (we try to decay this ASAP, but if you have a SymInt in hand and then later we do a replacement that refines it to an int, you are still going to have a SymInt.)

I think probably what's more right is to call free_symbols(dim). When there are no free symbols, you are convertible to int, which is what this code is trying to do right?

Versions

main

@ezyang
Copy link
Contributor Author

ezyang commented Oct 2, 2024

cc @mcr229 @digantdesai

@iseeyuan iseeyuan added the module: xnnpack Issues related to xnnpack delegation label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: xnnpack Issues related to xnnpack delegation
Projects
None yet
Development

No branches or pull requests

3 participants