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