Skip to content

-(::BFloat16) causes LLVM error on Apple M4 #113

@AntonOresten

Description

@AntonOresten

On an M4 MacBook running Julia 1.12 I encounter this error, specifically when negating a BFloat16 number:

julia> -one(BFloat16)
LLVM ERROR: Cannot select: 0x11387b570: bf16 = fneg 0x11387af50, int.jl:379 @[ ~/.julia/packages/BFloat16s/BmABx/src/bfloat16.jl:248 ]
  0x11387af50: bf16,ch = CopyFromReg 0x10671b110, Register:bf16 %1
    0x11387aee0: bf16 = Register %1
In function: julia_-_2881

[45869] signal 6: Abort trap: 6
in expression starting at REPL[4]:1
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 14871363 (Pool: 14869443; Big: 1920); GC: 17
zsh: abort      julia +1.12

The error does not happen on my Linux machine:

julia> -one(BFloat16)
BFloat16(-1.0)

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