TikTok Coding Interview / OA: Tiled Matrix Multiplication

17 Views
No Comments

A = (M, K1)

B = (K2, N)

Given a util function matmul(X1, X2), where X1 and X2 can only be tensors of shape (tile_size, tile_size). Implement tiled_matmul(A, B).

This problem asks you to implement matrix multiplication under a strict tile constraint: the only available helper, <code>matmul(X1, X2)</code>, accepts tensors of shape <code>(tile_size, tile_size)</code> only. The intended solution is to split the input matrices into tiles, multiply compatible blocks one by one, and accumulate partial results into each output tile. Key concerns are block indexing, boundary handling, and correctly summing over the shared dimension.

END
 0