Skip to content

Commit

Permalink
[Feature](mlu-ops): fix utils func-name.
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrelYy committed Jan 2, 2025
1 parent 5b17320 commit de2c2ee
Show file tree
Hide file tree
Showing 52 changed files with 173 additions and 159 deletions.
File renamed without changes.
File renamed without changes.
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
2 changes: 1 addition & 1 deletion kernels/roi_crop/roi_crop.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, int bin_num,
cnrtDim3_t *k_dim, cnrtFunctionType_t *k_type) {
Expand Down
Loading

0 comments on commit de2c2ee

Please sign in to comment.