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 DEV_AICPU_TS_HCCS_CHANNEL_H
12 : #define DEV_AICPU_TS_HCCS_CHANNEL_H
13 :
14 : #include "common.h"
15 : #include "channel_param.h"
16 : #include "hccl_dispatcher_ctx.h"
17 : #include "dev_aicpu_ts_channel.h"
18 :
19 : namespace hccl {
20 : class DevAicpuTsHccsChannel : public DevAicpuTsChannel {
21 : public:
22 0 : DevAicpuTsHccsChannel() = default;
23 : ~DevAicpuTsHccsChannel() override;
24 :
25 : HcclResult
26 : Create(const void* blob, u64 blobBytes, const HcommDeviceInfo& deviceInfo, ChannelHandle& outHandle) override;
27 : bool Destroy(ChannelHandle handle) override;
28 :
29 : private:
30 : HcclResult SetTransportMachinePara(hccl::MachinePara& machinePara, const HcclChannelHccsRes& channelHccsRes);
31 :
32 : struct HccsSlot {
33 : DispatcherCtxPtr dispatcherCtx{nullptr};
34 : std::shared_ptr<hccl::Transport> transport;
35 : std::string tag{""};
36 : };
37 :
38 : std::unordered_map<ChannelHandle, HccsSlot> slots_;
39 : std::mutex mutex_;
40 : };
41 : } // namespace hccl
42 :
43 : #endif // DEV_AICPU_TS_HCCS_CHANNEL_H
|