Altifigence Academy

11 / 20 · Concept

Scale to N×N and count completion edges

Parameterize spatial size N separately from reduction length K.

Separate spatial size from reduction length

An N×N PE grid produces one N×N output tile. K is the reduction dimension and need not equal N. With N=3 and K=5, A is 3×5, B is 5×3 and C is 3×3. Nine PEs each consume five terms, performing forty-five MACs. N determines wiring and skew; K determines accumulation width, term counting and injection duration.

Use the established convention: clear finishes before E0, inputs are stable before E_t, MAC and registered forwarding occur at that edge, and there is no extra multiplier pipeline. A(i,k) is injected on k+i and travels j hops. B(k,j) is injected on k+j and travels i hops. Both reach PE(i,j) on k+i+j.

tlast(i,j)=K−1+i+jt_{last}(i,j)=K-1+i+j

The final PE completes after E_(K+2N−3). Counting E0 inclusively gives K+2N−2 advance edges. For N=K=2, the last edge number is three and the count is four. For N=3, K=5, the last number is eight and the count is nine.

Parameterize the links and counters

At column zero, a PE's A input comes from the boundary; elsewhere it comes from its left neighbor's registered A output. The B rule is analogous for the top boundary and neighbor above. Connect valid and job/k tags with the same links, and share clear and advance across the grid.

Require N≥1, K≥1 and AW≥2W. A count storing zero through K needs max(1,ceil(log2(K+1))) bits. A k tag storing zero through K−1 needs max(1,ceil(log2 K)) bits. These widths differ when K is a power of two; avoid zero-width declarations for K=1.

The last boundary injection occurs on E_(K+N−2), followed by N−1 drain edges. Computation counts exclude initialization, memory loading and output transfer. With P pause edges, elapsed physical edges become K+2N−2+P. Extra pipeline stages require a new timing analysis.

Try it yourself

For N=4, K=3, find PE(2,1)'s first/last MAC edges, the grid's final edge, compute-edge count and physical-edge count with two pauses.

Read the explanation

PE(2,1) consumes k0 on E3 and k2 on E5. The grid finishes after E8, requiring nine advance edges E0..E8. Two pauses give eleven physical edges, excluding initialization and output transfer.

Your choice applies to this browser. Change it any time using the footer.