Skip to content

Conversation

@wangjiangben-hw
Copy link
Collaborator

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

Added ascending device support in mmcv.

Modification

  • The main modification points are as follows:
    1. In mmcv/device/, We've added our NPU devices. Since the NPU does not support the DataParallel mode, DP and DDP have been customized, the Scatter related methods have been rewritten, and the use case of MLU has been referenced, thanks.
    2. In mmcv/runner/dist_utils.py, We have added NPU-related distributed initialization methods.
    3. In mmcv/runner/hooks/optimizer.py, We've added the amp method on npu.
    4. In mmcv/utils/, We've added NPU devices.

BC-breaking (Optional)

None

Use cases (Optional)

  • test case
    • tests/test_device/test_device_utils.py
    • tests/test_device/test_functions.py
    • tests/test_device/test_npu/test_npu_parallel.py

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.

wangjiangben-hw and others added 2 commits September 14, 2022 12:02
[Feature] Support engine with NPU backend.
@CLAassistant
Copy link

CLAassistant commented Sep 15, 2022

CLA assistant check
All committers have signed the CLA.

@zhouzaida zhouzaida requested a review from grimoire September 29, 2022 07:44
* fix autocast bugs on npu
* using scatter_kwargs in mmcv.device.scatter_gather
'FORCE_CUDA', '0') == '1':
if is_rocm_pytorch:
define_macros += [('HIP_DIFF', None)]
define_macros += [('MMCV_WITH_HIP', None)]
Copy link
Member

Choose a reason for hiding this comment

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

Why do we remove HIP_DIFF?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@grimoire
Copy link
Member

Please update tests/test_ops/test_focal_loss.py.

* add npu test case
@wangjiangben-hw
Copy link
Collaborator Author

Please update tests/test_ops/test_focal_loss.py.

done..

Copy link
Member

@grimoire grimoire left a comment

Choose a reason for hiding this comment

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

LGTM

Co-authored-by: Zaida Zhou <[email protected]>
@zhouzaida zhouzaida merged commit a5db5f6 into master Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NPU Ascend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants