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 <hccl/hccl_types.h>
12 :
13 : #include "log.h"
14 : #include "hccl/base.h"
15 : #include "profiler_manager_impl.h"
16 : #include "profiler_manager.h"
17 :
18 : namespace hccl {
19 309 : ProfilerManager::ProfilerManager(s32 devicePhyId, s32 deviceLogicId, u32 realUserRank, u32 rankSize)
20 : {
21 309 : pimpl_.reset(new (std::nothrow) ProfilerManagerImpl(devicePhyId, deviceLogicId, realUserRank, rankSize));
22 309 : }
23 :
24 309 : ProfilerManager::~ProfilerManager()
25 : {
26 309 : pimpl_ = nullptr;
27 309 : }
28 :
29 309 : HcclResult ProfilerManager::InitProfiler()
30 : {
31 309 : CHK_PTR_NULL(pimpl_);
32 309 : return pimpl_->InitProfiler();
33 : }
34 :
35 0 : HcclResult ProfilerManager::GetandClearOverFlowTasks(std::vector<HcclDumpInfo> &hcclDumpInfo)
36 : {
37 0 : CHK_PTR_NULL(pimpl_);
38 0 : return pimpl_->GetandClearOverFlowTasks(hcclDumpInfo);
39 : }
40 :
41 0 : void ProfilerManager::TaskSdmaProfiler(ProfilerType profilerType, HcclRtStream stream, TaskParaDMA ¶)
42 : {
43 0 : CHK_SMART_PTR_RET_NULL(pimpl_);
44 0 : pimpl_->TaskSdmaProfiler(profilerType, stream, para);
45 : }
46 :
47 0 : void ProfilerManager::TaskRdmaProfiler(ProfilerType profilerType, HcclRtStream stream, TaskParaDMA ¶)
48 : {
49 0 : CHK_SMART_PTR_RET_NULL(pimpl_);
50 0 : pimpl_->TaskRdmaProfiler(profilerType, stream, para);
51 : }
52 :
53 0 : void ProfilerManager::TaskReduceInlineProfiler(ProfilerType profilerType, HcclRtStream stream, TaskParaReduce ¶)
54 : {
55 0 : CHK_SMART_PTR_RET_NULL(pimpl_);
56 0 : pimpl_->TaskReduceInlineProfiler(profilerType, stream, para);
57 : }
58 :
59 0 : void ProfilerManager::TaskReduceTbeProfiler(ProfilerType profilerType, HcclRtStream stream, TaskParaReduce ¶)
60 : {
61 0 : CHK_SMART_PTR_RET_NULL(pimpl_);
62 0 : pimpl_->TaskReduceTbeProfiler(profilerType, stream, para);
63 : }
64 :
65 0 : void ProfilerManager::TaskRecordProfiler(ProfilerType profilerType, HcclRtStream stream, TaskParaNotify ¶)
66 : {
67 0 : CHK_SMART_PTR_RET_NULL(pimpl_);
68 0 : pimpl_->TaskRecordProfiler(profilerType, stream, para);
69 : }
70 :
71 0 : void ProfilerManager::TaskWaitProfiler(ProfilerType profilerType, HcclRtStream stream, TaskParaNotify ¶)
72 : {
73 0 : CHK_SMART_PTR_RET_NULL(pimpl_);
74 0 : pimpl_->TaskWaitProfiler(profilerType, stream, para);
75 : }
76 :
77 0 : void ProfilerManager::TaskAivProfiler(ProfilerType profilerType, HcclRtStream stream, TaskParaAiv ¶)
78 : {
79 0 : CHK_SMART_PTR_RET_NULL(pimpl_);
80 0 : pimpl_->TaskAivProfiler(profilerType, stream, para);
81 : }
82 :
83 0 : void ProfilerManager::TaskProfiler(ProfilerType profilerType, HcclRtStream stream)
84 : {
85 0 : CHK_SMART_PTR_RET_NULL(pimpl_);
86 0 : pimpl_->TaskProfiler(profilerType, stream);
87 : }
88 :
89 0 : void ProfilerManager::TaskProfiler(ProfilerType profilerType, TaskParaHost ¶)
90 : {
91 0 : CHK_SMART_PTR_RET_NULL(pimpl_);
92 0 : pimpl_->TaskProfiler(profilerType, para);
93 : }
94 :
95 41 : void ProfilerManager::TaskProfilerHandle(void *param, u32 length)
96 : {
97 41 : CHK_SMART_PTR_RET_NULL(pimpl_);
98 41 : pimpl_->TaskProfilerHandle(param, length);
99 : }
100 :
101 5 : void ProfilerManager::TaskAivProfilerHandle(void *param, u32 length)
102 : {
103 5 : CHK_SMART_PTR_RET_NULL(pimpl_);
104 5 : pimpl_->TaskAivProfilerHandle(param, length);
105 : }
106 :
107 : } // namespace hccl
|