Repository navigation
feat(benchmarks): add a compiled PyTorch reference bar to the release figure - #25
Merged
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
benchmark_releaseshows how much fasteraether-mlgot between versions, but not how it compares with an established framework. This PR adds PyTorch as a reference on the same CNN and GPU, drawn as a third bar on that GPU's panel.Commits are split into the move of the shared helpers into
common.py, which is mechanical, and the PyTorch script, plot changes, docs and the RX 9070 XT and RTX 3050 results.PyTorch reference
cifar10_torch.pytrains the v1 CNN with the same batch standardization, label-smoothed loss, L2 term, accuracy and AdamW step as Aether, undercifar10_breakdown.py's timing protocol. It runs in its own process because importing CuPy and PyTorch together aborts with an LLVM error, andplot.pyjoins the two result files. A parameter count check stops the script if the model stops matchingbuild_model.The whole step goes through
torch.compile, with fp16 autocast and no loss scaling. It's a reference point and not a tuned ceiling.Aether v1.2 is 2.1× faster than v1.1 on the RX 9070 XT (10.2 → 4.86 ms/step) and 2.3× faster on the RTX 3050 (49.9 → 21.7 ms/step). On the RX 9070 XT it beats compiled PyTorch. On the RTX 3050 it doesn't: compiled PyTorch is faster there, and Aether is only slightly behind eager PyTorch (20.0 ms).
The layout stays NCHW on both GPUs.
channels_lastalone reverts to NCHW at the first conv, so the NHWC rows also needPYTORCH_MIOPEN_SUGGEST_NHWC=1, and real NHWC is much slower on this GPU.cudnn.benchmarkdoesn't change it. Compiled NHWC avoids them, which fits Inductor replacing the batch-norm calls with its own fused kernels, but I didn't test that directly.The comparison isn't exact in three ways:
aetherkeeps them fp32.Shared helpers
cifar10_torch.pycan't import fromcifar10_breakdown.pywithout loading CuPy. The constants,load_train,spreadand the run metadata move tocommon.py, which imports neither library.Behavior changes
None. Nothing in
aether/changed. PyTorch is only needed bycifar10_torch.pyand isn't added topyproject.toml.A
torch_<gpu>.jsonnext to a GPU's breakdown result adds the bar to that GPU's panel. A GPU without one draws as before.Testing
python3 -m unittest discover tests: 1190 tests pass on NumPy and CuPy (78 skipped).aether/changed.cifar10_breakdown.pyafter the refactor on the RX 9070 XT: 4.855 ms/step, matching the saved result.cifar10_torch.pyon the RTX 3050 on PyTorch2.12.0+cu132withtriton-windows3.9.0 (torch.compilehas no Triton on Windows otherwise): 16.87 ms/step, median of 3 (min 16.83, max 16.88). The first compiled step took about 86 s.plot.pyand viewed the light and darkbenchmark_releasefor layout and labels.torch_*.jsonfiles recorddirty: true, from uncommitted trees atfc06f99(RX 9070 XT) and29c71e3(RTX 3050). Nothing inaether/is used by that script.Follow-ups (out of scope)
pyproject.tomlversion to 1.2.0 in a separate PR.