LCOV - code coverage report
Current view: top level - legacy/ascend950/framework/ccu - ccu_ins_preprocessor.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 2 2
Test Date: 2026-07-28 12:11:00 Functions: 100.0 % 1 1

            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              : #ifndef CCU_INS_PREPROCESSOR_H
      11              : #define CCU_INS_PREPROCESSOR_H
      12              : 
      13              : #include "ccu_ins.h"
      14              : #include "ins_queue.h"
      15              : #include "ccu_ctx_mgr.h"
      16              : #include "ccu_respack_mgr.h"
      17              : #include "ccu_communicator.h"
      18              : 
      19              : namespace Hccl {
      20              : 
      21              : class CcuInsPreprocessor {
      22              : public:
      23              :     using InsIterator = HierarchicalQueue<Instruction, InsQueue>::UnConstIterator;
      24              : 
      25          261 :     explicit CcuInsPreprocessor(CommunicatorImpl *comm) : ccuComm(comm)
      26              :     {
      27          261 :     }
      28              : 
      29              :     ~CcuInsPreprocessor();
      30              : 
      31              :     void Preprocess(std::shared_ptr<InsQueue> &insQueue, bool isMc2 = false);
      32              : 
      33              :     CcuCommunicator *GetCcuComm();
      34              :     HcclResult       RecoverCcuTransportCtx(const std::vector<LinkData> &links, vector<std::pair<LinkGroup, u32>> linkGroupPair);
      35              :     HcclResult       RecoverCcuTransportConfirm();
      36              : 
      37              :     void PrepareCcuCtx(std::shared_ptr<InsQueue> &insQueue, bool isMc2);
      38              :     void RegisterCtx(bool isFuncBlock);
      39              :     bool IsRollback() const;
      40              : private:
      41              :     CcuCommunicator                      ccuComm;
      42              :     vector<u32>                          resPackIdxs;   //  用于注册需要ins对应的ResPackMgr中resPack的索引
      43              :     vector<CcuCtxSignature>              ctxSignatures; //  用于注册需要ins对应的CcuCtxSignature
      44              :     vector<InsIterator>                  insPtrs;       //  用于注册时需要setExecId提供ins迭代器
      45              :     unordered_map<CcuCtxSignature, unordered_map<u32, std::unique_ptr<CcuCtxGroup>>> ccuCtxGroups;  //  用于注册需要ins对应的ccuCtxGroup
      46              : 
      47              :     bool needHandShake{false};  // true: 有没注册的ctx则需要握手
      48              :     bool resAllocSuccess{true}; // true: 本地资源申请成功(包括connection\transport\transportGrp\ctx)
      49              :     bool isRollback{false}; // true: 资源申请失败,尝试回退
      50              : 
      51              :     void InsPreprocess(InsIterator &insIter, u32 resPackIndex, bool isMc2);
      52              :     void CreateCcuCtxGroup(const CcuInstruction &ccuIns, std::unique_ptr<CcuCtxGroup> &ccuCtxGroupPtr, bool &createStatus);
      53              :     std::unique_ptr<CcuContext> CreateCcuCtx(const CcuInstruction &ccuInst, bool &createStatus);
      54              :     bool CheckCtxTransportStatus(bool resAllocSuccess);
      55              :     void Fallback();
      56              :     void Confirm();
      57              :     void ClearTmpResRecords();
      58              : };
      59              : 
      60              : } // namespace Hccl
      61              : 
      62              : #endif // CCU_INS_PREPROCESSOR_H
        

Generated by: LCOV version 2.0-1