LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/common - tokenInfo_manager.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              : 
      11              : #ifndef HCCLV2_TOKENINFO_MANAGER_H
      12              : #define HCCLV2_TOKENINFO_MANAGER_H
      13              : 
      14              : #include <mutex>
      15              : #include <vector>
      16              : #include <unordered_map>
      17              : #include <hccl/hccl_types.h>
      18              : #include "buffer_key.h"
      19              : #include "orion_adapter_hccp.h"
      20              : 
      21              : namespace Hccl {
      22              : 
      23              : using TokenInfo = std::pair<TokenIdHandle, uint32_t>;
      24              : using BufKeyVecIndex = u32;
      25              : 
      26              : class TokenInfoManager
      27              : {
      28              : public:
      29           43 :     TokenInfoManager(u32 devId, RdmaHandle rdmahandle) : devId_(devId), rdmahandle_(rdmahandle)
      30              :     {
      31           43 :     }
      32              :     
      33              :     TokenInfo GetTokenInfo(const BufferKey<uintptr_t, u64> &bufKey);
      34              : 
      35              :     void Destroy();
      36              : 
      37              : private:
      38              :     u32        devId_;
      39              :     RdmaHandle rdmahandle_;
      40              :     std::mutex tokenInfoMgrMutex_;
      41              : 
      42              :     std::unordered_map<BufKeyVecIndex, TokenInfo> tokenInfoMap_;
      43              :     std::unordered_map<u32, vector<vector<BufferKey<uintptr_t, u64>>>> bufferKeysMap_; // <devId, BufKeyVecIndex, vector<BufferKey>>
      44              : 
      45              :     BufKeyVecIndex GetBufferVecIndex(const BufferKey<uintptr_t, u64> &inputBufKey);
      46              : };
      47              : 
      48              : bool HasIntersect(const vector<BufferKey<uintptr_t, u64>> &bufKeys, const BufferKey<uintptr_t, u64> &inputBufKey);
      49              : 
      50              : } // namespace Hccl
      51              : 
      52              : #endif // HCCLV2_TOKENINFO_MANAGER_H
        

Generated by: LCOV version 2.0-1