Skip to content

Conversation

yf225
Copy link
Contributor

@yf225 yf225 commented Aug 30, 2025

Fixes #529.

@yf225 yf225 requested review from jansel and oulgen August 30, 2025 08:32
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 30, 2025
@yf225 yf225 marked this pull request as draft September 2, 2025 22:28
@yf225 yf225 changed the title torch.rand_like and torch.randn_like support [WIP] torch.rand_like and torch.randn_like support Sep 2, 2025
@yf225 yf225 marked this pull request as ready for review September 2, 2025 23:34
@yf225 yf225 changed the title [WIP] torch.rand_like and torch.randn_like support torch.rand_like and torch.randn_like support Sep 2, 2025
This reverts commit 5fe0fe4.
@yf225 yf225 requested a review from jansel September 3, 2025 22:42

# Create host-side seed buffer with the required number of seeds
seed_buffer_stmt = statement_from_string(
f"_rng_seed_buffer = inductor_prims.seeds({self.device_function.rng_seed_count}, torch.device('cuda'))"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we use the same approach as torch.compile (allocate one seed value per RNG op).

@yf225 yf225 merged commit 84d7430 into main Sep 4, 2025
13 checks passed
@yf225 yf225 deleted the torch_rand_v3 branch September 4, 2025 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

torch.rand_like and torch.randn_like support
2 participants