LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_representation/reps/data - ccu_rep_bufreduce.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 22 22
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 "ccu_rep_v1.h"
      12              : #include "string_util.h"
      13              : #include "ccu_ins_generator_v1.h"
      14              : #include "exception_util.h"
      15              : #include "ccu_api_exception.h"
      16              : #include "ccu_ins_generator_base.h"
      17              : #include "ccu_kernel.h"
      18              : 
      19              : namespace hcomm {
      20              : namespace CcuRep {
      21              : 
      22           10 :     CcuRepBufReduce::CcuRepBufReduce(
      23              :         CcuInsGeneratorBase* insGenPtr, const std::vector<CcuBuf>& mem, uint16_t count, uint16_t dataType,
      24           10 :         uint16_t outputDataType, uint16_t opType, CompletedEvent sem, const CcuRep::Variable& len, uint16_t mask)
      25           10 :         : insGenPtr(insGenPtr),
      26           10 :           mem(mem),
      27           10 :           count(count),
      28           10 :           dataType(dataType),
      29           10 :           outputDataType(outputDataType),
      30           10 :           opType(opType),
      31           10 :           sem(sem),
      32           10 :           xnIdLength_(len),
      33           10 :           mask(mask)
      34              :     {
      35           10 :         type = CcuRepType::BUF_REDUCE;
      36           10 :         instrCount = insGenPtr->GetInstrCount(type);
      37           10 :     }
      38              : 
      39            8 :     bool CcuRepBufReduce::Translate(
      40              :         CcuKernel* ccuKernel, CcuInstr*& instr, uint16_t& instrId, [[maybe_unused]] const TransDep& dep)
      41              :     {
      42            8 :         this->instrId = instrId;
      43            8 :         translated = true;
      44              : 
      45            8 :         instrCount = insGenPtr->GetInstrCount(type);
      46           10 :         CHK_PRT_THROW(
      47              :             insGenPtr->CcuRepBufReduceTranslate(ccuKernel, instr, this) != HcclResult::HCCL_SUCCESS,
      48              :             HCCL_ERROR("[CcuRepBufReduce][Translate] failed to translate for instrId[%u]", instrId),
      49              :             Hccl::CcuApiException, "CcuRepBufReduce translate failed");
      50              : 
      51            7 :         instrId += instrCount;
      52              : 
      53            7 :         return translated;
      54              :     }
      55              : 
      56            5 :     std::string CcuRepBufReduce::Describe() { return Hccl::StringFormat("Reduce"); }
      57              : 
      58              : }; // namespace CcuRep
      59              : }; // namespace hcomm
        

Generated by: LCOV version 2.0-1