Skip to content
This repository was archived by the owner on Sep 30, 2026. It is now read-only.

[CI] Deselect XPU-failing TestProfilerDevice CPU tests - #1451

Closed
aostrowski-hbn wants to merge 1 commit into
pytorch:mainfrom
aostrowski-hbn:xpu-ci-deselect-profiler-device-tests
Closed

aostrowski-hbn wants to merge 1 commit into
pytorch:mainfrom
aostrowski-hbn:xpu-ci-deselect-profiler-device-tests

Conversation

@aostrowski-hbn

Copy link
Copy Markdown
Contributor

Problem

linux_xpu_pytorch.yml has been red on main. The job builds PyTorch (USE_XPU=1) and runs test/profiler/. Two CPU-variant tests from the device-parametrized TestProfilerDevice (added in pytorch/pytorch#182434) fail and were never deselected for XPU, unlike CUDA/ROCm (#1429).

What fails and why (verified on PVC with an XPU device present)

  • test_forked_process_cpu — RuntimeError: Cannot re-initialize XPU in forked subprocess. Independent of runtime XPU availability (it also fails with an XPU device present); already deselected on CUDA and ROCm.
  • test_basic_chrome_trace_cpu — _validate_basic_json indexes traceEvents[-4] expecting the "PyTorch Profiler (0)" event, but a USE_XPU=1 build appends a second "__xpu_profiler__ (0)" instance to the trace, shifting that fixed offset. Caused by XPU being built, not by runtime availability. An upstream fix to locate the events by name instead of by offset is tracked separately; deselecting until it lands.

Relationship to #1450

Orthogonal. #1450 fixes runtime XPU visibility (umf/tcm env sourcing); this PR fixes the two build-dependent test failures. Both are needed for the workflow to go green.

Note: test_kineto_profiler_with_environment_variable_cpu is intentionally not deselected here — it passes once XPU is available at runtime (covered by #1450).

The XPU PyTorch CI runs test/profiler/ from a USE_XPU=1 build. Two CPU-variant
tests from the device-parametrized TestProfilerDevice (added in
pytorch/pytorch#182434) fail on this job and need deselecting, mirroring what
config_cuda.sh and config_rocm.sh already do for issue pytorch#1429:

- test_forked_process_cpu: re-initializing XPU in a forked subprocess raises
  "Cannot re-initialize XPU in forked subprocess". This is independent of
  runtime XPU availability (it also fails with an XPU device present) and is
  already deselected for CUDA and ROCm.

- test_basic_chrome_trace_cpu: _validate_basic_json indexes traceEvents[-4]
  expecting the "PyTorch Profiler (0)" event, but a USE_XPU=1 build appends a
  second "__xpu_profiler__ (0)" instance to the trace, shifting that fixed
  offset. It is caused by XPU being built rather than by runtime availability.
  An upstream fix to locate the events by name instead of by offset is tracked
  separately.

This is orthogonal to the runtime XPU environment fix in pytorch#1450 (umf/tcm env
sourcing); both are needed for the workflow to go green.
@meta-codesync

meta-codesync Bot commented Jun 26, 2026

Copy link
Copy Markdown

@ryanzhang22 has imported this pull request. If you are a Meta employee, you can view this in D109839396.

@aostrowski-hbn

Copy link
Copy Markdown
Contributor Author

@ryanzhang22 please also add the ciflow/xpu label. I lack permissions to add it myself.

@meta-codesync

meta-codesync Bot commented Jun 26, 2026

Copy link
Copy Markdown

@ryanzhang22 merged this pull request in eb66185.

@meta-codesync meta-codesync Bot added the Merged label Jun 26, 2026
@aostrowski-hbn
aostrowski-hbn deleted the xpu-ci-deselect-profiler-device-tests branch June 29, 2026 08:00
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Jun 30, 2026
Includes the following commits:

- Serialize CUDA/ROCm JSON directly from typed metadata (pytorch/kineto#1455) ab3d5e5
- Address missing OSS license headers (pytorch/kineto#1456) 6662873
- Remove support for old versions of PTI. Rework of PTI error handling. (pytorch/kineto#1405) d5d5c01
- Add MetadataDict for nested metadata fields (pytorch/kineto#1454) 510fde2
- Update XPU test env config (pytorch/kineto#1450) 5d8f827
- Deselect XPU-failing TestProfilerDevice CPU tests (pytorch/kineto#1451) eb66185
- Escape LOG messages in output_json.cpp (pytorch/kineto#1453) 9f6b3f7
- Daily `arc lint --take CLANGFORMAT` (pytorch/kineto#1452) c4eea6b
- Add a visitor class for JSON serialization (pytorch/kineto#1449) b12cc99
- Enable OVERHEAD activity (pytorch/kineto#1441) 3980198
- Make TypedMetadata a visitor interface instead (pytorch/kineto#1448) 594e334
- Avoid CI OOMs by limiting parallel compile jobs (pytorch/kineto#1447) d5f7009
- Adds TypedMetadata.h to get_libkineto_public_headers (pytorch/kineto#1439) 774d10c
- FIx build error by removing unused param (pytorch/kineto#1445) 8341a9e
- Prefix internal controller sync/async methods (pytorch/kineto#1438) b1a1f1e
- Expose ActivityLoggerFactory via public API (pytorch/kineto#1414) 8279dc0
- Guard GenericActivityProfiler teardown against null traceBuffers_ (pytorch/kineto#1443) b7a7b0e
- Finalize pending trace on async profiler teardown (pytorch/kineto#1442) b0ddf1b

Authored-with: Claude (AI assistant)
Pull Request resolved: #188550
Approved by: https://github.com/scotts
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Jul 7, 2026
…8264)

`_validate_basic_json` (used by `test_basic_chrome_trace`) located the `"PyTorch Profiler (0)"`, `"Iteration Start: PyTorch Profiler"` and `"Record Window End"` markers at fixed negative indices `-4`/`-2`/`-1` of the trace event list.

On a device build that emits a **second** profiler instance this no longer holds. A `USE_XPU=1` build appends an `__xpu_profiler__ (N)` event plus its own `Iteration Start: __xpu_profiler__` marker to the trace, so `traceEvents[-4]` is now the secondary profiler event and the assertion `traceEvents[-4]["name"] == "PyTorch Profiler (0)"` fails. The secondary instance is emitted regardless of the requested activities, and it is not bounded by the PyTorch profiler window, so it also trips the in-window bounds check (`"Trace event ends too late!"`).

This change locates the three PyTorch profiler markers by name instead of by offset, and skips the secondary device profiler's events when validating the window. CPU and CUDA traces are unaffected (no secondary instance is emitted there), and the GPU-label / `sort_index` checks are preserved.

Surfaced by the Kineto XPU CI, which runs `test/profiler/` from a `USE_XPU=1` build (pytorch/kineto#1451 deselects this test until this fix reaches `viable/strict`).

## Test plan

Verified on an Intel Data Center GPU Max (PVC) `USE_XPU=1` build: `test_basic_chrome_trace_cpu` passes with this change and fails without it (`AssertionError: False is not true` on the `traceEvents[-4]` name check).

Pull Request resolved: #188264
Approved by: https://github.com/ryanzhang22

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
vishalgoyal316 pushed a commit to vishalgoyal316/pytorch that referenced this pull request Jul 16, 2026
Includes the following commits:

- Serialize CUDA/ROCm JSON directly from typed metadata (pytorch/kineto#1455) ab3d5e5
- Address missing OSS license headers (pytorch/kineto#1456) 6662873
- Remove support for old versions of PTI. Rework of PTI error handling. (pytorch/kineto#1405) d5d5c01
- Add MetadataDict for nested metadata fields (pytorch/kineto#1454) 510fde2
- Update XPU test env config (pytorch/kineto#1450) 5d8f827
- Deselect XPU-failing TestProfilerDevice CPU tests (pytorch/kineto#1451) eb66185
- Escape LOG messages in output_json.cpp (pytorch/kineto#1453) 9f6b3f7
- Daily `arc lint --take CLANGFORMAT` (pytorch/kineto#1452) c4eea6b
- Add a visitor class for JSON serialization (pytorch/kineto#1449) b12cc99
- Enable OVERHEAD activity (pytorch/kineto#1441) 3980198
- Make TypedMetadata a visitor interface instead (pytorch/kineto#1448) 594e334
- Avoid CI OOMs by limiting parallel compile jobs (pytorch/kineto#1447) d5f7009
- Adds TypedMetadata.h to get_libkineto_public_headers (pytorch/kineto#1439) 774d10c
- FIx build error by removing unused param (pytorch/kineto#1445) 8341a9e
- Prefix internal controller sync/async methods (pytorch/kineto#1438) b1a1f1e
- Expose ActivityLoggerFactory via public API (pytorch/kineto#1414) 8279dc0
- Guard GenericActivityProfiler teardown against null traceBuffers_ (pytorch/kineto#1443) b7a7b0e
- Finalize pending trace on async profiler teardown (pytorch/kineto#1442) b0ddf1b

Authored-with: Claude (AI assistant)
Pull Request resolved: pytorch#188550
Approved by: https://github.com/scotts
vishalgoyal316 pushed a commit to vishalgoyal316/pytorch that referenced this pull request Jul 16, 2026
…orch#188264)

`_validate_basic_json` (used by `test_basic_chrome_trace`) located the `"PyTorch Profiler (0)"`, `"Iteration Start: PyTorch Profiler"` and `"Record Window End"` markers at fixed negative indices `-4`/`-2`/`-1` of the trace event list.

On a device build that emits a **second** profiler instance this no longer holds. A `USE_XPU=1` build appends an `__xpu_profiler__ (N)` event plus its own `Iteration Start: __xpu_profiler__` marker to the trace, so `traceEvents[-4]` is now the secondary profiler event and the assertion `traceEvents[-4]["name"] == "PyTorch Profiler (0)"` fails. The secondary instance is emitted regardless of the requested activities, and it is not bounded by the PyTorch profiler window, so it also trips the in-window bounds check (`"Trace event ends too late!"`).

This change locates the three PyTorch profiler markers by name instead of by offset, and skips the secondary device profiler's events when validating the window. CPU and CUDA traces are unaffected (no secondary instance is emitted there), and the GPU-label / `sort_index` checks are preserved.

Surfaced by the Kineto XPU CI, which runs `test/profiler/` from a `USE_XPU=1` build (pytorch/kineto#1451 deselects this test until this fix reaches `viable/strict`).

## Test plan

Verified on an Intel Data Center GPU Max (PVC) `USE_XPU=1` build: `test_basic_chrome_trace_cpu` passes with this change and fails without it (`AssertionError: False is not true` on the `traceEvents[-4]` name check).

Pull Request resolved: pytorch#188264
Approved by: https://github.com/ryanzhang22

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
DamJanusz pushed a commit to DamJanusz/pytorch that referenced this pull request Jul 21, 2026
…orch#188264)

`_validate_basic_json` (used by `test_basic_chrome_trace`) located the `"PyTorch Profiler (0)"`, `"Iteration Start: PyTorch Profiler"` and `"Record Window End"` markers at fixed negative indices `-4`/`-2`/`-1` of the trace event list.

On a device build that emits a **second** profiler instance this no longer holds. A `USE_XPU=1` build appends an `__xpu_profiler__ (N)` event plus its own `Iteration Start: __xpu_profiler__` marker to the trace, so `traceEvents[-4]` is now the secondary profiler event and the assertion `traceEvents[-4]["name"] == "PyTorch Profiler (0)"` fails. The secondary instance is emitted regardless of the requested activities, and it is not bounded by the PyTorch profiler window, so it also trips the in-window bounds check (`"Trace event ends too late!"`).

This change locates the three PyTorch profiler markers by name instead of by offset, and skips the secondary device profiler's events when validating the window. CPU and CUDA traces are unaffected (no secondary instance is emitted there), and the GPU-label / `sort_index` checks are preserved.

Surfaced by the Kineto XPU CI, which runs `test/profiler/` from a `USE_XPU=1` build (pytorch/kineto#1451 deselects this test until this fix reaches `viable/strict`).

## Test plan

Verified on an Intel Data Center GPU Max (PVC) `USE_XPU=1` build: `test_basic_chrome_trace_cpu` passes with this change and fails without it (`AssertionError: False is not true` on the `traceEvents[-4]` name check).

Pull Request resolved: pytorch#188264
Approved by: https://github.com/ryanzhang22

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
youlituao pushed a commit to youlituao/pytorch that referenced this pull request Jul 28, 2026
…orch#188264)

`_validate_basic_json` (used by `test_basic_chrome_trace`) located the `"PyTorch Profiler (0)"`, `"Iteration Start: PyTorch Profiler"` and `"Record Window End"` markers at fixed negative indices `-4`/`-2`/`-1` of the trace event list.

On a device build that emits a **second** profiler instance this no longer holds. A `USE_XPU=1` build appends an `__xpu_profiler__ (N)` event plus its own `Iteration Start: __xpu_profiler__` marker to the trace, so `traceEvents[-4]` is now the secondary profiler event and the assertion `traceEvents[-4]["name"] == "PyTorch Profiler (0)"` fails. The secondary instance is emitted regardless of the requested activities, and it is not bounded by the PyTorch profiler window, so it also trips the in-window bounds check (`"Trace event ends too late!"`).

This change locates the three PyTorch profiler markers by name instead of by offset, and skips the secondary device profiler's events when validating the window. CPU and CUDA traces are unaffected (no secondary instance is emitted there), and the GPU-label / `sort_index` checks are preserved.

Surfaced by the Kineto XPU CI, which runs `test/profiler/` from a `USE_XPU=1` build (pytorch/kineto#1451 deselects this test until this fix reaches `viable/strict`).

## Test plan

Verified on an Intel Data Center GPU Max (PVC) `USE_XPU=1` build: `test_basic_chrome_trace_cpu` passes with this change and fails without it (`AssertionError: False is not true` on the `traceEvents[-4]` name check).

Pull Request resolved: pytorch#188264
Approved by: https://github.com/ryanzhang22

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
Includes the following commits:

- Serialize CUDA/ROCm JSON directly from typed metadata (pytorch/kineto#1455) ab3d5e5
- Address missing OSS license headers (pytorch/kineto#1456) 6662873
- Remove support for old versions of PTI. Rework of PTI error handling. (pytorch/kineto#1405) d5d5c01
- Add MetadataDict for nested metadata fields (pytorch/kineto#1454) 510fde2
- Update XPU test env config (pytorch/kineto#1450) 5d8f827
- Deselect XPU-failing TestProfilerDevice CPU tests (pytorch/kineto#1451) eb66185
- Escape LOG messages in output_json.cpp (pytorch/kineto#1453) 9f6b3f7
- Daily `arc lint --take CLANGFORMAT` (pytorch/kineto#1452) c4eea6b
- Add a visitor class for JSON serialization (pytorch/kineto#1449) b12cc99
- Enable OVERHEAD activity (pytorch/kineto#1441) 3980198
- Make TypedMetadata a visitor interface instead (pytorch/kineto#1448) 594e334
- Avoid CI OOMs by limiting parallel compile jobs (pytorch/kineto#1447) d5f7009
- Adds TypedMetadata.h to get_libkineto_public_headers (pytorch/kineto#1439) 774d10c
- FIx build error by removing unused param (pytorch/kineto#1445) 8341a9e
- Prefix internal controller sync/async methods (pytorch/kineto#1438) b1a1f1e
- Expose ActivityLoggerFactory via public API (pytorch/kineto#1414) 8279dc0
- Guard GenericActivityProfiler teardown against null traceBuffers_ (pytorch/kineto#1443) b7a7b0e
- Finalize pending trace on async profiler teardown (pytorch/kineto#1442) b0ddf1b

Authored-with: Claude (AI assistant)
Pull Request resolved: pytorch#188550
Approved by: https://github.com/scotts
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…orch#188264)

`_validate_basic_json` (used by `test_basic_chrome_trace`) located the `"PyTorch Profiler (0)"`, `"Iteration Start: PyTorch Profiler"` and `"Record Window End"` markers at fixed negative indices `-4`/`-2`/`-1` of the trace event list.

On a device build that emits a **second** profiler instance this no longer holds. A `USE_XPU=1` build appends an `__xpu_profiler__ (N)` event plus its own `Iteration Start: __xpu_profiler__` marker to the trace, so `traceEvents[-4]` is now the secondary profiler event and the assertion `traceEvents[-4]["name"] == "PyTorch Profiler (0)"` fails. The secondary instance is emitted regardless of the requested activities, and it is not bounded by the PyTorch profiler window, so it also trips the in-window bounds check (`"Trace event ends too late!"`).

This change locates the three PyTorch profiler markers by name instead of by offset, and skips the secondary device profiler's events when validating the window. CPU and CUDA traces are unaffected (no secondary instance is emitted there), and the GPU-label / `sort_index` checks are preserved.

Surfaced by the Kineto XPU CI, which runs `test/profiler/` from a `USE_XPU=1` build (pytorch/kineto#1451 deselects this test until this fix reaches `viable/strict`).

## Test plan

Verified on an Intel Data Center GPU Max (PVC) `USE_XPU=1` build: `test_basic_chrome_trace_cpu` passes with this change and fails without it (`AssertionError: False is not true` on the `traceEvents[-4]` name check).

Pull Request resolved: pytorch#188264
Approved by: https://github.com/ryanzhang22

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants