{
  "version": 1,
  "language": "en",
  "title": "Accumulate C from K tiles",
  "description": "The kernel stages A/B values, multiplies register fragments and accumulates one C tile for two example K-tile iterations.",
  "caption": "Figure 2. Staged A/B values supply data for an output tile through shared memory and register fragments. Partial C accumulates from K tiles. The 3×3 grids and two iterations show structure, not hardware tile dimensions or measured traces. The author made this explanatory diagram.",
  "alt": "Tile-reuse flow: stage A/B values, multiply register fragments and accumulate one C tile across two illustrative K-tile iterations.",
  "sources": [
    {
      "path": "content/blog/2026-06-10_transformer-performance-matmul-gpu/post.md",
      "sha256": "9b2336976006590a0e49ec94aee527e754cd116fc4525ec748dadfb01e695203",
      "description": "Current article explanation, equations, assumptions and retained citations."
    },
    {
      "path": "research/dynamic-mechanisms-2026-10-21/before/content/blog/2026-06-10_transformer-performance-matmul-gpu/illustrations/01-matmul-tile-reuse-algorithm.svg",
      "sha256": "be44cf99f4e4cd93f17f3164ca01ac7b9dc13bbf99fd0fc7b689eb844cfbae32",
      "description": "Frozen prior illustration; exact pre-migration bytes retained."
    },
    {
      "path": "content/blog/2026-06-10_transformer-performance-matmul-gpu/illustrations/source-notes.json",
      "description": "Existing article illustration provenance, retained unchanged."
    }
  ],
  "limitations": [
    "The execution is an example. Playback time is not measured runtime."
  ],
  "targets": {
    "a": {
      "id": "mechanism-a",
      "kind": "node",
      "label": "A tile"
    },
    "b": {
      "id": "mechanism-b",
      "kind": "node",
      "label": "B tile"
    },
    "c": {
      "id": "mechanism-c",
      "kind": "node",
      "label": "C tile"
    },
    "stage": {
      "id": "mechanism-stage",
      "kind": "node",
      "label": "Stage A/B"
    },
    "mma": {
      "id": "mechanism-mma",
      "kind": "node",
      "label": "Fragment MMA"
    },
    "partial": {
      "id": "mechanism-partial",
      "kind": "node",
      "label": "Partial C"
    },
    "a-stage": {
      "id": "mechanism-a-stage",
      "kind": "edge",
      "label": "a-stage"
    },
    "b-stage": {
      "id": "mechanism-b-stage",
      "kind": "edge",
      "label": "b-stage"
    },
    "stage-mma": {
      "id": "mechanism-stage-mma",
      "kind": "edge",
      "label": "stage-mma"
    },
    "mma-partial": {
      "id": "mechanism-mma-partial",
      "kind": "edge",
      "label": "mma-partial"
    },
    "partial-c": {
      "id": "mechanism-partial-c",
      "kind": "edge",
      "label": "partial-c"
    },
    "next-k": {
      "id": "mechanism-next-k",
      "kind": "edge",
      "label": "next-k"
    }
  },
  "stateLabels": {
    "stage": "Stage",
    "artifact": "Artifact"
  },
  "scenarios": [
    {
      "id": "two-reduction-tiles",
      "title": "Two example reduction tiles",
      "description": "This example has two reduction tiles.",
      "initial": {
        "stage": "Prepared",
        "artifact": "Inputs kept"
      },
      "unselected": [],
      "steps": [
        {
          "title": "Stage k=0",
          "description": "The kernel stages the tiles at k=0.",
          "duration": 3000,
          "active": [
            "a",
            "b",
            "stage"
          ],
          "paths": [
            "a-stage",
            "b-stage"
          ],
          "state": {
            "stage": "Stage k=0",
            "artifact": "Reusable data from A/B tiles"
          }
        },
        {
          "title": "Do fragment MMA",
          "description": "The kernel does fragment MMA.",
          "duration": 3000,
          "active": [
            "mma"
          ],
          "paths": [
            "stage-mma"
          ],
          "state": {
            "stage": "Do fragment MMA",
            "artifact": "Supported multiply-accumulate operation"
          }
        },
        {
          "title": "Keep partial C",
          "description": "The kernel keeps partial C.",
          "duration": 3000,
          "active": [
            "partial"
          ],
          "paths": [
            "mma-partial"
          ],
          "state": {
            "stage": "Keep partial C",
            "artifact": "Partial C includes the first contribution."
          }
        },
        {
          "title": "Examine partial C",
          "description": "Examine partial C.",
          "duration": 3000,
          "active": [
            "c"
          ],
          "paths": [
            "partial-c"
          ],
          "state": {
            "stage": "Examine partial C",
            "artifact": "C includes the first K-tile contribution."
          }
        },
        {
          "title": "Select the next K tile",
          "description": "The kernel selects the next K tile.",
          "duration": 3000,
          "active": [
            "stage"
          ],
          "paths": [
            "next-k"
          ],
          "state": {
            "stage": "Select the next K tile",
            "artifact": "Partial C stays available in registers."
          }
        },
        {
          "title": "Stage k=1",
          "description": "The kernel stages the tiles at k=1.",
          "duration": 3000,
          "active": [
            "a",
            "b",
            "stage"
          ],
          "paths": [
            "a-stage",
            "b-stage"
          ],
          "state": {
            "stage": "Stage k=1",
            "artifact": "The next tiles from A/B are for the same output tile."
          }
        },
        {
          "title": "Calculate at k=1",
          "description": "The kernel calculates the contribution at k=1.",
          "duration": 3000,
          "active": [
            "mma"
          ],
          "paths": [
            "stage-mma"
          ],
          "state": {
            "stage": "Calculate at k=1",
            "artifact": "Second multiply-accumulate contribution"
          }
        },
        {
          "title": "Add the second contribution",
          "description": "The kernel adds the second contribution to C.",
          "duration": 3000,
          "active": [
            "partial"
          ],
          "paths": [
            "mma-partial"
          ],
          "state": {
            "stage": "Add the second contribution",
            "artifact": "C in registers includes the two K-tile contributions."
          }
        },
        {
          "title": "Examine completed C",
          "description": "Examine completed C.",
          "duration": 3000,
          "active": [
            "c"
          ],
          "paths": [
            "partial-c"
          ],
          "state": {
            "stage": "Examine completed C",
            "artifact": "C includes the two contributions. The two tiles are examples."
          }
        }
      ]
    }
  ]
}
