LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/impl/coll_executor/coll_reduce - coll_reduce_single_rank_executor.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 22 0
Test Date: 2026-08-18 17:47:01 Functions: 0.0 % 2 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              : #include "coll_reduce_single_rank_executor.h"
      12              : 
      13              : namespace hccl {
      14              : 
      15            0 : CollReduceSingleRankExecutor::CollReduceSingleRankExecutor(
      16            0 :     const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher>& topoMatcher)
      17            0 :     : CollReduceExecutor(dispatcher, topoMatcher)
      18            0 : {}
      19              : 
      20            0 : HcclResult CollReduceSingleRankExecutor::KernelRun(const OpParam& param, ExecMem& execMem)
      21              : {
      22            0 :     HCCL_CONFIG_INFO(HCCL_ALG, "[CollReduceSingleRankExecutor][KernelRun] userRank[%u] starts.", topoAttr_.userRank);
      23            0 :     u64 totalSize = execMem.count * SIZE_TABLE[param.DataDes.dataType];
      24            0 :     ReduceType reduceType
      25            0 :         = ((param.reduceType != HCCL_REDUCE_PROD) && (param.DataDes.dataType != HCCL_DATA_TYPE_INT64)) ?
      26              :               ReduceType::INLINE_REDUCE :
      27              :               ReduceType::TBE_REDUCE;
      28            0 :     auto autoSelectedAlgTypeLevel1 = static_cast<u32>(algType_.algoLevel1);
      29            0 :     bool isRootRank = param.root == topoAttr_.realUserRank ? true : false;
      30            0 :     bool hugeData = IsHugeData(totalSize); // override
      31            0 :     u8 deterministic = topoMatcher_->GetExternalInputHcclDeterministic();
      32              : 
      33            0 :     auto opMeta = HcclOpMetaInfo::GetOneForReduce(
      34            0 :         isRootRank, param.root, autoSelectedAlgTypeLevel1, param.DataDes.dataType, reduceType, hugeData, deterministic);
      35            0 :     CHK_RET(InitTask(dispatcher_, const_cast<Stream&>(param.stream), opMeta.isEnableCache, opMeta.GetCacheKey()));
      36              : 
      37            0 :     DeviceMem srcMem(execMem.inputPtr, totalSize);
      38            0 :     DeviceMem dstMem(execMem.outputPtr, totalSize);
      39            0 :     CHK_RET(HcclD2DMemcpyAsync(dispatcher_, dstMem, srcMem, const_cast<Stream&>(param.stream)));
      40            0 :     CHK_RET(LaunchTask(dispatcher_, const_cast<Stream&>(param.stream)));
      41            0 :     return HCCL_SUCCESS;
      42            0 : }
      43              : 
      44              : REGISTER_EXEC("ReduceSingleExecutor", ReduceSingleRank, CollReduceSingleRankExecutor);
      45              : 
      46              : } // namespace hccl
        

Generated by: LCOV version 2.0-1