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