Avoid extra philox calls with ElementRNG - #723
Conversation
| @test false in Array(A) | ||
|
|
||
| # Int128 is not supported on many backends yet | ||
| if nameof(AT) == :JLArray |
There was a problem hiding this comment.
Ehh, this is ugly. Normally we do this through eltypes, which shouldn't list Int128.
| for T in (Float16, Float32, Float64, ComplexF32, ComplexF64) | ||
| @eval @inline function Random.randn(rng::ElementRNG, ::Type{$T}) |
There was a problem hiding this comment.
How do we reach this for Complex types? ComplexF32 and ComplexF64 are in BatchedRandnTypes. Meanwhile, ComplexF16 isn't, so that's probably the case which should be listed here?
There was a problem hiding this comment.
This can be reached if a type with a custom sampling method calls randn. I can try and also add ComplexF16 to the BatchedRandnTypes.
|
There are many interesting bugs with using |
|
Due to JuliaLang/julia#62507 I'm restricting Float16 tests to Julia versions 1.13 or later. |
That's excessive. Float16 had been working fine before; why does it only fail here? If it's specific to a test, you can always add a specific version-gated filter on top of the |
|
The Julia 1.12 miscompile only happens on CPUs with avx512_fp16. Github actions will sometimes use a CPU with avx512_fp16 now. If you run the existing tests enough times you can see the failure. I've limited the removal of Float16 tests to only Julia 1.12 and avx512_fp16 CPUs. |
Fixes #721
This PR avoids some extra philox calls when using
ElementRNG.ElementRNGis used as anAbstractRNGwhen sampling any non batched type including types with custom samplers defined in different packages.This PR also makes
ComplexF16a batched type.