This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Softmax microbenchmark comparing Torch and MLX on Apple Silicon. | |
The script measures six variants of softmax (manual/native implementations in | |
eager and compiled form) on identical all-ones inputs. Torch executes on MPS | |
while MLX runs on the Apple GPU. Each variant is verified once against the | |
``torch.softmax`` reference before timing. | |
Optionally set ``MTL_CAPTURE_ENABLED=1`` to record MLX Metal captures | |
while the correctness checks run. Traces are written to the current | |
directory. |