Skip to content

Set_zero_subnormals ineffective for Float16 #40151

@milankl

Description

@milankl

The set_zero_subnormals function is working fine for Float32/Float64 on x86 and ARM (aarch64) in Julia 1.6-rc3 but has no effect for Float16

julia> set_zero_subnormals(true)
true
julia> floatmin(Float64)/4
0.0
julia> floatmin(Float32)/4
0.0f0
julia> floatmin(Float16)/4
Float16(1.526e-5)

This is an issue as a64fx (tested on Isambard and Fugaku) considerably slows down with subnormals:

julia> A = floatmin(Float16)*rand(Float16,1000,1000)
julia> B = floatmin(Float16)*rand(Float16,1000,1000)
julia> @btime +($A,$B);
  7.116 ms (2 allocations: 1.91 MiB)

compared to computations without subnormals

julia> A = rand(Float16,1000,1000)
julia> B = rand(Float16,1000,1000)
julia> @btime +($A,$B);
  274.681 μs (2 allocations: 1.91 MiB)

(@vchuravy I believe you've switched julia's Float16 to LLVM's half for 1.6?) @samhatfield

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions