| 3 | #include "kernel.h" |
| 4 | |
| 5 | torch::Tensor run(const torch::Tensor& A, const torch::Tensor& B) { |
| 6 | TORCH_CHECK(A.dim() == 2 && B.dim() == 2, "inputs must be 2D"); |
| 7 | TORCH_CHECK(A.size(1) == B.size(0), "inner dimensions must match"); |
| 8 | TORCH_CHECK(A.is_cuda() && B.is_cuda(), "inputs must be CUDA tensors"); |
| 9 | TORCH_CHECK(A.scalar_type() == torch::kFloat32, "A must be float32"); |
| 10 | TORCH_CHECK(B.scalar_type() == torch::kFloat32, "B must be float32"); |
| 11 | TORCH_CHECK(A.is_contiguous() && B.is_contiguous(), "inputs must be contiguous"); |
| 12 | |
| 13 | auto C = torch::empty({A.size(0), B.size(1)}, A.options()); |
| 14 | cudaStream_t current = at::cuda::getCurrentCUDAStream(); |
| 15 | gemm_launcher(C, A, B, current); |
| 16 | return C; |
| 17 | } |
| 18 | |
| 19 | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { |
| 20 | m.def("run", &run, "CUTLASS GEMM"); |
nothing calls this directly
no outgoing calls
no test coverage detected