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 : #ifndef CCU_JETTY_CTX_MGR_V2_H
12 : #define CCU_JETTY_CTX_MGR_V2_H
13 :
14 : #include <vector>
15 :
16 : #include "ccu_jetty_ctx_mgr.h"
17 :
18 : #include "ccu_res_specs.h"
19 :
20 : namespace hcomm {
21 :
22 : struct JettyCtxGroup {
23 : uint32_t startJettyCtxId{0};
24 : uint32_t startTaJettyId{0};
25 : uint32_t useCnt{0}; // 记录对应channel是否已经全部释放
26 : bool configured{false}; // 记录是否已经配置jettyCtx表
27 : };
28 :
29 : class CcuJettyCtxMgrV2 : public CcuJettyCtxMgr {
30 : public:
31 : CcuJettyCtxMgrV2(const int32_t devLogicId, const uint8_t dieId, const uint32_t devPhyId);
32 :
33 : CcuJettyCtxMgrV2() = default;
34 27 : ~CcuJettyCtxMgrV2() override final = default;
35 :
36 : HcclResult Init() override final;
37 : HcclResult Alloc(const uint32_t feId, const uint32_t jettyNum, const uint32_t sqSize,
38 : std::vector<JettyInfo>& jettyInfos) override final;
39 : HcclResult Config(const uint32_t feId, const std::vector<JettyInfo> &jettyInfos,
40 : const std::vector<JettyCfg>& jettyCfgs) override final;
41 : HcclResult Release(const uint32_t feId, const std::vector<JettyInfo> &jettyInfos) override final;
42 :
43 : private:
44 : CcuChannelJettyMap channelJettyMap_{8, 1}; // 默认配比8:1
45 : std::vector<JettyCtxGroup> ctxGroups_{};
46 : HcclResult CheckCtxGroupsByFeId(const uint32_t feId);
47 : };
48 :
49 : }; // namespace hcomm
50 :
51 : #endif
|