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

[MPS] Fwd-fix for clamp regression #122148

Closed
wants to merge 1 commit into from
Closed

Conversation

malfet
Copy link
Contributor

@malfet malfet commented Mar 19, 2024

Forward fix for regressions introduced by #121381 as we failed to run MPS CI twice on it

  • Do not call minimumWithNaNPropagationWithPrimaryTensor for integral tensors as it will crash with
      /AppleInternal/Library/BuildRoots/ce725a5f-c761-11ee-a4ec-b6ef2fd8d87b/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Utility/MPSKernelDAG.mm:805: failed assertion `Error getting visible function: (null) Function isNaN_i16_i8 was not found in the library'
    
  • Change the order of max and min call as it's apparently important for
    consistency, as min(max(a, b), c) might not equal to max(min(a, c), b) if c is not always less or equal than b

Forward fix for regresion introdcued by
#121381

- Do not call `minimumWithNaNPropagationWithPrimaryTensor` for integer
  typed tensors as it will crash with
  ```
    /AppleInternal/Library/BuildRoots/ce725a5f-c761-11ee-a4ec-b6ef2fd8d87b/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Utility/MPSKernelDAG.mm:805: failed assertion `Error getting visible function:
 (null) Function isNaN_i16_i8 was not found in the library'
   ```
- Change the order of max and min call as it's apparently important for
  consistency, as `min(max(a, b), c)` might not equal to `max(min(a, c), b)` if `c` is not always less or equal than `b`
@malfet malfet requested a review from kulinseth as a code owner March 19, 2024 00:03
Copy link

pytorch-bot bot commented Mar 19, 2024

🔗 Helpful Links

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

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

✅ No Failures

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

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

@pytorch-bot pytorch-bot bot added ciflow/mps Run MPS tests (subset of trunk) release notes: mps Release notes category labels Mar 19, 2024
@malfet malfet requested a review from huydhn March 19, 2024 00:05
@malfet malfet added the topic: bug fixes topic category label Mar 19, 2024
@malfet
Copy link
Contributor Author

malfet commented Mar 19, 2024

@pytorchbot merge -f "Lint and MPS tests are green"

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@malfet malfet deleted the malfet/mps-fix-clamp-regression branch March 19, 2024 22:39
@huydhn
Copy link
Contributor

huydhn commented Apr 4, 2024

@pytorchbot cherry-pick --onto release/2.3 --fixes #120899 -c critical

pytorchbot pushed a commit that referenced this pull request Apr 4, 2024
Forward fix for regressions introduced by #121381 as we failed to run MPS CI twice on it

- Do not call `minimumWithNaNPropagationWithPrimaryTensor` for integral tensors as it will crash with
  ```
    /AppleInternal/Library/BuildRoots/ce725a5f-c761-11ee-a4ec-b6ef2fd8d87b/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Utility/MPSKernelDAG.mm:805: failed assertion `Error getting visible function: (null) Function isNaN_i16_i8 was not found in the library'
   ```
- Change the order of max and min call as it's apparently important for
  consistency, as `min(max(a, b), c)` might not equal to `max(min(a, c), b)` if `c` is not always less or equal than `b`

Pull Request resolved: #122148
Approved by: https://github.com/huydhn

(cherry picked from commit 34f36a2)
@pytorchbot
Copy link
Collaborator

Cherry picking #122148

The cherry pick PR is at #123381 and it is linked with issue #120899

Details for Dev Infra team Raised by workflow job

@huydhn
Copy link
Contributor

huydhn commented Apr 4, 2024

@pytorchbot cherry-pick --onto release/2.3 --fixes #120899 -c critical

@pytorchbot
Copy link
Collaborator

Cherry picking #122148

Command git -C /home/runner/work/pytorch/pytorch rebase origin/cherry-pick-122148-by-pytorch_bot_bot_ returned non-zero exit code 1

Rebasing (1/2)
Auto-merging aten/src/ATen/native/mps/operations/TensorCompare.mm
CONFLICT (content): Merge conflict in aten/src/ATen/native/mps/operations/TensorCompare.mm
error: could not apply b67b2772686... Fix torch.clamp in MPS to handle NaN correctly (#121381) (#122785)
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply b67b2772686... Fix torch.clamp in MPS to handle NaN correctly (#121381) (#122785)
Details for Dev Infra team Raised by workflow job

huydhn pushed a commit that referenced this pull request Apr 4, 2024
Forward fix for regressions introduced by #121381 as we failed to run MPS CI twice on it

- Do not call `minimumWithNaNPropagationWithPrimaryTensor` for integral tensors as it will crash with
  ```
    /AppleInternal/Library/BuildRoots/ce725a5f-c761-11ee-a4ec-b6ef2fd8d87b/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Utility/MPSKernelDAG.mm:805: failed assertion `Error getting visible function: (null) Function isNaN_i16_i8 was not found in the library'
   ```
- Change the order of max and min call as it's apparently important for
  consistency, as `min(max(a, b), c)` might not equal to `max(min(a, c), b)` if `c` is not always less or equal than `b`

Pull Request resolved: #122148
Approved by: https://github.com/huydhn
huydhn added a commit that referenced this pull request Apr 4, 2024
Forward fix for regressions introduced by #121381 as we failed to run MPS CI twice on it

- Do not call `minimumWithNaNPropagationWithPrimaryTensor` for integral tensors as it will crash with
  ```
    /AppleInternal/Library/BuildRoots/ce725a5f-c761-11ee-a4ec-b6ef2fd8d87b/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Utility/MPSKernelDAG.mm:805: failed assertion `Error getting visible function: (null) Function isNaN_i16_i8 was not found in the library'
   ```
- Change the order of max and min call as it's apparently important for
  consistency, as `min(max(a, b), c)` might not equal to `max(min(a, c), b)` if `c` is not always less or equal than `b`

Pull Request resolved: #122148
Approved by: https://github.com/huydhn

Co-authored-by: Nikita Shulga <nikita.shulga@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/mps Run MPS tests (subset of trunk) Merged release notes: mps Release notes category topic: bug fixes topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants