Skip to content

Arm backend: Add support to eq.Scalar #9715

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

Merged
merged 1 commit into from
Mar 28, 2025
Merged

Conversation

fumchin
Copy link
Collaborator

@fumchin fumchin commented Mar 27, 2025

Implement eq.Scalar by converting to eq.Tensor using replace_scalar_with_tensor_pass and match_arg_ranks_pass.

  • Convert eq.Tensor to eq.Scalar
  • Expand test_eq to test both eq.Tensor and eq.Scalar

cc @digantdesai @freddan80 @per @zingo @oscarandersson8218

Copy link

pytorch-bot bot commented Mar 27, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit d6cf513 with merge base d72ef5b (image):
💚 Looks good so far! There are no failures yet. 💚

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

@facebook-github-bot facebook-github-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 Mar 27, 2025
@fumchin fumchin added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm topic: not user facing ciflow/trunk labels Mar 27, 2025
Implement eq.Scalar by converting to eq.Tensor using replace_scalar_with_tensor_pass and match_arg_ranks_pass

Signed-off-by: Fang-Ching <[email protected]>
Change-Id: I9df5e95ad18b0ac2ceb9ff4295b728937ad147a7
Copy link
Collaborator

@zingo zingo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

@zingo zingo merged commit 7fc176d into pytorch:main Mar 28, 2025
165 checks passed
@kirklandsign
Copy link
Contributor

Hi @zingo seems that it broke some of our internal tests.

cc @zonglinpeng for more contexts

@zonglinpeng
Copy link
Contributor

Hi @zingo This diff breaks CI T219571006, introducing large loss in the model output. I verified the new eq scalar-to-tensor replacement caused the issue. Could you make make this replacement optional?

@zingo
Copy link
Collaborator

zingo commented Apr 1, 2025

Thanks for notifying us, just for my understanding is this test on Arm delegate or other delegates?

We have a follow up PR where we internally discussing if we should move this change to only run on Arm delegate (its our Pow PR) and Im wondering if that will solve the problems you see or if we should investigate more?

As we cant see the test you run we can only guess. Thanks a lot for your help and initial triage.

@kirklandsign
Copy link
Contributor

Hi @zingo, the broken test is on other delegates. Seems that this has impacts on all delegates? In this case, if we apply it to arm only, it would be ideal.

@zingo
Copy link
Collaborator

zingo commented Apr 1, 2025

Thanks for the response, that good news and a fix is almost already prepared by @martinlsm that we can start with and figure out the Arm delegate later.

@zingo
Copy link
Collaborator

zingo commented Apr 1, 2025

The PR we hope will fix this is merged now.
E g.
Add support for torch.pow in the Arm backend (PR #9309)

@zonglinpeng
Copy link
Contributor

thanks @zingo I will try if PR #9309 fixes on my delegate, thank you @kirklandsign for clarifying!

@kirklandsign
Copy link
Contributor

@zingo @zonglinpeng I tried applying this patch but seems that the test was not fixed

@martinlsm
Copy link
Collaborator

martinlsm commented Apr 2, 2025

@kirklandsign Which delegate are you using? Is it possible for us at Arm to reproduce?

From our view #9309 reverts what this PR (#9715) introduced for other delegates than Arm's. Because this PR changed the ReplaceScalarWithTensor pass globally (and specifically the eq op in there) which #9309 then reverted. So we try to understand how other delegates are affected after #9309 did the revert.

@kirklandsign
Copy link
Contributor

Hi @martinlsm the test is cadence backend. I am not sure how to repro, could @zonglinpeng provide context?

BTW seems that #9309 is not a clean revert of #9715 for that file. Is that related?

@zonglinpeng
Copy link
Contributor

zonglinpeng commented Apr 2, 2025 via email

kirklandsign pushed a commit that referenced this pull request Apr 11, 2025
Implement eq.Scalar by converting to eq.Tensor using
replace_scalar_with_tensor_pass and match_arg_ranks_pass.

* Convert eq.Tensor to eq.Scalar
* Expand test_eq to test both eq.Tensor and eq.Scalar

Signed-off-by: Fang-Ching <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants