Skip to content

Commit

Permalink
[PyTorch] Add contiguous check for grouped gemm
Browse files Browse the repository at this point in the history
  • Loading branch information
BeingGod committed Aug 29, 2024
1 parent 4ddb0a7 commit 88fbcb8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions transformer_engine/pytorch/csrc/extensions/gemm.cu
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ void te_grouped_gemm(std::vector<at::Tensor> A, at::Tensor A_scale_inverse, int
if (pre_gelu_out[i].data_ptr() != nullptr) pre_gelu_out[i].zero_();
continue;
}

NVTE_CHECK(A[i].is_contiguous(), "A[", i, "] must be contiguous.");
NVTE_CHECK(B[i].is_contiguous(), "B[", i, "] must be contiguous.");
NVTE_CHECK(D[i].is_contiguous(), "D[", i, "] must be contiguous.");

te_A.emplace_back(make_tensor(
A[i].data_ptr(), {static_cast<size_t>(A[i].size(0)), static_cast<size_t>(A[i].size(1))},
A_type, nullptr, nullptr, getDataPtr(A_scale_inverse, A_offset + i)));
Expand Down

0 comments on commit 88fbcb8

Please sign in to comment.