You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refine device operations into a unified DeviceManager / ARDevice abstraction so that (1) adding a new device is cheap and
(2) every device PyTorch supports works automatically with no per-device code.
a) Discovery is now data-driven. Backends are found via torch.accelerator, the PrivateUse1 registration, and a generic is_available() probe, and fall back to a preferred-order hint on older PyTorch. AR_DEVICE_BACKENDS= is an escape hatch for brand-new backends with zero code change.
b) Capability flags replace device-type branches. ARDevice now declares visible_devices_env_var, supports_pipeline_parallel, supports_multi_card_tuning, supports_empty_cache, supports_device_map_dispatch, and auto_select_by_default.
c) New APIs: register_ar_device() and get_active_device(), and a CudaARDevice/XpuARDevice handle for the built-in backends.
Route remaining torch.cuda.* call sites (hadamard, spinquant, calibration, convert_model) through the device manager.
Root cause: The refactor changed set_cuda_visible_devices into an alias that does not explicitly select CUDA. For numeric inputs such as "0" or "5", set_visible_devices infers the current backend; in this CI environment that resolves to HPU or CPU, so CUDA_VISIBLE_DEVICES is never set.
Suggested fix: Pass device_type="cuda" from the backward-compatible set_cuda_visible_devices wrapper so it preserves its original CUDA-specific behavior.
unit/common/utils/test_device.py:434: in test_multiple_devices
assert os.environ.get("CUDA_VISIBLE_DEVICES") == "0,2"
E AssertionError: assert '0,1,2,3' == '0,2'
E
E - 0,2
E + 0,1,2,3
✨ AI analysis
Category: Code Regression
Confidence: high
Root cause: The PR replaced the CUDA-specific implementation with a generic set_visible_devices helper, but the backward-compatible set_cuda_visible_devices alias no longer forces device_type="cuda". On the CPU CI runner, numeric input resolves to the current CPU backend, whose visibility variable is unset, so the function becomes a no-op and does not remap or validate CUDA_VISIBLE_DEVICES.
Suggested fix: Pass device_type="cuda" from set_cuda_visible_devices so the compatibility wrapper retains its original CUDA-specific behavior.
unit/common/utils/test_device.py:470: in test_invalid_device_index_raises
with pytest.raises(ValueError):
^^^^^^^^^^^^^^^^^^^^^^^^^
E Failed: DID NOT RAISE ValueError
✨ AI analysis
Category: Code Regression
Confidence: high
Root cause: The PR changed set_cuda_visible_devices to delegate without specifying CUDA. On CPU CI, get_current_device_type() returns cpu, whose backend has no visibility environment variable, so the function returns without inspecting CUDA_VISIBLE_DEVICES and does not raise for index 5.
Suggested fix: Preserve the backward-compatible CUDA-specific behavior by explicitly passing device_type="cuda" from set_cuda_visible_devices.
Patch:
diff --git a/auto_round/utils/device.py b/auto_round/utils/device.py--- a/auto_round/utils/device.py+++ b/auto_round/utils/device.py@@ -368,7 +368,7 @@
def set_cuda_visible_devices(device: str):
"""Backward-compatible alias of :func:`set_visible_devices`."""
- set_visible_devices(device)+ set_visible_devices(device, device_type="cuda")
Notes
Only top-3 issues receive AI analysis.
To request an additional fix from Copilot, use "Quote reply" on the PR comment and @mention Copilot.
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
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
Refine device operations into a unified DeviceManager / ARDevice abstraction so that (1) adding a new device is cheap and
(2) every device PyTorch supports works automatically with no per-device code.
a) Discovery is now data-driven. Backends are found via
torch.accelerator, thePrivateUse1registration, and a genericis_available()probe, and fall back to a preferred-order hint on older PyTorch. AR_DEVICE_BACKENDS= is an escape hatch for brand-new backends with zero code change.b) Capability flags replace device-type branches. ARDevice now declares
visible_devices_env_var,supports_pipeline_parallel,supports_multi_card_tuning,supports_empty_cache,supports_device_map_dispatch, andauto_select_by_default.c) New APIs:
register_ar_device()andget_active_device(), and a CudaARDevice/XpuARDevice handle for the built-in backends.Route remaining torch.cuda.* call sites (hadamard, spinquant, calibration, convert_model) through the device manager.
Type of Change
Enhancement
Related Issues
#1788
Checklist Before Submitting
/azp run Unit-Test-CUDA-AutoRound.