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_WRITE_H
12 : #define HCOMM_CCU_REPRESENTATION_WRITE_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 CcuRepWrite : public CcuRepBase {
21 : public:
22 : CcuRepWrite(
23 : CcuInsGeneratorBase* insGenPtr, const ChannelHandle channel, RemoteAddr rem, LocalAddr loc, Variable len,
24 : CompletedEvent sem, uint16_t mask);
25 : CcuRepWrite(
26 : CcuInsGeneratorBase* insGenPtr, const ChannelHandle channel, RemoteAddr rem, LocalAddr loc, 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 :
31 1 : uint16_t GetLocAddrId() { return loc.addr.Id(); }
32 1 : uint16_t GetLocTokenId() { return loc.token.Id(); }
33 1 : uint16_t GetRemAddrId() { return rem.addr.Id(); }
34 1 : uint16_t GetRemTokenId() { return rem.token.Id(); }
35 1 : uint16_t GetLenId() { return len.Id(); }
36 1 : uint16_t GetSemId() { return sem.Id(); }
37 : uint32_t GetChannelId() { return channelId; }
38 4 : ChannelHandle GetChannel() { return channel; }
39 6 : LocalAddr GetLoc() { return loc; }
40 6 : RemoteAddr GetRem() { return rem; }
41 3 : Variable GetLen() { return len; }
42 3 : CompletedEvent GetSem() { return sem; }
43 5 : uint16_t GetMask() { return mask; }
44 3 : uint16_t GetDataType() { return dataType; }
45 3 : uint16_t GetOpType() { return opType; }
46 3 : uint16_t GetReduceFlag() { return reduceFlag; }
47 :
48 : private:
49 : CcuInsGeneratorBase* insGenPtr{nullptr};
50 : ChannelHandle channel;
51 : uint32_t channelId{0};
52 : RemoteAddr rem;
53 : LocalAddr loc;
54 : Variable len;
55 :
56 : CompletedEvent sem;
57 : uint16_t mask{0};
58 :
59 : uint16_t dataType{0};
60 : uint16_t opType{0};
61 : uint16_t reduceFlag{0};
62 : };
63 :
64 : }; // namespace CcuRep
65 : }; // namespace hcomm
66 : #endif // HCOMM_CCU_REPRESENTATION_WRITE_H
|