LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/ccu/ccu_representation/reps/loop - ccu_rep_setloop.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 17 17
Test Date: 2026-07-28 12:11:00 Functions: 100.0 % 3 3

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 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.h"
      12              : #include "ccu_assist.h"
      13              : #include <climits>
      14              : 
      15              : #include "string_util.h"
      16              : 
      17              : namespace Hccl {
      18              : namespace CcuRep {
      19              : 
      20           59 : CcuRepSetLoop::CcuRepSetLoop(const Variable &loopParam, const Executor &executor, const Variable &var)
      21           59 :     : loopParam(loopParam), executor(executor), var(var)
      22              : {
      23           59 :     type       = CcuRepType::SET_LOOP;
      24           59 :     instrCount = 2;  // set loop 指令数量为2
      25           59 : }
      26              : 
      27           17 : bool CcuRepSetLoop::Translate(CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
      28              : {
      29           17 :     this->instrId = instrId;
      30           17 :     translated    = true;
      31              : 
      32           17 :     LoadImdToXnInstr(instr++, loopParam.Id(), GetLoopParam(executor.Id(), 0, 0));
      33           17 :     LoadXXInstr(instr++, loopParam.Id(), loopParam.Id(), var.Id());
      34              : 
      35           17 :     if (instrId > USHRT_MAX - instrCount) {
      36            1 :         THROW<InternalException>(StringFormat("[CcuRepSetLoop][Translate] instrId[%u] + instrCount[%u] exceeds the "
      37            1 :             "maximum value of unsigned short int.", instrId, instrCount));
      38              :     }
      39           16 :     instrId += instrCount;
      40              : 
      41           16 :     return translated;
      42              : }
      43              : 
      44           25 : std::string CcuRepSetLoop::Describe()
      45              : {
      46           25 :     return StringFormat("loopParam[%u] = var[%u], execute on LoopEngine[%u]", loopParam.Id(), var.Id(), executor.Id());
      47              : }
      48              : 
      49              : }; // namespace CcuRep
      50              : }; // namespace Hccl
        

Generated by: LCOV version 2.0-1