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