Line data Source code
1 : /**
2 : * Copyright (c) 2025 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 AICPU_INSTRUCTION_H
12 : #define AICPU_INSTRUCTION_H
13 :
14 : #include "instruction.h"
15 : #include "virtual_topo.h"
16 : #include "coll_alg_params.h"
17 :
18 : #include "template_utils.h"
19 :
20 : namespace Hccl {
21 :
22 : class AicpuInstruction : public Instruction {
23 : public:
24 2 : AicpuInstruction(const std::string &algName, const CollAlgResReq &collAlgResReq, const TemplateInfo &tmpInfo)
25 2 : : Instruction(InstructionType::AICPU_INS), algName(algName), collAlgResReq(collAlgResReq), tmpInfo(tmpInfo)
26 : {
27 2 : }
28 :
29 0 : std::string GetAlgName() const
30 : {
31 0 : return algName;
32 : }
33 :
34 0 : CollAlgResReq GetCollAlgResReq() const
35 : {
36 0 : return collAlgResReq;
37 : }
38 :
39 2 : virtual std::vector<LinkData> GetLinks() const
40 : {
41 2 : return collAlgResReq.links;
42 : }
43 :
44 0 : std::string Describe() const override
45 : {
46 : return StringFormat("AicpuInstruction[algName=%s, linkNum=%zu, workQueueNum=%u]",
47 0 : algName.c_str(), collAlgResReq.links.size(), collAlgResReq.primQueueNum);
48 : }
49 :
50 : protected:
51 : std::string algName{""};
52 : CollAlgResReq collAlgResReq{};
53 :
54 : TemplateInfo tmpInfo;
55 : };
56 :
57 : } // namespace Hccl
58 :
59 : #endif // AICPU_INSTRUCTION_H
|