From 365075ac320c360cd047f68ac7725b552282926a Mon Sep 17 00:00:00 2001 From: Gong-air <994321849@qq.com> Date: Thu, 26 Sep 2024 17:48:38 +0800 Subject: [PATCH] move if into TORCHCHECK --- dipu/torch_dipu/csrc_dipu/vendor/droplet/pccl.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/dipu/torch_dipu/csrc_dipu/vendor/droplet/pccl.cpp b/dipu/torch_dipu/csrc_dipu/vendor/droplet/pccl.cpp index facc2b553..9e32f8498 100644 --- a/dipu/torch_dipu/csrc_dipu/vendor/droplet/pccl.cpp +++ b/dipu/torch_dipu/csrc_dipu/vendor/droplet/pccl.cpp @@ -70,19 +70,15 @@ static const std::map 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(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() {