(x: torch.Tensor, y: torch.Tensor)
| 85 | }, |
| 86 | ) |
| 87 | def matmul(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor: |
| 88 | m, k = x.size() |
| 89 | k2, n = y.size() |
| 90 | assert k == k2, f"size mismatch {k} != {k2}" |
| 91 | out = torch.empty([m, n], dtype=torch.promote_types(x.dtype, y.dtype), device=x.device) |
| 92 | for tile_m, tile_n in hl.tile([m, n]): |
| 93 | acc = hl.zeros([tile_m, tile_n], dtype=torch.float32) |
| 94 | for tile_k in hl.tile(k): |
| 95 | acc = torch.addmm(acc, x[tile_m, tile_k], y[tile_k, tile_n]) |
| 96 | out[tile_m, tile_n] = acc |
| 97 | return out |
nothing calls this directly
no outgoing calls
no test coverage detected