pytorch/benchmarks/fuser/plot_speedups.py
Bert Maher 4b084bc832 Benchmarks for various fusers (#67622)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/67622

Test Plan: Imported from OSS

Reviewed By: eellison

Differential Revision: D32171063

Pulled By: bertmaher

fbshipit-source-id: 40d3a7adcc52aba3b051e382ec5ec4ee7e43d81b
2021-11-04 18:57:17 -07:00

23 lines
623 B
Python

import pandas
df = pandas.read_csv("perf.csv")
ops = pandas.unique(df["operator"])
nops = len(ops)
pivot_op_shape = df.pivot_table(
values="time", index=["operator", "shape"], columns=["fuser"]
)
pivot_speedups = (pivot_op_shape.T / pivot_op_shape["eager"]).T
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (20, 100)
fig, axs = plt.subplots(nops)
plt.subplots_adjust(hspace=0.5)
for idx, op in enumerate(ops):
op_speedups = pivot_speedups.T[op].T
op_speedups.plot(ax=axs[idx], kind="bar", ylim=(0, 2), rot=45)
axs[idx].set_title(op)
axs[idx].set_xlabel("")
plt.savefig("perf.png")