Fix XPU CI UT test_circular_dependencies#158189
Fix XPU CI UT test_circular_dependencies#158189guangyey wants to merge 1 commit intogh/guangyey/167/basefrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/158189
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 508cfff with merge base 5221448 ( UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@Skylion007 Thanks very much~ |
|
cc @malfet >>> import torch
>>> import torch._inductor
>>> import torch._inductor.jagged_lowerings
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/data/guangyey/pytorch/torch/_inductor/jagged_lowerings.py", line 9, in <module>
from .lowering import fallback_handler, is_integer_type, register_lowering
File "/data/guangyey/pytorch/torch/_inductor/lowering.py", line 7167, in <module>
jagged_lowerings.register_jagged_ops()
AttributeError: partially initialized module 'torch._inductor.jagged_lowerings' has no attribute 'register_jagged_ops' (most likely due to a circular import)
>>> |
This is a might be bug caused by subdirectories without init.py? I know that has slightly different behaviorn when using setup.py develop vs pip install? |
|
@Skylion007 I am not sure, but it still fails with pytorch-cuda-nightly that I installed via pip (ygy_2.7) pt-gpu@mlp-milan-02:/data/guangyey/pytorch/test$ python
Python 3.10.18 | packaged by conda-forge | (main, Jun 4 2025, 14:45:41) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__file__
'/data/wengshiy/conda/envs/ygy_2.7/lib/python3.10/site-packages/torch/__init__.py'
>>> torch.__version__
'2.9.0.dev20250712+cu128'
>>> exit()
(ygy_2.7) pt-gpu@mlp-milan-02:/data/guangyey/pytorch/test$ python test_testing.py TestImports.test_circular_dependencies
/data/wengshiy/conda/envs/ygy_2.7/lib/python3.10/importlib/__init__.py:126: DeprecationWarning: `torch._functorch.pytree_hacks` is deprecated and will be removed in a future release. Please `use torch.utils._pytree` instead.
return _bootstrap._gcd_import(name[level:], package, level)
/data/wengshiy/conda/envs/ygy_2.7/lib/python3.10/importlib/__init__.py:126: DeprecationWarning: `torch.distributed._shard.checkpoint` will be deprecated, use `torch.distributed.checkpoint` instead
return _bootstrap._gcd_import(name[level:], package, level)
/data/wengshiy/conda/envs/ygy_2.7/lib/python3.10/importlib/__init__.py:126: DeprecationWarning: `torch.distributed._sharded_tensor` will be deprecated, use `torch.distributed._shard.sharded_tensor` instead
return _bootstrap._gcd_import(name[level:], package, level)
/data/wengshiy/conda/envs/ygy_2.7/lib/python3.10/importlib/__init__.py:126: DeprecationWarning: `torch.distributed._sharding_spec` will be deprecated, use `torch.distributed._shard.sharding_spec` instead
return _bootstrap._gcd_import(name[level:], package, level)
E
======================================================================
ERROR: test_circular_dependencies (__main__.TestImports)
Checks that all modules inside torch can be imported
----------------------------------------------------------------------
Traceback (most recent call last):
File "/data/wengshiy/conda/envs/ygy_2.7/lib/python3.10/site-packages/torch/distributed/_tools/sac_ilp.py", line 11, in <module>
from pulp import ( # type: ignore[import-untyped,import-not-found]
ModuleNotFoundError: No module named 'pulp'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/data/guangyey/pytorch/test/test_testing.py", line 2402, in test_circular_dependencies
mod = importlib.import_module(mod_name)
File "/data/wengshiy/conda/envs/ygy_2.7/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/data/wengshiy/conda/envs/ygy_2.7/lib/python3.10/site-packages/torch/distributed/_tools/sac_ilp.py", line 24, in <module>
raise ImportError(
ImportError: Please install pulp package. See: https://github.com/coin-or/pulp.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/data/wengshiy/conda/envs/ygy_2.7/lib/python3.10/site-packages/torch/testing/_internal/common_utils.py", line 3223, in wrapper
method(*args, **kwargs)
File "/data/wengshiy/conda/envs/ygy_2.7/lib/python3.10/site-packages/torch/testing/_internal/common_utils.py", line 1916, in wrapper
return fn(*args, **kwargs)
File "/data/guangyey/pytorch/test/test_testing.py", line 2404, in test_circular_dependencies
raise RuntimeError(f"Failed to import {mod_name}: {e}") from e
RuntimeError: Failed to import torch.distributed._tools.sac_ilp: Please install pulp package. See: https://github.com/coin-or/pulp.
To execute this test, run the following from the base repo dir:
python test/test_testing.py TestImports.test_circular_dependencies
This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
----------------------------------------------------------------------
Ran 1 test in 0.992s
FAILED (errors=1) |
|
Anyway, CI pass, land this PR first. |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
cc @malfet |
|
What makes it XPU specific? And test plan doesn't sound reasonable |
@malfet It seems that |
Stack from ghstack (oldest at bottom):
Motivation
fix #110040
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov @gujinghui @fengyuan14