Conversation
Reuses the rand pipeline: a Box-Muller transform on the (c1, c2) pair each Philox call already emits, so a tile of n Float32 normals costs n/2 Philox calls (same as `rand(Float32)`). Float64 needs n calls since each output draws a UInt64 of entropy. Float16/BFloat16 compute the transform in Float32 and narrow at the end. Same `rand`-style overlay surface for both the default stream and explicit `DeviceRNG`. The host-side `cuTile.RNG` gets a parallel `randn!` / `randn` / `cuTile.randn` aliases via a `randn_fill_kernel` that mirrors `rand_fill_kernel`'s counter accounting (advance-by-element-count is T-agnostic, so the host bookkeeping is unchanged).
`randexp` is the simplest of the non-uniform draws: each output is `-log(U)` where `U` is a uniform sample from the existing rand path. No Box-Muller, no rejection — one log per element. Same surface coverage as randn (default-stream + DeviceRNG, scalar/tile/variadic). This rounds out Random.jl's array-distribution API on cuTile (rand, randn, randexp); the remaining stdlib `rand*` family is array permutations / strings, which doesn't fit the GPU element-wise model. Also collapse the randn and randexp test sections into shared loops. The two distributions agree on every property tested (typed/untyped surfaces, in-kernel-seed match, host basics, determinism, T-coverage, etc.) — only the per-bin probabilities, mean, and in-range predicate differ. Shared `bin_counts` + a `RAND_DISTS` table replace ~250 lines of duplicated testset bodies. The rand testset stays separate since its multi-stream / control-flow tests are unique to it.
[ci skip]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.