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 : /*!
12 : * \file kernel_vec_broadcast_to_mm_check.cpp
13 : * \brief
14 : */
15 :
16 : #include "kernel_check_params.h"
17 : #include "kernel_vec_broadcast_to_mm_check.h"
18 :
19 : namespace AscendC {
20 : namespace check {
21 20 : bool TikcppBroadCastToMMCheck::CheckAllHighLevel()
22 : {
23 100 : ASCENDC_CHECK(CheckTensorScope(param_.dstLogicPos, static_cast<uint8_t>(HardWareIndex::L0C), "dst", "CO1"));
24 80 : ASCENDC_CHECK(
25 : CheckTensorScope(param_.srcLogicPos, static_cast<uint8_t>(HardWareIndex::UB), "src", "VECIN/VECOUT/VECCALC"));
26 :
27 12 : constexpr uint64_t baseNumL0C = 256; // L0C has 16 * 16 elements as 1 fractal
28 12 : uint64_t dstAlignBytes = param_.dstDtypeBytes * baseNumL0C;
29 36 : ASCENDC_CHECK(CheckTensorAddrAlign(param_.dstAddr, param_.dstPos, dstAlignBytes, "dst"));
30 36 : ASCENDC_CHECK(CheckTensorAddrAlign(param_.srcAddr, param_.srcPos, param_.srcDtypeBytes, "src")); // dtype aligned
31 :
32 36 : ASCENDC_CHECK(CheckBufferSizeOverFlow(
33 : param_.srcSize, GlobalParams::Instance().bufferSizeMap.at(param_.srcPos),
34 : "check src tensor buffersize failed"));
35 36 : ASCENDC_CHECK(CheckBufferSizeOverFlow(
36 : param_.dstSize, GlobalParams::Instance().bufferSizeMap.at(param_.dstPos),
37 : "check dst tensor buffersize failed"));
38 : // unit element
39 12 : return true;
40 : };
41 : } // namespace check
42 : } // namespace AscendC
|