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

Fix DecomposeMultiDimSqueeze callback failure #52

Merged

Conversation

meenakshiramanathan1
Copy link
Contributor

@meenakshiramanathan1 meenakshiramanathan1 commented Dec 10, 2024

Fixes #642

@nvukobratTT
Copy link
Contributor

@meenakshiramanathan1 can you provide a bit more context to this PR. Here are few questions I'm interested in:

  1. The one @dgolubovicTT already asked, are we testing this path? If no, let's try to reproduce this with simple op test.
  2. What are the results with and without your fix?
    • Before the change, you end up with failure in DecomposeMultiDimSqueeze
    • What about when you add this fix? Howe this multi-dim squeeze is further lowered in FFE, and latter on into MLIR? Can you share some reportify graphs for few compile stages (both TVM and FFE), as well a TTIR?
    • If you're unable to create simple unit test to cover this one, let's see screenshots from the original model.

@meenakshiramanathan1
Copy link
Contributor Author

meenakshiramanathan1 commented Dec 28, 2024

@meenakshiramanathan1 can you provide a bit more context to this PR. Here are few questions I'm interested in:

  1. The one @dgolubovicTT already asked, are we testing this path? If no, let's try to reproduce this with simple op test.

  2. What are the results with and without your fix?

    • Before the change, you end up with failure in DecomposeMultiDimSqueeze
    • What about when you add this fix? Howe this multi-dim squeeze is further lowered in FFE, and latter on into MLIR? Can you share some reportify graphs for few compile stages (both TVM and FFE), as well a TTIR?
    • If you're unable to create simple unit test to cover this one, let's see screenshots from the original model.
  1. Tried testing this path with dynamic inputs but in the all cases of trying to create dynamic inputs , it is ending up with formation of argwhere which is not supported in forge yet
    For example,
def test_dynamic_multi_squeeze(test_device):
    class Multi_Squeeze(torch.nn.Module):
        def __init__(self):
            super().__init__()

        def forward(self, input):
            mask = input > 5
            indices = torch.nonzero(mask)
            squeezed_tensor = indices.squeeze(0)
            return squeezed_tensor

Here non_zero is mapped to argwhere which was one of the cases which was tried, so if we want to test this out further , argwhere op tvm decomposition should be brought in.

Before fix , graps are dumped till relay passes.
Screenshot 2024-12-28 at 9 09 31 AM
While after fix, it is progressing till forge_passes
Screenshot 2024-12-28 at 9 09 37 AM

  1. With my fix , model is ending up with argwhere unsupported and without my fix, it would end up with this error.

  2. Screenshots from original model which is causing dynamic shapes:

Screenshot 2024-12-28 at 9 01 58 AM

@nvukobratTT
Copy link
Contributor

@meenakshiramanathan1

Tried testing this path with dynamic inputs but in the all cases of trying to create dynamic inputs , it is ending up with formation of argwhere which is not supported in forge yet

Thanks for the details! We're pushing the effort on outlining what and how our indexing should work.

Here non_zero is mapped to argwhere which was one of the cases which was tried, so if we want to test this out further , argwhere op tvm decomposition should be brought in.

Before fix , graps are dumped till relay passes.

Can you send actually screenshot of the graph? I'm interested in graph structure changes, rather than compile depth.

@meenakshiramanathan1
Copy link
Contributor Author

@meenakshiramanathan1

Tried testing this path with dynamic inputs but in the all cases of trying to create dynamic inputs , it is ending up with formation of argwhere which is not supported in forge yet

Thanks for the details! We're pushing the effort on outlining what and how our indexing should work.

Here non_zero is mapped to argwhere which was one of the cases which was tried, so if we want to test this out further , argwhere op tvm decomposition should be brought in.
Before fix , graps are dumped till relay passes.

Can you send actually screenshot of the graph? I'm interested in graph structure changes, rather than compile depth.

I will send this information.

@meenakshiramanathan1
Copy link
Contributor Author

@meenakshiramanathan1

Tried testing this path with dynamic inputs but in the all cases of trying to create dynamic inputs , it is ending up with formation of argwhere which is not supported in forge yet

Thanks for the details! We're pushing the effort on outlining what and how our indexing should work.

Here non_zero is mapped to argwhere which was one of the cases which was tried, so if we want to test this out further , argwhere op tvm decomposition should be brought in.
Before fix , graps are dumped till relay passes.

Can you send actually screenshot of the graph? I'm interested in graph structure changes, rather than compile depth.

Screenshot 2025-01-09 at 3 41 16 PM Screenshot 2025-01-09 at 3 43 59 PM

@meenakshiramanathan1 meenakshiramanathan1 force-pushed the mramanathan/decompose_multi_dim_squeeze_tvm branch from 396ac87 to 8f67e84 Compare January 17, 2025 02:01
@meenakshiramanathan1 meenakshiramanathan1 force-pushed the mramanathan/decompose_multi_dim_squeeze_tvm branch from 8f67e84 to 3e17dbe Compare January 17, 2025 02:03
@meenakshiramanathan1 meenakshiramanathan1 merged commit 4304c2f into main Jan 17, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError in DecomposeMultiDimSqueeze TVM callback in densenet xray variant
3 participants