diff --git a/Project.toml b/Project.toml index 6dddeeb5..89090046 100644 --- a/Project.toml +++ b/Project.toml @@ -41,7 +41,7 @@ Adapt = "4" CEnum = "0.5, 1" Crayons = "4" GPUArrays = "12.1" -GPUCompiler = "2.24" +GPUCompiler = "2.26" GPUToolbox = "3.7" IntelITT = "0.2" KernelAbstractions = "0.10" diff --git a/test/execution.jl b/test/execution.jl index cf829e86..a3fb1bd4 100644 --- a/test/execution.jl +++ b/test/execution.jl @@ -703,6 +703,50 @@ end @test Array(out) == [0, 10, 20, 30, 0, 10, 20, 30] end +@testset "#783: 128-bit integers" begin + # SPIR-V has none, and the Khronos translator crashes on them instead of failing + function f(x) + x[1] *= x[1] + return + end + @test_throws oneAPI.InvalidIRError @oneapi f(oneArray(Int128[3])) +end + +@static if isdefined(Core, :BFloat16) +if oneAPI.compiler_config(device()).target.supports_bfloat16 +@testset "#783: BFloat16 arithmetic" begin + n = 1024 + a = Core.BFloat16.(100 .* randn(Float32, n)) + b = Core.BFloat16.(100 .* randn(Float32, n)) + da, db = oneArray(a), oneArray(b) + + # IGC used to round the results of bf16 instructions towards zero + function binary(y, op, a, b) + i = get_global_id() + @inbounds y[i] = op(a[i], b[i]) + return + end + dy = similar(da) + @testset "$op" for op in (+, -, *, /) + @oneapi items=256 groups=n÷256 binary(dy, op, da, db) + @test Array(dy) == op.(a, b) + end + + # ... and applied `abs` to the bits of the bf16 value it converted to Float32 + function unary(y, op, a) + i = get_global_id() + @inbounds y[i] = op(Float32(a[i])) + return + end + dy = oneArray{Float32}(undef, n) + @testset "$op" for op in (-, abs) + @oneapi items=256 groups=n÷256 unary(dy, op, da) + @test Array(dy) == op.(Float32.(a)) + end +end +end +end + @testset "#160: barrier intrinsincs should be convergent" begin # Solve L*x = r and store the result in r. function cpu(n::Int, r::Vector{Float32})