LCOV - code coverage report
Current view: top level - coll_communicator_mgr/api_c_adpt/resource - legacy_thread_c_adapt.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 14 0
Test Date: 2026-08-18 17:47:01 Functions: 0.0 % 2 0

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2026 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 <string>
      12              : #include <vector>
      13              : #include <memory>
      14              : #include "hccl/hccl_res.h"
      15              : #include "hccl_comm_pub.h"
      16              : #include "coll_comm_mgr.h"
      17              : #include "orion_adapter_rts.h"
      18              : #include "hcom_common.h"
      19              : #include "param_check_basic_v2.h"
      20              : #include "log.h"
      21              : 
      22              : #ifdef __cplusplus
      23              : extern "C" {
      24              : #endif
      25              : 
      26            0 : HcclResult HcomSetAttachedStream(const char* group, u32 graphId, const rtStream_t* stream, s32 len)
      27              : {
      28              :     EXCEPTION_HANDLE_BEGIN
      29            0 :     HCCL_INFO(
      30              :         "[HcomSetAttachedStream] entry, group[%s], graphId[%u], stream[%p], len[%d]",
      31              :         group == nullptr ? "nullptr" : group, graphId, stream, len);
      32              : 
      33            0 :     CHK_PRT_RET(len < 0, HCCL_ERROR("[HcomSetAttachedStream] len is %d", len), HCCL_E_PARA);
      34            0 :     CHK_PTR_NULL(stream);
      35            0 :     if (group == nullptr) {
      36            0 :         group = HCCL_WORLD_GROUP;
      37              :     }
      38              : 
      39            0 :     HCCLV2_FUNC_RUN([&]() -> HcclResult {
      40              :         return HCCL_SUCCESS;
      41              :         if (len == 0) {
      42              :             HCCL_WARNING("[HcomSetAttachedStream] len is 0, no stream");
      43              :             return HCCL_SUCCESS;
      44              :         }
      45              :         void* attachedStream = const_cast<void*>(static_cast<const void*>(stream[0]));
      46              :         s32 deviceLogicId = Hccl::HrtGetDevice();
      47              :         auto& mgr = hccl::CollCommMgr::GetInstance().GetOrderLaunchThreadMgr(deviceLogicId);
      48              :         return mgr.SetAttachedStream(std::string(group), graphId, attachedStream);
      49              :     }());
      50              : 
      51            0 :     std::shared_ptr<hccl::hcclComm> hcclComm = nullptr;
      52            0 :     std::vector<rtStream_t> rtStream(stream, stream + len);
      53            0 :     if (HcomGetCommByGroup(group, hcclComm) == HCCL_SUCCESS) {
      54            0 :         CHK_RET(hcclComm->SetAttachedStream(graphId, rtStream));
      55              :     } else {
      56            0 :         HCCL_WARNING("[HcomSetAttachedStream] HcclCommBase now don't support set attached stream");
      57              :     }
      58            0 :     EXCEPTION_HANDLE_END
      59            0 :     return HCCL_SUCCESS;
      60              : }
      61              : 
      62              : #ifdef __cplusplus
      63              : }
      64              : #endif
        

Generated by: LCOV version 2.0-1