LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/resource/stream - stream.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 HCCLV2_STREAM_H
      11              : #define HCCLV2_STREAM_H
      12              : 
      13              : #include "orion_adapter_rts.h"
      14              : #include "stream_lite.h"
      15              : namespace Hccl {
      16              : 
      17              : class Stream {
      18              : public:
      19              :     explicit Stream(aclrtStream ptr, bool isMaster = true);
      20              : 
      21              :     explicit Stream(bool deviceUsed = false, bool isMaster = true);
      22              : 
      23              :     Stream(const Stream &stream, bool isMaster = true) = delete;
      24              : 
      25              :     Stream &operator=(const Stream &stream) = delete;
      26              : 
      27              :     ~Stream();
      28              : 
      29            7 :     bool operator==(const Stream &rhs) const
      30              :     {
      31            7 :         return ptr == rhs.ptr;
      32              :     }
      33              : 
      34              :     bool operator!=(const Stream &rhs) const
      35              :     {
      36              :         return !(rhs == *this);
      37              :     }
      38              : 
      39              :     void SetStmMode(u64 stmMode);
      40              : 
      41              :     aclrtStream GetPtr() const;
      42              : 
      43              :     u32 GetId() const;
      44              : 
      45              :     u32 GetSqId() const;
      46              : 
      47              :     bool IsMaster() const;
      48              : 
      49              :     bool IsSelfOwned() const;
      50              : 
      51              :     u64 GetMode() const;
      52              : 
      53              :     std::vector<char> GetUniqueId() const;
      54              : 
      55              :     std::string Describe() const;
      56              : 
      57              : private:
      58              :     static constexpr int32_t HCCL_STREAM_PRIORITY_LOW  = 5;
      59              :     static constexpr int32_t HCCL_STREAM_PRIORITY_HIGH = 5;
      60              :     static constexpr int32_t STREAM_MODE_STOP_ON_FAILURE = 1; // 配置流失败模式为遇错即停
      61              : 
      62              :     aclrtStream ptr;
      63              :     u32        id{0};
      64              :     bool       selfOwned{false};
      65              :     u64        mode{0};
      66              :     bool       devUsed{false};
      67              :     u32        sqId{0};
      68              :     u32        cqId{0};
      69              :     u32        devPhyId{0};
      70              :     bool       isMaster_{true};
      71              : 
      72              :     void InitDevPhyId();
      73              : };
      74              : 
      75              : } // namespace Hccl
      76              : #endif
        

Generated by: LCOV version 2.0-1