Skip to content

Add support for aten.min.dim #12623

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

cccclai
Copy link
Contributor

@cccclai cccclai commented Jul 18, 2025

Differential Revision: D78526966

Copy link

pytorch-bot bot commented Jul 18, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/12623

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures

As of commit 23f09da with merge base 7a37676 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78526966

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 18, 2025
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@cccclai
Copy link
Contributor Author

cccclai commented Jul 18, 2025

@haowhsu-quic @shewu-quic @DannyYuyang-quic @winskuo-quic I ran into some issues to lower an internal model to QNN and this is one of the missing ops. I think the output are two nodes, while the regular min output is one node. Do you think we should re-use the op_min or have a different file to handle this case?

Summary:



Rollback Plan:

Differential Revision: D78526966
@cccclai cccclai force-pushed the export-D78526966 branch from 1069ff4 to 23f09da Compare July 18, 2025 00:15
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78526966

@cccclai cccclai marked this pull request as draft July 18, 2025 00:17
@cccclai
Copy link
Contributor Author

cccclai commented Jul 18, 2025

Actually, seems like the min operator in HTP doesn't support returning index, we may need to decompose min.dim, is it correct?

@haowhsu-quic
Copy link
Collaborator

haowhsu-quic commented Jul 18, 2025

Actually, seems like the min operator in HTP doesn't support returning index, we may need to decompose min.dim, is it correct?

Yes, looks like the most similar one is ReduceMin. But it cannot return index.
Maybe we can compose it with ReduceMin + ArgMin.

@DannyYuyang-quic
Copy link
Collaborator

Actually, seems like the min operator in HTP doesn't support returning index, we may need to decompose min.dim, is it correct?

Thanks for catching that, I’ll handle the min.dim op support

@cccclai
Copy link
Contributor Author

cccclai commented Jul 20, 2025

Actually, seems like the min operator in HTP doesn't support returning index, we may need to decompose min.dim, is it correct?

Thanks for catching that, I’ll handle the min.dim op support

Thanks! That will be super helpful. I find that we need to have 2 more ops...can we have the following ops supported?

                "aten.min.dim",
                "aten.logical_and.default",
                "aten.max.dim",

@DannyYuyang-quic
Copy link
Collaborator

DannyYuyang-quic commented Jul 21, 2025

Actually, seems like the min operator in HTP doesn't support returning index, we may need to decompose min.dim, is it correct?

Thanks for catching that, I’ll handle the min.dim op support

Thanks! That will be super helpful. I find that we need to have 2 more ops...can we have the following ops supported?

                "aten.min.dim",
                "aten.logical_and.default",
                "aten.max.dim",

Yes sure, could you please also share the source(testcase) for aten.logical_and.default~?

@cccclai
Copy link
Contributor Author

cccclai commented Jul 21, 2025

Something like this will be helpful

class LogicalAnd(torch.nn.Module):
    def __init__(self):
        super().__init__()

    def forward(self, x, y):
        return torch.logical_and(x, y)

a = torch.tensor([0, 1, 10, 0], dtype=torch.int8)
b = torch.tensor([4, 0, 1, 0], dtype=torch.int8)
model = LogicalAnd()
example_inputs = (a, b)
model(*example_inputs)

@DannyYuyang-quic
Copy link
Collaborator

Something like this will be helpful

class LogicalAnd(torch.nn.Module):
    def __init__(self):
        super().__init__()

    def forward(self, x, y):
        return torch.logical_and(x, y)

a = torch.tensor([0, 1, 10, 0], dtype=torch.int8)
b = torch.tensor([4, 0, 1, 0], dtype=torch.int8)
model = LogicalAnd()
example_inputs = (a, b)
model(*example_inputs)

aten.min.dim and aten.max.dim are almost ready, I’ll push the PR once internal CI passes.

Regarding logical_and, it seems that int8 inputs are not supported, the ElementWiseAnd only accepts UFIXED_POINT_8, SFIXED_POINT_8, or BOOL_8. Is int8 part of your internal model in FP mode?

DannyYuyang-quic pushed a commit to CodeLinaro/executorch that referenced this pull request Jul 21, 2025
Summary:



Rollback Plan:

Differential Revision: D78526966
DannyYuyang-quic pushed a commit to CodeLinaro/executorch that referenced this pull request Jul 21, 2025
Summary:



Rollback Plan:

Differential Revision: D78526966
DannyYuyang-quic pushed a commit to CodeLinaro/executorch that referenced this pull request Jul 22, 2025
Summary:



Rollback Plan:

Differential Revision: D78526966
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants