JuliaGPU / JuliaGPU/GPUArrays.jl

Can `RNG` be moved to `GPUArraysCore`?

Open
#556 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
450
Forks
104
Avg merge
1d 4h
Merged PRs (30d)
10

Description

From the definition of the struct, it seems like it should be as simple as copy-pasting it over. I can open a PR for this, but wanted to know if there was any reason not to do this previously.

`Metal` and `oneAPI` `default_rng` return `RNG` objects, so it is very useful (in the deep learning context) to define dispatches on `RNG` to initialize data directly on the device (for weight initialization, functions that need random numbers on runtime, etc.). To do this I end up defining weakdeps like:

1. https://github.com/LuxDL/WeightInitializers.jl/blob/main/ext/WeightInitializersGPUArraysExt.jl
2. https://github.com/LuxDL/MLDataDevices.jl/blob/main/ext/MLDataDevicesGPUArraysExt.jl

Moving to GPUArraysCore makes it significantly easier, since that is quite lightweight to not need extensions.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the RNG struct definition and the Metal and oneAPI default_rng implementations mentioned in the issue, then compare the existing GPUArraysCore API. Confirm the package-boundary implications before moving it, and verify that device-specific dispatches can use the shared RNG without the cited weak dependency extensions.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.