Skip to content

[upstream_ut] torch._dynamo.exc.Unsupported: Attempted to inline function marked as skipped #12

Draft
Stonepia wants to merge 1 commit into
mainfrom
agent/issue-2715
Draft

[upstream_ut] torch._dynamo.exc.Unsupported: Attempted to inline function marked as skipped #12
Stonepia wants to merge 1 commit into
mainfrom
agent/issue-2715

Conversation

@Stonepia

Copy link
Copy Markdown
Collaborator

[upstream_ut] torch._dynamo.exc.Unsupported: Attempted to inline function marked as skipped

Fixes intel/torch-xpu-ops#2715

Root Cause: When torch.xpu.device(x.device.index - 1) is traced by Dynamo, the dispatch in user_defined.py finds XPUDeviceVariable via _device_context_manager_map but immediately raises Unsupported because args[0].is_python_constant() returns False for a symbolic tensor attribute expression. This triggers a graph break, and Dynamo falls back to inlining torch.xpu.device.__init__ directly. Since the entire torch.xpu module is in MOD_SKIPLIST in trace_rules.py (line 3638), inlining is rejected with 'Attempted to inline function marked as skipped'. The CUDA test passes because x.device.index - 1 evaluates to a Python constant for CUDA tensors during tracing, bypassing the error branch.

Failed Tests:

  • test/dynamo/test_ctx_manager.py::CtxManagerTests::test_cuda_device

Diff stat:

torch/_dynamo/trace_rules.py            | 12 +++++-----
 torch/_dynamo/variables/ctx_manager.py  | 39 ++++++++++++++++++++++++++-------
 torch/_dynamo/variables/user_defined.py |  7 +-----
 3 files changed, 39 insertions(+), 19 deletions(-)

[upstream_ut]  torch._dynamo.exc.Unsupported: Attempted to inline function marked as skipped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[upstream_ut] torch._dynamo.exc.Unsupported: Attempted to inline function marked as skipped

1 participant