Skip to content

Commit f158ea6

Browse files
committed
test: fix BFloat16 math test on the Aurora LTS stack
The gpuarrays/math/intrinsics BFloat16 subtest failed two ways: 1. Host-side: Core.BFloat16 exists on Julia 1.12 but has no Real->bf16 constructors (those live in BFloat16s.jl), so ET(-1) threw a MethodError before any GPU work. Add BFloat16s as a test dep and load it in the worker so the CPU reference path works. 2. Codegen: _device_supports_bfloat16() is a hardware check, but the Aurora LTS SPIR-V stack (Khronos translator + NEO/IGC) cannot codegen native bfloat in generic kernels -- clamp! fails with InvalidIRError, and declaring SPV_KHR_bfloat16 crashes the LTS runtime. Gate the bf16 eltypes push on !oneL0.LTS[] so BFloat16 is only exercised as a generic element type off the LTS stack (storage/conversions/oneMKL bf16 are unaffected).
1 parent 25d5236 commit f158ea6

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

test/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[deps]
22
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
33
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
4+
BFloat16s = "ab4f0b2a-ad5b-11e8-123f-65d77653426b"
45
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
56
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
67
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"

test/runtests.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ end
6464
init_worker_code = quote
6565
$device_claim_code
6666
using oneAPI, Adapt
67+
# BFloat16s.jl supplies the host-side numeric conversions (e.g. BFloat16(::Real))
68+
# that Core.BFloat16 lacks on its own; the testsuite's CPU reference path needs them.
69+
using BFloat16s
6770

6871
import GPUArrays
6972
include($gpuarrays_testsuite)
@@ -83,7 +86,12 @@ init_worker_code = quote
8386
append!(eltypes, [Float64, ComplexF64])
8487
end
8588
@static if isdefined(Core, :BFloat16)
86-
const bfloat16_supported = oneAPI._device_supports_bfloat16()
89+
# _device_supports_bfloat16() is a hardware check (bf16 conversions ext / PVC device),
90+
# but the Aurora LTS SPIR-V stack (Khronos translator + NEO/IGC) cannot codegen native
91+
# `bfloat` in generic kernels: any kernel that keeps a bfloat value (e.g. clamp!) fails
92+
# with InvalidIRError, and declaring SPV_KHR_bfloat16 crashes the LTS runtime. So only
93+
# exercise BFloat16 as a generic element type off the LTS stack.
94+
const bfloat16_supported = oneAPI._device_supports_bfloat16() && !oneL0.LTS[]
8795
if bfloat16_supported
8896
push!(eltypes, Core.BFloat16)
8997
end

0 commit comments

Comments
 (0)