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),
26 2 : algName(algName),
27 2 : collAlgResReq(collAlgResReq),
28 2 : tmpInfo(tmpInfo)
29 2 : {}
30 :
31 0 : std::string GetAlgName() const { return algName; }
32 :
33 0 : CollAlgResReq GetCollAlgResReq() const { return collAlgResReq; }
34 :
35 2 : virtual std::vector<LinkData> GetLinks() const { return collAlgResReq.links; }
36 :
37 0 : std::string Describe() const override
38 : {
39 : return StringFormat(
40 : "AicpuInstruction[algName=%s, linkNum=%zu, workQueueNum=%u]", algName.c_str(), collAlgResReq.links.size(),
41 0 : collAlgResReq.primQueueNum);
42 : }
43 :
44 : protected:
45 : std::string algName{""};
46 : CollAlgResReq collAlgResReq{};
47 :
48 : TemplateInfo tmpInfo;
49 : };
50 :
51 : } // namespace Hccl
52 :
53 : #endif // AICPU_INSTRUCTION_H
|