JuliaGPU / CUDA.jl

CUDA programming in Julia.
https://juliagpu.org/cuda/
Other
1.19k stars 214 forks source link

Int128 support #974

Open maleadt opened 3 years ago

maleadt commented 3 years ago

CUDA GPUs do not natively support Int128 operations. LLVM supports lowering code that works with Int128, https://reviews.llvm.org/rGb9fc48da832654a2b486adaa790ceaa6dba94455, but requires compiler intrinsics for many operations:

julia> using CUDA

julia> x = widen.(CuArray(rand(Int64, 10)))
10-element CuArray{Int128, 1}:
  ...

julia> .÷(x, x)
ERROR: LLVM error: Undefined external symbol "__divti3"

With https://reviews.llvm.org/D34708, it should be possible to resolve those intrinsics in the current module, so we can just add them to our runtime library.

maleadt commented 3 years ago

Alternatively, we could build compiler-rt for NVPTX and ship that in CUDA.jl like we do with libdevice.

maleadt commented 4 months ago

Another MWE from https://github.com/JuliaGPU/CUDA.jl/issues/793:

julia> using CUDA

julia> A = zeros(3) |> CuArray
3-element CuArray{Float64, 1}:
 0.0
 0.0
 0.0

julia> A .= UInt128(5)