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 "task.h"
12 : #include "local_notify.h"
13 : namespace Hccl {
14 :
15 1 : std::string TaskLocalCopy::Describe() const
16 : {
17 1 : return StringFormat("Task %s: src[0x%llx] dst[0x%llx] size[0x%llx] kind %s", type.Describe().c_str(), srcAddr,
18 2 : dstAddr, size, kind.Describe().c_str());
19 : }
20 :
21 1 : std::string TaskP2pMemcpy::Describe() const
22 : {
23 1 : return StringFormat("Task %s: src[0x%llx] dst[0x%llx] size[0x%llx] kind %s", type.Describe().c_str(), srcAddr,
24 2 : dstAddr, size, kind.Describe().c_str());
25 : }
26 :
27 1 : std::string TaskRemoteRecord::Describe() const
28 : {
29 1 : return StringFormat("Task %s: notify[%s]", type.Describe().c_str(), notify->Describe().c_str());
30 : }
31 :
32 1 : std::string TaskWait::Describe() const
33 : {
34 1 : return StringFormat("Task %s: notify[%s]", type.Describe().c_str(), notify->Describe().c_str());
35 : }
36 :
37 1 : std::string TaskLocalRecord::Describe() const
38 : {
39 1 : return StringFormat("Task %s: notify[%s]", type.Describe().c_str(), notify->Describe().c_str());
40 : }
41 :
42 0 : std::string TaskWaitValue::Describe() const
43 : {
44 0 : return StringFormat("Task %s: notify[%s] value[%u]", type.Describe().c_str(), notify->Describe().c_str(), value);
45 : }
46 :
47 0 : std::string TaskPostBits::Describe() const
48 : {
49 0 : return StringFormat("Task %s: notify[%s] bitValue[%u]", type.Describe().c_str(), notify->Describe().c_str(),
50 0 : bitValue);
51 : }
52 :
53 1 : std::string TaskSdmaReduce::Describe() const
54 : {
55 1 : return StringFormat("Task %s: src[0x%llx] dst[0x%llx] size[0x%llx] %s, %s", type.Describe().c_str(), srcAddr,
56 2 : dstAddr, size, dataType.Describe().c_str(), reduceOp.Describe().c_str());
57 : }
58 :
59 1 : std::string TaskLocalReduce::Describe() const
60 : {
61 : return StringFormat("Task %s: src1[0x%llx] src2[0x%llx] dst[0x%llx] "
62 : "size[0x%llx] dataCount[0x%llx] %s, %s",
63 1 : type.Describe().c_str(), srcAddr1, srcAddr2, dstAddr, size, GetDataCount(),
64 2 : dataType.Describe().c_str(), reduceOp.Describe().c_str());
65 : }
66 :
67 2 : std::string TaskRdmaSend::Describe() const
68 : {
69 2 : if (IsTemplateMode()) {
70 1 : return StringFormat("Task %s: qpn[%u], wqeIndex[%u]", type.Describe().c_str(), qpn, wqeIndex);
71 : } else {
72 1 : return StringFormat("Task %s: dbIndex[%u], dbInfo[%llu]", type.Describe().c_str(), dbIndex, dbInfo);
73 : }
74 : }
75 :
76 1 : std::string TaskLocalAddrCopy::Describe() const
77 : {
78 1 : return StringFormat("Task %s: src[0x%llx] dst[0x%llx] size[0x%llx]", type.Describe().c_str(), srcAddr, dstAddr,
79 2 : size);
80 : }
81 :
82 1 : std::string TaskUbDbSend::Describe() const
83 : {
84 1 : return StringFormat("Task %s: jettyId[0x%llx] funcId[%u] piVal[%u] dieId[%u]", type.Describe().c_str(), jettyId,
85 2 : funcId, piVal, dieId);
86 : }
87 :
88 11 : TaskUbDirectSend::TaskUbDirectSend(u32 funcId, u32 dieId, u32 jettyId, u32 dwqeSize, const u8 *dwqe)
89 11 : : BaseTask(TaskType::UB_DIRECT_SEND), funcId(funcId), dieId(dieId), jettyId(jettyId), dwqeSize(dwqeSize)
90 : {
91 11 : if (dwqeSize != DWQE_SIZE_64 && dwqeSize != DWQE_SIZE_128) {
92 1 : std::string msg = StringFormat("Invalid dwqe size, dwqeSize=[%u]", dwqeSize);
93 1 : THROW<InternalException>(msg);
94 1 : }
95 :
96 10 : s32 ret = memcpy_s(this->dwqe, DWQE_MAX_LEN, dwqe, dwqeSize);
97 10 : if (ret != 0) {
98 0 : std::string msg = StringFormat("TaskUbDirectSend constructor copy dwqe failed, ret=[%d]", ret);
99 0 : THROW<InternalException>(msg);
100 0 : }
101 11 : }
102 1 : std::string TaskUbDirectSend::Describe() const
103 : {
104 1 : return StringFormat("Task %s: jettyId[0x%x] funcId[%u] dieId[%u] dwqeSize[%u]", type.Describe().c_str(), jettyId,
105 2 : funcId, dieId, dwqeSize);
106 : }
107 :
108 1 : std::string TaskWriteValue::Describe() const
109 : {
110 1 : return StringFormat("Task %s: dbAddr[%llx] piVal[%u]", type.Describe().c_str(), dbAddr, piVal);
111 : }
112 :
113 0 : std::string TaskWaitBits::Describe() const
114 : {
115 0 : return StringFormat("Task %s: notify[%s] bitValue[%u]", type.Describe().c_str(), notify->Describe().c_str(), bitValue);
116 : }
117 :
118 0 : std::string TaskPostValue::Describe() const
119 : {
120 0 : return StringFormat("Task %s: notify[%s] value[%u]", type.Describe().c_str(), notify->Describe().c_str(),
121 0 : value);
122 : }
123 : } // namespace Hccl
|