Skip to content

[MPS][BE] Extend torch.special. to integer dtypes#155002

Closed
malfet wants to merge 3 commits intogh/malfet/373/basefrom
gh/malfet/373/head
Closed

[MPS][BE] Extend torch.special. to integer dtypes#155002
malfet wants to merge 3 commits intogh/malfet/373/basefrom
gh/malfet/373/head

Conversation

@malfet
Copy link
Contributor

@malfet malfet commented Jun 3, 2025

Stack from ghstack (oldest at bottom):

By changing the functor to looks as follows

struct xlog1py_functor {
  template <typename T, enable_if_t<is_floating_point_v<T>, bool> = true>
  inline T operator()(const T a, const T b) {
    return static_cast<T>(c10::metal::xlog1py(a, b));
  }
  template <typename T, enable_if_t<is_integral_v<T>, bool> = true>
  inline float operator()(const T a, const T b) {
    return c10::metal::xlog1py(float(a), float(b));
  }
};

Repeat the same for zeta, chebyshev_polynomial_[tuvw]_functor and hermite_polynomial_h[e]_functor

[ghstack-poisoned]
@malfet malfet requested a review from kulinseth as a code owner June 3, 2025 14:19
@pytorch-bot
Copy link

pytorch-bot bot commented Jun 3, 2025

🔗 Helpful Links

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

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

⏳ No Failures, 20 Pending

As of commit 7c32ff8 with merge base 0fab322 (image):
💚 Looks good so far! There are no failures yet. 💚

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

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 Jun 3, 2025
@malfet malfet requested review from Skylion007 and dcci June 3, 2025 14:21
@malfet malfet added the topic: improvements topic category label Jun 3, 2025
[ghstack-poisoned]
@Skylion007 Skylion007 changed the title [MPS][BE] Extend torch.special.xlog1py to intergers [MPS][BE] Extend torch.special.xlog1py to integers Jun 3, 2025
@Skylion007 Skylion007 added the better-engineering Relatively self-contained tasks for better engineering contributors label Jun 3, 2025
[ghstack-poisoned]
malfet added a commit that referenced this pull request Jun 3, 2025
And may be other special ops as well, depending on how many workaround
for compiler crashes one has to do to make it work on MacOS-13

ghstack-source-id: 93599b5
Pull Request resolved: #155002
@malfet malfet changed the title [MPS][BE] Extend torch.special.xlog1py to integers [MPS][BE] Extend torch.special. to integer dtypes Jun 3, 2025
@malfet
Copy link
Contributor Author

malfet commented Jun 3, 2025

@pytorchbot merge -f "Lint + MPS 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

pytorchmergebot pushed a commit to Eliasj42/pytorch that referenced this pull request Jun 3, 2025
By changing the functor to looks as follows
```metal
struct xlog1py_functor {
  template <typename T, enable_if_t<is_floating_point_v<T>, bool> = true>
  inline T operator()(const T a, const T b) {
    return static_cast<T>(c10::metal::xlog1py(a, b));
  }
  template <typename T, enable_if_t<is_integral_v<T>, bool> = true>
  inline float operator()(const T a, const T b) {
    return c10::metal::xlog1py(float(a), float(b));
  }
};
```

Repeat the same for `zeta`, `chebyshev_polynomial_[tuvw]_functor` and `hermite_polynomial_h[e]_functor`
Pull Request resolved: pytorch#155002
Approved by: https://github.com/Skylion007, https://github.com/dcci
ghstack dependencies: pytorch#154936
pytorchmergebot pushed a commit that referenced this pull request Jun 4, 2025
That creates _kernel_mps function that takes iterator and calls stub for
it
Pull Request resolved: #155081
Approved by: https://github.com/dcci
ghstack dependencies: #154936, #155002
pytorchmergebot pushed a commit that referenced this pull request Jun 4, 2025
iupaikov-amd pushed a commit to ROCm/pytorch that referenced this pull request Jun 4, 2025
By changing the functor to looks as follows
```metal
struct xlog1py_functor {
  template <typename T, enable_if_t<is_floating_point_v<T>, bool> = true>
  inline T operator()(const T a, const T b) {
    return static_cast<T>(c10::metal::xlog1py(a, b));
  }
  template <typename T, enable_if_t<is_integral_v<T>, bool> = true>
  inline float operator()(const T a, const T b) {
    return c10::metal::xlog1py(float(a), float(b));
  }
};
```

Repeat the same for `zeta`, `chebyshev_polynomial_[tuvw]_functor` and `hermite_polynomial_h[e]_functor`
Pull Request resolved: pytorch#155002
Approved by: https://github.com/Skylion007, https://github.com/dcci
ghstack dependencies: pytorch#154936
iupaikov-amd pushed a commit to ROCm/pytorch that referenced this pull request Jun 4, 2025
That creates _kernel_mps function that takes iterator and calls stub for
it
Pull Request resolved: pytorch#155081
Approved by: https://github.com/dcci
ghstack dependencies: pytorch#154936, pytorch#155002
iupaikov-amd pushed a commit to ROCm/pytorch that referenced this pull request Jun 4, 2025
angelayi pushed a commit to angelayi/pytorch that referenced this pull request Jun 5, 2025
By changing the functor to looks as follows
```metal
struct xlog1py_functor {
  template <typename T, enable_if_t<is_floating_point_v<T>, bool> = true>
  inline T operator()(const T a, const T b) {
    return static_cast<T>(c10::metal::xlog1py(a, b));
  }
  template <typename T, enable_if_t<is_integral_v<T>, bool> = true>
  inline float operator()(const T a, const T b) {
    return c10::metal::xlog1py(float(a), float(b));
  }
};
```

Repeat the same for `zeta`, `chebyshev_polynomial_[tuvw]_functor` and `hermite_polynomial_h[e]_functor`
Pull Request resolved: pytorch#155002
Approved by: https://github.com/Skylion007, https://github.com/dcci
ghstack dependencies: pytorch#154936
angelayi pushed a commit to angelayi/pytorch that referenced this pull request Jun 5, 2025
That creates _kernel_mps function that takes iterator and calls stub for
it
Pull Request resolved: pytorch#155081
Approved by: https://github.com/dcci
ghstack dependencies: pytorch#154936, pytorch#155002
angelayi pushed a commit to angelayi/pytorch that referenced this pull request Jun 5, 2025
@github-actions github-actions bot deleted the gh/malfet/373/head branch July 4, 2025 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

better-engineering Relatively self-contained tasks for better engineering contributors ciflow/mps Run MPS tests (subset of trunk) Merged release notes: mps Release notes category topic: improvements topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants