LCOV - code coverage report
Current view: top level - src/api_check - kernel_vec_gatherb_check.cpp (source / functions) Coverage Total Hit
Test: coverage.info_filtered Lines: 100.0 % 28 28
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_gatherb_check.cpp
      13              :  * \brief
      14              :  */
      15              : 
      16              : #include "kernel_check_params.h"
      17              : #include "kernel_vec_gatherb_check.h"
      18              : 
      19              : namespace AscendC {
      20              : namespace check {
      21           12 : bool TikcppVecGatherbCheck::CheckOffsetTensorOverflow(const std::string& errMsg)
      22              : {
      23           12 :     ASCENDC_CHECK_AND_LOG(param_.offsetDtypeBytes != 0, { CHECK_LOG_ERROR("offset dtype bytes is 0."); });
      24           12 :     if ((static_cast<uint32_t>(param_.repeatTimes) * static_cast<uint32_t>(PlatFormParams::BLK_NUM_PER_REP)) >
      25           12 :         static_cast<uint32_t>(param_.offsetSize / param_.offsetDtypeBytes)) {
      26            4 :         CHECK_LOG_ERROR("%s", errMsg.c_str());
      27            4 :         return false;
      28              :     }
      29            8 :     return true;
      30              : }
      31           20 : bool TikcppVecGatherbCheck::CheckAllLowLevel(std::vector<uint64_t> maskArray)
      32              : {
      33           20 :     const std::string supportPos = "VECIN/VECOUT/VECCALC";
      34           60 :     ASCENDC_CHECK(CheckTensorScope(param_.dstLogicPos, static_cast<uint8_t>(HardWareIndex::UB), "dst", supportPos));
      35           48 :     ASCENDC_CHECK(CheckTensorScope(param_.srcLogicPos, static_cast<uint8_t>(HardWareIndex::UB), "src", supportPos));
      36           48 :     ASCENDC_CHECK(
      37              :         CheckTensorScope(param_.offsetLogicPos, static_cast<uint8_t>(HardWareIndex::UB), "offset", supportPos));
      38              : 
      39           48 :     ASCENDC_CHECK(CheckTensorAddrAlign(param_.dstAddr, param_.dstPos, ONE_BLK_SIZE, "dst"));
      40           48 :     ASCENDC_CHECK(CheckTensorAddrAlign(param_.srcAddr, param_.srcPos, ONE_BLK_SIZE, "src"));
      41           48 :     ASCENDC_CHECK(CheckTensorAddrAlign(param_.offsetAddr, param_.offsetPos, ONE_BLK_SIZE, "offset"));
      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           48 :     ASCENDC_CHECK(CheckBufferSizeOverFlow(
      50              :         param_.offsetSize, GlobalParams::Instance().bufferSizeMap.at(param_.offsetPos),
      51              :         "check offset tensor buffersize failed"));
      52              : 
      53              :     TensorOverflowParams params = {
      54           16 :         param_.dstSize,
      55           16 :         param_.dstDtypeBytes,
      56           16 :         static_cast<uint64_t>(param_.repeatTimes),
      57           16 :         static_cast<uint64_t>(param_.dstBlockStride),
      58           16 :         static_cast<uint64_t>(param_.dstRepeatStride),
      59           16 :         false};
      60           48 :     ASCENDC_CHECK(CheckTensorOverflowLow(maskArray, params, "dstLocal"));
      61              : 
      62           24 :     ASCENDC_CHECK(CheckOffsetTensorOverflow("offset calculate size overflow"));
      63            8 :     return true;
      64           20 : }
      65              : 
      66              : } // namespace check
      67              : } // namespace AscendC
        

Generated by: LCOV version 2.0-1