Line data Source code
1 : /*
2 : * Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved.
3 : * Description: ccu representation base header file
4 : * Create: 2025-02-18
5 : */
6 :
7 : #ifndef HCOMM_CCU_REPRESENTATION_LOOP_H
8 : #define HCOMM_CCU_REPRESENTATION_LOOP_H
9 :
10 : #include <memory>
11 :
12 : #include "ccu_datatype_v1.h"
13 : #include "ccu_rep_base_v1.h"
14 : #include "ccu_rep_loopblock_v1.h"
15 :
16 : namespace hcomm {
17 : namespace CcuRep {
18 :
19 : class CcuRepLoop : public CcuRepBase {
20 : public:
21 : explicit CcuRepLoop(CcuInsGeneratorBase* insGeneratorPtr, const std::string &label, const Variable &loopParam);
22 : explicit CcuRepLoop(CcuInsGeneratorBase* insGeneratorPtr, const std::string &label,
23 : const Variable &loopParam, const Variable &loopIterNum, const Variable &loopGsaOffset);
24 : bool Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep) override;
25 : std::string Describe() override;
26 : const std::string &GetLabel() const;
27 :
28 : void Reference(std::shared_ptr<CcuRepLoopBlock> refRep);
29 : std::shared_ptr<CcuRepBase> SetLoopParam(Executor executor, Variable var);
30 1 : CcuRepLoopBlock* GetLoopBlock() { return loopBlock.get(); }
31 :
32 1 : Variable* GetLoopParam() { return &loopParam; }
33 0 : Variable GetLoopIterNum() {return loopIterNum;}
34 0 : Variable GetLoopGsaOffset() {return loopGsaOffset;}
35 :
36 : private:
37 : void ValidateInsGeneratorForLoop();
38 :
39 : CcuInsGeneratorBase* insGeneratorPtr_;
40 : std::string label;
41 : std::shared_ptr<CcuRepLoopBlock> loopBlock{nullptr};
42 :
43 : Variable loopParam;
44 : Variable loopIterNum;
45 : Variable loopGsaOffset;
46 : CcuInstr *instr{nullptr};
47 :
48 : bool supportCcuV1{false};
49 : bool supportCcuV2{false};
50 : };
51 :
52 : }; // namespace CcuRep
53 : }; // namespace hcomm
54 : #endif // HCCL_CCU_REPRESENTATION_LOOP_H
|