Line data Source code
1 : /**
2 : * Copyright (c) 2026 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 HCOMM_CCU_REPRESENTATION_READ_H
12 : #define HCOMM_CCU_REPRESENTATION_READ_H
13 :
14 : #include "ccu_rep_base_v1.h"
15 : #include "ccu_datatype_v1.h"
16 :
17 : namespace hcomm {
18 : namespace CcuRep {
19 :
20 : class CcuRepRead : public CcuRepBase {
21 : public:
22 : CcuRepRead(
23 : CcuInsGeneratorBase* insGenPtr, const ChannelHandle channel, LocalAddr loc, RemoteAddr rem, Variable len,
24 : CompletedEvent sem, uint16_t mask);
25 : CcuRepRead(
26 : CcuInsGeneratorBase* insGenPtr, const ChannelHandle channel, LocalAddr loc, RemoteAddr rem, Variable len,
27 : uint16_t dataType, uint16_t opType, CompletedEvent sem, uint16_t mask);
28 : bool Translate(CcuKernel* ccuKernel, CcuInstr*& instr, uint16_t& instrId, const TransDep& dep) override;
29 : std::string Describe() override;
30 1 : uint16_t GetLocAddrId() { return loc.addr.Id(); }
31 1 : uint16_t GetLocTokenId() { return loc.token.Id(); }
32 1 : uint16_t GetRemAddrId() { return rem.addr.Id(); }
33 1 : uint16_t GetRemTokenId() { return rem.token.Id(); }
34 1 : uint16_t GetLenId() { return len.Id(); }
35 2 : uint16_t GetSemId() { return sem.Id(); }
36 : uint32_t GetChannelId() { return channelId; }
37 :
38 6 : ChannelHandle GetChannel() { return channel; }
39 8 : LocalAddr GetLoc() { return loc; }
40 8 : RemoteAddr GetRem() { return rem; }
41 4 : Variable GetLen() { return len; }
42 4 : CompletedEvent GetSem() { return sem; }
43 7 : uint16_t GetMask() { return mask; }
44 3 : uint16_t GetDataType() { return dataType; }
45 3 : uint16_t GetOpType() { return opType; }
46 4 : uint16_t GetReduceFlag() { return reduceFlag; }
47 :
48 : private:
49 : CcuInsGeneratorBase* insGenPtr{nullptr};
50 : ChannelHandle channel;
51 : uint32_t channelId{0};
52 :
53 : LocalAddr loc;
54 : RemoteAddr rem;
55 : Variable len;
56 :
57 : CompletedEvent sem;
58 : uint16_t mask{0};
59 :
60 : uint16_t dataType{0};
61 : uint16_t opType{0};
62 : uint16_t reduceFlag{0};
63 : };
64 :
65 : }; // namespace CcuRep
66 : }; // namespace hcomm
67 : #endif // HCOMM_CCU_REPRESENTATION_READ_H
|