* Copyright (c) 2026 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 stride_add_apt.cpp
* \brief StrideAdd operator entry point
*/
#include "arch35/stride_add_simt.h"
template <uint32_t schMode>
__global__ __aicore__ void stride_add(GM_ADDR x1, GM_ADDR x2, GM_ADDR y, GM_ADDR workspace, GM_ADDR tiling)
{
REGISTER_TILING_DEFAULT(StrideAddTilingData);
GET_TILING_DATA_WITH_STRUCT(StrideAddTilingData, tilingData, tiling);
using T = DTYPE_X1;
bool use32Bit = (tilingData.totalElements <= static_cast<int64_t>(UINT32_MAX))
&& (tilingData.x1NStride <= static_cast<int64_t>(UINT32_MAX))
&& (tilingData.x2NStride <= static_cast<int64_t>(UINT32_MAX))
&& (tilingData.hwC0Size <= static_cast<int64_t>(UINT32_MAX))
&& (tilingData.c1Len <= static_cast<int64_t>(UINT32_MAX))
&& (tilingData.perCoreElements <= static_cast<int64_t>(UINT32_MAX));
if (use32Bit) {
if constexpr (schMode == STRIDE_ADD_TPL_SCH_MODE_0) {
NsStrideAdd::Process<T, uint32_t>(x1, x2, y, workspace, tiling, &tilingData);
}
} else {
if constexpr (schMode == STRIDE_ADD_TPL_SCH_MODE_0) {
NsStrideAdd::Process<T, uint64_t>(x1, x2, y, workspace, tiling, &tilingData);
}
}
}