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

Fix npu op bug. #3122

Open
wants to merge 53 commits into
base: main
Choose a base branch
from
Open

Fix npu op bug. #3122

wants to merge 53 commits into from

Conversation

momo609
Copy link
Collaborator

@momo609 momo609 commented May 30, 2024

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

Please describe the motivation of this PR and the goal you want to achieve through this PR.

Modification

Please briefly describe what modification is made in this PR.

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

Before PR:

  • I have read and followed the workflow indicated in the CONTRIBUTING.md to create this PR.
  • Pre-commit or linting tools indicated in CONTRIBUTING.md are used to fix the potential lint issues.
  • Bug fixes are covered by unit tests, the case that causes the bug should be added in the unit tests.
  • New functionalities are covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  • The documentation has been modified accordingly, including docstring or example tutorials.

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with some of those projects, like MMDet or MMCls.
  • CLA has been signed and all committers have signed the CLA in this PR.

@CLAassistant
Copy link

CLAassistant commented Jun 4, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
14 out of 18 committers have signed the CLA.

✅ momo609
✅ Pr0Wh1teGivee
✅ Annarine
✅ huhongsun
✅ DaGaiBa
✅ ZrBac
✅ huangyuan64
✅ hust17yixuan
✅ OlaWod
✅ ason-rob
✅ frh23333
✅ wujiadi1
✅ Hua-yuxiu
✅ Bosco-lab
❌ zhuweichen
❌ mikaelchan
❌ JYYCaN
❌ abdu-uy


zhuweichen seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@momo609 momo609 changed the title Rc4main Fix npu op bug. Jun 11, 2024
@momo609 momo609 force-pushed the rc4main branch 3 times, most recently from 2ec5da3 to 5189ddd Compare June 17, 2024 01:21
mmcv/ops/nms.py Outdated
@@ -415,6 +415,8 @@ def nms_rotated(dets: Tensor,
order = scores.new_empty(0, dtype=torch.long)
if dets.device.type == 'npu':
coefficient = 57.29578 # 180 / PI
dets_cw = dets_cw.float()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dets.float will return a copy of dets. So , is it necessary to copy dets to dets_cw before?

mmcv/ops/nms.py Outdated
@@ -415,6 +415,8 @@ def nms_rotated(dets: Tensor,
order = scores.new_empty(0, dtype=torch.long)
if dets.device.type == 'npu':
coefficient = 57.29578 # 180 / PI
dets_cw = dets_cw.float()
scores = scores.float()
Copy link
Collaborator

@HAOCHENYE HAOCHENYE Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If dets is a float16 tensor, it will be concated with a float32 tensor scores here. Is it expected?

https://github.com/open-mmlab/mmcv/pull/3122/files#diff-4f20412e03a468cc2c517581b2425ad32b39e01db36e56fb5083ca338f1f737bR425

if torch.cuda.current_device() != points_device:
torch.cuda.set_device(points_device)
elif points.device.type == 'npu':
boxes[:, :, 2] += boxes[:, :, 5] / 2.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave a comment to describe why we should do this.

@momo609 momo609 force-pushed the rc4main branch 3 times, most recently from c151a35 to c6478ef Compare June 18, 2024 08:47
hust17yixuan and others added 30 commits October 29, 2024 10:06
points_in_boxes_all的mmcv适配
修改knn与three_nn的适配层代码以适应新版本修改
codeclean npu/boxes_overlap_bev_npu.cpp
adapt npu box_iou_quadri
新增RoiAlignRotatedV2适配层
update point_to_voxel & voxel_to_point in scatter_points.py
add assign_score_withk NPU adaptation
update points_in_boxes_all
border_align算子NPU适配
add new npu op roiaware_pool3d && fix npu op scatter_points bug
pixel_group适配层修改
 update nms_rotated from openmmlab.mmcv main
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.