LCOV - code coverage report
Current view: top level - legacy/ascend910/platform/resource/dispatcher_ctx - dispatcher_ctx.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 4 4
Test Date: 2026-08-17 10:19:35 Functions: 100.0 % 2 2

            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 CTX_H
      11              : #define CTX_H
      12              : 
      13              : #include "hccl_common.h"
      14              : #include "hccl/base.h"
      15              : #include "notify_pool.h"
      16              : 
      17              : namespace hccl {
      18              : using FftsCounterCallBack = HcclResult (*)(const HcclDispatcher&, Stream&);
      19              : HcclResult FftsHeadCounter(const HcclDispatcher& dispatcher, Stream& stream);
      20              : HcclResult FftsTailCounter(const HcclDispatcher& dispatcher, Stream& stream);
      21              : 
      22              : enum class CtxDispatcherType {
      23              :     DISPATCHER_NORMAL = 0,
      24              :     DISPATCHER_VIRTURAL,
      25              :     DISPATCHER_AICPU,
      26              :     DISPATCHER_FFTS,
      27              : };
      28              : 
      29              : class DispatcherCtx {
      30              : public:
      31          422 :     explicit DispatcherCtx(u32 devicePhyId, u32 timeOut = INVALID_UINT)
      32          422 :         : devicePhyId_(devicePhyId),
      33          422 :           waitTimeOut_(timeOut) {};
      34          422 :     ~DispatcherCtx() { Destroy(); };
      35              :     HcclResult Init();
      36              :     HcclResult Destroy();
      37              :     HcclDispatcher GetDispatcher() const;
      38              :     u32 GetWaitTimeOut() const;
      39              :     HcclResult SetWaitTimeOut(u32 waitTimeOut);
      40              :     FftsCounterCallBack GetInitTaskCallback() const;
      41              :     FftsCounterCallBack GetLaunchTaskCallback() const;
      42              :     HcclResult SetDispatcherHcclQos(u32 hcclQos);
      43              : 
      44              : private:
      45              :     CtxDispatcherType dispatcherType_;
      46              :     HcclDispatcher dispatcher_{nullptr};
      47              : 
      48              :     u32 devicePhyId_ = INVALID_UINT;
      49              :     u32 deviceLogicId_ = INVALID_UINT;
      50              :     DevType deviceType_ = DevType::DEV_TYPE_COUNT;
      51              :     u32 waitTimeOut_ = INVALID_UINT;
      52              :     HcclResult DispatcherInit(CtxDispatcherType type, const s32 devicePhyId, HcclDispatcher* dispatcher);
      53              : 
      54              :     FftsCounterCallBack g_InitTaskCallback = nullptr;
      55              :     FftsCounterCallBack g_LaunchTaskCallback = nullptr;
      56              : 
      57              :     std::mutex destroyMutex_;
      58              : };
      59              : } // namespace hccl
      60              : 
      61              : #endif
        

Generated by: LCOV version 2.0-1