Line data Source code
1 : /**
2 : * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 :
11 : #ifndef HCOMM_CCU_REPRESENTATION_BUFREDUCE_H
12 : #define HCOMM_CCU_REPRESENTATION_BUFREDUCE_H
13 :
14 : #include <vector>
15 :
16 : #include "ccu_rep_base_v1.h"
17 : #include "ccu_datatype_v1.h"
18 :
19 : namespace hcomm {
20 : namespace CcuRep {
21 :
22 : class CcuRepBufReduce : public CcuRepBase {
23 : public:
24 : CcuRepBufReduce(
25 : CcuInsGeneratorBase* insGenPtr, const std::vector<CcuBuf>& mem, uint16_t count, uint16_t dataType,
26 : uint16_t outputDataType, uint16_t opType, CompletedEvent sem, const CcuRep::Variable& len,
27 : uint16_t mask = 1);
28 : bool Translate(CcuKernel* ccuKernel, CcuInstr*& instr, uint16_t& instrId, const TransDep& dep) override;
29 : std::string Describe() override;
30 14 : const std::vector<CcuBuf>& GetMem() { return mem; }
31 24 : uint16_t GetCount() { return count; }
32 8 : uint16_t GetDataType() { return dataType; }
33 10 : uint16_t GetOutputDataType() { return outputDataType; }
34 10 : uint16_t GetOpType() { return opType; }
35 0 : uint16_t GetXnLengthId() { return xnIdLength_.Id(); }
36 8 : uint16_t GetMask() { return mask; }
37 0 : uint16_t GetSemId() { return sem.Id(); }
38 :
39 7 : CompletedEvent GetSem() { return sem; }
40 7 : CcuRep::Variable GetXnIdLength() { return xnIdLength_; }
41 :
42 : private:
43 : CcuInsGeneratorBase* insGenPtr;
44 : std::vector<CcuBuf> mem;
45 : uint16_t count;
46 : uint16_t dataType;
47 : uint16_t outputDataType;
48 : uint16_t opType;
49 : CompletedEvent sem;
50 : CcuRep::Variable xnIdLength_;
51 :
52 : uint16_t mask{0};
53 : };
54 :
55 : }; // namespace CcuRep
56 : }; // namespace hcomm
57 : #endif // HCOMM_CCU_REPRESENTATION_BUFREDUCE_H
|