Skip to content

Migrate XPU UT files from Upstream PR#3593

Open
shangerxin wants to merge 18 commits into
intel:mainfrom
shangerxin:erxin/migrate_dynamo_cases
Open

Migrate XPU UT files from Upstream PR#3593
shangerxin wants to merge 18 commits into
intel:mainfrom
shangerxin:erxin/migrate_dynamo_cases

Conversation

@shangerxin
Copy link
Copy Markdown
Contributor

Summary

Migrate 11 files

Upstream PR

pytorch/pytorch#169241

XPU Issues

#3356
#3393

Copilot AI review requested due to automatic review settings May 10, 2026 11:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 under test/xpu/.
  • Updated test/xpu/skip_list_common.py to 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.

Comment on lines +34 to +39
try:
from .utils import create_dummy_module_and_function
except ImportError:
from utils import create_dummy_module_and_function


Comment on lines +96 to +108
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)
Comment thread test/xpu/dynamo/test_deviceguard_xpu.py Outdated
@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")
@shangerxin shangerxin added disable_e2e Disable all e2e test jobs for the PR disable_distributed Disable distributed UT test jobs for the PR labels May 12, 2026
@shangerxin shangerxin force-pushed the erxin/migrate_dynamo_cases branch from 2d1e53b to 4c0658c Compare May 14, 2026 07:42
@shangerxin shangerxin changed the title Migrate11 XPU UT files from Upstream PR Migrate XPU UT files from Upstream PR May 14, 2026
@shangerxin
Copy link
Copy Markdown
Contributor Author

@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:

  1. review the lint failures log via the link above
  2. fix all lint errors in the relevant source files
  3. ensure both python lint and clang format checks pass

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 8 changed files in this pull request and generated 2 comments.

Comment on lines +20 to +22
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,
@shangerxin
Copy link
Copy Markdown
Contributor Author

@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:

  1. review the lint failures log via the link above
  2. fix all lint errors in the relevant source files
  3. ensure both python lint and clang format checks pass

Copilot AI review requested due to automatic review settings May 19, 2026 06:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 8 changed files in this pull request and generated 2 comments.

Comment on lines +20 to +22
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 AI review requested due to automatic review settings May 19, 2026 07:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_type defined here is computed but never used anywhere in this file. Additionally, torch.accelerator.current_accelerator(True) passes check=True, which will raise on environments without an accelerator and would cause this helper module to fail at import time. Since device_type is 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,
Comment on lines +17 to +22
import torch._thread_safe_fork


device_type = (
acc.type if (acc := torch.accelerator.current_accelerator(True)) else "cpu"
)
Copilot AI review requested due to automatic review settings May 19, 2026 07:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_type variable defined here is never used anywhere in this file. The upstream tracked_process_pool.py does not include this block. Since this is a verbatim copy of the upstream helper and device_type serves no purpose here, this block (and the resulting dependency on torch.accelerator) appears to be unnecessary dead code that should be removed.
device_type = (
    acc.type if (acc := torch.accelerator.current_accelerator(True)) else "cpu"
)

Comment on lines +16 to +21
import torch._thread_safe_fork
from typing_extensions import ParamSpec

device_type = (
acc.type if (acc := torch.accelerator.current_accelerator(True)) else "cpu"
)
Comment thread .lintrunner.toml
Comment on lines +18 to +20
'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")
Copilot AI review requested due to automatic review settings May 19, 2026 07:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 9 changed files in this pull request and generated 5 comments.

"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,
Comment on lines +19 to +21
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")
Comment thread .lintrunner.toml
Comment on lines +18 to +20
'test/xpu/dynamo/test_*.py',
'test/xpu/dynamo/test_subclasses_xpu.py',
'test/xpu/dynamo/test_structured_trace_xpu.py',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disable_distributed Disable distributed UT test jobs for the PR disable_e2e Disable all e2e test jobs for the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants