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 CCU_REPRESENTATION_FUNC_BLOCK_H
12 : #define CCU_REPRESENTATION_FUNC_BLOCK_H
13 :
14 : #include "ccu_rep_block_v1.h"
15 : #include "ccu_rep_arg_v1.h"
16 : #include "ccu_rep_reference_manager_v1.h"
17 :
18 : namespace hcomm {
19 : namespace CcuRep {
20 :
21 : class CcuRepFuncBlock : public CcuRepBlock {
22 : public:
23 : explicit CcuRepFuncBlock(CcuInsGeneratorBase* insGenPtr, const std::string& label);
24 : bool Translate(CcuKernel* ccuKernel, CcuInstr*& instr, uint16_t& instrId, const TransDep& dep) override;
25 : std::string Describe() override;
26 : uint16_t InstrCount() override;
27 :
28 : void SetFuncManager(CcuRepReferenceManager* funcManager);
29 :
30 : void DefineInArg(const Variable& var);
31 : void DefineOutArg(const Variable& var);
32 : void DefineInArg(const std::vector<Variable>& varList);
33 : void DefineOutArg(const std::vector<Variable>& varList);
34 :
35 : void SetCallLayer(uint16_t callLayer);
36 : uint16_t GetCallLayer() const;
37 : std::vector<Variable> GetInArgVars() const;
38 :
39 8 : CcuRepReferenceManager* GetFuncManager() { return funcManager; }
40 :
41 0 : std::vector<CcuRepArg>& GetInArgs() { return inArgs; }
42 :
43 8 : std::vector<CcuRepArg>& GetOutArgs() { return outArgs; }
44 :
45 10 : uint16_t GetCallLayer() { return callLayer; }
46 :
47 : private:
48 : CcuRepReferenceManager* funcManager{nullptr};
49 :
50 : std::vector<CcuRepArg> inArgs;
51 : std::vector<CcuRepArg> outArgs;
52 : uint64_t inArgCount{0};
53 : uint64_t outArgCount{0};
54 :
55 : uint16_t callLayer{0};
56 : };
57 :
58 : }; // namespace CcuRep
59 : }; // namespace hcomm
60 : #endif // _CCU_REPRESENTATION_FUNC_BLOCK_H
|