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_LOOP_CALL_H
12 : #define HCOMM_CCU_REPRESENTATION_LOOP_CALL_H
13 :
14 : #include "ccu_rep_base_v1.h"
15 : #include "ccu_rep_loopblock_v1.h"
16 :
17 : namespace hcomm {
18 : namespace CcuRep {
19 :
20 : class CcuRepLoopCall : public CcuRepBase {
21 : public:
22 : explicit CcuRepLoopCall(CcuInsGeneratorBase* insGeneratorPtr, const std::string& label);
23 : bool Translate(CcuKernel* ccuKernel, CcuInstr*& instr, uint16_t& instrId, const TransDep& dep) override;
24 : std::string Describe() override;
25 : uint16_t InstrCount() override;
26 : const std::string& GetLabel() const;
27 :
28 : void Reference(std::shared_ptr<CcuRepLoopBlock> refRep);
29 :
30 : void SetInArg(const Variable& var);
31 : void SetInArg(const std::vector<Variable>& varList);
32 : void SetInArg(const Memory& mem);
33 : void SetInArg(const std::vector<Memory>& memList);
34 :
35 : void SetInArg(const LocalAddr& addr);
36 : void SetInArg(const RemoteAddr& addr);
37 : void SetInArg(const std::vector<LocalAddr>& addrList);
38 : void SetInArg(const std::vector<RemoteAddr>& addrList);
39 :
40 0 : std::shared_ptr<CcuRepLoopBlock> GetLoopBlock() { return loopBlock; }
41 0 : std::vector<CcuRepArg>& GetInArgs() { return inArgs; }
42 : uint32_t GetInArgCount() { return inArgCount; }
43 :
44 : private:
45 : CcuInsGeneratorBase* insGeneratorPtr_;
46 : std::string label;
47 : std::shared_ptr<CcuRepLoopBlock> loopBlock{nullptr};
48 :
49 : std::vector<CcuRepArg> inArgs;
50 : uint32_t inArgCount{0};
51 : uint32_t inArgInstrCount{0}; // 处理LoopCall的入参需要的指令数
52 :
53 : CcuInstr* instr{nullptr};
54 : };
55 :
56 : }; // namespace CcuRep
57 : }; // namespace hcomm
58 : #endif // HCOMM_CCU_REPRESENTATION_LOOP_CALL_H
|