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 HCCLV2_AICPU_SQEMGR_SQE_H
12 : #define HCCLV2_AICPU_SQEMGR_SQE_H
13 :
14 : #include <cstdint>
15 : #include <memory>
16 : #include "types.h"
17 : #include "log.h"
18 : #include "sqe.h"
19 :
20 : namespace Hccl {
21 :
22 : u32 GetAddrLow(u64 addr);
23 : u32 GetAddrHigh(u64 addr);
24 :
25 : class HcclSqe {
26 : public:
27 : virtual u64 GetSqe() = 0;
28 22 : virtual ~HcclSqe() = default;
29 : };
30 :
31 : class HcclNotifyWaitSqe : public HcclSqe {
32 : public:
33 : HcclNotifyWaitSqe();
34 :
35 : void Config(u16 streamId, u16 taskId, u64 notifyId);
36 :
37 : u64 GetSqe() override;
38 :
39 : private:
40 : std::unique_ptr<RtStarsNotifySqe> sqe;
41 : };
42 :
43 : class HcclNotifyRecordSqe : public HcclSqe {
44 : public:
45 : HcclNotifyRecordSqe();
46 : void Config(u16 streamId, u16 taskId, u64 notifyId);
47 : u64 GetSqe() override;
48 :
49 : private:
50 : std::unique_ptr<RtStarsNotifySqe> sqe;
51 : };
52 :
53 : class HcclWriteValueSqe : public HcclSqe {
54 : public:
55 : HcclWriteValueSqe();
56 :
57 : void Config(u16 streamId, u16 taskId, u64 notifyWRAddr);
58 :
59 : u64 GetSqe() override;
60 :
61 : private:
62 : std::unique_ptr<RtStarsWriteValueSqe> sqe;
63 : };
64 :
65 : class HcclSdmaSqe : public HcclSqe {
66 : public:
67 : HcclSdmaSqe();
68 :
69 : void Config(
70 : u16 streamId, u16 taskId, const u64 src, u32 length, RtDataType rtDataType, RtReduceKind rtReduceOp,
71 : const u64 dst, u32 partId);
72 :
73 : u64 GetSqe() override;
74 :
75 : private:
76 : u8 GetSdmaOpCode(u32 copyKind, u8 copyDataType) const;
77 :
78 : u8 ConvertToMemcpyDataType(u8 copyDataType) const;
79 :
80 : u8 ConvertToMemcpyOpType(u32 copyKind) const;
81 :
82 : std::unique_ptr<RtStarsMemcpyAsyncSqe> sqe;
83 : };
84 : } // namespace Hccl
85 :
86 : #endif
|