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