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_v1.h"
9 : #include "string_util.h"
10 : #include "ccu_ins_generater_v1.h"
11 : #include "exception_util.h"
12 : #include "ccu_api_exception.h"
13 : #include "ccu_ins_generater_base.h"
14 : #include "ccu_kernel.h"
15 :
16 : namespace hcomm {
17 : namespace CcuRep {
18 :
19 8 : CcuRepBufReduce::CcuRepBufReduce(CcuInsGeneraterBase* insGenPtr, const std::vector<CcuBuf> &mem, uint16_t count, uint16_t dataType,
20 : uint16_t outputDataType, uint16_t opType, CompletedEvent sem, const CcuRep::Variable &len,
21 8 : uint16_t mask)
22 8 : : insGenPtr(insGenPtr), mem(mem), count(count), dataType(dataType), outputDataType(outputDataType), opType(opType), sem(sem),
23 16 : xnIdLength_(len), mask(mask)
24 : {
25 8 : type = CcuRepType::BUF_REDUCE;
26 8 : instrCount = 1;
27 8 : }
28 :
29 6 : bool CcuRepBufReduce::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
30 : {
31 6 : this->instrId = instrId;
32 6 : translated = true;
33 :
34 6 : instrCount = insGenPtr->GetInstrCount(type);
35 6 : insGenPtr->CcuRepBufReduceTranslate(ccuKernel, instr, this);
36 :
37 6 : instrId += instrCount;
38 :
39 6 : return translated;
40 : }
41 :
42 3 : std::string CcuRepBufReduce::Describe()
43 : {
44 3 : return Hccl::StringFormat("Reduce");
45 : }
46 :
47 : }; // namespace CcuRep
48 : }; // namespace hcomm
|