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_check_vec_data_filling_util.h
13 : * \brief
14 : */
15 : #ifndef ASCENDC_CHECK_VEC_DATA_FILLING_UTIL_H
16 : #define ASCENDC_CHECK_VEC_DATA_FILLING_UTIL_H
17 : #if ASCENDC_CPU_DEBUG
18 : #include <string>
19 : #include "kernel_utils.h"
20 : namespace AscendC {
21 : namespace check {
22 : struct VecDupApiParams {
23 : VecDupApiParams() {}
24 16 : VecDupApiParams(
25 : uint64_t dstAddrIn, uint8_t repeatIn, uint16_t dstBlockStrideIn, uint16_t dstRepeatStrideIn,
26 : uint32_t dstDtypeBytesIn, uint64_t dstSizeIn, uint8_t dstPosIn)
27 16 : {
28 16 : dstAddr = dstAddrIn;
29 16 : repeatTimes = repeatIn;
30 16 : dstBlockStride = dstBlockStrideIn;
31 16 : dstRepeatStride = dstRepeatStrideIn;
32 16 : dstDtypeBytes = dstDtypeBytesIn;
33 16 : dstSize = dstSizeIn;
34 16 : dstLogicPos = dstPosIn;
35 16 : dstPos = static_cast<uint8_t>(GetPhyType(static_cast<TPosition>(dstPosIn)));
36 16 : }
37 16 : VecDupApiParams(uint64_t dstAddrIn, uint32_t dstDtypeBytesIn, uint64_t dstSizeIn, uint8_t dstPosIn, uint32_t count)
38 16 : {
39 16 : dstAddr = dstAddrIn;
40 16 : dstDtypeBytes = dstDtypeBytesIn;
41 16 : dstSize = dstSizeIn;
42 16 : dstLogicPos = dstPosIn;
43 16 : dstPos = static_cast<uint8_t>(GetPhyType(static_cast<TPosition>(dstPosIn)));
44 16 : calCount = count;
45 16 : }
46 : uint64_t dstAddr = 0;
47 : uint8_t repeatTimes = 0;
48 : uint16_t dstBlockStride = 0;
49 : uint16_t dstRepeatStride = 0;
50 : uint32_t dstDtypeBytes = 0;
51 : uint64_t dstSize = 0;
52 : uint8_t dstLogicPos = 0;
53 : uint8_t dstPos = 0;
54 : uint32_t calCount = 0;
55 : };
56 : struct VecCreateVecIndexApiParams {
57 : VecCreateVecIndexApiParams() {}
58 : VecCreateVecIndexApiParams(
59 : uint64_t dstAddrIn, uint8_t repeatIn, uint16_t dstBlkStrideIn, uint16_t dstRepStrideIn,
60 : uint32_t dstDtypeBytesIn, uint64_t dstSizeIn, uint8_t dstPosIn, uint32_t calCountIn)
61 : {
62 : dstAddr = dstAddrIn;
63 : repeatTimes = repeatIn;
64 : dstBlkStride = dstBlkStrideIn;
65 : dstRepStride = dstRepStrideIn;
66 : dstDtypeBytes = dstDtypeBytesIn;
67 : dstSize = dstSizeIn;
68 : dstLogicPos = dstPosIn;
69 : dstPos = static_cast<uint8_t>(GetPhyType(static_cast<TPosition>(dstPosIn)));
70 : calCount = calCountIn;
71 : }
72 : uint64_t dstAddr = 0;
73 : uint8_t repeatTimes = 0;
74 : uint16_t dstBlkStride = 0;
75 : uint16_t dstRepStride = 0;
76 : uint32_t dstDtypeBytes = 0;
77 : uint64_t dstSize = 0;
78 : uint8_t dstLogicPos = 0;
79 : uint8_t dstPos = 0;
80 : uint32_t calCount = 0;
81 : };
82 : bool CheckFunDupImplForMaskArray(VecDupApiParams& chkParams, const uint64_t mask[], const char* intriName);
83 : bool CheckFunDupImpl(VecDupApiParams& chkParams, const uint64_t mask, const char* intriName);
84 : bool CheckFunDupImpl(VecDupApiParams& chkParams, const char* intriName);
85 : bool CheckFuncCreateVecIndexImpl(VecCreateVecIndexApiParams& chkParams, const uint64_t mask, const char* intriName);
86 : bool CheckFuncCreateVecIndexImpl(VecCreateVecIndexApiParams& chkParams, const uint64_t mask[], const char* intriName);
87 : bool CheckFuncCreateVecIndexImpl(VecCreateVecIndexApiParams& chkParams, const char* intriName);
88 : } // namespace check
89 : } // namespace AscendC
90 : #endif
91 : #endif
|