Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
Signed-off-by: Guyue Huang <[email protected]>
  • Loading branch information
guyueh1 committed Feb 22, 2025
1 parent fd76d53 commit f6ccf80
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions transformer_engine/pytorch/tensor/float8_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,10 @@ def _set_data(self, tensor: torch.Tensor) -> None:
casts to FP8.
"""

# Synchronize to avoid a race condition
torch.cuda.synchronize()

# Tensor device
new_device = tensor.device if tensor.is_cuda else self.device

Expand Down
3 changes: 3 additions & 0 deletions transformer_engine/pytorch/tensor/mxfp8_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ def _set_data(self, tensor: torch.Tensor) -> None:
"""

# Synchronize to avoid a race condition
torch.cuda.synchronize()

# Tensor device
new_device = tensor.device if tensor.is_cuda else self.device

Expand Down

0 comments on commit f6ccf80

Please sign in to comment.