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):add new op masked_col2im_forward #649

Merged
merged 2 commits into from
May 29, 2023

Conversation

defei-coder
Copy link
Collaborator

@defei-coder defei-coder commented May 5, 2023

Thanks for your contribution and we appreciate it a lot.

1. Motivation

Add new op masked_col2im_forward

2. Modification

Modify files

  • bangc-ops/kernel_depends.toml
  • bangc-ops/mlu_op.h

Add new files

  • bangc-ops/kernels/masked_col2im_forward/masked_col2im_forward.cpp
  • bangc-ops/kernels/masked_col2im_forward/masked_col2im_forward.h
  • bangc-ops/kernels/masked_col2im_forward/masked_col2im_forward_union1.mlu
  • bangc-ops/test/mlu_op_gtest/pb_gtest/src/zoo/masked_col2im_forward/masked_col2im_forward.cpp
  • bangc-ops/test/mlu_op_gtest/pb_gtest/src/zoo/masked_col2im_forward/masked_col2im_forward.h
  • bangc-ops/test/mlu_op_gtest/pb_gtest/src/zoo/masked_col2im_forward/test_case/case_0.prototxt
  • bangc-ops/test/mlu_op_gtest/pb_gtest/src/zoo/masked_col2im_forward/test_case/case_1.prototxt
  • docs/bangc-docs/design_docs/masked_col2im_forward/masked_col2im_forward.md
  • docs/bangc-docs/design_docs/masked_col2im_forward/maskedcol2im.png

3. Test Report

If you want to know how to do operator testing, you can see GTest-User-Guide-zh.

3.1 Modification Details

3.1.1 Accuracy Acceptance Standard

For static threshold standard details, see: MLU-OPS Accuracy Acceptance Standard.

  • diff3: diff3 == 0

3.1.2 Operator Scheme checklist

No. Details Check Results
1 Supported hardware MLU370
MLU590
2 Job types U1
3 Layouts NCHW
4 Whether multi-dimensions are supported No
5 Whether element zero is supported mask_h_idx,mask_w_idx和col的第二维支持0元素,返回MLUOP_STATUS_SUCCESS;col的第一维和im不支持0元素,MLUOP_STATUS_BAD_PARAM
6 Data type(half/float) half / float
7 Whether there is size limit No

3.1.3 New Feature Test

If you have checked the following items, please tick the relevant box.

  • Data type test
  • Multi-dimensional tensor test
  • Layout test
  • Different size/integer remainder end segment/alignment misalignment test
  • Zero dimensional tensor test/zero element test
  • stability test
  • Multiple platform test
  • Gen_case module test
  • Nan/INF tests
  • Bug fix tests
  • For memory leak check details, seeGTest-User-Guide-zh.
  • For code coverage check details, see: GTest-User-Guide-zh.
  • For I/O calculation efficiency check details, see: MLU-OPS Performance Acceptance Standard.

3.1.4 Parameter Check

When a new operator is submitted, the test points are given and the test results are stated.

Test Point Acceptance Standard Test Result (Error Message)
im(输出)的layout必须是NCHW Normal error [Error]:[mluOpMaskedCol2imForward] Check failed: im_desc->layout == MLUOP_LAYOUT_NCHW.
col(第一个输入)的维度必须是2 Normal error [MLUOP] [Error]:[mluOpMaskedCol2imForward] Check failed: col_desc->dim == 2.
mask_h_idx和mask_w_idx 的维度必须是1 Normal error [MLUOP] [Error]:[mluOpMaskedCol2imForward] Check failed: mask_w_idx_desc->dim == 1.
im和col的第一维必须相等 Normal error [MLUOP] [Error]:[mluOpMaskedCol2imForward] Check failed: col_desc->dims[0] == im_desc->dims[1].
im和col的第一维必须相等 Normal error [MLUOP] [Error]:[mluOpMaskedCol2imForward] Check failed: col_desc->dims[0] == im_desc->dims[1].
col的数据类型必须是half或float Normal error [MLUOP] [Error]:[mluOpMaskedCol2imForward] Check failed: col_desc->dtype == MLUOP_DTYPE_FLOAT
col和im的数据类型必须相同 Normal error [MLUOP] [Error]:[mluOpMaskedCol2imForward] Check failed: col_desc->dtype == im_desc->dtype.
col的第二维和mask_h_idx、mask_w_idx的第一维必须相同 Normal error [MLUOP] [Error]:[mluOpMaskedCol2imForward] Check failed: col_desc->dims[1] == mask_h_idx_desc->dims[0].
mask_h_idx和mask_w_idx的数据类型必须是int32_t Normal error [MLUOP] [Error]:[mluOpMaskedCol2imForward] Check failed: mask_w_idx_desc->dtype == MLUOP_DTYPE_INT32.
im的第一维(dims[0])必须是1 Normal error [MLUOP] [Error]:[mluOpMaskedCol2imForward] Check failed: im_desc->dims[0] == 1.
不支持large tensor Normal error [MLUOP] [Error]:[[mluOpMaskedCol2imForward]]: overflow max supported tensor num. 2147483647, now tensor's total num is 2147483650.

