Line data Source code
1 : /*
2 : * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
3 : * Description: ccu representation implementation file
4 : * Author: sunzhepeng
5 : * Create: 2024-06-17
6 : */
7 :
8 : #include "ccu_rep_v1.h"
9 : #include "string_util.h"
10 : #include "exception_util.h"
11 : #include "ccu_api_exception.h"
12 :
13 : #include "ccu_ins_generater_base.h"
14 : #include "ccu_kernel.h"
15 :
16 : namespace hcomm {
17 : namespace CcuRep {
18 :
19 : using namespace Hccl;
20 :
21 36 : CcuRepLoadArg::CcuRepLoadArg(CcuInsGeneraterBase* insGenPtr, const Variable &var, uint16_t argId, uint16_t fullArgId) :
22 36 : insGeneratorPtr_(insGenPtr), var(var), argId(argId), fullArgId(fullArgId)
23 : {
24 36 : type = CcuRepType::LOAD_ARG;
25 36 : instrCount = insGeneratorPtr_->GetInstrCount(type);
26 36 : }
27 :
28 34 : bool CcuRepLoadArg::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
29 : {
30 34 : this->instrId = instrId;
31 34 : translated = true;
32 :
33 34 : CHK_RET_THROW(Hccl::CcuApiException,
34 : Hccl::StringFormat("[CcuRepLoadArg][%s] failed to translate repLoadArg for instrId[%u] ", __func__, instrId),
35 : insGeneratorPtr_->CcuRepLoadArgTranslate(ccuKernel, instr, instrId, this, dep));
36 :
37 34 : instrId += instrCount;
38 :
39 34 : return translated;
40 : }
41 :
42 33 : std::string CcuRepLoadArg::Describe()
43 : {
44 33 : return Hccl::StringFormat("Variable[%u] = Arg[%u] (slot=%u)", var.Id(), fullArgId, argId);
45 : }
46 :
47 : }; // namespace CcuRep
48 : }; // namespace hcomm
|