* 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.
*/
#include "defalut_reg_func.h"
namespace af {
namespace ascir {
std::vector<std::unique_ptr<TmpBufDesc>> CalcTrueDivTmpSize(const AscNode &node)
{
AscNodeInputs node_inputs = node.inputs;
const auto input_size = GetInputSize(node_inputs);
auto data_type = node_inputs[0].attr.dtype;
const auto data_type_size = GetSizeByDataType(data_type);
if (HasScalarOrUbScalar(node_inputs)) {
return CalcDefaultTmpSize(node);
}
if (data_type == ge::DT_INT32) {
const Expression total_size = Symbol(data_type_size) * input_size * Symbol(2);
GELOGD("Node %s[%s] TrueDivExtend int32 tmp buffer size: %s (input_size: %s, type_size: %d)",
node.GetTypePtr(), node.GetNamePtr(), total_size.Str().get(),
input_size.Str().get(), data_type_size);
return GetTmpBuffer(total_size);
} else {
return CalcDefaultTmpSize(node);
}
}
}
}