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 : #ifndef AIV_INS_PREPROCESSOR_H
11 : #define AIV_INS_PREPROCESSOR_H
12 :
13 : #include "ins_queue.h"
14 : #include "communicator_impl.h"
15 : #include "mc2_type.h"
16 : #include "connections_builder.h"
17 :
18 : namespace Hccl {
19 :
20 : class AivInsPreprocessor {
21 : public:
22 : using InsIterator = HierarchicalQueue<Instruction, InsQueue>::Iterator;
23 :
24 238 : explicit AivInsPreprocessor(CommunicatorImpl *comm) : comm(comm)
25 : {
26 238 : }
27 :
28 : ~AivInsPreprocessor();
29 :
30 : void Preprocess(std::shared_ptr<InsQueue> &insQueue) const;
31 : std::vector<HcclAiRMAWQ> GetWqs() const;
32 : std::vector<HcclAiRMACQ> GetCqs() const;
33 : void SetProtocol(uint8_t protocol);
34 : uint8_t GetProtocol() const;
35 :
36 : private:
37 : void InsPreprocess(InsIterator &insIter) const;
38 : void BatchBuildTransports(const vector<LinkData> &links) const;
39 : void BatchBuildUrmaTransports(const vector<LinkData> &links) const;
40 :
41 : private:
42 : CommunicatorImpl *comm;
43 : uint8_t protocol_{0};
44 : };
45 :
46 : } // namespace Hccl
47 :
48 : #endif // AIV_INS_PREPROCESSOR_H
|