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 : #ifndef CCU_ERROR_INFO_H
12 : #define CCU_ERROR_INFO_H
13 :
14 : #include <cstdint>
15 : #include "ccu_rep_type.h"
16 : namespace Hccl {
17 :
18 : constexpr uint32_t MISSION_STATUS_MSG_LEN = 64;
19 : constexpr uint32_t WAIT_SIGNAL_CHANNEL_SIZE = 16;
20 : constexpr uint32_t BUF_REDUCE_ID_SIZE = 8;
21 :
22 246 : MAKE_ENUM(CcuErrorType, DEFAULT, MISSION, WAIT_SIGNAL, TRANS_MEM, BUF_TRANS_MEM, BUF_REDUCE, LOOP, LOOP_GROUP)
23 :
24 : struct CcuErrorInfo {
25 : // 根据不同的typeId解析不同的union类型
26 : CcuErrorType type;
27 :
28 : // 出异常的Rep类型
29 : CcuRep::CcuRepType repType;
30 :
31 : // CCU任务执行的DieId
32 : uint8_t dieId;
33 :
34 : // CCU任务执行的MissionId
35 : uint8_t missionId;
36 :
37 : // Error所在的指令Id
38 : uint16_t instrId;
39 :
40 : union {
41 : struct {
42 : char missionError[MISSION_STATUS_MSG_LEN];
43 : } mission;
44 :
45 : struct {
46 : uint16_t signalId;
47 : uint16_t signalMask;
48 : uint16_t signalValue;
49 : uint16_t paramId;
50 : uint64_t paramValue;
51 : uint16_t channelId[WAIT_SIGNAL_CHANNEL_SIZE];
52 : } waitSignal;
53 :
54 : struct {
55 : uint64_t locAddr;
56 : uint64_t locToken;
57 : uint64_t rmtAddr;
58 : uint64_t rmtToken;
59 : uint64_t len;
60 : uint16_t signalId;
61 : uint16_t signalMask;
62 : uint16_t channelId;
63 : uint16_t dataType;
64 : uint16_t opType;
65 : } transMem;
66 :
67 : struct {
68 : uint16_t bufId;
69 : uint64_t addr;
70 : uint64_t token;
71 : uint64_t len;
72 : uint16_t signalId;
73 : uint16_t signalMask;
74 : uint16_t channelId;
75 : } bufTransMem;
76 :
77 : struct {
78 : uint16_t bufIds[BUF_REDUCE_ID_SIZE];
79 : uint16_t count;
80 : uint16_t dataType;
81 : uint16_t outputDataType;
82 : uint16_t opType;
83 : uint16_t signalId;
84 : uint16_t signalMask;
85 : uint16_t xnIdLength;
86 : } bufReduce;
87 :
88 : struct {
89 : uint16_t startInstrId;
90 : uint16_t endInstrId;
91 : uint16_t loopEngineId;
92 : uint16_t loopCnt; // 该Loop需要循环执行的次数
93 : uint16_t loopCurrentCnt; // 该Loop已经循环次数
94 : uint32_t addrStride;
95 : } loop;
96 :
97 : struct {
98 : uint16_t startLoopInsId;
99 : uint16_t loopInsCnt;
100 : uint16_t expandOffset;
101 : uint16_t expandCnt;
102 : } loopGroup;
103 : } msg;
104 :
105 31 : void SetBaseInfo(CcuRep::CcuRepType ccuRepType, uint8_t ccuDieId, uint8_t ccuMissionId, uint16_t insId)
106 : {
107 31 : this->repType = ccuRepType;
108 31 : this->dieId = ccuDieId;
109 31 : this->missionId = ccuMissionId;
110 31 : this->instrId = insId;
111 31 : }
112 : };
113 :
114 : } // namespace Hccl
115 : #endif // CCU_ERROR_INFO_H
|