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_generator_base.h"
14 : #include "ccu_kernel.h"
15 :
16 : namespace hcomm {
17 : namespace CcuRep {
18 :
19 : using namespace Hccl;
20 :
21 53 : CcuRepLoadArg::CcuRepLoadArg(CcuInsGeneratorBase* insGenPtr, const Variable &var, uint16_t argId, uint16_t fullArgId) :
22 53 : insGeneratorPtr_(insGenPtr), var(var), argId(argId), fullArgId(fullArgId)
23 : {
24 53 : type = CcuRepType::LOAD_ARG;
25 53 : instrCount = insGeneratorPtr_->GetInstrCount(type);
26 53 : }
27 :
28 49 : bool CcuRepLoadArg::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
29 : {
30 49 : this->instrId = instrId;
31 49 : translated = true;
32 :
33 49 : 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 49 : instrId += instrCount;
38 :
39 49 : return translated;
40 : }
41 :
42 48 : std::string CcuRepLoadArg::Describe()
43 : {
44 48 : return Hccl::StringFormat("Variable[%u] = Arg[%u] (slot=%u)", var.Id(), fullArgId, argId);
45 : }
46 :
47 : }; // namespace CcuRep
48 : }; // namespace hcomm
|