Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/183693
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 2 New Failures, 3 Unrelated Failures, 2 Unclassified FailuresAs of commit 5ecbfaf with merge base c230e69 ( NEW FAILURES - The following jobs have failed:
UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures 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:
UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@claude review these changes |
|
Claude finished @jansel's task in 1m 15s —— View job Review: Fix Inductor stream wrapper codegen for XPU
Overall: Clean, well-structured change. The abstraction is the right approach — routing stream operations through Feedback1. Minor: stale docstring (
2. Minor: The class name still references "Cuda" even though it's now device-agnostic. The docstring was updated correctly, but renaming the class (and 3. The base class default is 4. Test uses The 5. Looks good otherwise:
LGTM with the minor nits above. |
Route Python wrapper stream operations through device op overrides so multi-stream code on XPU emits torch.xpu stream APIs instead of CUDA-only calls. This preserves CUDA codegen while allowing the disabled control-deps test to run on XPU. Fixes #181701 Generated by my agent ghstack-source-id: 12ae314 Pull-Request: #183693
|
In PyTorch, stream = torch.Stream()
with stream:
pass
stream = torch.cuda.Stream()
with stream:
pass
... |
Make Inductor wrapper stream codegen use device-specific current-stream lookup and native stream context managers, while using generic native_handle raw stream handles so torch.Stream works across CUDA and XPU. This removes CUDA-only wrapper paths that broke the disabled XPU control-deps test. Fixes #181701 Generated by my agent ghstack-source-id: 2ca0757 Pull-Request: #183693
|
@claude review these changes |
|
Claude finished @jansel's task in 2m 30s —— View job
Review: Fix Inductor stream wrapper codegen for XPUOverall: Clean change. The approach of routing stream operations through Key observations1. The old code used 2. CUDA doesn't override 3. Minor: These class names still reference "Cuda" even though they're now device-agnostic. The docstrings were correctly updated. Not blocking — renaming public symbols is a separate cleanup. 4. Test quality is good
5. The LGTM. |
Make Inductor wrapper stream codegen use device-specific current-stream lookup and native stream context managers, while using generic native_handle raw stream handles so torch.Stream works across CUDA and XPU. This removes CUDA-only wrapper paths that broke the disabled XPU control-deps test. Fixes #181701 Generated by my agent ghstack-source-id: bc92e35 Pull-Request: #183693
Make Inductor wrapper stream codegen use device-specific current-stream lookup and native stream context managers, while using generic native_handle raw stream handles so torch.Stream works across CUDA and XPU. This removes CUDA-only wrapper paths that broke the disabled XPU control-deps test. Fixes #181701 Generated by my agent ghstack-source-id: f41cbaa Pull-Request: #183693
|
Agent, rebase and look into those XPU CI failures. |
Make Inductor wrapper stream codegen use device-specific current-stream lookup and native stream context managers, while using generic native_handle raw stream handles so torch.Stream works across CUDA and XPU. This removes CUDA-only wrapper paths that broke the disabled XPU control-deps test. Fixes #181701 Generated by my agent ghstack-source-id: 0545f66 Pull-Request: #183693
|
Hi @eellison, The code change looks great to XPU. Could you please help stamp it? |
|
My agent says guangyey has approved and asked for eellison to stamp the PR, so I re-requested eellison as an active reviewer. CI is complete; Dr.CI classifies the remaining failures as unrelated/flaky/broken-trunk/unstable. |
Root cause: Inductor wrapper stream codegen and benchmarking/profiler helpers still assumed CUDA APIs on paths exercised by XPU. The wrapper emitted CUDA current-stream/raw-stream code, and profiler benchmarking selected and synchronized through CUDA-centric helpers, so XPU-only CI failed before reaching the intended control-dependency and benchmark assertions. Fix this by routing stream lookup and raw handles through DeviceOpOverrides, using the native Python stream context manager with stream objects, and threading device_type through profiler setup, synchronization, and cache-flush allocation. The profiler benchmarker also falls back to correlated device kernel events when a backend does not emit a device-side _CALLABLE annotation. After rebasing over the in-source disabled-test import, remove the stale XPU skip decorators for the tests this PR now fixes. I kept the change in the existing device/backend abstraction instead of adding local XPU branches in wrapper or benchmarking code, because these paths need to keep CUDA, XPU, and MTIA behavior aligned. Test Plan: python test/inductor/test_benchmarking.py TestBenchmarker.test_default_profiler_benchmarker_selection_supports_xpu_only TestBenchmarker.test_profiler_benchmarker_fallback_uses_correlated_device_events -v python test/inductor/test_benchmarking.py -k test_torch_profiler_benchmarker_reuses_inductor_helpers -v python test/inductor/test_user_streams.py TestStreamCodegen TestWrapperCodegenStreams TestStreamUtils -v python test/inductor/test_control_deps.py -k test_control_deps_orders_void_op_across_nested_calls -v python test/inductor/test_benchmarking.py TestBenchmarker -v python test/inductor/test_user_streams.py TestUserStreamCompile.test_compile_with_user_stream_context TestUserStreamCompile.test_compile_preserves_stream_semantics TestUserStreamCompile.test_multiple_stream_contexts TestUserStreamCompile.test_nested_stream_contexts TestUserStreamCompile.test_stream_context_with_data_dependency TestGenericStreamCompile.test_generic_stream_basic -v lintrunner -a Fixes #181701 Generated by my agent ghstack-source-id: d5fb8cd Pull-Request: #183693
|
My agent says rebased onto current main after the disabled-test skips were inlined into source. The PR now also removes the stale XPU skip decorators for the control-deps and profiler benchmark tests fixed by this change; local targeted tests and lintrunner -a passed, and fresh CI is queued on the updated head. |
|
@claude review these changes |
|
Claude finished @jansel's task in 1m 8s —— View job Review: Fix Inductor stream wrapper codegen for XPU
Overall: LGTM. Clean, well-structured change with two orthogonal improvements: (1) routing stream codegen through Stream codegen — solidThe switch from Benchmarking — clean generalizationThe One observation on if "L2_cache_size" in self.__dict__:
return self.__dict__["L2_cache_size"]If
Test changes — good coverage
Minor nits (non-blocking)
LGTM. |
|
@claude xpu failure FAILED CONSISTENTLY: test/inductor/test_benchmarking.py::TestBenchmarker::test_torch_profiler_benchmarker_reuses_inductor_helpers_hip_value0_expected_buffer_size_bytes_1024 is related. Use prof.key_averages() to handle other device except cuda |
|
Claude finished @guangyey's task in 7m 36s —— View job Fixing XPU test failure in benchmarking code
Root CauseThe
On XPU, neither approach works because XPU's kineto backend doesn't emit FixAs @guangyey suggested, add a third fallback using In if callable_gpu_time_us <= 0:
raise AssertionError(
f"TorchProfilerBenchmarker: '_CALLABLE' {device_type_upper} event not found in "
"raw kineto results, and no correlated device events were found."
)With: if callable_gpu_time_us <= 0:
for evt in prof.key_averages():
if evt.key == _CALLABLE_PROFILE_EVENT_NAME:
callable_gpu_time_us = evt.self_device_time_total
break
if callable_gpu_time_us <= 0:
raise AssertionError(
f"TorchProfilerBenchmarker: '_CALLABLE' {device_type_upper} event not found in "
"raw kineto results, correlated device events, or key_averages()."
)This preserves the fast path for CUDA (raw kineto events) and adds a robust device-agnostic fallback via Note: I was unable to push this change due to sandbox permission restrictions on file-writing operations. A patch file ( |
|
Hi @jansel, thanks a lot for this fix! Really appreciate your help! |
|
@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 |
Merge failedReason: 4 jobs have failed, first few of them are: trunk / linux-jammy-rocm-py3.10-mi355 / test (distributed, 4, 4, linux.rocm.gpu.gfx950.2), trunk / linux-jammy-rocm-py3.10-mi355 / test (distributed, 2, 4, linux.rocm.gpu.gfx950.2), xpu / linux-noble-xpu-n-py3.10 / test (default, 4, 12, linux.idc.xpu), xpu / linux-noble-xpu-n-py3.10 / test (default, 12, 12, linux.idc.xpu) Details for Dev Infra teamRaised by workflow job |
|
@pytorchbot merge -i |
Merge startedYour change will be merged while ignoring the following 7 checks: trunk / linux-jammy-rocm-py3.10-mi355 / test (default, 8, 10, linux.rocm.gpu.gfx950.1, unstable), trunk / linux-jammy-rocm-py3.10-mi355 / test (default, 4, 10, linux.rocm.gpu.gfx950.1, unstable), trunk / linux-jammy-rocm-py3.10-mi355 / test (distributed, 4, 4, linux.rocm.gpu.gfx950.2), trunk / linux-jammy-rocm-py3.10-mi355 / test (distributed, 2, 4, linux.rocm.gpu.gfx950.2), xpu / linux-noble-xpu-n-py3.10 / test (default, 5, 12, linux.idc.xpu), xpu / linux-noble-xpu-n-py3.10 / test (default, 4, 12, linux.idc.xpu), xpu / linux-noble-xpu-n-py3.10 / test (default, 12, 12, linux.idc.xpu) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Route Python wrapper stream operations through device op overrides so multi-stream code on XPU emits torch.xpu stream APIs instead of CUDA-only calls. This preserves CUDA codegen while allowing the disabled control-deps test to run on XPU. Fixes pytorch#181701 Generated by my agent Pull Request resolved: pytorch#183693 Approved by: https://github.com/guangyey, https://github.com/eellison
Route Python wrapper stream operations through device op overrides so multi-stream code on XPU emits torch.xpu stream APIs instead of CUDA-only calls. This preserves CUDA codegen while allowing the disabled control-deps test to run on XPU. Fixes pytorch#181701 Generated by my agent Pull Request resolved: pytorch#183693 Approved by: https://github.com/guangyey, https://github.com/eellison
Route Python wrapper stream operations through device op overrides so multi-stream code on XPU emits torch.xpu stream APIs instead of CUDA-only calls. This preserves CUDA codegen while allowing the disabled control-deps test to run on XPU. Fixes pytorch#181701 Generated by my agent Pull Request resolved: pytorch#183693 Approved by: https://github.com/guangyey, https://github.com/eellison
Stack from ghstack (oldest at bottom):
Route Python wrapper stream operations through device op overrides so multi-stream code on XPU emits torch.xpu stream APIs instead of CUDA-only calls. This preserves CUDA codegen while allowing the disabled control-deps test to run on XPU.
Fixes #181701
Generated by my agent
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo