Line data Source code
1 : /**
2 : * Copyright (c) 2026 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 : #include "ccu_rep_v1.h"
12 : #include "ccu_assist_v1.h"
13 :
14 : #include "string_util.h"
15 :
16 : #include "exception_util.h"
17 : #include "ccu_api_exception.h"
18 : #include "hcomm_c_adpt.h"
19 :
20 : #include "../../../../endpoint_pairs/channels/ccu/ccu_urma_channel.h"
21 : #include "ccu_ins_generator_base.h"
22 : #include "ccu_kernel.h"
23 :
24 : namespace hcomm {
25 : namespace CcuRep {
26 :
27 2 : CcuRepRemMem::CcuRepRemMem(CcuInsGeneratorBase* insGenPtr, const ChannelHandle channel, RemoteAddr rem)
28 2 : : insGenPtr(insGenPtr),
29 2 : channel(channel),
30 2 : rem(rem)
31 : {
32 2 : type = CcuRepType::REM_MEM;
33 2 : instrCount = insGenPtr->GetInstrCount(type);
34 2 : }
35 :
36 0 : bool CcuRepRemMem::Translate(
37 : CcuKernel* ccuKernel, CcuInstr*& instr, uint16_t& instrId, [[maybe_unused]] const TransDep& dep)
38 : {
39 0 : this->instrId = instrId;
40 0 : translated = true;
41 :
42 0 : instrCount = insGenPtr->GetInstrCount(type);
43 0 : CHK_PRT_THROW(
44 : insGenPtr->CcuRepRemMemTranslate(ccuKernel, instr, this) != HcclResult::HCCL_SUCCESS,
45 : HCCL_ERROR("[CcuRepRemMem][Translate] failed to translate for instrId[%u]", instrId), Hccl::CcuApiException,
46 : "CcuRepRemMem translate failed");
47 0 : instrId += instrCount;
48 :
49 0 : return translated;
50 : }
51 :
52 0 : std::string CcuRepRemMem::Describe()
53 : {
54 0 : return Hccl::StringFormat("Get Remote Buffer Addr and TokenInfo By Transport");
55 : }
56 :
57 : }; // namespace CcuRep
58 : }; // namespace hcomm
|