Repository navigation
[Test] Refactor test_profiler.py tests to enhance device compatibility[2/N] - #198321
can-gaa-hou wants to merge 2 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/198321
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 6dcfe87 with merge base ecc974c ( NEW FAILURES SUPPRESSED BY AI (non-blocking) - The following job failed, but the AI CI Advisor judged the failure not to be evidence against this change:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| with _profile(use_kineto=use_kineto) as prof: | ||
| t1, t2 = torch.ones(1), torch.ones(1) | ||
| torch.add(t1, t2) |
There was a problem hiding this comment.
| with _profile(use_kineto=use_kineto) as prof: | |
| t1, t2 = torch.ones(1), torch.ones(1) | |
| torch.add(t1, t2) | |
| with _profile(use_device=device, use_kineto=use_kineto) as prof: | |
| t1, t2 = torch.ones(1, device=device), torch.ones(1, device=device) | |
| torch.add(t1, t2) |
| # Same test but for an accelerator. | ||
| if device_type == "cpu": | ||
| return | ||
|
|
||
| with _profile(use_device=device_type, use_kineto=use_kineto) as prof: | ||
| t1, t2 = torch.ones(1, device=device), torch.ones(1, device=device) | ||
| torch.add(t1, t2) | ||
|
|
||
| with TemporaryFileName(mode="w+") as fname: | ||
| prof.export_chrome_trace(fname) | ||
| # Now validate the json | ||
| with open(fname) as f: | ||
| json.load(f) | ||
|
|
|
Starting merge as part of PR stack under #198324 |
…y[3/N] (#198322) Pull Request resolved: #198322 Approved by: https://github.com/fffrog ghstack dependencies: #198321
…y[4/N] (#198323) Pull Request resolved: #198323 Approved by: https://github.com/fffrog ghstack dependencies: #198321, #198322
Part of #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 #198321-#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: #196466 Approved by: https://github.com/pbielak, https://github.com/etaf, https://github.com/jansel Co-authored-by: Claude Opus 5 <[email protected]>
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]>
Stack from ghstack (oldest at bottom):