Skip to content

Commit 4e67325

Browse files
alexmalyshevmeta-codesync[bot]
authored andcommitted
Clarify how torchbench is still dispatch-bound
Summary: Trying to make it clear that this benchmark is going to be limited in how much the JIT can speed it up. Reviewed By: mpage Differential Revision: D109588784 fbshipit-source-id: 9b9c236f61af87da9fd9e64056493b892d814d8d
1 parent e92bd91 commit 4e67325

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

cinderx/benchmarks/torchbench.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,20 @@
44

55
"""Run a TorchBench eager CPU workload with and without the CinderX JIT.
66
7-
The default model is ``pyhpc_equation_of_state``, which is a small eager CPU
8-
workload where Python op dispatch is expected to matter. TorchBench is not
9-
vendored here; see ``benchmarks/requirements-torchbench.txt`` for setup.
7+
The default model is ``pyhpc_equation_of_state``, a small eager CPU workload
8+
chosen because Python op dispatch is about as visible here as it gets in
9+
TorchBench. TorchBench is not vendored here; see
10+
``benchmarks/requirements-torchbench.txt`` for setup.
11+
12+
What this measures, and its limits: eager PyTorch on CPU is *dispatch-bound*,
13+
not interpreter-bound. Profiling shows ~95% of the time goes to ATen C++ per-op
14+
overhead -- GIL / thread-state handoff, ``TensorIterator`` setup, and tensor
15+
allocation/refcounting -- which no Python JIT can touch; only the few percent
16+
spent interpreting the dispatch bytecode is addressable. Measured CinderX
17+
speedups are therefore small (~1.0x), even on free-threaded 3.14t where the GIL
18+
cost disappears. This still makes torchbench a useful, realistic guardrail --
19+
it confirms the JIT stays neutral-to-positive on real eager PyTorch and does not
20+
regress it -- but it is a poor place to look for large wins.
1021
"""
1122

1223
from __future__ import annotations

0 commit comments

Comments
 (0)