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 :
10 : #include "string_util.h"
11 : #include "exception_util.h"
12 : #include "ccu_api_exception.h"
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 117 : CcuRepNop::CcuRepNop(CcuInsGeneratorBase* insGeneratorPtr) : insGeneratorPtr_(insGeneratorPtr)
22 : {
23 117 : type = CcuRepType::NOP;
24 117 : instrCount = insGeneratorPtr_->GetInstrCount(type);
25 117 : }
26 :
27 56 : bool CcuRepNop::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
28 : {
29 56 : this->instrId = instrId;
30 56 : translated = true;
31 :
32 56 : CHK_RET_THROW(Hccl::CcuApiException,
33 : Hccl::StringFormat("[CcuRepNop][%s] failed to translate repNop for instrId[%u] ", __func__, instrId),
34 : insGeneratorPtr_->CcuRepNopTranslate(ccuKernel, instr, instrId, this, dep));
35 :
36 56 : instrId += instrCount;
37 :
38 56 : return translated;
39 : }
40 :
41 1 : std::string CcuRepNop::Describe()
42 : {
43 1 : return Hccl::StringFormat("Nop");
44 : }
45 :
46 : }; // namespace CcuRep
47 : }; // namespace hcomm
|