Migrate XPU UT files from Upstream PR#3593
Conversation
There was a problem hiding this comment.
Pull request overview
Read skill file(s): .github/skills/xpu-ops-pr-review/SKILL.md.
This PR migrates a batch of upstream TorchDynamo/Inductor-related XPU unit test files into test/xpu/ and updates the XPU skip list to exclude these new tests from execution (at least for now), aligning the repo’s test tree with upstream structure and future enablement.
Changes:
- Added migrated Dynamo/Inductor-related XPU test modules under
test/xpu/dynamo/plus a helper module undertest/xpu/. - Updated
test/xpu/skip_list_common.pyto skip the newly added test files. - Introduced an async compile/process-pool tracking helper with queue timing metrics.
Reviewed changes
Copilot reviewed 7 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
test/xpu/tracked_process_pool_xpu.py |
Adds a ProcessPoolExecutor wrapper that tracks queue depth/timing and reports metrics at exit. |
test/xpu/skip_list_common.py |
Adds the newly migrated test files to the global skip list (skipping whole files). |
test/xpu/dynamo/test_trace_rules_xpu.py |
Migrated trace-rules tests for Dynamo rule maps and inlining behavior. |
test/xpu/dynamo/test_structured_trace_xpu.py |
Migrated structured-logging/trace validation tests for Dynamo/Inductor flows. |
test/xpu/dynamo/test_regional_inductor_xpu.py |
Migrated extensive regional-inductor tests (annotations, invoke_subgraph, serialization, partitioning). |
test/xpu/dynamo/test_deviceguard_xpu.py |
Migrated DeviceGuard tests for mocked and real device interfaces. |
test/xpu/dynamo/test_debug_utils_xpu.py |
Migrated Dynamo debug utilities tests (env var generation, override routing, parsers). |
test/xpu/dynamo/test_compiler_bisector_xpu.py |
Migrated Inductor compiler-bisector integration tests. |
test/xpu/dynamo/test_activation_checkpointing_xpu.py |
Migrated activation-checkpointing via tags/selective AC tests. |
test/xpu/dynamo/test_aot_autograd_cache_xpu.py |
Migrated AOTAutograd cache tests and related integration coverage. |
test/xpu/dynamo/test_export_xpu.py |
Migrated Dynamo export tests (graph generation, constraints, error cases). |
test/xpu/dynamo/test_subclasses_xpu.py |
Migrated tensor subclass/nested tensor Dynamo tests. |
| try: | ||
| from .utils import create_dummy_module_and_function | ||
| except ImportError: | ||
| from utils import create_dummy_module_and_function | ||
|
|
||
|
|
| stats = _queue_stats | ||
| if stats.pool_count == 0: | ||
| return | ||
|
|
||
| timing = stats.timing | ||
| timing.sort() | ||
|
|
||
| log.info("AsyncCompile Metrics:") | ||
| log.info(" Pools %s", stats.pool_count) | ||
| log.info( | ||
| " Items %d enqueued / %d dequeued", stats.enqueue_count, stats.dequeue_count | ||
| ) | ||
| log.info(" Max Queue Depth: %d", stats.max_queue_depth) |
| @unittest.skipIf(not TEST_GPU, "No GPU available.") | ||
| class TestGPUDeviceGuard(torch._dynamo.test_case.TestCase): | ||
| """ | ||
| Unit tests for the DeviceGuard class using a GPU=Interface. |
| self.assertEqual(out.subsystem, "pre_grad_graph") | ||
| self.assertEqual(out.bisect_number, 1) | ||
|
|
||
| @skipIfXpu(msg="XPU doesn't support cudagrah") |
2d1e53b to
4c0658c
Compare
|
@copilot fix the lint issue on this PR. lint job log: https://github.com/intel/torch-xpu-ops/actions/runs/25848307428/job/75948554362?pr=3593 instructions:
|
| device_type = ( | ||
| acc.type if (acc := torch.accelerator.current_accelerator(True)) else "cpu" | ||
| ) |
| "profiler/test_execution_trace_xpu.py": None, | ||
| "profiler/test_profiler_xpu.py": None, | ||
| "export/test_hop_xpu.py": None, | ||
| "tracked_process_pool_xpu.py": None, |
|
@copilot fix the lint issue on this PR. lint job log: https://github.com/intel/torch-xpu-ops/actions/runs/25848307428/job/75948554362?pr=3593 instructions:
|
| device_type = ( | ||
| acc.type if (acc := torch.accelerator.current_accelerator(True)) else "cpu" | ||
| ) |
| "profiler/test_execution_trace_xpu.py": None, | ||
| "profiler/test_profiler_xpu.py": None, | ||
| "export/test_hop_xpu.py": None, | ||
| "tracked_process_pool_xpu.py": None, |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 9 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
test/xpu/tracked_process_pool_xpu.py:22
- The module-level
device_typedefined here is computed but never used anywhere in this file. Additionally,torch.accelerator.current_accelerator(True)passescheck=True, which will raise on environments without an accelerator and would cause this helper module to fail at import time. Sincedevice_typeis unused, this block should be removed.
device_type = (
acc.type if (acc := torch.accelerator.current_accelerator(True)) else "cpu"
)
| "profiler/test_execution_trace_xpu.py": None, | ||
| "profiler/test_profiler_xpu.py": None, | ||
| "export/test_hop_xpu.py": None, | ||
| "tracked_process_pool_xpu.py": None, |
| import torch._thread_safe_fork | ||
|
|
||
|
|
||
| device_type = ( | ||
| acc.type if (acc := torch.accelerator.current_accelerator(True)) else "cpu" | ||
| ) |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 9 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
test/xpu/tracked_process_pool_xpu.py:21
- The
device_typevariable defined here is never used anywhere in this file. The upstreamtracked_process_pool.pydoes not include this block. Since this is a verbatim copy of the upstream helper anddevice_typeserves no purpose here, this block (and the resulting dependency ontorch.accelerator) appears to be unnecessary dead code that should be removed.
device_type = (
acc.type if (acc := torch.accelerator.current_accelerator(True)) else "cpu"
)
| import torch._thread_safe_fork | ||
| from typing_extensions import ParamSpec | ||
|
|
||
| device_type = ( | ||
| acc.type if (acc := torch.accelerator.current_accelerator(True)) else "cpu" | ||
| ) |
| 'test/xpu/dynamo/test_*.py', | ||
| 'test/xpu/dynamo/test_subclasses_xpu.py', | ||
| 'test/xpu/dynamo/test_structured_trace_xpu.py', |
|
|
||
| self.assertParses() | ||
|
|
||
| @skipIf(HAS_XPU_AND_TRITON, "No backend type associated with device type xpu") |
| "profiler/test_execution_trace_xpu.py": None, | ||
| "profiler/test_profiler_xpu.py": None, | ||
| "export/test_hop_xpu.py": None, | ||
| "tracked_process_pool_xpu.py": None, |
| device_type = ( | ||
| acc.type if (acc := torch.accelerator.current_accelerator(True)) else "cpu" | ||
| ) |
| from torch.testing._internal.inductor_utils import HAS_XPU_AND_TRITON | ||
| from torch.testing._internal.triton_utils import requires_gpu_and_triton | ||
|
|
||
| device_type = acc.type if (acc := torch.accelerator.current_accelerator()) else "cpu" |
|
|
||
| self.assertParses() | ||
|
|
||
| @skipIf(HAS_XPU_AND_TRITON, "No backend type associated with device type xpu") |
| 'test/xpu/dynamo/test_*.py', | ||
| 'test/xpu/dynamo/test_subclasses_xpu.py', | ||
| 'test/xpu/dynamo/test_structured_trace_xpu.py', |
Summary
Migrate 11 files
Upstream PR
pytorch/pytorch#169241
XPU Issues
#3356
#3393