LCOV - code coverage report
Current view: top level - coll_communicator_mgr/communicator/device - hccl_aicpu_hdc_handler.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 82.6 % 23 19
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 3 3

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2026 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #include "hccl_aicpu_hdc_handler.h"
      12              : #include "log.h"
      13              : 
      14              : namespace hccl {
      15              : 
      16            3 : HcclAicpuHdcHandler::HcclAicpuHdcHandler(
      17            3 :     const std::shared_ptr<HDCommunicate>& h2dTransfer, const std::shared_ptr<HDCommunicate>& d2hTransfer)
      18            3 :     : h2dTransfer_(h2dTransfer),
      19            3 :       d2hTransfer_(d2hTransfer)
      20            3 : {}
      21              : 
      22            1 : HcclResult HcclAicpuHdcHandler::GetKfcCommand(Hccl::KfcCommand& cmd)
      23              : {
      24            1 :     auto ret = h2dTransfer_->Get(0, sizeof(Hccl::KfcCommand), reinterpret_cast<uint8_t*>(&cmd));
      25            1 :     if (ret != HcclResult::HCCL_SUCCESS) {
      26            1 :         HCCL_ERROR("[HcclAicpuHdcHandler][GetKfcCommand] h2dTransfer Get fail, ret[%d]", ret);
      27            1 :         return ret;
      28              :     }
      29            0 :     if (lastCmd_ != cmd) {
      30            0 :         HCCL_INFO(
      31              :             "[HcclAicpuHdcHandler][GetKfcCommand] Get new KfcCommand[%d], last KfcCommand[%d]", static_cast<int>(cmd),
      32              :             static_cast<int>(lastCmd_));
      33            0 :         lastCmd_ = cmd;
      34              :     }
      35            0 :     return HCCL_SUCCESS;
      36              : }
      37              : 
      38            1 : void HcclAicpuHdcHandler::SetKfcExecStatus(Hccl::KfcStatus state, Hccl::KfcErrType errorCode)
      39              : {
      40            1 :     Hccl::KfcExecStatus status;
      41            1 :     status.kfcStatus = state;
      42            1 :     status.kfcError = errorCode;
      43            1 :     HCCL_INFO(
      44              :         "[HcclAicpuHdcHandler][SetKfcExecStatus] SetKfcExecStatus: state[%d], errorCode[%d]", static_cast<int>(state),
      45              :         static_cast<int>(errorCode));
      46            1 :     auto ret = d2hTransfer_->Put(0, sizeof(Hccl::KfcExecStatus), reinterpret_cast<uint8_t*>(&status));
      47            1 :     if (ret != HcclResult::HCCL_SUCCESS) {
      48            1 :         HCCL_ERROR("[HcclAicpuHdcHandler][SetKfcExecStatus] d2hTransfer Put fail, ret[%d]", ret);
      49              :     }
      50            1 : }
      51              : 
      52              : } // namespace hccl
        

Generated by: LCOV version 2.0-1