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 "string_util.h"
9 : #include "exception_util.h"
10 : #include "hcomm_c_adpt.h"
11 : #include "ccu_rep_v1.h"
12 : #include "ccu_api_exception.h"
13 : #include "ccu_ins_generater_v1.h"
14 : #include "ccu_kernel.h"
15 : #include "../../../../endpoint_pairs/channels/ccu/ccu_urma_channel.h"
16 :
17 : namespace hcomm {
18 : namespace CcuRep {
19 :
20 4 : CcuRepRemWaitSem::CcuRepRemWaitSem(CcuInsGeneraterBase* insGenPtr, const ChannelHandle channel, uint16_t semIndex, uint16_t mask, bool isProfiling)
21 4 : : insGenPtr(insGenPtr), channel(channel), semIndex(semIndex), mask(mask), isProfiling(isProfiling)
22 : {
23 4 : type = CcuRepType::REM_WAIT_SEM;
24 4 : instrCount = insGenPtr->GetInstrCount(type);
25 4 : }
26 :
27 4 : bool CcuRepRemWaitSem::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
28 : {
29 4 : this->instrId = instrId;
30 4 : translated = true;
31 :
32 4 : insGenPtr->CcuRepRemWaitSemTranslate(ccuKernel, instr, this);
33 :
34 4 : CHK_PRT_THROW(instrId > UINT16_MAX - instrCount,
35 : HCCL_ERROR("[CcuRepRemWaitSem::Translate]uint16 integer overflow occurs, instrId = [%hu], instrCount = [%hu]", instrId, instrCount),
36 : Hccl::InternalException, "integer overflow");
37 :
38 4 : instrId += instrCount;
39 :
40 4 : return translated;
41 : }
42 :
43 4 : std::string CcuRepRemWaitSem::Describe()
44 : {
45 4 : return Hccl::StringFormat("Wait, Use semIndex[%u] and mask[%04x]", semIndex, mask);
46 : }
47 :
48 : }; // namespace CcuRep
49 : }; // namespace hcomm
|