LCOV - code coverage report
Current view: top level - legacy/ascend950/framework/device_mode - aicpu_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 AICPU_INS_PREPROCESSOR_H
      11              : #define AICPU_INS_PREPROCESSOR_H
      12              : 
      13              : #include <unordered_map>
      14              : #include <memory>
      15              : #include "aicpu_ins.h"
      16              : #include "ins_queue.h"
      17              : #include "dev_buffer.h"
      18              : #include "communicator_impl.h"
      19              : #include "virtual_topo.h"
      20              : #include "connections_builder.h"
      21              : 
      22              : namespace Hccl {
      23              : 
      24              : class AicpuInsPreprocessor {
      25              : public:
      26              :     using InsIterator = HierarchicalQueue<Instruction, InsQueue>::Iterator;
      27              : 
      28          244 :     explicit AicpuInsPreprocessor(CommunicatorImpl *comm) : comm(comm)
      29              :     {
      30          244 :     }
      31              : 
      32              :     void Preprocess(std::shared_ptr<InsQueue> &insQueue);
      33              : 
      34              :     // AlltoallV算子使用
      35              :     void       SetAicpuKernelLaunchParam(HcclKernelLaunchParam &param);
      36              :     bool       IsAicpuResExisted(const std::string &algName);
      37              :     void       SetAicpuResExisted(const std::string &algName);
      38              :     DevBuffer *GetAicpuResBuffer(const std::string &algName);
      39              : 
      40              : private:
      41              :     CommunicatorImpl *comm;
      42              :     std::unordered_map<std::string, std::shared_ptr<DevBuffer>> aicpuResMap; // 集合通信算子资源加载到device侧的内存
      43              :     std::unordered_map<std::string, bool> aicpuResExistedMap;
      44              : 
      45              :     std::set<LinkData>                                         availableLinks;
      46              :     unordered_map<std::string, unique_ptr<ConnectionsBuilder>> connectionsBuilders;
      47              : 
      48              :     // AlltoallV算子使用
      49              :     std::vector<std::shared_ptr<DevBuffer>> sendCountsMem{};
      50              :     std::vector<std::shared_ptr<DevBuffer>> recvCountsMem{};
      51              :     std::vector<std::shared_ptr<DevBuffer>> sdisplsMem{};
      52              :     std::vector<std::shared_ptr<DevBuffer>> rdisplsMem{};
      53              :     bool                                    isCountMemInited{false};
      54              :     u32                                     resIndex{0};
      55              :     u32                                     launchResIndex{0};
      56              : 
      57              :     void InsPreprocess(InsIterator &insIter);
      58              : 
      59              :     void AllocQueueNotify(std::vector<std::tuple<QId, QId, u32>> &queueNotifyReq) const;
      60              :     void AllocBcastPostCntNotify(std::vector<std::pair<QId, u32>> &bcastPostCntNotifyReq) const;
      61              :     void AllocWaitGroupCntNotify(std::vector<std::pair<QId, u32>> &waitGroupCntNotifyReq) const;
      62              :     void AllocWorkStream(u32 primQueueNum) const;
      63              :     void AllocInterRankNotifies(const vector<LinkData> &links);
      64              :     void BatchBuildTransports(const vector<LinkData> &links);
      65              : 
      66              :     void PackResAndCopyToDev(const std::string &algName, const CollAlgResReq &collAlgResReq);
      67              : 
      68              :     // AlltoallV算子使用
      69              :     void AllocAlltoallVOpMem();
      70              : 
      71              :     std::vector<char> PackOpData(const std::string &opTag, const std::string &algName, const CollAlgResReq &resReq);
      72              : };
      73              : 
      74              : } // namespace Hccl
      75              : 
      76              : #endif // AICPU_INS_PREPROCESSOR_H
        

Generated by: LCOV version 2.0-1