Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/189980
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New Failures, 1 Unrelated Failure, 1 Unclassified FailureAs of commit c9641f3 with merge base fa31877 ( NEW FAILURES - The following jobs have failed:
UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:
FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
20a32e6 to
7251e56
Compare
|
@claude review these changes |
|
Claude finished @jansel's task in 2m 55s —— View job PR ReviewThe second commit ( Full review detailsPR Review: #189980SummaryThe PR bumps Code Quality
Correctness
Scope
RecommendationRequest Changes Drop commit |
The D2H fix in torch-xpu-ops returns sycl::event objects which trigger cudaEvent_t generation in AOTI wrapper. XPU uses in-order SYCL queues — skip CUDA events.
34c66ee to
125b671
Compare
- cpp_wrapper_gpu.py: change return True to bare return in codegen_stream_info_prologue (function declared -> None) - test_xpu.py: restore try/except RuntimeError for elevated privileges in test_clock_rate_returns_float
|
Test failures? |
Status UpdatePR #4349 fix approach rejected — guangyey's review:
The Reclassification: This is now tracked as a driver/runtime bug. A JIRA will be submitted to GSD (Intel GPU driver team) to request the SYCL runtime fix. Action: Converting both PRs to DRAFT until the GSD driver fix lands. |
The user-streams support PR pytorch#182971 added `codegen_stream_info_prologue` which emits `_aoti_aux_stream_cache` helpers that are CUDA-specific. On XPU, SYCL in-order queues handle events implicitly, and the generated CUDA stream code is not applicable. This caused AOTInductor tests using `torch.Event()` (e.g. `test_copy_non_blocking_is_pinned`) to fail on XPU when the DualWrapper code path (`autotune_at_compile_time=False`) triggered multi-stream codegen. Note: this supersedes PR pytorch#189980 which attempted a different fix (barrier event chaining in Copy.cpp) that was unrelated to the actual root cause. See PR pytorch#4349 review for context.
…0637) ## Summary Skip the CUDA-specific stream event codegen (`_aoti_aux_stream_cache` helpers) in the AOTI `cpp_wrapper` for XPU devices. SYCL in-order queues handle events implicitly, making the generated CUDA stream cache code unnecessary and incompatible. ## Root Cause PR [#182971](#182971) (Jul 8, 2026) added `codegen_stream_info_prologue()` to `cpp_wrapper_gpu.py`, which emits `_aoti_aux_stream_cache.ensure(...)` — a CUDA-specific stream cache helper. When a model uses `torch.Event()`, the AOTI compiler detects `num_strams > 1` and enters this codegen path, generating code that references CUDA-only symbols. For the XPU backend, these CUDA stream helpers are not needed because: - SYCL in-order queues handle event synchronization implicitly - The generated code causes compilation/link errors on XPU This affected the `AOTInductorTestDualWrapper` test class specifically because it uses `autotune_at_compile_time=False` (lazy Triton compile), which triggers the dual-wrapper codegen path that exercises the multi-stream codegen. ## Timeline | Date | Event | |------|-------| | Jun 10 | `AOTInductorTestDualWrapper` added (PR #184735) — running fine | | **Jul 8** | **User-streams support added (PR #182971) — introduced CUDA stream codegen** | | Jul 9 | Auto-disabler detected test failure, created issues #189327 and #189326 | | Jul 15 | PR #189980 submitted with barrier chaining fix in Copy.cpp | | Jul 17 | Reviewer rejected barrier fix as unnecessary overhead | | Jul 21 | **This PR** — correct root cause identified | ## Notes on PR #189980 The earlier PR #189980 attempted to fix this by capturing the `sycl::event` from `q.memcpy()` and chaining it with `ext_oneapi_submit_barrier({copy_event})` in `Copy.cpp`. That approach was rejected by the reviewer ([comment](intel/torch-xpu-ops#4349 (comment))) as adding unnecessary overhead, and has since been determined to be unrelated to the actual root cause. The DMA engine event tracking gap described there is a separate PVC driver-level issue that does not reproduce on the tested hardware configuration (driver 1.6.33578+15, all D2H non_blocking copy tests pass without the barrier workaround). ## Test Plan - `test_copy_non_blocking_is_pinned_xpu` on both `AOTInductorTestDualWrapper` and `AOTInductorTestABICompatibleGpu` - Full XPU CI suite Fixes #189327 Fixes #189326 Pull Request resolved: #190637 Approved by: https://github.com/guangyey, https://github.com/jansel
|
Close as #190637 was fixed the issue. |
Summary
Update
third_party/xpu.txtto pick up the torch-xpu-ops DMA synchronization fix for PVC and bump the pin to latest torch-xpu-ops main (f6197f6b0a23), resolving two auto-disabled tests.Root Cause
The D2H (Device-to-Host) non_blocking copy path in torch-xpu-ops
_copy_xpu()discards thesycl::eventreturned byq.memcpy(). On PVC (Intel Data Center GPU Max 1550), the SYCL runtime routes memcpy through a dedicated hardware DMA engine. Because the event was discarded, a subsequentext_oneapi_submit_barrier()(used internally bytorch.Event().record()) does not track the DMA engine's completion. This causestorch.Event().synchronize()to return before the D2H transfer has actually finished, leaving stale/zero data in the CPU-side pinned buffer.The test
test_copy_non_blocking_is_pinned_xpu(in bothAOTInductorTestDualWrapperandAOTInductorTestABICompatibleGpuwrappers) relies ontorch.Event()synchronization after non_blocking D2H copies and would sporadically fail with output mismatches on PVC.Why It Didn't Fail Earlier
This bug existed since the
q.memcpy()path was introduced, but it was only exposed recently due to three converging factors:1. New test class (Jun 10)
The
AOTInductorTestDualWrapperclass was added in #184735, which runs tests withautotune_at_compile_time=False. This generates a different AOTI code path that exercises the D2H copy with a different timing profile, making the race condition more likely to manifest than in theAOTInductorTestABICompatibleGpuwrapper.2. PVC SYCL driver update (~late Jun)
The PVC CI machines received a SYCL runtime/driver update around late June that changed how
q.memcpy()is handled. Prior to the update,q.memcpy()on PVC used the queue's in-order command stream — the same as Xe2 — and queue barriers could properly track it. After the update, the runtime began routingq.memcpy()through PVC's dedicated hardware DMA engine. This exposed the pre-existing event tracking gap:ext_oneapi_submit_barrier()only sees the main queue's command stream and does not capture DMA engine operations.3. Auto-disabler accumulation period
The PyTorch CI auto-disabler does not disable tests on the first failure. It accumulates failure history over days to weeks before creating a disable issue. Even though the driver update may have happened around late June, the auto-disabler needed sufficient data points before filing issues #189327 and #189326 on Jul 9.
4. ABICompatibleGpu variant was previously more resilient
The
AOTInductorTestABICompatibleGpuvariant had been running on PVC for a longer period. Before the driver update, the test passed consistently because the event synchronization worked correctly. After the driver update changed DMA routing, the same test code that had been passing for months began exhibiting the race condition.Timeline
f25acade— Changed D2D copy to usequeue.memcpyinstead of copy kernel973a1658— Added PVC-specific copy kernel choice withTORCH_XPU_USE_COPY_ENGINEenv-var gateAOTInductorTestDualWrapperclass added, test started running on PVC CIq.memcpy()began routing through DMA engineFix
intel/torch-xpu-ops#4349 — Capture the
sycl::eventfromq.memcpy()in the D2H non_blocking path and chain it with an explicitext_oneapi_submit_barrier({copy_event}). This forces the queue's command graph to properly track the DMA engine operation.xpu.txt pin update:
fc8bffed→f6197f6b0a23(bumped to latest torch-xpu-ops main, includes 7 additional commits beyond the D2H fix).Companion Fix (in this PR)
Also skips CUDA event codegen for XPU in AOTI
cpp_wrapper_gpu.py. The D2H fix returnssycl::eventobjects which triggercudaEvent_tgeneration in the wrapper. XPU uses in-order SYCL queues — skip CUDA events.Validation
AOTInductorTestDualWrappersuite (344 tests): 343 pass, 1 pre-existing unrelated numerical failureruff check&ruff formatpasspytorch/pytorchmainRelated Issues
Fixes #189327
Fixes #189326
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo