Skip to content

Conversation

@NickLucche
Copy link
Collaborator

@NickLucche NickLucche commented Sep 19, 2025

xm.mark_step has been deprecated for some time now.
I am replacing the occurrences with the new API torch_xla.sync.

So long, xm.mark_step().

@mergify mergify bot added v1 tpu Related to Google TPUs labels Sep 19, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly replaces the deprecated xm.mark_step() with the new torch_xla.sync() API across multiple files. Most changes correctly use torch_xla.sync(wait=False), which is the direct equivalent for the asynchronous xm.mark_step(). However, I've identified one instance where torch_xla.sync() is used without wait=False, which changes the behavior to a synchronous wait. This could introduce a performance regression. My review includes a suggestion to correct this for consistency and to maintain the intended asynchronous behavior.

):
# Make sure we don't accidentally collect outside operations
xm.mark_step()
torch_xla.sync()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The call to torch_xla.sync() uses the default wait=True, which introduces a synchronous wait. The deprecated xm.mark_step() is equivalent to torch_xla.sync(wait=False). Using wait=True here may unnecessarily block execution and could impact performance. To maintain the original asynchronous behavior and ensure consistency with other changes in this pull request, torch_xla.sync(wait=False) should be used instead.

Suggested change
torch_xla.sync()
torch_xla.sync(wait=False)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NickLucche
Copy link
Collaborator Author

cc @yaochengji

Copy link
Collaborator

@yaochengji yaochengji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yeqcharlotte yeqcharlotte enabled auto-merge (squash) September 20, 2025 07:01
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Sep 20, 2025
@yeqcharlotte yeqcharlotte merged commit 4cf71cc into vllm-project:main Sep 22, 2025
47 checks passed
FeiDaLI pushed a commit to FeiDaLI/vllm that referenced this pull request Sep 25, 2025
charlifu pushed a commit to ROCm/vllm that referenced this pull request Sep 25, 2025
…oject#25254)

Signed-off-by: NickLucche <[email protected]>
Co-authored-by: Ye (Charlotte) Qi <[email protected]>
Signed-off-by: charlifu <[email protected]>
yewentao256 pushed a commit that referenced this pull request Oct 3, 2025
Signed-off-by: NickLucche <[email protected]>
Co-authored-by: Ye (Charlotte) Qi <[email protected]>
Signed-off-by: yewentao256 <[email protected]>
xuebwang-amd pushed a commit to xuebwang-amd/vllm that referenced this pull request Oct 10, 2025
…oject#25254)

Signed-off-by: NickLucche <[email protected]>
Co-authored-by: Ye (Charlotte) Qi <[email protected]>
Signed-off-by: xuebwang-amd <[email protected]>
choprahetarth pushed a commit to Tandemn-Labs/vllm that referenced this pull request Oct 11, 2025
lywa1998 pushed a commit to lywa1998/vllm that referenced this pull request Oct 20, 2025
xuebwang-amd pushed a commit to xuebwang-amd/vllm that referenced this pull request Oct 24, 2025
…oject#25254)

Signed-off-by: NickLucche <[email protected]>
Co-authored-by: Ye (Charlotte) Qi <[email protected]>
Signed-off-by: xuebwang-amd <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed tpu Related to Google TPUs v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants