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_generator_v1.h"
14 : #include "../../../../endpoint_pairs/channels/ccu/ccu_urma_channel.h"
15 : #include "ccu_kernel.h"
16 : #include "ccu_ins_generator_base.h"
17 :
18 : namespace hcomm {
19 : namespace CcuRep {
20 :
21 7 : CcuRepWrite::CcuRepWrite(CcuInsGeneratorBase* insGenPtr, const ChannelHandle channel, RemoteAddr rem, LocalAddr loc, Variable len, CompletedEvent sem,
22 7 : uint16_t mask)
23 7 : : insGenPtr(insGenPtr), channel(channel), rem(rem), loc(loc), len(len), sem(sem), mask(mask)
24 : {
25 7 : type = CcuRepType::WRITE;
26 7 : instrCount = insGenPtr->GetInstrCount(type);
27 7 : }
28 :
29 3 : CcuRepWrite::CcuRepWrite(CcuInsGeneratorBase* insGenPtr, const ChannelHandle channel, RemoteAddr rem, LocalAddr loc, Variable len,
30 3 : uint16_t dataType, uint16_t opType, CompletedEvent sem, uint16_t mask)
31 3 : : insGenPtr(insGenPtr), channel(channel), rem(rem), loc(loc), len(len), sem(sem), mask(mask),
32 3 : dataType(dataType), opType(opType), reduceFlag(1)
33 : {
34 3 : type = CcuRepType::WRITE;
35 3 : instrCount = insGenPtr->GetInstrCount(type);
36 3 : }
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
|