40
csrc/common/stub/op_api/CMakeLists.txt
Normal file
40
csrc/common/stub/op_api/CMakeLists.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
# CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
# Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See LICENSE in the root of the software repository for the full text of the License.
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/build)
|
||||
|
||||
file(GLOB_RECURSE OP_API_FILES "*.cpp")
|
||||
|
||||
add_library(opapi_math SHARED ${OP_API_FILES})
|
||||
|
||||
target_compile_definitions(opapi_math PRIVATE
|
||||
_GLIBCXX_USE_CXX11_ABI=0
|
||||
LOG_CPP
|
||||
)
|
||||
|
||||
target_include_directories(opapi_math PRIVATE
|
||||
${OPAPI_INCLUDE}
|
||||
${ASCEND_CANN_PACKAGE_PATH}/pkg_inc
|
||||
)
|
||||
|
||||
if(ENABLE_TEST)
|
||||
add_library(opapi_stub SHARED ${OP_API_FILES})
|
||||
|
||||
target_compile_definitions(opapi_stub PRIVATE
|
||||
_GLIBCXX_USE_CXX11_ABI=0
|
||||
LOG_CPP
|
||||
)
|
||||
|
||||
target_include_directories(opapi_stub PRIVATE
|
||||
${OPAPI_INCLUDE}
|
||||
${ASCEND_CANN_PACKAGE_PATH}/pkg_inc
|
||||
${ASCEND_CANN_PACKAGE_PATH}/include/ascendc/basic_api
|
||||
)
|
||||
endif()
|
||||
24
csrc/common/stub/op_api/aclnn_kernels/cast.h
Normal file
24
csrc/common/stub/op_api/aclnn_kernels/cast.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_INC_EXTERNAL_ACLNN_KERNELS_CAST_H
|
||||
#define COMMON_INC_EXTERNAL_ACLNN_KERNELS_CAST_H
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
#include "opdev/make_op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor* Cast(const aclTensor* self, op::DataType dstDtype, aclOpExecutor* executor);
|
||||
|
||||
// 专攻卷积反向定制
|
||||
const aclTensor* CastOnlyForConvBackward(const aclTensor* self, op::DataType dstDtype, aclOpExecutor* executor);
|
||||
} // namespace l0op
|
||||
|
||||
#endif // COMMON_INC_EXTERNAL_ACLNN_KERNELS_CAST_H
|
||||
251
csrc/common/stub/op_api/aclnn_kernels/common/op_error_check.h
Normal file
251
csrc/common/stub/op_api/aclnn_kernels/common/op_error_check.h
Normal file
@@ -0,0 +1,251 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
#ifndef OP_ERROR_CHECK_H__
|
||||
#define OP_ERROR_CHECK_H__
|
||||
|
||||
#include "opdev/op_log.h"
|
||||
#include "opdev/common_types.h"
|
||||
#include "opdev/data_type_utils.h"
|
||||
#include "opdev/shape_utils.h"
|
||||
|
||||
const int32_t NCHW_N_DIM = 0;
|
||||
const int32_t NCHW_C_DIM = 1;
|
||||
const int32_t NHWC_N_DIM = 0;
|
||||
const int32_t NHWC_C_DIM = 3;
|
||||
|
||||
static inline bool IsNullptr(const aclTensor *tensor, const char *name) {
|
||||
if (tensor == nullptr) {
|
||||
OP_LOGE(ACLNN_ERR_PARAM_NULLPTR, "Expected a proper Tensor but got null for argument %s.", name);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool IsNullptr(const aclTensorList *tensorList, const char *name) {
|
||||
if (tensorList == nullptr) {
|
||||
OP_LOGE(ACLNN_ERR_PARAM_NULLPTR, "Expected a proper TensorList but got null for argument %s.", name);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool IsNullptr(const aclScalar *scalar, const char *name) {
|
||||
if (scalar == nullptr) {
|
||||
OP_LOGE(ACLNN_ERR_PARAM_NULLPTR, "Expected a value of type number for argument %s but instead found type null.",
|
||||
name);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool IsNullptr(const aclIntArray *intArr, const char *name) {
|
||||
if (intArr == nullptr) {
|
||||
OP_LOGE(ACLNN_ERR_PARAM_NULLPTR, "Expected a value of type List[int] for argument %s but instead found type null.",
|
||||
name);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool IsNullptr(const aclBoolArray *boolArr, const char *name) {
|
||||
if (boolArr == nullptr) {
|
||||
OP_LOGE(ACLNN_ERR_PARAM_NULLPTR, "Expected a value of type List[bool] for argument %s but instead found type null.",
|
||||
name);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool IsNullptr(const aclFloatArray *floatArr, const char *name) {
|
||||
if (floatArr == nullptr) {
|
||||
OP_LOGE(ACLNN_ERR_PARAM_NULLPTR, "Expected a value of type List[float] for argument %s but instead found type \
|
||||
null.", name);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool CheckDims(const aclTensor *tensor) {
|
||||
const auto& xShape = tensor->GetViewShape();
|
||||
for(size_t i = 0; i < xShape.GetDimNum(); i++) {
|
||||
if (xShape.GetDim(i) > INT32_MAX) {
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID, "The tensor's shape cannot be larger than %d.", INT32_MAX);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool CheckReduceOutShape(const aclTensor *inferOut, const aclTensor *out)
|
||||
{
|
||||
auto const &xShape = inferOut->GetViewShape();
|
||||
auto const &yShape = out->GetViewShape();
|
||||
if (xShape != yShape) {
|
||||
if (!(xShape.GetShapeSize() == 1 && yShape.GetShapeSize() == 1)) {
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID, "The out tensor's shape[%s] is not equal with inferOut shape[%s].",
|
||||
op::ToString(out->GetViewShape()).GetString(), op::ToString(inferOut->GetViewShape()).GetString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool CheckNCDimValid(const aclTensor *self, const aclTensor *out) {
|
||||
auto format = self->GetStorageFormat();
|
||||
int64_t selfDimN = 0;
|
||||
int64_t selfDimC = 0;
|
||||
int64_t outDimN = 0;
|
||||
int64_t outDimC = 0;
|
||||
if (format == op::Format::FORMAT_NCHW) {
|
||||
selfDimN = self->GetViewShape().GetDim(NCHW_N_DIM);
|
||||
selfDimC = self->GetViewShape().GetDim(NCHW_C_DIM);
|
||||
outDimN = out->GetViewShape().GetDim(NCHW_N_DIM);
|
||||
outDimC = out->GetViewShape().GetDim(NCHW_C_DIM);
|
||||
} else if (format == op::Format::FORMAT_NHWC) {
|
||||
selfDimN = self->GetViewShape().GetDim(NHWC_N_DIM);
|
||||
selfDimC = self->GetViewShape().GetDim(NHWC_C_DIM);
|
||||
outDimN = out->GetViewShape().GetDim(NHWC_N_DIM);
|
||||
outDimC = out->GetViewShape().GetDim(NHWC_C_DIM);
|
||||
} else {
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID,
|
||||
"Input and output format only support [NCHW, NHWC] format .");
|
||||
return false;
|
||||
}
|
||||
if ((selfDimN != outDimN) || (selfDimC != outDimC)) {
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID,
|
||||
"The selfDimN[%ld]/outDimN[%ld] or selfDimC[%ld]/outDimC[%ld] not equal .",
|
||||
selfDimN, outDimN, selfDimC, outDimC);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#define OP_CHECK_NULL(param, retExpr) \
|
||||
if (IsNullptr(param, #param)) { \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_DTYPE_NOT_SUPPORT(tensor, supportList, retExpr) \
|
||||
if (!CheckType(tensor->GetDataType(), supportList)) { \
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID, "Tensor %s not implemented for %s, should be in dtype support list %s.", \
|
||||
#tensor, op::ToString(tensor->GetDataType()).GetString(), op::ToString(supportList).GetString()); \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_DTYPE_NOT_MATCH(tensor, expectedDtype, retExpr) \
|
||||
if (tensor->GetDataType() != expectedDtype) { \
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID, "Tensor %s expected dtype is %s but found %s.", \
|
||||
#tensor, op::ToString(expectedDtype).GetString(), op::ToString(tensor->GetDataType()).GetString()); \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_DTYPE_NOT_SAME(tensor1, tensor2, retExpr) \
|
||||
if (tensor1->GetDataType() != tensor2->GetDataType()) { \
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID, "Expected both tensors to have same dtype, but found %s %s and %s %s.", \
|
||||
#tensor1, op::ToString(tensor1->GetDataType()).GetString(), \
|
||||
#tensor2, op::ToString(tensor2->GetDataType()).GetString()); \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_RESULT_DTYPE_CAST_FAILED(dtype, desiredDtype, retExpr); \
|
||||
if (!CanCast(dtype, desiredDtype)) { \
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID, "Result type %s can't be cast to the desired output type %s.", \
|
||||
op::ToString(dtype).GetString(), op::ToString(desiredDtype).GetString()); \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_BROADCAST(tensor1, tensor2, retExpr) \
|
||||
if (!CheckBroadcastShape(tensor1->GetViewShape(), tensor2->GetViewShape())) { \
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID, "The size of tensor %s %s must match the size of tensor %s %s.", \
|
||||
#tensor1, op::ToString(tensor1->GetViewShape()).GetString(), \
|
||||
#tensor2, op::ToString(tensor2->GetViewShape()).GetString()); \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_BROADCAST_WITH_SHAPE(tensor, shape, retExpr) \
|
||||
if (!CheckBroadcastShape(tensor->GetViewShape(), shape)) { \
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID, "The size of tensor %s %s must match the size %s.", \
|
||||
#tensor, op::ToString(tensor->GetViewShape()).GetString(), op::ToString(shape).GetString()); \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_BROADCAST_AND_INFER_SHAPE(tensor1, tensor2, retShape, retExpr) \
|
||||
if (!BroadcastInferShape(tensor1->GetViewShape(), tensor2->GetViewShape(), retShape)) { \
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID, "The size of tensor %s %s must match the size of tensor %s %s.", \
|
||||
#tensor1, op::ToString(tensor1->GetViewShape()).GetString(), \
|
||||
#tensor2, op::ToString(tensor2->GetViewShape()).GetString()); \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_SHAPE_NOT_EQUAL(tensor1, tensor2, retExpr) \
|
||||
if (tensor1->GetViewShape() != tensor2->GetViewShape()) { \
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID, "Expected tensor for %s to have same size as tensor for %s, but %s does not " \
|
||||
"equal %s.", #tensor1, #tensor2, op::ToString(tensor1->GetViewShape()).GetString(), \
|
||||
op::ToString(tensor2->GetViewShape()).GetString()); \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_SHAPE_NOT_EQUAL_WITH_EXPECTED_SIZE(tensor, shape, retExpr) \
|
||||
if (tensor->GetViewShape() != shape) { \
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID, "Expected tensor for %s to have same size as %s, but got %s.", \
|
||||
#tensor, op::ToString(shape).GetString(), op::ToString(tensor->GetViewShape()).GetString()); \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_WRONG_DIMENSION(tensor, expectedDimNum, retExpr) \
|
||||
if (tensor->GetViewShape().GetDimNum() != expectedDimNum) { \
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID, "Expected %zu dimension input, but got %s with sizes %s.", \
|
||||
static_cast<size_t>(expectedDimNum), #tensor, op::ToString(tensor->GetViewShape()).GetString()); \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_MAX_DIM(tensor, maxDim, retExpr) \
|
||||
if (tensor->GetViewShape().GetDimNum() > static_cast<size_t>(maxDim)) { \
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID, "The %s tensor cannot be larger than %zu dimensions.", \
|
||||
#tensor, static_cast<size_t>(maxDim)); \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_MIN_DIM(tensor, minDim, retExpr) \
|
||||
if (tensor->GetViewShape().GetDimNum() < static_cast<size_t>(minDim)) { \
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID, "The %s tensor must have at least %zu dimensions.", \
|
||||
#tensor, static_cast<size_t>(minDim)); \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_COMM_INPUT(workspaceSize, executor) \
|
||||
if (workspaceSize == nullptr || executor == nullptr) { \
|
||||
OP_LOGE(ACLNN_ERR_PARAM_NULLPTR, "The workspaceSize or executor is nullptr."); \
|
||||
return ACLNN_ERR_PARAM_NULLPTR; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_ADD_TO_LAUNCHER_LIST_AICORE(cond, retExpr, errMsg, ...) \
|
||||
if (cond) { \
|
||||
OP_LOGE(ACLNN_ERR_INNER_STATIC_WORKSPACE_INVALID, errMsg, ##__VA_ARGS__); \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_INFERSHAPE(cond, retExpr, errMsg, ...) \
|
||||
if (cond) { \
|
||||
OP_LOGE(ACLNN_ERR_INNER_INFERSHAPE_ERROR, errMsg, ##__VA_ARGS__); \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#define OP_CHECK_TENSORLIST_SIZE_EQUAL(tensorlist1, tensorlist2, retExpr) \
|
||||
if ((tensorlist1)->Size() != (tensorlist2)->Size()) { \
|
||||
OP_LOGE(ACLNN_ERR_PARAM_INVALID, \
|
||||
"The %s tensorlist and %s tensorlist must have the same number of tensors, but got %ld and %ld.", \
|
||||
#tensorlist1, #tensorlist2, (tensorlist1)->Size(), (tensorlist2)->Size()); \
|
||||
retExpr; \
|
||||
}
|
||||
|
||||
#endif
|
||||
89
csrc/common/stub/op_api/aclnn_kernels/contiguous.h
Normal file
89
csrc/common/stub/op_api/aclnn_kernels/contiguous.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_INC_EXTERNAL_ACLNN_KERNELS_CONTIGUOUS_H
|
||||
#define COMMON_INC_EXTERNAL_ACLNN_KERNELS_CONTIGUOUS_H
|
||||
|
||||
#include "opdev/op_def.h"
|
||||
#include "opdev/common_types.h"
|
||||
|
||||
namespace l0op {
|
||||
|
||||
typedef struct {
|
||||
// 每个op::Shape 18ns
|
||||
int64_t viewOffset;
|
||||
|
||||
// Transpose
|
||||
op::Shape transposeSrcShape;
|
||||
op::Shape transposeDstShape;
|
||||
op::FVector<int64_t, op::MAX_DIM_NUM> perm;
|
||||
|
||||
// broadcast to
|
||||
op::Shape broadcastSrcShape;
|
||||
op::Shape broadcastDstShape;
|
||||
op::FVector<int64_t, op::MAX_DIM_NUM> shape;
|
||||
|
||||
// slice
|
||||
op::Shape sliceSrcShape;
|
||||
op::Shape sliceDstShape;
|
||||
op::FVector<int64_t, op::MAX_DIM_NUM> offset;
|
||||
op::FVector<int64_t, op::MAX_DIM_NUM> size;
|
||||
|
||||
// strided slice
|
||||
op::Shape stridedsliceSrcShape;
|
||||
op::Shape stridedsliceDstShape;
|
||||
op::FVector<int64_t, op::MAX_DIM_NUM> begin;
|
||||
op::FVector<int64_t, op::MAX_DIM_NUM> end;
|
||||
op::FVector<int64_t, op::MAX_DIM_NUM> strides;
|
||||
|
||||
// optimizer
|
||||
bool mayBroadcast;
|
||||
bool mayTranspose;
|
||||
bool maySlice;
|
||||
bool mayStridedslice;
|
||||
} ContiguousParam;
|
||||
|
||||
/**
|
||||
* @brief 将非连续Tensor转换为连续Tensor
|
||||
* @param x
|
||||
* @param executor
|
||||
* @return aclTensor 转换后的tensor
|
||||
*/
|
||||
const aclTensor* Contiguous(const aclTensor* x, aclOpExecutor* executor);
|
||||
|
||||
/**
|
||||
* @brief 将连续tensor拷贝到非连续的tensor上
|
||||
* @param x
|
||||
* @param y
|
||||
* @param executor
|
||||
* @return aclTensor 转换后的tensor
|
||||
*/
|
||||
const aclTensor* ViewCopy(const aclTensor* x, const aclTensor* y, aclOpExecutor* executor);
|
||||
|
||||
/**
|
||||
* @brief 对Tensor创建一个View,要求Tensor满足PickView的条件
|
||||
* @param x 输入Tensor,可以是一整块的非连续Tensor
|
||||
* @param executor
|
||||
* @return 输出Shape是一个连续Tensor
|
||||
*/
|
||||
const aclTensor* PickViewAsContiguous(const aclTensor* x, aclOpExecutor* executor);
|
||||
|
||||
const aclTensor* ReViewToOut(const aclTensor* x, const aclTensor* y, aclOpExecutor* executor);
|
||||
|
||||
// ============内部接口=============
|
||||
bool CanOptimizeContiguous(
|
||||
const op::Shape& viewShape, const op::Strides& strides, int64_t offset, int64_t storageSize,
|
||||
ContiguousParam& param);
|
||||
|
||||
bool CanOptimizeView(const op::Shape& viewShape, const op::Strides& strides, int64_t offset, ContiguousParam& param);
|
||||
// ============内部接口=============
|
||||
} // namespace l0op
|
||||
|
||||
#endif // COMMON_INC_EXTERNAL_ACLNN_KERNELS_CONTIGUOUS_H
|
||||
20
csrc/common/stub/op_api/aclnn_kernels/pad.h
Normal file
20
csrc/common/stub/op_api/aclnn_kernels/pad.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_INC_EXTERNAL_ACLNN_KERNELS_PAD_H
|
||||
#define COMMON_INC_EXTERNAL_ACLNN_KERNELS_PAD_H
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
#include "opdev/make_op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor* Pad(const aclTensor* self, const aclTensor* paddings, aclOpExecutor* executor);
|
||||
}
|
||||
#endif // COMMON_INC_EXTERNAL_ACLNN_KERNELS_PAD_H
|
||||
37
csrc/common/stub/op_api/aclnn_kernels/reshape.h
Normal file
37
csrc/common/stub/op_api/aclnn_kernels/reshape.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_INC_EXTERNAL_ACLNN_KERNELS_RESHAPE_H
|
||||
#define COMMON_INC_EXTERNAL_ACLNN_KERNELS_RESHAPE_H
|
||||
|
||||
#include "opdev/shape_utils.h"
|
||||
#include "opdev/op_def.h"
|
||||
|
||||
namespace l0op {
|
||||
/**
|
||||
* @brief Modify input tensor's shape.
|
||||
* @param x Input Tensor. Should be contiguous.
|
||||
* @param shape Target Shape. Only one dimension can be -1.
|
||||
* @param executor aclOpExecutor.ldd
|
||||
* @return *aclTensor Output tensor.
|
||||
*/
|
||||
const aclTensor* Reshape(const aclTensor* x, const op::Shape& shape, aclOpExecutor* executor);
|
||||
|
||||
/**
|
||||
* @brief Modify input tensor's shape.
|
||||
* @param x Input Tensor. Should be contiguous.
|
||||
* @param shape Target Shape. Only one dimension can be -1.
|
||||
* @param executor aclOpExecutor.
|
||||
* @return *aclTensor Output tensor.
|
||||
*/
|
||||
const aclTensor* Reshape(const aclTensor* x, const aclIntArray* shape, aclOpExecutor* executor);
|
||||
} // namespace l0op
|
||||
|
||||
#endif // COMMON_INC_EXTERNAL_ACLNN_KERNELS_RESHAPE_H
|
||||
25
csrc/common/stub/op_api/aclnn_kernels/slice.h
Normal file
25
csrc/common/stub/op_api/aclnn_kernels/slice.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_INC_EXTERNAL_ACLNN_KERNELS_SLICE_H
|
||||
#define COMMON_INC_EXTERNAL_ACLNN_KERNELS_SLICE_H
|
||||
|
||||
#include "opdev/op_def.h"
|
||||
|
||||
namespace l0op {
|
||||
|
||||
const aclTensor* Slice(
|
||||
const aclTensor* x, const aclTensor* y, const aclTensor* offset, const aclTensor* size, aclOpExecutor* executor);
|
||||
|
||||
const aclTensor* Slice(
|
||||
const aclTensor* x, const aclIntArray* offsets, const aclIntArray* size, aclOpExecutor* executor);
|
||||
} // namespace l0op
|
||||
|
||||
#endif // COMMON_INC_EXTERNAL_ACLNN_KERNELS_SLICE_H
|
||||
56
csrc/common/stub/op_api/aclnn_kernels/transdata.h
Normal file
56
csrc/common/stub/op_api/aclnn_kernels/transdata.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_INC_EXTERNAL_ACLNN_KERNELS_TRANSDATA_H
|
||||
#define COMMON_INC_EXTERNAL_ACLNN_KERNELS_TRANSDATA_H
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
|
||||
const aclTensor* ReFormat(const aclTensor* x, const op::Format& format, aclOpExecutor* executor = nullptr);
|
||||
|
||||
/**
|
||||
* TransData
|
||||
* Formal Transdata. Set the c0 size strictly based on the data type and chip block size.
|
||||
* support data type as follows: fp16,fp32,int32,uint32,int8,uint8
|
||||
* fp16: block_size/2
|
||||
* fp32/int32/uint32: block_size/4 (this is different from `TransDataSpecial`)
|
||||
* int8/uint8: block_size/1
|
||||
*
|
||||
* @param x : aclTensor need to transpose
|
||||
* @param dstPrimaryFormat: dstPrimaryFormat like NC1HWC0
|
||||
* @param groups: groups
|
||||
* @param executor: executor should not be null
|
||||
* @return trans format tensor
|
||||
*/
|
||||
const aclTensor* TransData(const aclTensor* x, op::Format dstPrimaryFormat, int64_t groups, aclOpExecutor* executor);
|
||||
/**
|
||||
* Special Transdata. Set the c0 size strictly based on the data type and chip block size.
|
||||
* this transdata c0 size rule:
|
||||
* fp16: block_size/2
|
||||
* fp32/int32/uint32: block_size/2
|
||||
* int8/uint8: block_size/1
|
||||
* bool not supported, should do:
|
||||
* (NCHW, bool)-> cast -> (NCHW, fp16) -> TransDataSpecial -> (5HD, fp16) -> cast -> (5HD, bool)
|
||||
* (5HD, bool)-> cast -> (5HD, fp16) -> TransDataSpecial -> (NCHW, fp16) -> cast -> (NCHW, bool)
|
||||
*
|
||||
* @param x : aclTensor need to transpose
|
||||
* @param dstPrimaryFormat: dstPrimaryFormat like NC1HWC0
|
||||
* @param groups: groups
|
||||
* @param executor: executor should not be null
|
||||
* @return trans format tensor
|
||||
*/
|
||||
const aclTensor* TransDataSpecial(
|
||||
const aclTensor* x, op::Format dstPrimaryFormat, int64_t groups, aclOpExecutor* executor);
|
||||
|
||||
} // namespace l0op
|
||||
|
||||
#endif // COMMON_INC_EXTERNAL_ACLNN_KERNELS_TRANSDATA_H
|
||||
22
csrc/common/stub/op_api/aclnn_kernels/transpose.h
Normal file
22
csrc/common/stub/op_api/aclnn_kernels/transpose.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_INC_EXTERNAL_ACLNN_KERNELS_TRANSPOSE_H
|
||||
#define COMMON_INC_EXTERNAL_ACLNN_KERNELS_TRANSPOSE_H
|
||||
|
||||
#include "opdev/op_def.h"
|
||||
|
||||
namespace l0op {
|
||||
|
||||
const aclTensor* Transpose(const aclTensor* x, const aclTensor* y, const aclTensor* perm, aclOpExecutor* executor);
|
||||
const aclTensor* Transpose(const aclTensor* x, const aclIntArray* perm, aclOpExecutor* executor);
|
||||
} // namespace l0op
|
||||
|
||||
#endif // COMMON_INC_EXTERNAL_ACLNN_KERNELS_TRANSPOSE_H
|
||||
26
csrc/common/stub/op_api/level0/add.h
Normal file
26
csrc/common/stub/op_api/level0/add.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file add.h
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#ifndef OP_API_INC_LEVEL0_OP_ADD_OP_H_
|
||||
#define OP_API_INC_LEVEL0_OP_ADD_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor* Add(const aclTensor* self, const aclTensor* other, aclOpExecutor* executor);
|
||||
|
||||
}
|
||||
|
||||
#endif // OP_API_INC_LEVEL0_OP_ADD_OP_H_
|
||||
26
csrc/common/stub/op_api/level0/arange.h
Normal file
26
csrc/common/stub/op_api/level0/arange.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file arange.h
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#ifndef PTA_NPU_OP_API_INC_LEVEL0_OP_ARANGE_OP_H_
|
||||
#define PTA_NPU_OP_API_INC_LEVEL0_OP_ARANGE_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor* Arange(const aclScalar* start, const aclScalar* end, const aclScalar* step, const aclTensor* out,
|
||||
const bool isClosed, aclOpExecutor* executor);
|
||||
}
|
||||
|
||||
#endif
|
||||
26
csrc/common/stub/op_api/level0/axpy.h
Normal file
26
csrc/common/stub/op_api/level0/axpy.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file axpy.h
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#ifndef OP_API_INC_LEVEL0_OP_AXPY_OP_H_
|
||||
#define OP_API_INC_LEVEL0_OP_AXPY_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor* Axpy(const aclTensor* self, const aclTensor* other, float alpha, aclOpExecutor* executor);
|
||||
|
||||
}
|
||||
|
||||
#endif // OP_API_INC_LEVEL0_OP_AXPY_OP_H_
|
||||
45
csrc/common/stub/op_api/level0/batch_norm_backward.h
Normal file
45
csrc/common/stub/op_api/level0/batch_norm_backward.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
#ifndef PTA_NPU_OP_API_INC_LEVEL0_OP_BATCH_NORM_GRAD_OP_H_
|
||||
#define PTA_NPU_OP_API_INC_LEVEL0_OP_BATCH_NORM_GRAD_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const std::array<aclTensor*, 2> BNTrainingUpdateGrad(const aclTensor* gradOut, const aclTensor* x,
|
||||
const aclTensor* saveMean, const aclTensor* saveInvstd, float eps,
|
||||
aclOpExecutor* executor);
|
||||
const std::array<aclTensor*, 2> BN3DTrainingUpdateGrad(const aclTensor* gradOut, const aclTensor* x,
|
||||
const aclTensor* saveMean, const aclTensor* saveInvstd,
|
||||
float eps, aclOpExecutor* executor);
|
||||
|
||||
const aclTensor* BNTrainingReduceGrad(const aclTensor* gradOut, const aclTensor* x, const aclTensor* gradWeight,
|
||||
const aclTensor* gradBias, const aclTensor* weight, const aclTensor* saveMean,
|
||||
const aclTensor* saveInvstd, float eps, aclOpExecutor* executor);
|
||||
const aclTensor* BN3DTrainingReduceGrad(const aclTensor* gradOut, const aclTensor* x, const aclTensor* gradWeight,
|
||||
const aclTensor* gradBias, const aclTensor* weight, const aclTensor* saveMean,
|
||||
const aclTensor* saveInvstd, float eps, aclOpExecutor* executor);
|
||||
|
||||
const aclTensor* BNInferGrad(const aclTensor* gradOut, const aclTensor* weight, const aclTensor* runningVar, float eps,
|
||||
aclOpExecutor* executor);
|
||||
|
||||
constexpr size_t BN_GRAD_V3_OUTPUT_NUM = 3;
|
||||
const std::array<aclTensor*, BN_GRAD_V3_OUTPUT_NUM> BatchNormGradV3(const aclTensor* gradOut,
|
||||
const aclTensor* input,
|
||||
const aclTensor* weight,
|
||||
const aclTensor* runningMean,
|
||||
const aclTensor* runningVar,
|
||||
const aclTensor* saveMean,
|
||||
const aclTensor* saveInvstd,
|
||||
bool training, float eps,
|
||||
aclOpExecutor* executor);
|
||||
} // namespace l0op
|
||||
|
||||
#endif // PTA_NPU_OP_API_INC_LEVEL0_OP_BATCH_NORM_GRAD_OP_H_
|
||||
28
csrc/common/stub/op_api/level0/broadcast_to.h
Normal file
28
csrc/common/stub/op_api/level0/broadcast_to.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file broadcast_to.h
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#ifndef OP_API_INC_LEVEL0_BROADCAST_TO_H
|
||||
#define OP_API_INC_LEVEL0_BROADCAST_TO_H
|
||||
|
||||
# include "opdev/op_def.h"
|
||||
|
||||
namespace l0op {
|
||||
|
||||
const aclTensor *BroadcastTo(const aclTensor *x, const aclTensor *y, const aclTensor *shape, aclOpExecutor *executor);
|
||||
const aclTensor *BroadcastTo(const aclTensor *x, const aclIntArray *shape, aclOpExecutor *executor);
|
||||
|
||||
} // l0op
|
||||
|
||||
#endif // OP_API_INC_LEVEL0_BROADCAST_TO_H
|
||||
21
csrc/common/stub/op_api/level0/dilation.h
Normal file
21
csrc/common/stub/op_api/level0/dilation.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
#ifndef OP_API_OP_API_COMMON_INC_LEVEL0_OP_DILATION_OP_H_
|
||||
#define OP_API_OP_API_COMMON_INC_LEVEL0_OP_DILATION_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
// Dilation
|
||||
const aclTensor *Dilation(const aclTensor *x, const aclIntArray *dilations, const aclIntArray *pads,
|
||||
float paddingValue, aclOpExecutor *executor);
|
||||
} // namespace l0op
|
||||
|
||||
#endif // OP_API_OP_API_COMMON_INC_LEVEL0_OP_DILATION_OP_H_
|
||||
20
csrc/common/stub/op_api/level0/div.h
Normal file
20
csrc/common/stub/op_api/level0/div.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
#ifndef PTA_NPU_OP_API_INC_LEVEL0_OP_DIV_OP_H_
|
||||
#define PTA_NPU_OP_API_INC_LEVEL0_OP_DIV_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor *Div(const aclTensor *self, const aclTensor *other, aclOpExecutor *executor);
|
||||
|
||||
}
|
||||
|
||||
#endif // PTA_NPU_OP_API_INC_LEVEL0_OP_ADD_OP_H_
|
||||
27
csrc/common/stub/op_api/level0/dot.h
Normal file
27
csrc/common/stub/op_api/level0/dot.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file dot.h
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#ifndef OP_API_INC_LEVEL0_DOT_H_
|
||||
#define OP_API_INC_LEVEL0_DOT_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
|
||||
const aclTensor *Dot(const aclTensor *self, const aclTensor *tensor, aclOpExecutor *executor);
|
||||
|
||||
}
|
||||
|
||||
#endif // OP_API_INC_LEVEL0_DOT_H_
|
||||
25
csrc/common/stub/op_api/level0/expand.h
Normal file
25
csrc/common/stub/op_api/level0/expand.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file expand.h
|
||||
* \brief
|
||||
*/
|
||||
#ifndef PTA_NPU_OP_API_INC_LEVEL0_OP_EXPAND_OP_H_
|
||||
#define PTA_NPU_OP_API_INC_LEVEL0_OP_EXPAND_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
#include "opdev/make_op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor *Expand(const aclTensor *self, const aclIntArray *shape, aclOpExecutor *executor);
|
||||
}
|
||||
|
||||
#endif // PTA_NPU_OP_API_INC_LEVEL0_OP_EXPAND_OP_H_
|
||||
20
csrc/common/stub/op_api/level0/fault_injection.h
Normal file
20
csrc/common/stub/op_api/level0/fault_injection.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
#ifndef OP_API_INC_LEVEL0_FAULT_INJECTION_H_
|
||||
#define OP_API_INC_LEVEL0_FAULT_INJECTION_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor* FaultInjection(const aclTensor *injectObj, const aclTensor *injectPara, aclTensor *out, aclOpExecutor *executor);
|
||||
} // namespace l0op
|
||||
|
||||
#endif // OP_API_INC_LEVEL0_FAULT_INJECTION_H_
|
||||
26
csrc/common/stub/op_api/level0/fill.h
Normal file
26
csrc/common/stub/op_api/level0/fill.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file fill.h
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#ifndef OP_API_INC_LEVEL0_OP_FILL_OP_H_
|
||||
#define OP_API_INC_LEVEL0_OP_FILL_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor *Fill(const aclTensor *dims, const aclTensor *value, const aclIntArray *outShape,
|
||||
aclOpExecutor *executor);
|
||||
}
|
||||
|
||||
#endif
|
||||
27
csrc/common/stub/op_api/level0/gather_elements.h
Normal file
27
csrc/common/stub/op_api/level0/gather_elements.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file gather_elements.h
|
||||
* \brief
|
||||
*/
|
||||
#ifndef OP_API_INC_LEVEL0_OP_GATHER_ELEMENTS_H_
|
||||
#define OP_API_INC_LEVEL0_OP_GATHER_ELEMENTS_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor *GatherElements(const aclTensor *self,
|
||||
const int64_t dim,
|
||||
const aclTensor *index,
|
||||
aclOpExecutor *executor);
|
||||
} // l0op
|
||||
|
||||
#endif // OP_API_INC_LEVEL0_OP_GATHER_ELEMENTS_H_
|
||||
25
csrc/common/stub/op_api/level0/gather_v2.h
Normal file
25
csrc/common/stub/op_api/level0/gather_v2.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
#ifndef OP_API_INC_LEVEL0_OP_GATHER_V2_H_
|
||||
#define OP_API_INC_LEVEL0_OP_GATHER_V2_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
|
||||
const aclTensor *GatherV2(const aclTensor *self, int64_t axis, const aclTensor *indices, aclOpExecutor *executor,
|
||||
int batchDims = 0, bool negativeIndexSupport = false);
|
||||
|
||||
const aclTensor *GatherV2WithImplMode(const aclTensor *self, int64_t axis, const aclTensor *indices, int64_t implMode,
|
||||
aclOpExecutor *executor, int batchDims = 0, bool negativeIndexSupport = false);
|
||||
|
||||
}
|
||||
|
||||
#endif // OP_API_INC_LEVEL0_OP_GATHER_V2_H_
|
||||
23
csrc/common/stub/op_api/level0/gather_v3.h
Normal file
23
csrc/common/stub/op_api/level0/gather_v3.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_INC_EXTERNAL_ACLNN_KERNELS_GATHER_V3_H
|
||||
#define COMMON_INC_EXTERNAL_ACLNN_KERNELS_GATHER_V3_H
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
|
||||
const aclTensor *GatherV3(const aclTensor *self, int64_t axis, const aclTensor *indices, aclOpExecutor *executor,
|
||||
int batchDims = 0, bool negativeIndexSupport = false);
|
||||
|
||||
}
|
||||
|
||||
#endif // COMMON_INC_EXTERNAL_ACLNN_KERNELS_GATHER_V3_H
|
||||
34
csrc/common/stub/op_api/level0/inplace_index_add.h
Normal file
34
csrc/common/stub/op_api/level0/inplace_index_add.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file inplace_index_add.h
|
||||
* \brief
|
||||
*/
|
||||
#ifndef OP_API_INC_LEVEL0_OP_INDEX_ADD_H_
|
||||
#define OP_API_INC_LEVEL0_OP_INDEX_ADD_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor *InplaceIndexAddAiCore(const aclTensor *self, const int64_t dim, const aclTensor *index,
|
||||
const aclTensor *source, const aclTensor *alphaTensor,
|
||||
aclOpExecutor *executor);
|
||||
|
||||
const aclTensor *InplaceIndexAddAiCpu(const aclTensor *self, const int64_t dim, const aclTensor *index,
|
||||
const aclTensor *source, const aclTensor *alphaTensor,
|
||||
aclOpExecutor *executor);
|
||||
|
||||
const aclTensor *InplaceIndexAddWithSorted(const aclTensor *self, const int64_t dim, const aclTensor *sortedIndices,
|
||||
const aclTensor *pos, const aclTensor *value, const aclTensor *alphaTensor,
|
||||
aclOpExecutor *executor);
|
||||
}
|
||||
|
||||
#endif
|
||||
25
csrc/common/stub/op_api/level0/masked_scatter.h
Normal file
25
csrc/common/stub/op_api/level0/masked_scatter.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file masked_scatter.h
|
||||
* \brief
|
||||
*/
|
||||
#ifndef PTA_NPU_OP_API_INC_LEVEL0_OP_MASKED_SCATTER_OP_H_
|
||||
#define PTA_NPU_OP_API_INC_LEVEL0_OP_MASKED_SCATTER_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor* MaskedScatter(const aclTensor* self, const aclTensor* mask, const aclTensor* source,
|
||||
aclOpExecutor* executor);
|
||||
}
|
||||
|
||||
#endif // PTA_NPU_OP_API_INC_LEVEL0_OP_MASKED_SCATTER_OP_H_
|
||||
22
csrc/common/stub/op_api/level0/matmul_v2tov3.h
Normal file
22
csrc/common/stub/op_api/level0/matmul_v2tov3.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
#ifndef PTA_NPU_OP_API_INC_LEVEL0_OP_MATMUL_V2TOV3_H_
|
||||
#define PTA_NPU_OP_API_INC_LEVEL0_OP_MATMUL_V2TOV3_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
|
||||
bool MmCheckHitV3Shape(const aclTensor* x1, const aclTensor* x2, const aclTensor* bias,
|
||||
const bool transposeX1, const bool transposeX2, op::Format mat2_format, bool supportSplitK);
|
||||
}
|
||||
|
||||
#endif // PTA_NPU_OP_API_INC_LEVEL0_OP_MATMUL_V2TOV3_H_
|
||||
26
csrc/common/stub/op_api/level0/maximum.h
Normal file
26
csrc/common/stub/op_api/level0/maximum.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file maximum.h
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#ifndef OP_API_INC_LEVEL0_OP_MAXIMUM_OP_H_
|
||||
#define OP_API_INC_LEVEL0_OP_MAXIMUM_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor* Maximum(const aclTensor* self, const aclTensor* other, aclOpExecutor* executor);
|
||||
|
||||
}
|
||||
|
||||
#endif // OP_API_INC_LEVEL0_OP_MAXIMUM_OP_H_
|
||||
25
csrc/common/stub/op_api/level0/minimum.h
Normal file
25
csrc/common/stub/op_api/level0/minimum.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file minimum.h
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#ifndef OP_API_INC_LEVEL0_OP_MINIMUM_OP_H_
|
||||
#define OP_API_INC_LEVEL0_OP_MINIMUM_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor* Minimum(const aclTensor* self, const aclTensor* other, aclOpExecutor* executor);
|
||||
}
|
||||
|
||||
#endif // OP_API_INC_LEVEL0_OP_MINIMUM_OP_H_
|
||||
26
csrc/common/stub/op_api/level0/mul.h
Normal file
26
csrc/common/stub/op_api/level0/mul.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file mul.h
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#ifndef OP_API_INC_LEVEL0_MUL_H_
|
||||
#define OP_API_INC_LEVEL0_MUL_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor *Mul(const aclTensor *self, const aclTensor *other, aclOpExecutor *executor);
|
||||
|
||||
}
|
||||
|
||||
#endif // OP_API_INC_LEVEL0_MUL_H_
|
||||
28
csrc/common/stub/op_api/level0/muls.h
Normal file
28
csrc/common/stub/op_api/level0/muls.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file muls.h
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#ifndef PTA_NPU_OP_API_INC_LEVEL0_OP_MULS_OP_H_
|
||||
#define PTA_NPU_OP_API_INC_LEVEL0_OP_MULS_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor *Muls(const aclTensor *self,
|
||||
float alpha,
|
||||
aclOpExecutor *executor);
|
||||
|
||||
}
|
||||
|
||||
#endif // PTA_NPU_OP_API_INC_LEVEL0_OP_MULS_OP_H_
|
||||
27
csrc/common/stub/op_api/level0/ones_like.h
Normal file
27
csrc/common/stub/op_api/level0/ones_like.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
#ifndef PTA_NPU_OP_API_INC_LEVEL0_OP_ONES_LIKE_OP_H_
|
||||
#define PTA_NPU_OP_API_INC_LEVEL0_OP_ONES_LIKE_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
static const std::initializer_list<op::DataType> AICPU_DTYPE_SUPPORT_LIST = {
|
||||
op::DataType::DT_BOOL, op::DataType::DT_FLOAT, op::DataType::DT_FLOAT16, op::DataType::DT_INT8,
|
||||
op::DataType::DT_INT16, op::DataType::DT_UINT16, op::DataType::DT_UINT8, op::DataType::DT_INT32,
|
||||
op::DataType::DT_INT64, op::DataType::DT_DOUBLE, op::DataType::DT_COMPLEX64, op::DataType::DT_COMPLEX128,
|
||||
op::DataType::DT_BF16};
|
||||
const aclTensor *OnesLike(const aclTensor *self, aclOpExecutor *executor);
|
||||
inline static bool IsAiCpuSupport(const aclTensor *self) {
|
||||
return op::CheckType(self->GetDataType(), AICPU_DTYPE_SUPPORT_LIST);
|
||||
}
|
||||
} // namespace l0op
|
||||
|
||||
#endif // PTA_NPU_OP_API_INC_LEVEL0_OP_ONES_LIKE_OP_H_
|
||||
25
csrc/common/stub/op_api/level0/padv3.h
Normal file
25
csrc/common/stub/op_api/level0/padv3.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file padv3.h
|
||||
* \brief
|
||||
*/
|
||||
#ifndef PTA_NPU_OP_API_INC_LEVEL0_OP_PADV3_OP_H_
|
||||
#define PTA_NPU_OP_API_INC_LEVEL0_OP_PADV3_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
#include "opdev/make_op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor *PadV3(const aclTensor *self, const aclTensor *paddings, const aclTensor *constant_values,
|
||||
const std::string& mode, const bool paddingsContiguous, aclOpExecutor *executor);
|
||||
}
|
||||
#endif // PTA_NPU_OP_API_INC_LEVEL0_OP_PADV3_OP_H_
|
||||
21
csrc/common/stub/op_api/level0/reduce_mean.h
Normal file
21
csrc/common/stub/op_api/level0/reduce_mean.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
#ifndef OP_API_INC_LEVEL0_REDUCE_MEAN_H
|
||||
#define OP_API_INC_LEVEL0_REDUCE_MEAN_H
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor* ReduceMean(const aclTensor* self, const aclIntArray* dim, bool keepDim, aclOpExecutor* executor);
|
||||
const aclTensor* ReduceMean(
|
||||
const aclTensor* self, const aclIntArray* dim, bool keepDim, bool noopWithEmptyAxes, aclOpExecutor* executor);
|
||||
} // namespace l0op
|
||||
|
||||
#endif
|
||||
27
csrc/common/stub/op_api/level0/reduce_sum_op.h
Normal file
27
csrc/common/stub/op_api/level0/reduce_sum_op.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file padv3.h
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#ifndef OP_API_OP_API_COMMON_INC_LEVEL0_OP_REDUCE_SUM_OP_H_
|
||||
#define OP_API_OP_API_COMMON_INC_LEVEL0_OP_REDUCE_SUM_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
#include "opdev/make_op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor *ReduceSumOp(const aclTensor *x, const aclIntArray *axes,
|
||||
bool keep_dims, aclOpExecutor *executor);
|
||||
}
|
||||
|
||||
#endif // OP_API_OP_API_COMMON_INC_LEVEL0_OP_REDUCE_SUM_OP_H_
|
||||
18
csrc/common/stub/op_api/level0/shape_op.h
Normal file
18
csrc/common/stub/op_api/level0/shape_op.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
#ifndef OP_API_INC_LEVEL0_SHAPE_OP_H
|
||||
#define OP_API_INC_LEVEL0_SHAPE_OP_H
|
||||
#include "opdev/op_executor.h"
|
||||
namespace l0op {
|
||||
const aclTensor *Shape_op(const aclTensor *x, aclOpExecutor *executor);
|
||||
}
|
||||
|
||||
#endif
|
||||
26
csrc/common/stub/op_api/level0/sort.h
Normal file
26
csrc/common/stub/op_api/level0/sort.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file sort.h
|
||||
* \brief
|
||||
*/
|
||||
#ifndef PTA_NPU_OP_API_INC_LEVEL0_OP_SORT_OP_H_
|
||||
#define PTA_NPU_OP_API_INC_LEVEL0_OP_SORT_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
#include "opdev/fast_vector.h"
|
||||
|
||||
namespace l0op {
|
||||
const std::tuple<aclTensor*, aclTensor*> Sort(const aclTensor* self, int64_t dim, bool descending, bool stable,
|
||||
op::DataType indicesType, aclOpExecutor* executor);
|
||||
}
|
||||
|
||||
#endif // PTA_NPU_OP_API_INC_LEVEL0_OP_SORT_OP_H_
|
||||
24
csrc/common/stub/op_api/level0/squeeze.h
Normal file
24
csrc/common/stub/op_api/level0/squeeze.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
#ifndef OP_API_INC_LEVEL0_SQUEEZE_ND_H
|
||||
#define OP_API_INC_LEVEL0_SQUEEZE_ND_H
|
||||
|
||||
# include "opdev/op_def.h"
|
||||
|
||||
namespace l0op {
|
||||
|
||||
const aclTensor *SqueezeNd(const aclTensor *x, const aclIntArray* dim, aclOpExecutor *executor);
|
||||
|
||||
const aclTensor *SqueezeNd(const aclTensor *x, int64_t dim, aclOpExecutor *executor);
|
||||
|
||||
} // l0op
|
||||
|
||||
#endif // OP_API_INC_LEVEL0_SQUEEZE_ND_H
|
||||
21
csrc/common/stub/op_api/level0/sub.h
Normal file
21
csrc/common/stub/op_api/level0/sub.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
#ifndef PTA_NPU_OP_API_INC_LEVEL0_OP_SUB_OP_H_
|
||||
#define PTA_NPU_OP_API_INC_LEVEL0_OP_SUB_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
#include "opdev/make_op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor *Sub(const aclTensor *self, const aclTensor *other, aclOpExecutor *executor);
|
||||
|
||||
}
|
||||
|
||||
#endif // PTA_NPU_OP_API_INC_LEVEL0_OP_SUB_OP_H_
|
||||
26
csrc/common/stub/op_api/level0/tensor_move.h
Normal file
26
csrc/common/stub/op_api/level0/tensor_move.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file tensor_move.h
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#ifndef OP_API_INC_LEVEL0_TENSOR_MOVE_H
|
||||
#define OP_API_INC_LEVEL0_TENSOR_MOVE_H
|
||||
|
||||
# include "opdev/op_def.h"
|
||||
|
||||
namespace l0op {
|
||||
|
||||
const aclTensor *TensorMove(const aclTensor *x, const aclTensor *y, aclOpExecutor *executor);
|
||||
} // l0op
|
||||
|
||||
#endif // OP_API_INC_LEVEL0_TENSOR_MOVE_H
|
||||
29
csrc/common/stub/op_api/level0/unsqueeze.h
Normal file
29
csrc/common/stub/op_api/level0/unsqueeze.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file unsqueeze.h
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#ifndef OP_API_INC_LEVEL0_UNSQUEEZE_ND_H
|
||||
#define OP_API_INC_LEVEL0_UNSQUEEZE_ND_H
|
||||
|
||||
# include "opdev/op_def.h"
|
||||
|
||||
namespace l0op {
|
||||
|
||||
const aclTensor *UnsqueezeNd(const aclTensor *x, const aclIntArray* dim, aclOpExecutor *executor);
|
||||
|
||||
const aclTensor *UnsqueezeNd(const aclTensor *x, int64_t dim, aclOpExecutor *executor);
|
||||
|
||||
} // l0op
|
||||
|
||||
#endif // OP_API_INC_LEVEL0_UNSQUEEZE_ND_H
|
||||
20
csrc/common/stub/op_api/level0/zero_op.h
Normal file
20
csrc/common/stub/op_api/level0/zero_op.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
#ifndef PTA_NPU_OP_API_INC_LEVEL0_OP_ZERO_OP_H_
|
||||
#define PTA_NPU_OP_API_INC_LEVEL0_OP_ZERO_OP_H_
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor *ZerosLike(const aclTensor *self, aclOpExecutor *executor);
|
||||
|
||||
}
|
||||
|
||||
#endif // PTA_NPU_OP_API_INC_LEVEL0_OP_ZERO_OP_H_
|
||||
303
csrc/common/stub/op_api/opapi_stub.cpp
Normal file
303
csrc/common/stub/op_api/opapi_stub.cpp
Normal file
@@ -0,0 +1,303 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
* CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
* Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See LICENSE in the root of the software repository for the full text of the License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file op_legacy_api.cpp
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#include "opdev/op_executor.h"
|
||||
#include "aclnn_kernels/cast.h"
|
||||
#include "aclnn_kernels/contiguous.h"
|
||||
#include "aclnn_kernels/pad.h"
|
||||
#include "aclnn_kernels/reshape.h"
|
||||
#include "aclnn_kernels/slice.h"
|
||||
#include "aclnn_kernels/transdata.h"
|
||||
#include "aclnn_kernels/transpose.h"
|
||||
|
||||
#include "level0/add.h"
|
||||
#include "level0/axpy.h"
|
||||
#include "level0/broadcast_to.h"
|
||||
#include "level0/dot.h"
|
||||
#include "level0/fill.h"
|
||||
#include "level0/mul.h"
|
||||
#include "level0/muls.h"
|
||||
#include "level0/reduce_mean.h"
|
||||
#include "level0/padv3.h"
|
||||
#include "level0/sort.h"
|
||||
#include "level0/dilation.h"
|
||||
#include "level0/zero_op.h"
|
||||
#include "level0/squeeze.h"
|
||||
#include "level0/unsqueeze.h"
|
||||
|
||||
namespace l0op {
|
||||
const aclTensor *TensorMove(const aclTensor *x, const aclTensor * /*y*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
const aclTensor *ZerosLike(const aclTensor *self, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
const aclTensor *Maximum(const aclTensor *self, const aclTensor * /*other*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
const aclTensor *GatherV2(const aclTensor *self, int64_t /*axis*/, const aclTensor * /*indices*/,
|
||||
aclOpExecutor * /*executor*/, int /*batchDims = 0*/, bool /*negativeIndexSupport = false*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
const aclTensor *GatherV2WithImplMode(const aclTensor *self, int64_t /*axis*/, const aclTensor * /*indices*/,
|
||||
int64_t /*implMode*/, aclOpExecutor * /*executor*/, int /*batchDims = 0*/,
|
||||
bool /*negativeIndexSupport = false*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
const aclTensor *GatherElements(const aclTensor *self, const int64_t /*dim*/, const aclTensor * /*index*/,
|
||||
aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
const aclTensor *Minimum(const aclTensor *self, const aclTensor * /*other*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
const aclTensor *Cast(const aclTensor *self, op::DataType /*dstDtype*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
const aclTensor *CastOnlyForConvBackward(const aclTensor *self, op::DataType /*dstDtype*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
const aclTensor *Contiguous(const aclTensor *x, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *ViewCopy(const aclTensor *x, const aclTensor * /*y*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *PickViewAsContiguous(const aclTensor *x, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *ReViewToOut(const aclTensor *x, const aclTensor * /*y*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const std::tuple<aclTensor *, aclTensor *> Sort(const aclTensor * self, int64_t /*dim*/, bool /*descending*/,
|
||||
bool /*stable*/, op::DataType /*indicesType*/,
|
||||
aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return std::tuple<aclTensor *, aclTensor *>(const_cast<aclTensor *>(self), const_cast<aclTensor *>(self));
|
||||
}
|
||||
|
||||
bool CanOptimizeContiguous(const op::Shape & /*viewShape*/, const op::Strides & /*strides*/, int64_t /*offset*/,
|
||||
int64_t /*storageSize*/, ContiguousParam & /*param*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CanOptimizeView(const op::Shape & /*viewShape*/, const op::Strides & /*strides*/, int64_t /*offset*/,
|
||||
ContiguousParam & /*param*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const aclTensor *Pad(const aclTensor *self, const aclTensor * /*paddings*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
const aclTensor *Reshape(const aclTensor *x, const op::Shape & /*shape*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *Reshape(const aclTensor *x, const aclIntArray * /*shape*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *Slice(const aclTensor *x, const aclTensor * /*y*/, const aclTensor * /*offset*/,
|
||||
const aclTensor * /*size*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *Slice(const aclTensor *x, const aclIntArray * /*offsets*/, const aclIntArray * /*size*/,
|
||||
aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *ReFormat(const aclTensor *x, const op::Format & /*format*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *TransData(const aclTensor *x, op::Format /*dstPrimaryFormat*/, int64_t /*groups*/,
|
||||
aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *TransDataSpecial(const aclTensor *x, op::Format /*dstPrimaryFormat*/, int64_t /*groups*/,
|
||||
aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *Transpose(const aclTensor *x, const aclTensor * /*y*/, const aclTensor * /*perm*/,
|
||||
aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
const aclTensor *Transpose(const aclTensor *x, const aclIntArray * /*perm*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *Add(const aclTensor *self, const aclTensor * /*other*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
const aclTensor *Axpy(const aclTensor *self, const aclTensor * /*other*/, float /*alpha*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
const aclTensor *BroadcastTo(const aclTensor *x, const aclTensor * /*y*/, const aclTensor * /*shape*/,
|
||||
aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
const aclTensor *BroadcastTo(const aclTensor *x, const aclIntArray * /*shape*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
const aclTensor *Dot(const aclTensor *self, const aclTensor * /*tensor*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
const aclTensor *Fill(const aclTensor * /*dims*/, const aclTensor *value, const aclIntArray * /*outShape*/,
|
||||
aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
const aclTensor *Mul(const aclTensor *self, const aclTensor * /*other*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
const aclTensor *Muls(const aclTensor *self, float /*alpha*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
const aclTensor *ReduceMean(const aclTensor *self, const aclIntArray * /*dim*/, bool /*keepDim*/,
|
||||
aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
const aclTensor *ReduceMean(const aclTensor *self, const aclIntArray * /*dim*/, bool /*keepDim*/,
|
||||
bool /*noopWithEmptyAxes*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
const aclTensor *Dilation(const aclTensor *x, const aclIntArray * /*dilations*/, const aclIntArray * /*pads*/,
|
||||
float /*paddingValue*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
const aclTensor *Shape_op(const aclTensor *x, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *SqueezeNd(const aclTensor *x, const aclIntArray * /*dim*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
const aclTensor *SqueezeNd(const aclTensor *x, int64_t /*dim*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *PadV3(const aclTensor *self, const aclTensor * /*paddings*/, const aclTensor * /*constant_values*/,
|
||||
const std::string & /*mode*/, const bool /*paddingsContiguous*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
const aclTensor *UnsqueezeNd(const aclTensor *x, const aclIntArray * /*dim*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *UnsqueezeNd(const aclTensor *x, int64_t /*dim*/, aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *ReduceSumOp(const aclTensor *x, const aclIntArray * /*axes*/, bool /*keep_dims*/,
|
||||
aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
const aclTensor *MaskedScatter(const aclTensor * self, const aclTensor * /*mask*/, const aclTensor * /*source*/,
|
||||
aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
const aclTensor *InplaceIndexAddAiCore(const aclTensor * self, const int64_t /*dim*/, const aclTensor * /*index*/,
|
||||
const aclTensor * /*source*/, const aclTensor * /*alphaTensor*/,
|
||||
aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
const aclTensor *InplaceIndexAddAiCpu(const aclTensor * self, const int64_t /*dim*/, const aclTensor * /*index*/,
|
||||
const aclTensor * /*source*/, const aclTensor * /*alphaTensor*/,
|
||||
aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
const aclTensor *InplaceIndexAddWithSorted(const aclTensor * self, const int64_t /*dim*/,
|
||||
const aclTensor * /*sortedIndices*/, const aclTensor * /*pos*/,
|
||||
const aclTensor * /*value*/, const aclTensor * /*alphaTensor*/,
|
||||
aclOpExecutor * /*executor*/)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
const aclTensor *GatherV3(const aclTensor *self, int64_t axis, const aclTensor *indices, aclOpExecutor *executor,
|
||||
int batchDims = 0, bool negativeIndexSupport = false)
|
||||
{
|
||||
(void)self;
|
||||
(void)axis;
|
||||
(void)indices;
|
||||
(void)executor;
|
||||
(void)batchDims;
|
||||
(void)negativeIndexSupport;
|
||||
return self;
|
||||
}
|
||||
|
||||
} // namespace l0op
|
||||
Reference in New Issue
Block a user