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