LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/base/alg_template - template_v1_utils.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 2 2
Test Date: 2026-08-18 17:47:01 Functions: - 0 0

            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              : #ifndef HCCL_TEMPLATE_UTILS_H
      12              : #define HCCL_TEMPLATE_UTILS_H
      13              : 
      14              : #include <condition_variable>
      15              : #include <functional>
      16              : #include <map>
      17              : #include <memory>
      18              : #include <mutex>
      19              : #include <string>
      20              : #include <vector>
      21              : #include "alltoall_utils_pub.h"
      22              : #include "device_capacity.h"
      23              : #include "ffts_common_pub.h"
      24              : #include "hccl_socket.h"
      25              : #include "local_notify.h"
      26              : #include "stream_pub.h"
      27              : #include "transport_pub.h"
      28              : #include "comm_utils.h"
      29              : 
      30              : struct SendRecvInfo {
      31              :     // 存放数据长度和偏移长度
      32              :     std::vector<u64> sendLength;
      33              :     std::vector<u64> sendOffset;
      34              :     std::vector<u64> recvLength;
      35              :     std::vector<u64> recvOffset;
      36              :     // 存放数据个数和偏移个数
      37              :     std::vector<u64> sendCounts;
      38              :     std::vector<u64> sendDispls;
      39              :     std::vector<u64> recvCounts;
      40              :     std::vector<u64> recvDispls;
      41              : };
      42              : 
      43              : struct ZCopySendRecvInfo {
      44              :     // 存放数据长度和偏移长度
      45              :     std::vector<u64> localRecvLength;
      46              :     std::vector<u64> localRecvOffset;
      47              :     std::vector<u64> remoteSendOffset;
      48              : };
      49              : 
      50           10 : struct Slice {
      51              :     u64 offset{0}; // Slice相对于input/output的偏移字节数,gather类操作取output,scatter类操作取input
      52              :     u64 size{0};   // Slice的数据大小,单位:字节
      53              : };
      54              : 
      55              : struct MemBlockInfo {
      56              :     std::vector<u64> size;             // 每块数据块的字节大小
      57              :     std::vector<u64> userInputOffsets; // 每个输入块的起始偏移字节数(UserIn)
      58              :     std::vector<u64> inputOffsets;     // 每个输入块的起始偏移字节数(CclIn)
      59              :     std::vector<u64> outputOffsets;    // 每个输出块的起始偏移字节数
      60              : };
      61              : 
      62              : namespace hccl {
      63              : // common.h
      64              : constexpr s64 HCCL_SMALL_COUNT_32_KB = 32 * 1024; // hccl小数据量标准,暂定512KB
      65              : 
      66              : struct SubCommInfo {
      67              :     u32 localRank;
      68              :     u32 localRankSize;
      69              :     std::vector<LINK> links;
      70              :     std::vector<LINK> virtualLinks; // for alltoall 多线程性能提升使用
      71              : };
      72              : 
      73              : struct NslbDpAdjInfo {
      74              :     uint16_t dstLocalRankId;
      75              :     uint8_t phaseId;
      76              :     uint8_t rev;
      77              : };
      78              : 
      79              : // 算法信息表AdjInfo
      80           30 : struct AdjInfo {
      81              :     uint16_t dstRankNum;
      82              :     uint16_t rev;
      83              :     std::vector<NslbDpAdjInfo> nsAdjInfo;
      84              : };
      85              : 
      86              : // broadcast_nb_binary_pub.h
      87              : bool ShouldUseBinaryBroadcastOfNB(
      88              :     const u64 dataSize, const u32 rankSize, const u32 userRankSize, const float bandwidth);
      89              : 
      90              : // all_reduce_nb_pub.h
      91              : u64 GetSliceSizeOfNB(const u64 dataSize, const u32 rankSize);
      92              : } // namespace hccl
      93              : 
      94              : #endif /* HCCL_TEMPLATE_UTILS_H */
        

Generated by: LCOV version 2.0-1