LCOV - code coverage report
Current view: top level - aicpu_schedule/core/operator_kernel/preprocess - operator_kernel_model_prepare_output.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 10 10
Test Date: 2026-08-12 11:05:02 Functions: 93.3 % 15 14

            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              : #ifndef OPERATOR_KERNEL_PREPARE_OUTPUT_H
      12              : #define OPERATOR_KERNEL_PREPARE_OUTPUT_H
      13              : 
      14              : #include "operator_kernel.h"
      15              : #include "operator_kernel_context.h"
      16              : 
      17              : namespace AicpuSchedule {
      18              : class OperatorKernelPrepareOutputBase {
      19              : public:
      20           72 :     OperatorKernelPrepareOutputBase() = default;
      21           72 :     virtual ~OperatorKernelPrepareOutputBase(){};
      22              : 
      23              :     int32_t PrepareOutput(
      24              :         ProcessOutputInfo& outputInfo, const RunContext& taskContext, const bool zeroCpy,
      25              :         RuntimeTensorDesc* const tensorDesc) const;
      26              :     int32_t PrepareOutWithTensorDesc(
      27              :         const AicpuTaskInfo& kernelTaskInfo, const bool zeroCpy, const RunContext& taskContext) const;
      28              : 
      29              : private:
      30              :     int32_t PrepareOutputNonZeroCpy(
      31              :         const ProcessOutputInfo& outputInfo, Mbuf* const outMBuf, RuntimeTensorDesc* const tensorDesc) const;
      32              :     int32_t GetStaticNNOutPutIndex(const uint32_t modelId) const;
      33              :     void MarkStaticNNOutPutIndex(const uint32_t modelId) const;
      34              : };
      35              : 
      36              : class OperatorKernelModelPrepareOutput : public OperatorKernel, public OperatorKernelPrepareOutputBase {
      37              : public:
      38           15 :     OperatorKernelModelPrepareOutput() = default;
      39           18 :     ~OperatorKernelModelPrepareOutput() = default;
      40              : 
      41              :     int32_t Compute(const AicpuTaskInfo& kernelTaskInfo, const RunContext& taskContext) override;
      42              : };
      43              : 
      44              : class OperatorKernelModelPrepareOutputWithTensorDesc : public OperatorKernel, public OperatorKernelPrepareOutputBase {
      45              : public:
      46           15 :     OperatorKernelModelPrepareOutputWithTensorDesc() = default;
      47           18 :     ~OperatorKernelModelPrepareOutputWithTensorDesc() = default;
      48              : 
      49              :     int32_t Compute(const AicpuTaskInfo& kernelTaskInfo, const RunContext& taskContext) override;
      50              : };
      51              : 
      52              : class OperatorKernelBufferPrepareOutput : public OperatorKernel, public OperatorKernelPrepareOutputBase {
      53              : public:
      54           15 :     OperatorKernelBufferPrepareOutput() = default;
      55           18 :     ~OperatorKernelBufferPrepareOutput() = default;
      56              : 
      57              :     int32_t Compute(const AicpuTaskInfo& kernelTaskInfo, const RunContext& taskContext) override;
      58              : };
      59              : 
      60              : class OperatorKernelBufferPrepareOutputWithTensorDesc : public OperatorKernel, public OperatorKernelPrepareOutputBase {
      61              : public:
      62           15 :     OperatorKernelBufferPrepareOutputWithTensorDesc() = default;
      63           18 :     ~OperatorKernelBufferPrepareOutputWithTensorDesc() = default;
      64              : 
      65              :     int32_t Compute(const AicpuTaskInfo& kernelTaskInfo, const RunContext& taskContext) override;
      66              : };
      67              : 
      68              : } // namespace AicpuSchedule
      69              : 
      70              : #endif // OPERATOR_KERNEL_PREPARE_OUTPUT_H
        

Generated by: LCOV version 2.0-1