Repository navigation
[Test] Enable test/profiler/test_profiler.py on XPU - #196466
tszulist-hbn wants to merge 3 commits into
Conversation
PR Status: Approved 🚀Please fix all CI failures and trigger merge by commenting "@pytorchbot merge". ✅ AUTOMATED REVIEW - Ready for human review:
Findings (1): Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/196466
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit f4054ab with merge base bb154bb ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
b3418a3 to
3b7f26a
Compare
|
|
3b7f26a to
3f30780
Compare
|
This looks like a partial duplicate of #193961 |
3f30780 to
f35d57f
Compare
f35d57f to
5eafd46
Compare
TestChromeTraceInlineAnnotations drives stub activities and needs no CUDA, so classify it GENERIC. Rename TestMetadataJsonFormat to TestMetadataJsonFormatCUDA so its name matches its CUDA gate. Test Plan: ``` $ python test/profiler/test_profiler.py --hw-classification generic -v Ran 90 tests in 6.922s OK (skipped=1) ``` Authored with the assistance of an AI coding agent (Claude Code). Co-Authored-By: Claude Opus 5.5 <[email protected]>
setUpModule() primed Kineto only for CUDA, so on other accelerators a CPU-only first session left device collection dead process-wide. Add initialize_kineto_with_accelerator() next to initialize_kineto_with_cuda() and call it instead; the CUDA helper, used by test_cuspy.py and test_linalg.py, is unchanged. Priming XPU makes test_forked_process deadlock (intel/torch-xpu-ops#5287), so it is skipped on XPU builds in the same commit. Test Plan, on Intel Data Center GPU Max 1550: ``` $ python test/profiler/test_profiler.py Ran 116 tests in 19.248s OK (skipped=16) ``` Authored with the assistance of an AI coding agent (Claude Code). Co-Authored-By: Claude Opus 5.5 <[email protected]>
TestProfilerDevice was already device-generic but never instantiated for XPU, leaving its XPU-specific code dead. Set allow_xpu=True (not only_for, which would drop the PrivateUse1 and HPU instances the bare call already generated), drop a stale skip citing torch-xpu-ops#2263 (closed, and fixed in this very file by e0bab07), and widen test_kineto's onlyOn along with the matching branch in its body: XPU emits gemm_kernel and urEnqueueUSMMemcpy, so it belongs on the found_gemm/found_memcpy path rather than the found_mm one. Enablement exposed one real gap. XPU kernel activities carry "sycl queue" and "l0 queue" but no stream, grid or block, so test_kineto_kernel_metadata_in_trace fails; filed as intel/torch-xpu-ops#5284 and skipped on XPU with that URL as the reason. The torch-xpu-ops fork of this file, test/xpu/profiler/test_profiler_xpu.py, still cannot be deleted - it mirrors five other classes besides TestProfilerDevice. Test Plan: TestProfilerDeviceXPU goes 0 -> 18 IDs and every other class keeps its count (TestProfiler 57, TestProfilerDeviceCPU 18, TestProfilerDeviceStoppedCUDA 18, TestChromeTraceInlineAnnotations 12, TestProfilerEventsParityCUDA 10, TestProfilerCUDA 8, TestExperimentalUtils 7, TestPythonChromeTraceExportCUDA 5, TestMetadataJsonFormatCUDA 4, TestPrivateUse1ProfilerState 3, TestProfilerITT 1), so 143 -> 161. On Intel Data Center GPU Max 1550, oneAPI 2026.1.1: ``` $ python test/profiler/test_profiler.py Ran 161 tests in 42.913s OK (skipped=60) ``` ``` $ python -m pytest test/profiler/test_profiler.py -k xpu -rs 16 passed, 2 skipped, 143 deselected in 16.33s ``` The two XPU skips are test_kineto_kernel_metadata_in_trace (pytorch#5284 above) and test_activity_filter_dict_syntax (onlyOn cuda; XPU dies with PTI_ERROR_DRIVER in XpuptiScopeProfilerApi::enableScopeProfiler). Authored with the assistance of an AI coding agent (Claude Code). Co-Authored-By: Claude Opus 5 <[email protected]>
5eafd46 to
f4054ab
Compare
There was a problem hiding this comment.
Automated review of f4054ab: nothing blocking; ready for human review.
Enables TestProfilerDevice on XPU and generalizes Kineto priming in setUpModule to the current accelerator; CUDA/ROCm behavior is unchanged. The one issue found is a skip used where an expected-failure marker fits, which does not block human review.
⚪ 1 non-blocking finding
pytorch/test/profiler/test_profiler.py
Line 3124 in f4054ab
XPU kernel events deterministically lack stream/grid/block (assertIn fails, no crash/hang), so use @ expectedFailureXPU instead of skipXPUIf(True, ...) so the test flips to unexpected-success once torch-xpu-ops#5284 is fixed.
This review is AI-generated and advisory. Each new automated review replaces the previous one.
|
@pytorchbot merge |
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 |
Part of pytorch#142029. Enables the device-generic tests in `test/profiler/test_profiler.py` on XPU. Most of the hardware classification this PR used to carry landed upstream in pytorch#198321-pytorch#198324. What is left, reviewable in order: 1. Classify the inline-annotation tests as generic (they need no CUDA) and name the CUDA-gated metadata test class for its gate. 2. Prime Kineto with the current accelerator instead of CUDA only. Without it, a CPU-only first session leaves XPU collection dead process-wide (`kernel`, `ac2g`, `xpu_runtime` all 0). The CUDA priming helper used by `test_cuspy.py` and `test_linalg.py` is unchanged. 3. Run the device-generic tests on XPU, drop a stale skip for the now-closed torch-xpu-ops#2263, and widen `test_kineto` to XPU. ### Coverage delta Intel Data Center GPU Max 1550, oneAPI 2026.1.1. | XPU test IDs | before | after | | ------------ | ------ | ----- | | total | 0 | 20 | | passed | 0 | 18 | | skipped | 0 | 1 | | failed | 0 | 1 | ### Follow-ups filed against intel/torch-xpu-ops - intel/torch-xpu-ops#5284 - XPU kernel activities carry `sycl queue` / `l0 queue` but no `stream`, `grid` or `block`. Skips `test_kineto_kernel_metadata_in_trace` on XPU, and blocks the CUDA metadata-format tests from being enabled as written. - intel/torch-xpu-ops#5287 - `os.fork()` deadlocks after Kineto XPU init. Skips `test_forked_process` on XPU builds. Pull Request resolved: pytorch#196466 Approved by: https://github.com/pbielak, https://github.com/etaf, https://github.com/jansel Co-authored-by: Claude Opus 5 <[email protected]>
pytorch#196466 enabled TestProfilerDevice on XPU, which added test_profiler_tracing_use_kineto_False_xpu. It always fails: _profile(use_device="xpu", use_kineto=False) raises on purpose, because only CUDA and PrivateUse1 can profile without Kineto. Skip that case on XPU; use_kineto=True still runs.
pytorch#196466 enabled TestProfilerDevice on XPU, which added test_profiler_tracing_use_kineto_False_xpu. It always fails: _profile(use_device="xpu", use_kineto=False) raises on purpose, because only CUDA and PrivateUse1 can profile without Kineto. Skip that case on XPU; use_kineto=True still runs.
Part of #142029.
Enables the device-generic tests in
test/profiler/test_profiler.pyon XPU. Most of the hardware classification this PR used to carry landed upstream in #198321-#198324. What is left, reviewable in order:kernel,ac2g,xpu_runtimeall 0). The CUDA priming helper used bytest_cuspy.pyandtest_linalg.pyis unchanged.test_kinetoto XPU.Coverage delta
Intel Data Center GPU Max 1550, oneAPI 2026.1.1.
Follow-ups filed against intel/torch-xpu-ops
sycl queue/l0 queuebut nostream,gridorblock. Skipstest_kineto_kernel_metadata_in_traceon XPU, and blocks the CUDA metadata-format tests from being enabled as written.os.fork()deadlocks after Kineto XPU init. Skipstest_forked_processon XPU builds.