Skip to content

Restore CPU-RNG to GPU-array fallback for rand!/randn!.#710

Merged
maleadt merged 1 commit into
masterfrom
tb/cpu_rng
Apr 16, 2026
Merged

Restore CPU-RNG to GPU-array fallback for rand!/randn!.#710
maleadt merged 1 commit into
masterfrom
tb/cpu_rng

Conversation

@maleadt
Copy link
Copy Markdown
Member

@maleadt maleadt commented Apr 16, 2026

Without this, e.g. randn!(Random.TaskLocalRNG(), ::CuArray) falls through to the stdlib scalar setindex! path. Regression from #707.

Without this, e.g. `randn!(Random.TaskLocalRNG(), ::CuArray)` falls through
to the stdlib scalar setindex! path. Regression from #707.
Copy link
Copy Markdown
Member

@kshyatt kshyatt left a comment

Choose a reason for hiding this comment

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

Yikes that we gotta copy but I guess that's really the only solution here

@maleadt
Copy link
Copy Markdown
Member Author

maleadt commented Apr 16, 2026

It's probably even better for your GPU array-containing struct to provide a rand! that uses a GPU-native RNG.

@kshyatt
Copy link
Copy Markdown
Member

kshyatt commented Apr 16, 2026

Yep, that's on the menu for TensorKit as we upgrade its deps to version 6 of everything :D

@maleadt maleadt merged commit 1c60b59 into master Apr 16, 2026
17 of 18 checks passed
@maleadt maleadt deleted the tb/cpu_rng branch April 16, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants