mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[MPS] [BE] Use direct call vs virtual (#140950)
I.e. replace `at::detail::getMPSHooks().isOnMacOSorNewer` with `is_macos_13_or_newer`, which is a direct function call instead of going thru a virtual method call Hooks are only needed to provide a feature-agnostic inteface to query something even on the platforms that might not have support for the featuee, while functions implemented in `ATen/native/xxx` should be able to call those platform specific methods directly Pull Request resolved: https://github.com/pytorch/pytorch/pull/140950 Approved by: https://github.com/Skylion007 ghstack dependencies: #140896
This commit is contained in:
committed by
PyTorch MergeBot
parent
4eed438a42
commit
e46af7de0c
@ -165,7 +165,7 @@ static Tensor _mps_convolution_impl(const Tensor& input_t_,
|
||||
}
|
||||
TensorArg output{output_t, "result", 0};
|
||||
|
||||
if (!::at::detail::getMPSHooks().isOnMacOSorNewer(15, 1)) {
|
||||
if (!is_macos_13_or_newer(MacOSVersion::MACOS_VER_15_1_PLUS)) {
|
||||
// On macOS < 15.1, MPS convolution kernel does not support output channels > 2^16
|
||||
for (auto elem : output_t.sizes()) {
|
||||
TORCH_CHECK_NOT_IMPLEMENTED(elem <= (1 << 16), "Output channels > 65536 not supported at the MPS device. ");
|
||||
@ -373,7 +373,7 @@ static Tensor mps_convolution_backward_input(IntArrayRef input_size,
|
||||
using namespace mps;
|
||||
bool is3DConv = grad_output_t.dim() == 5;
|
||||
|
||||
if (!::at::detail::getMPSHooks().isOnMacOSorNewer(15, 1)) {
|
||||
if (!is_macos_13_or_newer(MacOSVersion::MACOS_VER_15_1_PLUS)) {
|
||||
// On macOS < 15.1, MPS convolution kernel does not support output channels > 2^16
|
||||
for (auto elem : grad_output_t.sizes()) {
|
||||
TORCH_CHECK_NOT_IMPLEMENTED(elem <= (1 << 16), "Output channels > 65536 not supported at the MPS device. ");
|
||||
|
Reference in New Issue
Block a user