Skip to content

[cpu-offload] Fix wait_tensor dep edge for non-Tensor consumers - #3520

Closed
mlazos wants to merge 1 commit into
gh/mlazos/8/basefrom
gh/mlazos/8/head
Closed

mlazos wants to merge 1 commit into
gh/mlazos/8/basefrom
gh/mlazos/8/head

Conversation

@mlazos

@mlazos mlazos commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

When the last forward consumer of an offloaded tensor's storage
produces a non-Tensor value (e.g. aten.sort returns a tuple), the
wait_tensor's last_use_of_storage arg cannot reference it directly
(schema requires Optional[Tensor]).

Previously this passed the node directly, causing a schema checker
error at runtime. Fix: find a Tensor-producing child of the
non-Tensor consumer (e.g. getitem after sort) and use that as the
dep arg. This preserves the data dependency chain
(tensor -> sort -> getitem -> wait_tensor) so the wait is always
ordered after the real last consumer.

[ghstack-poisoned]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/8gpu CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant