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 "ccu_rep.h"
12 :
13 : #include "string_util.h"
14 :
15 : namespace Hccl {
16 : namespace CcuRep {
17 :
18 197 : CcuRepBufWrite::CcuRepBufWrite(const CcuTransport &transport, CcuBuffer src, Memory dst, Variable len, MaskSignal sem,
19 197 : uint16_t mask)
20 197 : : transport(transport), src(src), dst(dst), len(len), sem(sem), mask(mask)
21 : {
22 197 : type = CcuRepType::BUF_WRITE;
23 197 : instrCount = 1;
24 197 : }
25 :
26 14 : bool CcuRepBufWrite::Translate(CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
27 : {
28 14 : this->instrId = instrId;
29 14 : translated = true;
30 :
31 14 : TransLocMSToRmtMemInstr(instr++, dst.addr.Id(), dst.token.Id(), src.Id(), len.Id(), transport.GetChannelId(),
32 14 : sem.Id(), mask, 0, 0, 1, 1);
33 :
34 14 : instrId += instrCount;
35 :
36 14 : return translated;
37 : }
38 :
39 14 : std::string CcuRepBufWrite::Describe()
40 : {
41 28 : return StringFormat("Write CcuBuffer[%u] To Rmt Mem[%u], len[%u], ChannalId[%u], sem[%u], mask[%04x]", src.Id(),
42 14 : dst.addr.Id(), len.Id(), transport.GetChannelId(), sem.Id(), mask);
43 : }
44 :
45 : }; // namespace CcuRep
46 : }; // namespace Hccl
|