Home › Practice › Accelerators › 2x2 matrix multiply

2x2 matrix multiply

EasyRTLAcceleratorscombinational

Matrix multiply is the main job of GPUs, TPUs and NPUs. Every layer of a neural network is one, only much bigger. A 2x2 version has the whole idea in it.

Concept first. A matrix is a small grid of numbers. To multiply grid A by grid B you build a new grid C. Each number in C comes from one row of A and one column of B: pair them up, multiply each pair, add. That is a dot product, the same thing you just built. Example with other numbers: A = [[1,2],[3,4]] and B = [[0,1],[1,0]]. The top-left of C uses the first row of A (1,2) and the first column of B (0,1): 1×0 + 2×1 = 2.

Names: a01 means row 0, column 1 of A. Same for B and C.

Solve in your browser →

No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.

More in this track

← Dot product with one multiplierOne cell of a systolic array (PE) →