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 : #include "coll_alg_component_builder.h"
12 : #include "rank_gph.h"
13 : #include "host/coll_alg_component.h"
14 :
15 : namespace Hccl {
16 226 : CollAlgComponentBuilder& CollAlgComponentBuilder::SetRankGraph(RankGraph* rankGraph)
17 : {
18 226 : rankGraph_ = rankGraph;
19 226 : return *this;
20 : }
21 :
22 226 : CollAlgComponentBuilder& CollAlgComponentBuilder::SetDevType(DevType devType)
23 : {
24 226 : devType_ = devType;
25 226 : return *this;
26 : }
27 :
28 226 : CollAlgComponentBuilder& CollAlgComponentBuilder::SetMyRank(u32 myRank)
29 : {
30 226 : myRank_ = myRank;
31 226 : return *this;
32 : }
33 :
34 226 : CollAlgComponentBuilder& CollAlgComponentBuilder::SetRankSize(u32 rankSize)
35 : {
36 226 : rankSize_ = rankSize;
37 226 : return *this;
38 : }
39 :
40 226 : CollAlgComponentBuilder& CollAlgComponentBuilder::EnableDetour(bool enableDetour)
41 : {
42 226 : enableDetour_ = enableDetour;
43 226 : return *this;
44 : }
45 :
46 226 : CollAlgComponentBuilder& CollAlgComponentBuilder::SetDmaMode(const DmaMode& dmaMode)
47 : {
48 226 : dmaMode_ = dmaMode;
49 226 : return *this;
50 : }
51 :
52 0 : CollAlgComponentBuilder& CollAlgComponentBuilder::EnableDataAllign(bool enableAllign)
53 : {
54 0 : enableAllign_ = enableAllign;
55 0 : return *this;
56 : }
57 :
58 0 : CollAlgComponentBuilder& CollAlgComponentBuilder::SetAllignSize(u64 allignSize)
59 : {
60 0 : allignSize_ = allignSize;
61 0 : return *this;
62 : }
63 :
64 0 : CollAlgComponentBuilder& CollAlgComponentBuilder::SetMaxQueue(u32 maxQueue)
65 : {
66 0 : maxQueue_ = maxQueue;
67 0 : return *this;
68 : }
69 :
70 0 : CollAlgComponentBuilder& CollAlgComponentBuilder::SetMaxLink(u32 maxLink)
71 : {
72 0 : maxLink_ = maxLink;
73 0 : return *this;
74 : }
75 :
76 0 : CollAlgComponentBuilder& CollAlgComponentBuilder::SetMaxDepQueuePairs(u32 maxDepQueuePairs)
77 : {
78 0 : maxDepQueuePairs_ = maxDepQueuePairs;
79 0 : return *this;
80 : }
81 :
82 226 : CollAlgComponentBuilder& CollAlgComponentBuilder::SetMainboardId(u64 mainBoardId)
83 : {
84 : (void)mainBoardId;
85 226 : return *this;
86 : }
87 :
88 226 : CollAlgComponentPtr CollAlgComponentBuilder::Build()
89 : {
90 226 : CollAlgComponentPtr component = std::make_shared<CollAlgComponent>(rankGraph_, devType_, myRank_, rankSize_);
91 226 : component->EnableDetour(enableDetour_);
92 226 : component->EnableDataAllign(enableAllign_);
93 226 : component->SetAllignSize(allignSize_);
94 226 : component->SetMaxQueue(maxQueue_);
95 226 : component->SetMaxLink(maxLink_);
96 226 : component->SetMaxDepQueuePairs(maxDepQueuePairs_);
97 226 : component->SetDmaMode(dmaMode_);
98 226 : return component;
99 0 : };
100 : } // namespace Hccl
|