Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature](mlu-ops): fix utils func-name. #1191

Merged
merged 3 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/MLU-OPS-Accuracy-Acceptance-Standard.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $$
**$diff2$:标准相对误差**

$$
diff2 = \sqrt{\frac{ \sum (evaluated \\_ data - baseline \\_ data)^2}{\sum baseline \\_ data^2 }}
diff2 = \sqrt{\left(\frac{\sum (evaluated \\_ data - baseline \\_ data)^2}{\sum baseline \\_ data^2}\right)}
$$

**$diff3_1$:最大单点相对误差**
Expand Down
6 changes: 3 additions & 3 deletions docs/MLU-OPS-How-To-Use-CNNL-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
在算子中调用CNNL tranpose 算子。
```c++
// 需要包含该文件
#include "utils/cnnl_helper.h"
#include "core/cnnl_helper.h"

// https://github.com/Cambricon/mlu-ops/blob/master/kernels/three_nn_forward/three_nn_forward.cpp
static mluOpStatus_t transposeTensor(
Expand Down Expand Up @@ -67,7 +67,7 @@ static mluOpStatus_t transposeTensor(
在算子中调用CNNL addN 算子的GetWorkspaceSize, 与示例1不同的点在于,当输入的tensor是数组时的处理方法。
```c++
// 需要包含该文件
#include "utils/cnnl_helper.h"
#include "core/cnnl_helper.h"

