LCOV - code coverage report
Current view: top level - src/api_check - kernel_vec_broadcast_check.cpp (source / functions) Coverage Total Hit
Test: coverage.info_filtered Lines: 85.2 % 27 23
Test Date: 2026-07-27 14:41:20 Functions: 100.0 % 2 2

            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_check.cpp
      13              :  * \brief
      14              :  */
      15              : 
      16              : #include "kernel_check_params.h"
      17              : #include "kernel_vec_broadcast_check.h"
      18              : 
      19              : namespace AscendC {
      20              : namespace check {
      21           12 : bool TikcppVecBroadCastCheck::CheckSrcTensorOverflow(const std::string& errMsg)
      22              : {
      23           12 :     if (param_.srcDtypeBytes == 0) {
      24            0 :         CHECK_LOG_ERROR("src dtype bytes is zeros");
      25            0 :         return false;
      26              :     }
      27           12 :     if ((static_cast<uint32_t>(param_.repeatTimes) * static_cast<uint32_t>(PlatFormParams::BLK_NUM_PER_REP)) >
      28           12 :         static_cast<uint32_t>(param_.srcSize / param_.srcDtypeBytes)) {
      29            0 :         CHECK_LOG_ERROR("%s", errMsg.c_str());
      30            0 :         return false;
      31              :     }
      32           12 :     return true;
      33              : }
      34           20 : bool TikcppVecBroadCastCheck::CheckAllLowLevel(std::vector<uint64_t> maskArray)
      35              : {
      36              :     (void)(maskArray);
      37           20 :     const std::string supportPos = "VECIN/VECOUT/VECCALC";
      38           60 :     ASCENDC_CHECK(CheckTensorScope(param_.dstLogicPos, static_cast<uint8_t>(HardWareIndex::UB), "dst", supportPos));
      39           48 :     ASCENDC_CHECK(CheckTensorScope(param_.srcLogicPos, static_cast<uint8_t>(HardWareIndex::UB), "src", supportPos));
      40           48 :     ASCENDC_CHECK(CheckTensorAddrAlign(param_.dstAddr, param_.dstPos, ONE_BLK_SIZE, "dst"));
      41           48 :     ASCENDC_CHECK(CheckTensorAddrAlign(param_.srcAddr, param_.srcPos, ONE_BLK_SIZE, "src"));
      42              : 
      43           48 :     ASCENDC_CHECK(CheckBufferSizeOverFlow(
      44              :         param_.dstSize, GlobalParams::Instance().bufferSizeMap.at(param_.dstPos),
      45              :         "check dst tensor buffersize failed"));
      46           48 :     ASCENDC_CHECK(CheckBufferSizeOverFlow(
      47              :         param_.srcSize, GlobalParams::Instance().bufferSizeMap.at(param_.srcPos),
      48              :         "check src tensor buffersize failed"));
      49              : 
      50              :     TensorOverflowParams params = {
      51           16 :         param_.dstSize,
      52           16 :         param_.dstDtypeBytes,
      53           16 :         static_cast<uint64_t>(param_.repeatTimes),
      54           16 :         static_cast<uint64_t>(param_.dstBlockStride),
      55           16 :         static_cast<uint64_t>(param_.dstRepeatStride),
      56           16 :         false};
      57           48 :     ASCENDC_CHECK(CheckTensorOverflowLowBrcb(params, "dstLocal"));
      58              : 
      59           24 :     ASCENDC_CHECK(CheckSrcTensorOverflow("src calculate size overflow"));
      60           12 :     return true;
      61           20 : }
      62              : } // namespace check
      63              : } // namespace AscendC
        

Generated by: LCOV version 2.0-1