Skip to content

Commit

Permalink
Dynamo doesn't support to(..., non_blocking=True) (pytorch#1979)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#1979

as per title.

Also internal workstreams are registering is_torchdynamo_compiling() as True in some workstreams, seems like a seperate bug.

Reviewed By: IvanKobzarev

Differential Revision:
D57190750

Privacy Context Container: 1203980333745195

fbshipit-source-id: 1ecb45040658ca3d4998d4efe1fe2c170e88065d
  • Loading branch information
dstaay-fb authored and facebook-github-bot committed May 11, 2024
1 parent 4a8f954 commit b32dc7a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions torchrec/sparse/jagged_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def is_non_strict_exporting() -> bool:

def _pin_and_move(tensor: torch.Tensor, device: torch.device) -> torch.Tensor:
if is_torchdynamo_compiling():
# TODO(ivankobzarev): Dynamo trace with pin_memory once FakeTensor supports it
return tensor.to(device=device, non_blocking=True)
# TODO: remove once FakeTensor supports pin_memory() and to(..., non_blocking=True)
return tensor.to(device=device)

return (
tensor.pin_memory().to(device=device, non_blocking=True)
Expand Down

0 comments on commit b32dc7a

Please sign in to comment.