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_CCU_TRANS_GROUP_H
12 : #define HCCL_CCU_TRANS_GROUP_H
13 :
14 : #include <vector>
15 : #include "ccu_transport.h"
16 : #include "ccu_device_manager.h"
17 :
18 : namespace Hccl {
19 :
20 115 : MAKE_ENUM(TransportGrpStatus, INIT, FAIL)
21 :
22 : class CcuTransportGroup {
23 : public:
24 : explicit CcuTransportGroup(const vector<CcuTransport*>& transports, u32 cntCkeNum);
25 : CcuTransportGroup() = delete; // 禁用默认构造函数
26 : virtual ~CcuTransportGroup();
27 : void Destroy();
28 : TransportGrpStatus GetGrpStatus() const;
29 : HcclResult GetCntCkeId(u32 index, u32& cntCkeId) const;
30 : bool CheckTransports(const vector<CcuTransport*>& transports);
31 : HcclResult CheckTransportCntCke();
32 : const vector<CcuTransport*>& GetTransports() const;
33 :
34 : private:
35 : vector<CcuTransport*> transportsGrp{};
36 : vector<u32> cntCkesGroup{};
37 : u32 cntCkesGroupDieId{0};
38 : u32 cntCkeNumTransportGroupUse{0};
39 : vector<CcuResHandle> cntResHandleTransportGroupUse{};
40 : vector<ResInfo> ckeInfoTransportGroupUse{};
41 : bool isDestroyed{false};
42 : TransportGrpStatus grpStatus;
43 : };
44 :
45 : } // namespace Hccl
46 :
47 : #endif // HCCL_CCU_TRANS_GROUP_H
|