The red-blue pebble game: the I/O bounds for matrix multiplication #
Support module of MiscMath.Computability.RedBluePebbleGame, where the results are stated and
where the reader should start. Nothing here is a result on its own.
This is Hong and Kung's §6 for the graphs of IsMatMulEvaluation, by way of their Theorem 3.1.
A complete calculation with S red pebbles gives a 2S-partition into h parts, S h ≤ q + S
(exists_isPartition). Each part holds at most S √(2S) products (card_prod_mem_le, which takes
the place of the source's Lemma 6.1):
- a product in the part leads, inside the part, to a vertex with no successor there, which lies in
the part's minimum set; products for different entries of the result lead to different such
vertices (
independent), so the part meets at most2Sentries of the result; - a product in the part is in its dominator, or both its factors are;
- so, slice by slice in the inner index
l, the products of the part outside the dominator number at mostmin(2S, α_l β_l) ≤ √(2S) (α_l + β_l) / 2, whereα_landβ_lcount the entries of columnlofAand of rowlofBin the dominator.
Summing over the parts gives m k n ≤ (q + S) √(2S) (mul_le_of_isMatMulLabelling). Alongside
it: every input is loaded and every output stored, so q ≥ m k + k n + m n
(add_le_of_isMatMulLabelling), and a calculation needs three red pebbles as soon as there is a
product (IsMatMulLabelling.three_le).
Facts about a complete calculation of a computation DAG #
An input of a computation DAG has a successor: it reaches an output, and it is not one.
In a complete calculation of a computation DAG, every vertex holds a pebble at some point: it reaches an output, which ends blue, and a vertex is computed only once its predecessors are red.
In a complete calculation of a computation DAG, a vertex with a successor holds a red pebble at some point: the successor is computed, and then it is red.
Facts about a matrix-multiplication labelling #
A product is not an input: it has a predecessor.
Three red pebbles are needed. When a product is first computed, it and its two factors are all red.
The trivial bound #
Every input is loaded and every output stored. The entries of the two matrices are distinct
inputs, and for k ≥ 1 the entries of the result lead to distinct outputs, so a complete
calculation is charged q ≥ m k + k n + m n.
The products in one part #
In a finite graph with no cycle, a vertex of a set U leads, along edges inside U, to a
vertex of U with no successor in U.
The products in one part, the source's Lemma 6.1 in the form the proof needs. A set U
dominated by at most s ≥ 4 vertices, of which at most s have no successor in U, holds at most
s √s / 2 products.
All the products #
The domination bound, Hong and Kung's Corollary 6.2 in finitary form. A complete calculation
with S ≥ 2 red pebbles, charged q, has m k n ≤ (q + S) √(2S).