PyTorch: [MPS] Migrate hardtanh_backward to Metal (#200791)
Fixes #200790 Replaces the MPSGraph implementation of hardtanh_backward with a native Metal kernel.
Executive Summary
Fixes #200790 Replaces the MPSGraph implementation of hardtanh_backward with a native Metal kernel. Performance Layout Shape Dtype MPSGraph (µs) Metal (µs) Speedup contiguous 1024 float32 12.73 5.16 2.47x contiguous 1024 float16 12.62 5.03 2.51x contiguous 1024 bfloat16 13.14 5.05 2.60x contiguous 1024x1024 float32 54.46 55.35 0.98x contiguous 1024x1024 float16 28.26 28.73 0.98x contiguous 1024x1024 bfloat16 28.25 28.45 0.99x contiguous 8x1024x1024 float32 838.45 814.76 1.03x contiguous 8x1024x1024 float16 491.88 434.51 1.13x contiguous 8x1024x1024 bfloat16 492.49 420.68 1.17x contiguous 1048576 float32 54.42 54.53 1.00x contiguous 32x1024x1024 float32 3506.70 3465.89...
Distribution Engineering & Packaging Ecosystem Audit
From a Linux distribution, deployment reliability, and systems engineering perspective: - **Dependency Determinism:** Declarative and isolated package trees guarantee reproducible execution across production hosts. - **Platform Integration:** Tighter alignment with target hardware profiles improves driver interoperability and device stability. - **Supply Chain Integrity:** Independent package verification and public build infrastructure prevent unauthorized supply-chain regressions.
Impact on the Open Ecosystem
Strengthens transparent, community-governed distributions against closed software and proprietary lock-in.