MCPcopy Create free account
hub / github.com/FlashSampling/FlashSampling / plot_memory_throughput

Function plot_memory_throughput

benchmarking/plot-triton-bench.py:258–342  ·  view source on GitHub ↗
(bdf_long: pd.DataFrame, peak_bw_gbs: float | None = None)

Source from the content-addressed store, hash-verified

256
257
258def plot_memory_throughput(bdf_long: pd.DataFrame, peak_bw_gbs: float | None = None):
259 palette = _provider_palette(bdf_long["provider"])
260 markers = _provider_markers(bdf_long["provider"])
261 fontsize = 18
262
263 _, ax = plt.subplots(figsize=(10, 7))
264 if peak_bw_gbs is not None:
265 # Primary axis: Speed-of-Light %, so grid lines align with SoL ticks.
266 plot_df = bdf_long.copy()
267 plot_df["SoL %"] = plot_df["mem_throughput[GB/s]"] / peak_bw_gbs * 100
268
269 sns.lineplot(
270 plot_df,
271 x="n_hidden_states",
272 y="SoL %",
273 hue="provider",
274 style="provider",
275 markers=markers,
276 markersize=12,
277 dashes=False,
278 palette=palette,
279 ax=ax,
280 )
281
282 ax.axhline(100, color="black", linestyle="--", linewidth=1)
283 ax.text(
284 0.01,
285 100,
286 "Peak Memory Bandwidth",
287 transform=ax.get_yaxis_transform(),
288 va="bottom",
289 ha="left",
290 fontsize=fontsize - 2,
291 color="black",
292 )
293
294 ax.set_ylabel("Speed-of-Light %", fontsize=fontsize)
295 ax.set_ylim(bottom=0, top=110)
296 ax.yaxis.set_minor_locator(plt.FixedLocator([10, 30, 50, 70, 90]))
297
298 # Secondary axis: GB/s on the right
299 ax2 = ax.secondary_yaxis(
300 "right",
301 functions=(
302 lambda pct: pct / 100 * peak_bw_gbs,
303 lambda gbs: gbs / peak_bw_gbs * 100,
304 ),
305 )
306 ax2.set_ylabel("Memory Throughput (GB/s)", fontsize=fontsize)
307 ax2.tick_params(axis="y", labelsize=fontsize)
308 else:
309 sns.lineplot(
310 bdf_long,
311 x="n_hidden_states",
312 y="mem_throughput[GB/s]",
313 hue="provider",
314 style="provider",
315 markers=markers,

Callers 1

Calls 2

_provider_paletteFunction · 0.85
_provider_markersFunction · 0.85

Tested by

no test coverage detected