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