Compute each output as a row-by-column dot product. For a matrix times a vector, give each permitted worker or lane an output row, initialize its accumulator to zero, and add the products of corresponding entries. Use the contract brief for dimensions, numeric widths, addresses, and task mapping.
Compute one matrix-vector output
For y = A × x, pick output index i and read row i from A. Multiply each A[i,k] by the corresponding x[k] and add every product to the accumulator. Write the total to y[i]. Repeat for every output row.
Extend the same rule to two matrices
For C = A × B, an individual task computes one cell (i,j). Read row i from A and column j from B. Add A[i,k] times B[k,j] across the shared dimension and store the result in cell (i,j). The index k walks across the input values, while i and j identify the output.
Check expected results on a small input
Use rows [1, 2] and [3, 4] with vector [1, 2]. The first row gives 5 and the second gives 11. A zero input should give all zeroes, which helps catch stale accumulator values. An identity matrix should reproduce the input and can help reveal swapped indexes.
Check the contract before adding workers
The GPU stage includes matrix-vector work, and the full game lists matrix multiplication and memory bandwidth as part of the campaign. The public demo leaves the matrix contract outside its playable levels, so take the wiring, instruction, and addressing requirements from the active brief. Verify the results of a small case before distributing the work. Then check memory stalls before adding more workers that share access to the input data.