Skip to content

Commit 38816cc

Browse files
committed
Skip atomic tests on integrated GPUs
1 parent e8c473e commit 38816cc

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

src/context.jl

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# XXX: rework this -- it doesn't work well when altering the state
88

9-
export driver, driver!, device, device!, context, context!, global_queue, synchronize
9+
export driver, driver!, device, device!, context, context!, global_queue, synchronize, is_integrated
1010

1111
"""
1212
driver() -> ZeDriver
@@ -111,6 +111,40 @@ function device!(i::Int)
111111
return device!(devs[i])
112112
end
113113

114+
"""
115+
is_integrated(dev::ZeDevice=device()) -> Bool
116+
117+
Check if the given device is an integrated GPU (i.e., integrated with the host processor).
118+
119+
Integrated GPUs share memory with the CPU and are typically found in laptop and desktop
120+
processors with integrated graphics.
121+
122+
# Arguments
123+
- `dev::ZeDevice`: The device to check. Defaults to the current device.
124+
125+
# Returns
126+
- `true` if the device is integrated, `false` otherwise (e.g., discrete GPU).
127+
128+
# Examples
129+
```julia
130+
if is_integrated()
131+
println("Running on integrated graphics")
132+
else
133+
println("Running on discrete GPU")
134+
end
135+
136+
# Check a specific device
137+
dev = devices()[1]
138+
is_integrated(dev)
139+
```
140+
141+
See also: [`device`](@ref), [`devices`](@ref)
142+
"""
143+
function is_integrated(dev::ZeDevice=device())
144+
props = oneL0.properties(dev)
145+
return (props.flags & oneL0.ZE_DEVICE_PROPERTY_FLAG_INTEGRATED) != 0
146+
end
147+
114148
const global_contexts = Dict{ZeDriver,ZeContext}()
115149

116150
"""

test/device/intrinsics.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ end
277277
# @testset "atomics (low level)" begin
278278

279279
@testset "atomic_add($T)" for T in [Int32, UInt32, Float32]
280+
if oneAPI.is_integrated() && T == Float32
281+
continue
282+
end
280283
a = oneArray([zero(T)])
281284

282285
function kernel(a, b)
@@ -289,6 +292,9 @@ end
289292
end
290293

291294
@testset "atomic_sub($T)" for T in [Int32, UInt32, Float32]
295+
if oneAPI.is_integrated() && T == Float32
296+
continue
297+
end
292298
a = oneArray([T(256)])
293299

294300
function kernel(a, b)
@@ -325,6 +331,9 @@ end
325331
end
326332

327333
@testset "atomic_min($T)" for T in [Int32, UInt32, Float32]
334+
if oneAPI.is_integrated() && T == Float32
335+
continue
336+
end
328337
a = oneArray([T(256)])
329338

330339
function kernel(a, T)
@@ -338,6 +347,9 @@ end
338347
end
339348

340349
@testset "atomic_max($T)" for T in [Int32, UInt32, Float32]
350+
if oneAPI.is_integrated() && T == Float32
351+
continue
352+
end
341353
a = oneArray([zero(T)])
342354

343355
function kernel(a, T)
@@ -405,6 +417,9 @@ end
405417
end
406418

407419
@testset "atomic_xchg($T)" for T in [Int32, UInt32, Float32]
420+
if oneAPI.is_integrated() && T == Float32
421+
continue
422+
end
408423
a = oneArray([zero(T)])
409424

410425
function kernel(a, b)

0 commit comments

Comments
 (0)