Skip to content

Commit

Permalink
move if into TORCHCHECK
Browse files Browse the repository at this point in the history
  • Loading branch information
Gong-air committed Sep 26, 2024
1 parent c161068 commit 365075a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions dipu/torch_dipu/csrc_dipu/vendor/droplet/pccl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,15 @@ static const std::map<pcclDataType_t, at::ScalarType> toScalarType = {

at::ScalarType PcclDataTypeToScalarType(pcclDataType_t pccl_data_type) {
auto p = toScalarType.find(pccl_data_type);
if (p == toScalarType.end()) {
TORCH_CHECK(false, "Not supported pcclDataType_t: " +
std::to_string(pccl_data_type));
}
TORCH_CHECK(p != toScalarType.end(), "Not supported pcclDataType_t: " +
std::to_string(pccl_data_type));
return p->second;
}

static const pcclComm_t kMagicComm = reinterpret_cast<pcclComm_t>(0x5043434C);

void checkCommOrThrow(pcclComm_t comm) {
if (comm == nullptr || comm != kMagicComm) {
TORCH_CHECK(false, "Invalid comm.");
}
TORCH_CHECK(comm != nullptr && comm == kMagicComm, "Invalid comm.");
}

[[noreturn]] void throwNotSupportedError() {
Expand Down

0 comments on commit 365075a

Please sign in to comment.