LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_representation/reps/common - ccu_rep_load_var.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 15 15
Test Date: 2026-07-28 12:11:00 Functions: 100.0 % 3 3

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved.
       3              :  * Description: ccu representation load var file
       4              :  * Create: 2025-04-22
       5              :  */
       6              : 
       7              : #include "ccu_rep_v1.h"
       8              : #include "string_util.h"
       9              : #include "exception_util.h"
      10              : #include "ccu_api_exception.h"
      11              : 
      12              : #include "ccu_ins_generater_base.h"
      13              : #include "ccu_kernel.h"
      14              : 
      15              : namespace hcomm {
      16              : namespace CcuRep {
      17              : 
      18              : using namespace Hccl;
      19              : 
      20            5 : CcuRepLoadVar::CcuRepLoadVar(CcuInsGeneraterBase* insGenPtr, const Variable &src, const Variable &var, uint32_t num) :
      21            5 :     insGeneratorPtr_(insGenPtr), src(src), var(var), num(num)
      22              : {
      23            5 :     type       = CcuRepType::LOAD_VAR;
      24            5 :     instrCount = insGeneratorPtr_->GetInstrCount(type);
      25            5 : }
      26              : 
      27            3 : bool CcuRepLoadVar::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
      28              : {
      29            3 :     Hccl::CHECK_NULLPTR(instr, "[CcuRepLoadVar::Translate] instr is nullptr!");
      30            3 :     this->instrId    = instrId;
      31            3 :     translated       = true;
      32            3 :     CHK_RET_THROW(Hccl::CcuApiException,
      33              :         Hccl::StringFormat("[CcuRepLoadVar][%s] failed to translate repLoadVar for instrId[%u] ", __func__, instrId),
      34              :             insGeneratorPtr_->CcuRepLoadVarTranslate(ccuKernel, instr, instrId, this, dep));
      35            3 :     CHK_PRT_THROW((instrId > UINT16_MAX - instrCount),
      36              :                         HCCL_ERROR("[CcuRepLoadVar::Translate]uint16 integer overflow occurs, instrId = [%hu], instrCount = [%hu]", instrId, instrCount),
      37              :                           Hccl::InternalException, "integer overflow");
      38            3 :     instrId += instrCount;
      39              : 
      40            3 :     return translated;
      41              : }
      42              : 
      43            3 : std::string CcuRepLoadVar::Describe()
      44              : {
      45            3 :     return Hccl::StringFormat("Load Var([%llu], [%u], [%u])", src.Id(), var.Id(), num);
      46              : }
      47              : 
      48              : }; // namespace CcuRep
      49              : }; // namespace hcomm
        

Generated by: LCOV version 2.0-1