Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: try integrate BFloat16 #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ authors = ["Erik Schnetter <[email protected]>", "Kristoffer Carlsson <kristof
version = "3.5.0"

[deps]
BFloat16s = "ab4f0b2a-ad5b-11e8-123f-65d77653426b"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"

[compat]
Expand Down
3 changes: 2 additions & 1 deletion src/LLVM_intrinsics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Intrinsics
# when passed to LLVM. It is up to the caller to make sure that the correct
# intrinsic is called (e.g uitofp vs sitofp).

import ..SIMD: SIMD, VE, LVec, FloatingTypes
import ..SIMD: SIMD, VE, LVec, FloatingTypes, BFloat16
# Include Bool in IntegerTypes
const IntegerTypes = Union{SIMD.IntegerTypes, Bool}

Expand All @@ -31,6 +31,7 @@ const d = Dict{DataType, String}(
Float16 => "half",
Float32 => "float",
Float64 => "double",
BFloat16 => "bfloat",
)
# Add the Ptr translations
# Julia <=1.11 (LLVM <=16) passes `Ptr{T}` as `i64`, Julia >=1.12 (LLVM >=17) passes them as `T*`.
Expand Down
4 changes: 3 additions & 1 deletion src/SIMD.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module SIMD

using Base: @propagate_inbounds

using BFloat16s: BFloat16

export Vec, vload, vloada, vloadnt, vloadx, vstore, vstorea, vstorent, vstorec,
vgather, vgathera, vscatter, vscattera, shufflevector, vifelse, valloc,
VecRange
Expand All @@ -14,7 +16,7 @@ const BIntTypes = Union{IntTypes, Bool}
const UIntTypes = Union{UInt8, UInt16, UInt32, UInt64}
const IntegerTypes = Union{IntTypes, UIntTypes}
const BIntegerTypes = Union{IntegerTypes, Bool}
const FloatingTypes = Union{Float16, Float32, Float64}
const FloatingTypes = Union{Float16, Float32, Float64, BFloat16}
const ScalarTypes = Union{IntegerTypes, FloatingTypes}
const VecTypes = Union{ScalarTypes, Ptr, Bool}
include("LLVM_intrinsics.jl")
Expand Down
Loading