[step 1]refine code to support all devices in torch and hot fix for gemma4-unified#1879
Open
wenhuach21 wants to merge 42 commits into
Open
[step 1]refine code to support all devices in torch and hot fix for gemma4-unified#1879wenhuach21 wants to merge 42 commits into
wenhuach21 wants to merge 42 commits into
Conversation
for more information, see https://pre-commit.ci
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors device handling by introducing a unified DeviceManager abstraction and updating existing utilities to use it, with the intent of reducing scattered backend-specific (cuda/xpu/hpu) branching across the codebase.
Changes:
- Added
auto_round/utils/device_manager.pyto centralize backend discovery and runtime ops (sync/cache/memory queries). - Updated
auto_round/utils/device.pyto route device counting, selection, memory clearing, and memory queries through the new device manager APIs. - Updated
auto_round/auto_scheme/delta_loss.pyto synchronize via the active device manager and broaden “non-CPU device” checks.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| auto_round/utils/device.py | Replaces backend-specific device/memory logic with DeviceManager calls. |
| auto_round/utils/device_manager.py | New unified device backend abstraction (discovery + runtime + memory APIs). |
| auto_round/auto_scheme/delta_loss.py | Uses DeviceManager for synchronization and generalized non-CPU device checks. |
Contributor
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…into refine_device_1 # Conflicts: # auto_round/utils/device_manager.py
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Contributor
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
for more information, see https://pre-commit.ci
…into refine_device_1
for more information, see https://pre-commit.ci
…into refine_device_1
for more information, see https://pre-commit.ci
…into refine_device_1
for more information, see https://pre-commit.ci
…into refine_device_1 # Conflicts: # auto_round/utils/device_manager.py
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…into refine_device_1 Signed-off-by: Wenhua Cheng <wenhua.cheng@intel.com>
for more information, see https://pre-commit.ci
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
for more information, see https://pre-commit.ci
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
Author
|
some functions have not been refined, I prefer to merge this pr first and refine them later to avoid conflicts. please have a review when you are free |
Contributor
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…into refine_device_1
for more information, see https://pre-commit.ci
Contributor
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| "get_device_and_parallelism", | ||
| "get_packing_device", | ||
| "is_auto_device_mapping", | ||
| "get_major_device", |
Contributor
There was a problem hiding this comment.
two "get_major_device"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Please briefly describe your main changes, the motivation.
Type of Change
Bug fix
Related Issues
Fixes or relates to #
Checklist Before Submitting
/azp run Unit-Test-CUDA-AutoRound.