LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_device/ccu_comp/ccu_channel/ccu_channel_ctx_v1 - ccu_jetty_ctx_mgr_v1.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 6 6
Test Date: 2026-08-18 17:47:01 Functions: 75.0 % 4 3

            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 CCU_JETTY_CTX_MGR_V1_H
      12              : #define CCU_JETTY_CTX_MGR_V1_H
      13              : 
      14              : #include <memory>
      15              : #include <vector>
      16              : #include <unordered_map>
      17              : 
      18              : #include "ccu_jetty_ctx_mgr.h"
      19              : #include "ccu_res_allocator.h"
      20              : #include "ccu_wqebb_mgr_v1.h"
      21              : 
      22              : namespace hcomm {
      23              : 
      24              : class CcuJettyCtxMgrV1 : public CcuJettyCtxMgr {
      25              : public:
      26          170 :     CcuJettyCtxMgrV1(const int32_t devLogicId, const uint8_t dieId, const uint32_t devPhyId)
      27          170 :         : CcuJettyCtxMgr(devLogicId, dieId, devPhyId) {};
      28              : 
      29              :     CcuJettyCtxMgrV1() = default;
      30          170 :     ~CcuJettyCtxMgrV1() override final = default;
      31              : 
      32              :     HcclResult Init() override final;
      33              : 
      34              :     HcclResult Alloc(
      35              :         const uint32_t feId, const uint32_t jettyNum, const uint32_t sqSize,
      36              :         std::vector<JettyInfo>& jettyInfos) override final;
      37              :     HcclResult Config(
      38              :         const uint32_t feId, const std::vector<JettyInfo>& jettyInfos,
      39              :         const std::vector<JettyCfg>& jettyCfgs) override final;
      40              :     HcclResult Release(const uint32_t feId, const std::vector<JettyInfo>& jettyInfos) override final;
      41              : 
      42              : private:
      43              :     struct JettyAllocator {
      44              :         PfeJettyStrategy strategy{};
      45              :         std::unique_ptr<CcuResIdAllocator> idAllocator{nullptr};
      46              : 
      47          170 :         explicit JettyAllocator(PfeJettyStrategy pfeJettyStrategy) : strategy(pfeJettyStrategy)
      48              :         {
      49              :             // 外部对空指针进行校验
      50          170 :             idAllocator.reset(new (std::nothrow) CcuResIdAllocator(strategy.size));
      51          170 :         }
      52              :     };
      53              : 
      54              :     HcclResult GetJettyAllocator(uint32_t feId, JettyAllocator*& allocatorHandle);
      55              : 
      56              : private:
      57              :     std::unique_ptr<JettyAllocator> allocator_; // 所有FE的Jetty统一打平分配
      58              : };
      59              : 
      60              : }; // namespace hcomm
      61              : 
      62              : #endif
        

Generated by: LCOV version 2.0-1