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