mluOpStatus_t GetAddNWorkspaceSize(
mluOpHandle_t handle, const mluOpTensorDescriptor_t input_descs[],
Expand Down Expand Up @@ -109,7 +109,7 @@ mluOpStatus_t GetAddNWorkspaceSize(
```c++
// https://github.com/Cambricon/mlu-ops/blob/master/kernels/indice_convolution_backward_data/indice_convolution_backward_data.cpp
// 需要包含该文件
#include "utils/cnnl_helper.h"
#include "core/cnnl_helper.h"

mluOpStatus_t MLUOP_WIN_API mluOpGetIndiceConvolutionBackwardDataWorkspaceSize(
mluOpHandle_t handle, const mluOpTensorDescriptor_t output_grad_desc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <string>

#include "core/cnnl_helper.h"
#include "core/context.h"
#include "core/gen_case.h"
#include "core/logging.h"
Expand All @@ -32,7 +33,6 @@
#include "core/type.h"
#include "core/tool.h"
#include "kernels/kernel.h"
#include "kernels/utils/cnnl_helper.h"

static void policyFunc(mluOpHandle_t handle, cnrtDim3_t *k_dim,
cnrtFunctionType_t *k_type) {
Expand Down
2 changes: 1 addition & 1 deletion kernels/carafe/carafe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <algorithm>
#include <vector>

#include "core/cnnl_helper.h"
#include "core/context.h"
#include "core/gen_case.h"
#include "core/logging.h"
Expand All @@ -34,7 +35,6 @@
#include "kernels/kernel.h"
#include "kernels/tensor_stride_process/tensor_stride_process_host.h"
#include "kernels/tensor_stride_process/tensor_stride_process_mlu.h"
#include "kernels/utils/cnnl_helper.h"

// 1.creat set destroy
mluOpStatus_t MLUOP_WIN_API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <math.h>
#include <vector>

#include "kernels/utils/cnnl_helper.h"
#include "core/cnnl_helper.h"

#define DCNBPDATA_API "mluOpDCNBackwardData"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <math.h>
#include <vector>

#include "kernels/utils/cnnl_helper.h"
#include "core/cnnl_helper.h"

#define DCNBACKWARDWEIGHT_API "mluOpDCNBackwardWeight"

Expand Down
2 changes: 1 addition & 1 deletion kernels/deform_conv/dcn_common/dcn_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <math.h>
#include <vector>

#include "kernels/utils/cnnl_helper.h"
#include "core/cnnl_helper.h"

#define DCN_API "mluOpDCN"

Expand Down
2 changes: 1 addition & 1 deletion kernels/deform_conv/dcn_forward/dcn_forward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*************************************************************************/
#include "kernels/utils/cnnl_helper.h"
#include "core/cnnl_helper.h"

#define DCNFORWARD_API "mluOpDCNForward"

Expand Down
2 changes: 1 addition & 1 deletion kernels/deform_roi_pool/deform_roi_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "core/tensor.h"
#include "core/type.h"
#include "kernels/kernel.h"
#include "kernels/utils/cnnl_helper.h"
#include "core/cnnl_helper.h"

// policy function
void policyFunc(const mluOpHandle_t handle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
#include <algorithm> // std::min
#include <string>

#include "core/cnnl_helper.h"
#include "core/gen_case.h"
#include "core/logging.h"
#include "core/runtime/device.h"
#include "core/tensor.h"
#include "core/type.h" // mluop::getSizeOfDataType
#include "kernels/kernel.h"
#include "kernels/utils/cnnl_helper.h"

static mluOpStatus_t DynamicPointToVoxelBackwardParamCheck(
const char *interface_name, const mluOpHandle_t handle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@

#include <string>

#include "core/cnnl_helper.h"
#include "core/gen_case.h"
#include "core/logging.h"
#include "core/runtime/device.h"
#include "core/tensor.h"
#include "core/type.h"
#include "kernels/kernel.h"
#include "kernels/utils/cnnl_helper.h"

// policy function
static void policyFuncDynamicPointToVoxelForward(const mluOpHandle_t handle,
Expand Down
5 changes: 3 additions & 2 deletions kernels/fft/common/fft_basic_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@

#include <algorithm>
#include <string>
#include "core/tensor.h"

#include "core/cnnl_helper.h"
#include "core/context.h"
#include "core/tensor.h"
#include "core/tool.h"
#include "kernels/kernel.h"
#include "kernels/utils/cnnl_helper.h"
#include "mlu_op.h"

bool fftIsIntDtype(const mluOpDataType_t dtype);
Expand Down
10 changes: 5 additions & 5 deletions kernels/fft/common/fft_common_kernels.mlu
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ __mlu_func__ void generateRFFTHalfDFTMatrixImpl(int n, void *output) {
float *row_addr = temp_addr;

// generate 0 to n indices
__mlu_op_gen_stage_index(inc_addr, deal_size, 0.0f, 1.0f);
__mluop_gen_stage_index(inc_addr, deal_size, 0.0f, 1.0f);

// generate sin and cos vectors
const float scale = -2.0 * M_PI / n;
Expand Down Expand Up @@ -234,7 +234,7 @@ __mlu_func__ void generateRFFTFullDFTMatrixImpl(int row, int n, void *output) {
float *row_addr = temp_addr;

// generate 0 to n indices
__mlu_op_gen_stage_index(inc_addr, deal_size, 0.0f, 1.0f);
__mluop_gen_stage_index(inc_addr, deal_size, 0.0f, 1.0f);

// generate sin and cos vectors
const float scale = -2.0 * M_PI / n;
Expand Down Expand Up @@ -323,7 +323,7 @@ __mlu_func__ void generateIRFFTHalfDFTMatrixImpl(int n, void *output) {
float *row_addr = temp_addr;

// generate 0 to n indices
__mlu_op_gen_stage_index(inc_addr, deal_size, 0.0f, 1.0f);
__mluop_gen_stage_index(inc_addr, deal_size, 0.0f, 1.0f);

// generate sin and cos coefficient vectors
__bang_write_value((float *)cos_coeff_addr, deal_size, (float)2.0);
Expand Down Expand Up @@ -418,7 +418,7 @@ __mlu_func__ void generateIRFFTFullDFTMatrixImpl(int n, void *output) {
float *row_addr = temp_addr;

// generate 0 to n indices
__mlu_op_gen_stage_index(inc_addr, deal_size, 0.0f, 1.0f);
__mluop_gen_stage_index(inc_addr, deal_size, 0.0f, 1.0f);

// generate sin and cos vectors
const float scale = 2.0 * M_PI / n;
Expand Down Expand Up @@ -514,7 +514,7 @@ __mlu_func__ void generateC2CFFTDFTMatrixImpl(int n, void *output) {
float *row_addr = temp_addr;

// generate 0 to n indices
__mlu_op_gen_stage_index(inc_addr, deal_size, 0.0f, 1.0f);
__mluop_gen_stage_index(inc_addr, deal_size, 0.0f, 1.0f);

// generate sin and cos vectors
const float forward_scale = -2.0 * M_PI / n;
Expand Down
2 changes: 1 addition & 1 deletion kernels/generate_proposals_v2/generate_proposals_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
#include <algorithm>
#include <string>

#include "core/cnnl_helper.h"
#include "core/context.h"
#include "core/gen_case.h"
#include "core/logging.h"
#include "core/runtime/device.h"
#include "core/tensor.h"
#include "core/type.h"
#include "kernels/kernel.h"
#include "kernels/utils/cnnl_helper.h"

#define GDRAM_ALIGN_SIZE 128
static void policyFunc(mluOpHandle_t handle, cnrtDim3_t *k_dim,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
*************************************************************************/
#include "masked_col2im_forward.h"

#include "core/cnnl_helper.h"
#include "core/context.h"
#include "core/gen_case.h"
#include "core/logging.h"
#include "core/runtime/device.h"
#include "core/tensor.h"
#include "core/type.h"
#include "kernels/kernel.h"
#include "kernels/utils/cnnl_helper.h"

static void policyFunc(const mluOpHandle_t handle, const int mask_cnt,
cnrtDim3_t *k_dim, cnrtFunctionType_t *k_type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
*************************************************************************/
#include "kernels/masked_im2col/masked_im2col_forward/masked_im2col_forward.h"

#include "core/cnnl_helper.h"
#include "core/gen_case.h"
#include "core/logging.h"
#include "core/runtime/device.h"
#include "kernels/kernel.h"
#include "kernels/utils/cnnl_helper.h"

// policy function
static void policyFunc(const mluOpHandle_t handle, const int mask_cnt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@

#include <string>

#include "core/cnnl_helper.h"
#include "core/context.h"
#include "core/gen_case.h"
#include "core/logging.h"
#include "core/runtime/device.h"
#include "core/tensor.h"
#include "core/type.h"
#include "kernels/utils/cnnl_helper.h"

// policy function
static void PolicyFunc(const mluOpHandle_t handle, cnrtDim3_t *k_dim,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@

#include <string>

#include "core/cnnl_helper.h"
#include "core/context.h"
#include "core/gen_case.h"
#include "core/logging.h"
#include "core/runtime/device.h"
#include "core/tensor.h"
#include "core/type.h"
#include "kernels/kernel.h"
#include "kernels/utils/cnnl_helper.h"

static void policyFunc(const mluOpHandle_t handle, const int samples,
cnrtDim3_t *k_dim, cnrtFunctionType_t *k_type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <string>

#include "core/cnnl_helper.h"
#include "core/context.h"
#include "core/gen_case.h"
#include "core/logging.h"
Expand All @@ -33,7 +34,6 @@
#include "core/type.h"
#include "kernels/debug.h"
#include "kernels/kernel.h"
#include "kernels/utils/cnnl_helper.h"

char API[] = "[mluOpMsDeformAttnBackward]";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*************************************************************************/
#include "kernels/ms_deform_attn/ms_deform_attn_forward/ms_deform_attn_forward.h"

#include "core/cnnl_helper.h"
#include "core/context.h"
#include "core/logging.h"
#include "core/gen_case.h"
Expand All @@ -31,7 +32,6 @@
#include "core/type.h"
#include "kernels/debug.h"
#include "kernels/kernel.h"
#include "kernels/utils/cnnl_helper.h"

typedef enum {
/*!< Index is invalid. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
#include <algorithm>
#include <string>

#include "core/cnnl_helper.h"
#include "core/context.h"
#include "core/gen_case.h"
#include "core/logging.h"
#include "core/runtime/device.h"
#include "core/tensor.h"
#include "core/type.h"
#include "kernels/utils/cnnl_helper.h"

#define API_NAME "[mluOpMutualInformationBackward]"

Expand Down
2 changes: 1 addition & 1 deletion kernels/nms/nms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*************************************************************************/
#include "kernels/utils/cnnl_helper.h"
#include "core/cnnl_helper.h"

mluOpStatus_t MLUOP_WIN_API
mluOpCreateNmsDescriptor(mluOpNmsDescriptor_t *desc) {
Expand Down
2 changes: 1 addition & 1 deletion kernels/psroipool/psroipool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@

#include <string>

#include "core/cnnl_helper.h"
#include "core/context.h"
#include "core/gen_case.h"
#include "core/logging.h"
#include "core/runtime/device.h"
#include "core/tensor.h"
#include "core/type.h"
#include "kernels/kernel.h"
#include "kernels/utils/cnnl_helper.h"

// policy function
static void policyFuncPsRoiPool(const mluOpHandle_t handle, cnrtDim3_t *k_dim,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*************************************************************************/
#include "kernels/utils/cnnl_helper.h"
#include "core/cnnl_helper.h"

mluOpStatus_t MLUOP_WIN_API mluOpRoiAlignBackward(
mluOpHandle_t handle, const float spatial_scale, const int sampling_ratio,
Expand Down
2 changes: 1 addition & 1 deletion kernels/roi_align/roialign_forward/roialign_forward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*************************************************************************/
#include "kernels/utils/cnnl_helper.h"
#include "core/cnnl_helper.h"

mluOpStatus_t MLUOP_WIN_API
mluOpCreateRoiAlignForwardDescriptor(mluOpRoiAlignForwardDescriptor_t *desc) {
Expand Down
2 changes: 1 addition & 1 deletion kernels/roi_align_rotated/roi_align_rotated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@

#include <string>

#include "core/cnnl_helper.h"
#include "core/context.h"
#include "core/gen_case.h"
#include "core/logging.h"
#include "core/runtime/device.h"
#include "core/tensor.h"
#include "core/type.h"
#include "kernels/utils/cnnl_helper.h"

static void policyFunc(const mluOpHandle_t handle, const int bin_num,
cnrtDim3_t *k_dim, cnrtFunctionType_t *k_type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ __mlu_global__ void roiAlignRotatedForward(
bin_order_num = 16;
}

__mlu_op_gen_stage_index(order, bin_order_num, (T)0.5);
__mluop_gen_stage_index(order, bin_order_num, (T)0.5);
const uint32_t bin_hw_order_num = bin_order_num * bin_order_num;

const uint32_t cache_channels_num = 1024;
Expand Down
Loading