3.2 Accuracy Test

For the cases used in the New Feature Test section, the features and the number of cases are recorded here. When multiple operations are tested, multiple tables are needed to include details of these operations.

Operation:

Test Point Description Quantity Comment
Data type test half/float [ SUMMARY ] Total 209 cases of 1 op(s). ALL PASSED.
Mult-tensor test Supports 4 dims [ SUMMARY ] Total 209 cases of 1 op(s). ALL PASSED.
Layout test Supports NCHW [ SUMMARY ] Total 209 cases of 1 op(s). ALL PASSED.
Zero element test Whether to support this test col的第一维和im不支持0元素: [MLUOP] [Error]:[mluOpMaskedCol2imForward] Zero element tensor failure.
Stability test --gtest_repeat=NUM
--thread=NUM
Mult-platform test MLU370/MLU590 [ SUMMARY ] Total 211 cases of 1 op(s). ALL PASSED.
Nan/INF test Whether to support this test yes
Memory leak check [ SUMMARY ] Total 211 cases of 1 op(s). ALL PASSED.
Code coverage check masked_col2im_forward_union1.mlu [94.4%] 94.4 %67 / 71 100.0 %5 / 5 代码量少,未执行代码为switch语句的default代码块

3.3 Performance Test

See MLU-OPS Performance Acceptance Standard for details.

Platform:MLU370

Operation Mlu_hardware_time(us) Mlu_interface_time(us) Mlu_io_efficiency Mlu_compute_efficiency Mlu_workwpace_size(Bytes) Data_type Shape
masked_col2im_forward 985 304 0.000676819 -1 614400 (Bytes) float col:[256,200], im:[1,256,20,20]

Platform:MLU590

Operation Mlu_hardware_time(us) Mlu_interface_time(us) Mlu_io_efficiency Mlu_compute_efficiency Mlu_workwpace_size(Bytes) Data_type Shape
masked_col2im_forward 80 144.65 0.000925926 -1 614400 (Bytes) float col:[256,200], im:[1,256,20,20]

3.4 Summary Analysis

Please give a brief overview here, if you want to note and summarize the content.

@defei-coder defei-coder force-pushed the masked_conv2d branch 2 times, most recently from ecb659f to 576112c Compare May 8, 2023 07:14
bangc-ops/mlu_op.h Outdated Show resolved Hide resolved
bangc-ops/mlu_op.h Outdated Show resolved Hide resolved
@defei-coder defei-coder force-pushed the masked_conv2d branch 4 times, most recently from 44f20f9 to 6ca03e8 Compare May 9, 2023 02:58
bangc-ops/mlu_op.h Outdated Show resolved Hide resolved
bangc-ops/mlu_op.h Outdated Show resolved Hide resolved
bangc-ops/mlu_op.h Outdated Show resolved Hide resolved
@defei-coder defei-coder force-pushed the masked_conv2d branch 2 times, most recently from 2e45e7c to 02134e9 Compare May 23, 2023 09:33
@duzekunKTH duzekunKTH merged commit d397876 into Cambricon:master May 29, 2023
@duzekunKTH duzekunKTH modified the milestones: 0.7.0, v0.8.0 May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants