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 : #include "ccu_rep_v1.h"
8 :
9 : #include "string_util.h"
10 : #include "exception_util.h"
11 : #include "hcomm_c_adpt.h"
12 : #include "ccu_api_exception.h"
13 : #include "ccu_ins_generater_v1.h"
14 : #include "../../../../endpoint_pairs/channels/ccu/ccu_urma_channel.h"
15 : #include "ccu_kernel.h"
16 : #include "ccu_ins_generater_base.h"
17 :
18 : namespace hcomm {
19 : namespace CcuRep {
20 :
21 5 : CcuRepWrite::CcuRepWrite(CcuInsGeneraterBase* insGenPtr, const ChannelHandle channel, RemoteAddr rem, LocalAddr loc, Variable len, CompletedEvent sem,
22 5 : uint16_t mask)
23 5 : : insGenPtr(insGenPtr), channel(channel), rem(rem), loc(loc), len(len), sem(sem), mask(mask)
24 : {
25 5 : type = CcuRepType::WRITE;
26 5 : instrCount = insGenPtr->GetInstrCount(type);
27 5 : }
28 :
29 2 : CcuRepWrite::CcuRepWrite(CcuInsGeneraterBase* insGenPtr, const ChannelHandle channel, RemoteAddr rem, LocalAddr loc, Variable len,
30 2 : uint16_t dataType, uint16_t opType, CompletedEvent sem, uint16_t mask)
31 2 : : insGenPtr(insGenPtr), channel(channel), rem(rem), loc(loc), len(len), sem(sem), mask(mask),
32 2 : dataType(dataType), opType(opType), reduceFlag(1)
33 : {
34 2 : type = CcuRepType::WRITE;
35 2 : instrCount = 1;
36 2 : }
37 :
38 3 : bool CcuRepWrite::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
39 : {
40 3 : this->instrId = instrId;
41 3 : translated = true;
42 :
43 3 : insGenPtr->CcuRepWriteTranslate(ccuKernel, instr, this);
44 3 : instrId += instrCount;
45 :
46 3 : return translated;
47 : }
48 :
49 4 : std::string CcuRepWrite::Describe()
50 : {
51 : return Hccl::StringFormat(
52 : "Write RemoteAddr[%u] to LocalAddr[%u], length[%u], set sem[%u] with mask[%04x], dataType[%u], opType[%u]",
53 4 : loc.addr.Id(), rem.addr.Id(), len.Id(), sem.Id(), mask, dataType, opType);
54 : }
55 :
56 : }; // namespace CcuRep
57 : }; // namespace hcomm
|