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 "exception_util.h"
10 : #include "ccu_ins_generator_base.h"
11 : #include "internal_exception.h"
12 :
13 : namespace hcomm {
14 : namespace CcuRep {
15 :
16 7 : CcuRepRemPostSem::CcuRepRemPostSem(CcuInsGeneratorBase* insGenPtr, const ChannelHandle channel, uint16_t semIndex, uint16_t mask)
17 7 : : insGenPtr(insGenPtr), channel(channel), semIndex(semIndex), mask(mask)
18 : {
19 7 : type = CcuRepType::REM_POST_SEM;
20 7 : instrCount = insGenPtr->GetInstrCount(type);
21 7 : }
22 :
23 3 : bool CcuRepRemPostSem::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
24 : {
25 3 : this->instrId = instrId;
26 3 : translated = true;
27 :
28 3 : insGenPtr->CcuRepRemPostSemTranslate(ccuKernel, instr, this, dep);
29 3 : CHK_PRT_THROW((instrId > UINT16_MAX - instrCount),
30 : HCCL_ERROR("[CcuRepRemPostSem::Translate]uint16 integer overflow occurs, instrId = [%hu], instrCount = [%hu]", instrId, instrCount),
31 : Hccl::InternalException, "integer overflow");
32 3 : instrId += instrCount;
33 :
34 3 : return translated;
35 : }
36 :
37 3 : std::string CcuRepRemPostSem::Describe()
38 : {
39 3 : return Hccl::StringFormat("Post, Use semIndex[%u] and mask[%04x]", semIndex, mask);
40 : }
41 :
42 : }; // namespace CcuRep
43 : }; // namespace hcomm
|