Skip to content

fix(device): prevent recursion when copying DeviceInfo - #148

Merged
jinzhen-lin merged 1 commit into
mainfrom
fix/device-info-copy-recursion
Oct 15, 2026
Merged

jinzhen-lin merged 1 commit into
mainfrom
fix/device-info-copy-recursion

Conversation

@jinzhen-lin

@jinzhen-lin jinzhen-lin commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

fix #147

Co-authored-by: Codex (GPT-6) <codex@openai.com>
Signed-off-by: jinzhen.ljz <jinzhen.ljz@antgroup.com>
@jinzhen-lin
jinzhen-lin requested a review from mgoin as a code owner October 15, 2026 03:15
@jinzhen-lin
jinzhen-lin merged commit f921223 into main Oct 15, 2026
4 checks passed
jinzhen-lin pushed a commit that referenced this pull request Oct 16, 2026
…em (#149)

The forward path builds a DeviceInfo on every call (LayerConfig.check_device,
_resolve_use_pdl). Even after #148, fullgraph compile fails there because
Dynamo cannot trace the extension's _DeviceInfo constructor. Return one shared
instance per device from __new__, so traced code only reads an existing
object, and add __reduce__ so copy/deepcopy/pickle resolve to the same
device's instance instead of overwriting the current device's.

Extend test_forward_fullgraph with int8 activations, which trace
may_process_input and check_device.

Signed-off-by: mgoin <mgoin64@gmail.com>
Co-authored-by: Claude Code (Claude Opus 5.5) <noreply@anthropic.com>
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.

DeviceInfo recurses forever when built inside torch.compile (or copy.copy'd)

1 participant