Skip to content

Commit f2cb327

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

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ end
277277
# @testset "atomics (low level)" begin
278278

279279
@testset "atomic_add($T)" for T in [Int32, UInt32, Float32]
280+
if oneAPI.is_integrated_device() && T == Float32
280281
a = oneArray([zero(T)])
281282

282283
function kernel(a, b)

0 commit comments

Comments
 (0)