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 : #include "ccu_rep_v1.h"
11 : #include "ccu_rep_loc_wait_notify.h"
12 : #include <climits>
13 : #include "string_util.h"
14 : #include "exception_util.h"
15 : #include "ccu_api_exception.h"
16 : #include "ccu_ins_generater_v1.h"
17 : #include "ccu_kernel.h"
18 : namespace hcomm {
19 : namespace CcuRep {
20 :
21 5 : CcuRepLocWaitNotify::CcuRepLocWaitNotify(CcuInsGeneraterBase* insGenPtr, const LocalNotify ¬ify, const uint32_t mask, bool isProfiling)
22 5 : : insGenPtr(insGenPtr), notify_(notify), mask_(mask), isProfiling_(isProfiling)
23 : {
24 5 : type = CcuRepType::LOC_WAIT_NOTIFY;
25 5 : instrCount = insGenPtr->GetInstrCount(type);
26 5 : }
27 :
28 2 : bool CcuRepLocWaitNotify::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
29 : {
30 2 : this->instrId = instrId;
31 2 : translated = true;
32 :
33 2 : insGenPtr->CcuRepLocWaitNotifyTranslate(ccuKernel, instr, this);
34 2 : CHK_PRT_THROW((instrId > UINT16_MAX - instrCount),
35 : HCCL_ERROR("[CcuRepLocWaitNotify::Translate]uint16 integer overflow occurs, "
36 : "instrId = [%hu], instrCount = [%hu]", instrId, instrCount),
37 : Hccl::CcuApiException, "integer overflow");
38 :
39 2 : instrId += instrCount;
40 2 : return translated;
41 : }
42 :
43 1 : std::string CcuRepLocWaitNotify::Describe()
44 : {
45 1 : return Hccl::StringFormat("CcuRepLocWaitNotify=id[%u], mask[%04x]", notify_.Id(), mask_);
46 : }
47 :
48 : }; // namespace CcuRep
49 : }; // namespace hcomm
|