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_generator_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 11 : CcuRepRemWaitSem::CcuRepRemWaitSem(CcuInsGeneratorBase* insGenPtr, const ChannelHandle channel, uint16_t semIndex, uint16_t mask, bool isProfiling)
21 11 : : insGenPtr(insGenPtr), channel(channel), semIndex(semIndex), mask(mask), isProfiling(isProfiling)
22 : {
23 11 : type = CcuRepType::REM_WAIT_SEM;
24 11 : instrCount = insGenPtr->GetInstrCount(type);
25 11 : }
26 :
27 6 : bool CcuRepRemWaitSem::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
28 : {
29 6 : this->instrId = instrId;
30 6 : translated = true;
31 :
32 6 : insGenPtr->CcuRepRemWaitSemTranslate(ccuKernel, instr, this);
33 :
34 6 : 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 6 : instrId += instrCount;
39 :
40 6 : return translated;
41 : }
42 :
43 6 : std::string CcuRepRemWaitSem::Describe()
44 : {
45 6 : return Hccl::StringFormat("Wait, Use semIndex[%u] and mask[%04x]", semIndex, mask);
46 : }
47 :
48 : }; // namespace CcuRep
49 : }; // namespace hcomm
|