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](bangc-ops): use fill_v3 instead of fill_zeros #858

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions bangc-ops/kernel_depends.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ div = ["binary_op"]
expand = ["copy"]
fill = ["tensor_stride_process"]
log = ["unary_op"]
psroipool = ["fill_zero"]
psroipool = ["fill"]
roi_align_rotated = ["fill"]
roi_crop = ["fill_zero"]
roi_crop = ["fill"]
rotated_feature_align = ["fill"]
sqrt = ["binary_op", "unary_op"]
tensor_stride_process = ["copy"]
moe_dispatch_backward_data = ["fill"]
roiaware_pool3d = ["fill","transpose"]
voxelization = ["fill"]
get_indice_pairs = ["fill", "scatter_nd", " gather_nd", "reduce", "unique"]
yolo_box = ["fill_zero"]
yolo_box = ["fill"]
deform_roi_pool = ["fill"]
moe_dispatch_backward_gate = ["fill"]
indice_convolution_backward_filter = ["fill", "transpose", "gather_nd", "matmul"]
Expand Down
33 changes: 0 additions & 33 deletions bangc-ops/kernels/fill_zero/fill_zero.h

This file was deleted.

48 changes: 0 additions & 48 deletions bangc-ops/kernels/fill_zero/fill_zero.mlu

This file was deleted.

9 changes: 4 additions & 5 deletions bangc-ops/kernels/psroipool/psroipool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@

#include <string>

#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/fill_zero/fill_zero.h"
#include "kernels/kernel.h"

// policy function
Expand Down Expand Up @@ -328,10 +328,9 @@ mluOpStatus_t MLUOP_WIN_API mluOpPsRoiPoolBackward(
<< ", " << k_dim.z << "].";

// gdram set zero
int gdramset_size = channels * width * height * batch_size * sizeof(float);
KERNEL_CHECK((KernelFillZero(k_dim, k_type, handle->queue, gdramset_size,
bottom_grad)));
VLOG(5) << "Kernel KernelFillZero.";
float fill_value = 0;
MLUOP_CHECK(mluOpFill_v3(handle, MLUOP_POINTER_MODE_HOST, &fill_value,
bottom_grad_desc, bottom_grad));

KERNEL_CHECK((KernelPsRoiPoolBackward(
k_dim, k_type, handle->queue, top_grad, mapping_channel, rois,
Expand Down
8 changes: 3 additions & 5 deletions bangc-ops/kernels/roi_crop/roi_crop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "core/runtime/device.h"
#include "core/tensor.h"
#include "core/type.h"
#include "kernels/fill_zero/fill_zero.h"

static void policyFunc(const mluOpHandle_t handle, int bin_num,
cnrtDim3_t *k_dim, cnrtFunctionType_t *k_type) {
Expand Down Expand Up @@ -251,10 +250,9 @@ mluOpStatus_t MLUOP_WIN_API mluOpRoiCropBackward(
VLOG(5) << "[mluOpRoiCropBackward] launch kernel policyFunc[" << k_dim.x
<< ", " << k_dim.y << ", " << k_dim.z << "].";
// gdram set zero
int gd_num = channels * width * height * batch * sizeof(float);
CHECK_RETURN("[FillZero]", (KernelFillZero(k_dim, k_type, handle->queue,
gd_num, grad_input)));
VLOG(5) << "Kernel KernelFillZero.";
float fill_value = 0;
MLUOP_CHECK(mluOpFill_v3(handle, MLUOP_POINTER_MODE_HOST, &fill_value,
grad_input_desc, grad_input));

CHECK_RETURN("[mluOpRoiCropBackward]",
KernelRoiCropBackward(k_dim, k_type, handle->queue, grad_output,
Expand Down
1 change: 0 additions & 1 deletion bangc-ops/kernels/voxelization/voxelization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "core/runtime/device.h"
#include "core/tensor.h"
#include "core/type.h"
#include "kernels/fill_zero/fill_zero.h"

static void policyFuncDefault(const mluOpHandle_t handle,
const size_t num_points, cnrtDim3_t *k_dim,
Expand Down
17 changes: 7 additions & 10 deletions bangc-ops/kernels/yolo_box/yolo_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "core/runtime/device.h"
#include "core/tensor.h"
#include "core/type.h"
#include "kernels/fill_zero/fill_zero.h"

#define MAX_CLASS_NUM_ARCH_200 1534
#define MAX_CLASS_NUM_ARCH_300 2558
Expand Down Expand Up @@ -188,15 +187,13 @@ mluOpStatus_t MLUOP_WIN_API mluOpYoloBox(
VLOG(5) << "[mluOpYoloBox] launch kernel policyFunc[" << k_dim.x << ", "
<< k_dim.y << ", " << k_dim.z << "].";

const int boxes_size = n_in * anchor_s * 4 * h_in * w_in * sizeof(float);
CHECK_RETURN("[FillZero]", (KernelFillZero(k_dim, k_type, handle->queue,
boxes_size, boxes)));

const int scores_size =
n_in * anchor_s * class_num * h_in * w_in * sizeof(float);
CHECK_RETURN("[FillZero]", (KernelFillZero(k_dim, k_type, handle->queue,
scores_size, scores)));

float fill_value = 0;
MLUOP_CHECK(mluOpFill_v3(handle, MLUOP_POINTER_MODE_HOST, &fill_value,
boxes_desc, boxes));

MLUOP_CHECK(mluOpFill_v3(handle, MLUOP_POINTER_MODE_HOST, &fill_value,
scores_desc, scores));

CHECK_RETURN("[mluOpYoloBox]",
KernelYoloBox(k_dim, k_type, handle->queue, x, img_size, anchors,
class_num, conf_thresh, downsample_ratio,
Expand Down
1 change: 0 additions & 1 deletion docs/bangc-docs/BANGC-OPS-OpList.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ MLU Binary Op算子结构: 
| dynamic_point_to_voxel_forward | √ | |
| expand | | √ |
| fill | | √ |
| fill_zero | √ | |
| focal_loss_sigmoid_backward | √ | |
| focal_loss_sigmoid_forward | √ | |
| gather_nd | | √ |
Expand Down