<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>MFU on Duo&#39;s Tech Blog</title>
    <link>https://duoan.github.io/tags/mfu/</link>
    <description>Recent content in MFU on Duo&#39;s Tech Blog</description>
    <image>
      <title>Duo&#39;s Tech Blog</title>
      <url>https://duoan.github.io/images/papermod-cover.png</url>
      <link>https://duoan.github.io/images/papermod-cover.png</link>
    </image>
    <generator>Hugo -- 0.153.1</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 11 Jul 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://duoan.github.io/tags/mfu/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Roofline: The First Step of Any Performance Optimization</title>
      <link>https://duoan.github.io/posts/roofline-first-step-of-performance-optimization/</link>
      <pubDate>Sat, 11 Jul 2026 00:00:00 +0000</pubDate>
      <guid>https://duoan.github.io/posts/roofline-first-step-of-performance-optimization/</guid>
      <description>&lt;h1 id=&#34;roofline-the-first-step-of-any-performance-optimization&#34;&gt;Roofline: The First Step of Any Performance Optimization&lt;/h1&gt;
&lt;p&gt;When MFU sits at 20%, most people open a profiler and hunt for a slow kernel. That often starts at the wrong layer. The first question is not &lt;em&gt;which kernel is hot&lt;/em&gt; — it is &lt;em&gt;which ceiling you are hitting&lt;/em&gt;: compute or memory bandwidth.&lt;/p&gt;
&lt;h2 id=&#34;tldr&#34;&gt;TL;DR&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Every GPU has two hard ceilings: peak FLOP/s and peak bandwidth. Arithmetic intensity &lt;code&gt;I = FLOPs / Bytes&lt;/code&gt; decides which one binds first.&lt;/li&gt;
&lt;li&gt;MFU answers “are we compute-bound?” for training. MBU answers “are we bandwidth-bound?” for decode. Both are Roofline ratios, not vibes.&lt;/li&gt;
&lt;li&gt;Shape matters more than op name: the same &lt;code&gt;matmul&lt;/code&gt; can be compute-bound at &lt;code&gt;M=N=K=8192&lt;/code&gt; and memory-bound at &lt;code&gt;M=1&lt;/code&gt;. That is why training and decode feel like different worlds.&lt;/li&gt;
&lt;li&gt;Count MFU/MBU by instrumentation (&lt;code&gt;FlopCounterMode&lt;/code&gt; + bytes), not PaLM &lt;code&gt;6PT&lt;/code&gt; — that formula is an LLM shortcut. ResNet / ViT work the same way as any other &lt;code&gt;nn.Module&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Model-level Roofline is useful when traffic is homogeneous (decode, dense training GEMMs). It is misleading when time is dominated by a mix of memory-bound and compute-bound ops — then go per-op, then profiler.&lt;/li&gt;
&lt;li&gt;Reproducible Modal measurements (ops, LLM decode/train sweeps, ResNet/ViT MFU·MBU) live in this page bundle; code in &lt;a href=&#34;https://github.com/duoan/duoan.github.io/blob/main/playground/roofline_modal.py&#34;&gt;&lt;code&gt;playground/roofline_modal.py&lt;/code&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;the-most-expensive-mistake&#34;&gt;The Most Expensive Mistake&lt;/h2&gt;
&lt;p&gt;The costly failure mode in performance work is not missing the optimal kernel. It is optimizing in the wrong direction.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
